diff --git a/documentation/manual/en/module_specs/Zend_Http_UserAgent-Device.xml b/documentation/manual/en/module_specs/Zend_Http_UserAgent-Device.xml
index fd8beb83a7..366439655b 100644
--- a/documentation/manual/en/module_specs/Zend_Http_UserAgent-Device.xml
+++ b/documentation/manual/en/module_specs/Zend_Http_UserAgent-Device.xml
@@ -532,12 +532,6 @@ echo '/>';
devices you wish to support, and then using the device capabilities to determine
which image to use.
-
-
- Another approach is to use third-party services. Zend Framework provides one
- such capability via the TinySrc view helper.
-
diff --git a/documentation/manual/en/module_specs/Zend_View-Helpers-TinySrc.xml b/documentation/manual/en/module_specs/Zend_View-Helpers-TinySrc.xml
deleted file mode 100644
index 485b9d2186..0000000000
--- a/documentation/manual/en/module_specs/Zend_View-Helpers-TinySrc.xml
+++ /dev/null
@@ -1,391 +0,0 @@
-
-
-
- TinySrc Helper
-
-
- Overview
-
-
- tinysrc.net provides an API for automatic scaling
- and image format conversion for use with mobile devices. The API is quite simple: you
- simply create a standard HTML image tag, but append your image URL to a URL on the
- tinysrc.net domain:
-
-
-
-]]>
-
-
- Their service then sizes the image appropriately for the device requesting it.
-
-
-
- You can control a number of aspects regarding image display, including:
-
-
-
-
-
- Image dimensions. You may specify a width and optional
- height. These dimensions can be in absolute pixels, or use one of the adaptive
- mechanisms tinysrc.net offers. One is subtractive;
- prepending a dimension with a minus ("-") indicates that the image should fill
- the maximum physical dimensions, minus the value given in
- pixels. The other is percentage based; prepending a
- dimension with an "x" tells the service to size that dimension by that
- percentage -- e.g., "x20" indicates "20%".
-
-
-
-
-
- Image format. By default, tinysrc.net autodiscovers the
- format. Internally, it supports only JPEG or
- PNG, and autoconverts GIF to
- PNG. You can specifically request that it should convert an
- image to either PNG or JPEG, however.
-
-
-
-
-
- The TinySrc view helper provides functionality around the
- tinysrc.net API, and gives you the ability to:
-
-
-
-
-
- selectively enable or disable whether it returns just the tinysrc.net URL or a
- fully-populated HTML img tag (enabled by default);
-
-
-
-
-
- specify default values for image format as well as width and height;
-
-
-
-
-
- specify a default value for the base URL used (uses the BaseUrl view helper
- by default);
-
-
-
-
-
- override the default options on a per-image basis, via passed in options.
-
-
-
-
-
-
- Quick Start
-
-
- The most basic usage is simply to pass the path to an image, relative to your document
- root or base URL, to create the appropriate image tag:
-
-
- tinySrc('/images/foo.png'); ?>
-]]>
-
-
- You may specify default values for the base URL, conversion format, dimensions, and
- whether or not to create an img tag by default:
-
-
- tinySrc()
- ->setBaseUrl('http://example.com/foo/')
- ->setCreateTag(false) // disable tag creation
- ->setDefaultFormat('png') // convert images to PNG
- ->setDefaultDimensions('-5', 'x20'); // width should be 5 less than screen width;
- // height should be 20% of total screen height
-?>
-]]>
-
-
- Finally, you can also pass in values as an array of options, passed as the second
- parameter:
-
-
- tinySrc('/images/foo.png', array(
- 'format' => 'jpg', // convert to JPEG
- 'width' => 'x50', // 1/2 screen width
-); ?>
-]]>
-
-
-
- Configuration Options
-
-
- TinySrc Helper Options
-
-
- The following options may be passed to the $options (second)
- argument of the helper.
-
-
-
- base_url
-
-
-
- The base URL, including scheme, host, and optionally port and/or path; this
- value will be prepended to the image path provided in the first argument. By
- default, this uses the BaseUrl and
- ServerUrl view helpers to determine the value.
-
-
-
-
-
- create_tag
-
-
-
- A boolean value indicating whether or not the helper should return an HTML
- img tag, or simply the tinysrc.net URL. By default, this
- flag is enabled.
-
-
-
-
-
- format
-
-
-
- Should be one of the values "png" or "jpeg". If specified, this value will
- be used to indicate the image conversion format. If not specified, the
- default format will be used, or the format will be auto-determined based on
- the image itself.
-
-
-
-
-
- width
-
-
-
- This should be either null, or an integer (optionally
- prefixed by "x" or "-"). If specified, this value will be used to determine
- the converted image width. If null, neither a width nor a height value will
- be used. If not specified, the default dimensions will be used.
-
-
-
-
-
- height
-
-
-
- This should be either null, or an integer (optionally
- prefixed by "x" or "-"). If specified, this value will be used to determine
- the converted image height. If null, no height value will be used. If not
- specified, the default height will be used.
-
-
-
-
-
-
- Any other options provided will be used as attributes to the HTML img
- tag (if created).
-
-
-
-
- Available Methods
-
-
-
-
-
- tinySrc
-
- $image = null, array $options = array()
-
-
-
-
-
-
- Called with no arguments, returns the helper instance. This is useful for
- configuring the helper.
-
-
-
- If the $image argument is provided, it will either create and
- return the tinysrc.net URL for the image, or an image tag containing that URL as
- the source, depending on the status of the "create tag" flag (either the default
- value, or the value passed via $options).
-
-
-
- See the configuration
- section for details on the $options array.
-
-
-
-
-
-
-
- setBaseUrl
-
- $url
-
-
-
-
-
-
- Use this method to manually specify the base URL to prepend to the
- $image argument of the tinySrc()
- method.
-
-
-
-
-
-
-
- getBaseUrl
-
-
-
-
-
- Retrieve the base URL for prepending to image URLs. By default, autodiscovers
- this from the BaseUrl and
- ServerUrl view helpers.
-
-
-
-
-
-
-
- setDefaultFormat
-
- $format = null
-
-
-
-
-
-
- Specifiy the default image conversion format. If none provided, the value is
- cleared. Otherwise, expects either "png" or "jpeg".
-
-
-
-
-
-
-
- setDefaultDimensions
-
- $width = null, $height = null
-
-
-
-
-
-
- Set the default dimensions for image conversion. If no $width
- is specified, an empty value is provided for all dimensions (setting the height
- requires a width as well). Passing no value for the height will set only a
- width. Dimensions should be specified as either pixel dimensions, or:
-
-
-
-
-
- A pixel value, preceded by a "-" sign. This will indicate the width
- should take the entire screen size, minus the number of pixels
- specified.
-
-
-
-
-
- A percentage of the total screen dimensions, expressed as "x" followed
- by the percentage: "x20" is equivalent to 20%.
-
-
-
-
-
-
-
-
-
- setCreateTag
-
- $flag
-
-
-
-
-
-
- Indicate whether the tinySrc() method should create an
- HTML image tag. If boolean false, only a tinysrc.net URL
- will be returned.
-
-
-
-
-
-
-
- createTag
-
-
-
-
-
- Returns the status of the "create tag" flag.
-
-
-
-
-
-
-
- Examples
-
-
- Returning only a tinysrc.net URL
-
-
- You may want to return only a tinysrc.net URL. To do this, you have two options:
- make this the default behavior, or specify in your $options not
- to create a tag.
-
-
- tinySrc()->setCreateTag(false);
-echo $this->tinySrc('image.jpg');
-
-// Per-image:
-echo $this->tinySrc('image.jpg', array('create_tag' => false));
-]]>
-
-
-
diff --git a/documentation/manual/en/module_specs/Zend_View-Helpers.xml b/documentation/manual/en/module_specs/Zend_View-Helpers.xml
index 56f3f08afb..afa6763aa0 100644
--- a/documentation/manual/en/module_specs/Zend_View-Helpers.xml
+++ b/documentation/manual/en/module_specs/Zend_View-Helpers.xml
@@ -742,7 +742,6 @@ echo $this->serverUrl();
-
diff --git a/documentation/manual/fr/module_specs/Zend_View-Helpers.xml b/documentation/manual/fr/module_specs/Zend_View-Helpers.xml
index a5c86d3e15..309720feb5 100644
--- a/documentation/manual/fr/module_specs/Zend_View-Helpers.xml
+++ b/documentation/manual/fr/module_specs/Zend_View-Helpers.xml
@@ -402,9 +402,6 @@ array('us' => 'Etats-Unis', 'fr' => 'France', 'de' => 'Allemagne').
-
-
-
@@ -633,4 +630,4 @@ $view->registerHelper($helper, 'foo');
-
\ No newline at end of file
+
diff --git a/documentation/manual/ja/module_specs/Zend_View-Helpers.xml b/documentation/manual/ja/module_specs/Zend_View-Helpers.xml
index 4b6b53f107..f013268c5b 100644
--- a/documentation/manual/ja/module_specs/Zend_View-Helpers.xml
+++ b/documentation/manual/ja/module_specs/Zend_View-Helpers.xml
@@ -718,9 +718,6 @@ echo $this->serverUrl();
-
-
-
diff --git a/documentation/manual/pt-br/module_specs/Zend_View-Helpers.xml b/documentation/manual/pt-br/module_specs/Zend_View-Helpers.xml
index abf0ed7cb7..8ca900db6c 100644
--- a/documentation/manual/pt-br/module_specs/Zend_View-Helpers.xml
+++ b/documentation/manual/pt-br/module_specs/Zend_View-Helpers.xml
@@ -404,7 +404,6 @@ echo $this->formCheckbox('foo',
-
diff --git a/library/Zend/View/Helper/TinySrc.php b/library/Zend/View/Helper/TinySrc.php
deleted file mode 100644
index 131065e960..0000000000
--- a/library/Zend/View/Helper/TinySrc.php
+++ /dev/null
@@ -1,317 +0,0 @@
- null,
- 'format' => null,
- 'width' => false,
- 'height' => false,
- 'create_tag' => true,
- );
-
- /**
- * @var string Default image format to use
- */
- protected $_format = '';
-
- /**
- * Generate a link or image tag pointing to tinysrc.net
- *
- * @param mixed $image
- * @param array $options
- * @return void
- */
- public function tinySrc($image = null, array $options = array())
- {
- if (null === $image) {
- return $this;
- }
-
- $defaultOptions = $this->_defaultOptions;
- $defaultOptions['create_tag'] = $this->createTag();
- $options = array_merge($defaultOptions, $options);
-
- $url = '/' . $this->_mergeBaseUrl($options) . ltrim($image, '/');
-
- $src = self::TINYSRC_BASE
- . $this->_mergeFormat($options)
- . $this->_mergeDimensions($options)
- . $url;
-
- if (!$options['create_tag']) {
- return $src;
- }
-
- foreach (array_keys($this->_defaultOptions) as $key) {
- switch ($key) {
- case 'width':
- case 'height':
- if (!is_int($options[$key]) || !is_numeric($options[$key]) || $options[$key] < 0) {
- unset($options[$key]);
- }
- break;
- default:
- unset($options[$key]);
- break;
- }
- }
-
- $options['src'] = $src;
-
- $tag = '_htmlAttribs($options) . $this->getClosingBracket();
- return $tag;
- }
-
- /**
- * Set base URL for images
- *
- * @param string $url
- * @return Zend_View_Helper_TinySrc
- */
- public function setBaseUrl($url)
- {
- $this->_baseUrl = rtrim($url, '/') . '/';
- return $this;
- }
-
- /**
- * Get base URL for images
- *
- * If none already set, uses the ServerUrl and BaseUrl view helpers to
- * determine the base URL to images.
- *
- * @return string
- */
- public function getBaseUrl()
- {
- if (null === $this->_baseUrl) {
- $this->setBaseUrl($this->view->serverUrl($this->view->baseUrl()));
- }
- return $this->_baseUrl;
- }
-
- /**
- * Set default image format
- *
- * If set, this will set the default format to use on all images.
- *
- * @param null|string $format
- * @return Zend_View_Helper_TinySrc
- * @throws Zend_View_Exception
- */
- public function setDefaultFormat($format = null)
- {
- if (null === $format) {
- $this->_format = '';
- return $this;
- }
-
- $format = strtolower($format);
- if (!in_array($format, array('png', 'jpeg'))) {
- require_once 'Zend/View/Exception.php';
- throw new Zend_View_Exception('Invalid format; must be one of "jpeg" or "png"');
- }
- $this->_format = "/$format";
- return $this;
- }
-
- /**
- * Set default dimensions
- *
- * If null is specified for width, default dimensions will be cleared. If
- * only width is specified, only width will be used. If either dimension
- * fails validation, an exception is raised.
- *
- * @param null|int|string $width
- * @param null|int|string $height
- * @return Zend_View_Helper_TinySrc
- * @throws Zend_View_Exception
- */
- public function setDefaultDimensions($width = null, $height = null)
- {
- if (null === $width) {
- $this->_dimensions = '';
- return $this;
- }
-
- if (!$this->_validateDimension($width)) {
- require_once 'Zend/View/Exception.php';
- throw new Zend_View_Exception('Invalid dimension; must be an integer, optionally preceded by "-" or "x"');
- }
-
- $this->_dimensions = "/$width";
- if (null === $height) {
- return $this;
- }
-
- if (!$this->_validateDimension($height)) {
- require_once 'Zend/View/Exception.php';
- throw new Zend_View_Exception('Invalid dimension; must be an integer, optionally preceded by "-" or "x"');
- }
- $this->_dimensions .= "/$height";
- return $this;
- }
-
- /**
- * Set state of "create tag" flag
- *
- * @param bool $flag
- * @return Zend_View_Helper_TinySrc
- */
- public function setCreateTag($flag)
- {
- $this->_createTagFlag = (bool) $flag;
- return $this;
- }
-
- /**
- * Should the helper create an image tag?
- *
- * @return bool
- */
- public function createTag()
- {
- return $this->_createTagFlag;
- }
-
- /**
- * Validate a dimension
- *
- * Dimensions may be integers, optionally preceded by '-' or 'x'.
- *
- * @param string $dim
- * @return bool
- */
- protected function _validateDimension($dim)
- {
- if (!is_scalar($dim) || is_bool($dim)) {
- return false;
- }
- return preg_match('/^(-|x)?\d+$/', (string) $dim);
- }
-
- /**
- * Determine whether to use default base URL, or base URL from options
- *
- * @param array $options
- * @return string
- */
- protected function _mergeBaseUrl(array $options)
- {
- if (null === $options['base_url']) {
- return $this->getBaseUrl();
- }
- return rtrim($options['base_url'], '/') . '/';
- }
-
- /**
- * Determine whether to use default format or format provided in options.
- *
- * @param array $options
- * @return string
- */
- protected function _mergeFormat(array $options)
- {
- if (in_array($options['format'], array('png', 'jpeg'))) {
- return '/' . $options['format'];
- }
- return $this->_format;
- }
-
- /**
- * Determine whether to use default dimensions, or those passed in options.
- *
- * @param array $options
- * @return string
- */
- protected function _mergeDimensions(array $options)
- {
- if (!$this->_validateDimension($options['width'])) {
- return $this->_dimensions;
- }
- $dimensions = '/' . $options['width'];
- if (!$this->_validateDimension($options['height'])) {
- return $dimensions;
- }
- $dimensions .= '/' . $options['height'];
- return $dimensions;
- }
-}
diff --git a/tests/Zend/View/Helper/AllTests.php b/tests/Zend/View/Helper/AllTests.php
index cbde62c4a8..2f9a274f7d 100644
--- a/tests/Zend/View/Helper/AllTests.php
+++ b/tests/Zend/View/Helper/AllTests.php
@@ -69,7 +69,6 @@
require_once 'Zend/View/Helper/Placeholder/RegistryTest.php';
require_once 'Zend/View/Helper/Placeholder/StandaloneContainerTest.php';
require_once 'Zend/View/Helper/ServerUrlTest.php';
-require_once 'Zend/View/Helper/TinySrcTest.php';
require_once 'Zend/View/Helper/TranslateTest.php';
require_once 'Zend/View/Helper/UrlTest.php';
require_once 'Zend/View/Helper/UserAgentTest.php';
@@ -139,7 +138,6 @@ public static function suite()
$suite->addTestSuite('Zend_View_Helper_Placeholder_RegistryTest');
$suite->addTestSuite('Zend_View_Helper_Placeholder_StandaloneContainerTest');
$suite->addTestSuite('Zend_View_Helper_ServerUrlTest');
- $suite->addTestSuite('Zend_View_Helper_TinySrcTest');
$suite->addTestSuite('Zend_View_Helper_TranslateTest');
$suite->addTestSuite('Zend_View_Helper_UrlTest');
$suite->addTestSuite('Zend_View_Helper_UserAgentTest');
diff --git a/tests/Zend/View/Helper/TinySrcTest.php b/tests/Zend/View/Helper/TinySrcTest.php
deleted file mode 100644
index 64e91a12c7..0000000000
--- a/tests/Zend/View/Helper/TinySrcTest.php
+++ /dev/null
@@ -1,236 +0,0 @@
-helper = new Zend_View_Helper_TinySrc();
- $this->view = new Zend_View();
- $this->view->doctype()->setDoctype(strtoupper("XHTML1_STRICT"));
- $this->helper->setView($this->view);
- }
-
- public function testCallingHelperMethodWithNoArgumentsReturnsHelperInstance()
- {
- $test = $this->helper->tinySrc();
- $this->assertSame($this->helper, $test);
- }
-
- public function testHelperUsesServerAndBaseUrlFromHelpersByDefault()
- {
- $base = $this->view->getHelper('baseUrl');
- $base->setBaseUrl('/foo/bar');
-
- $server = $this->view->getHelper('serverUrl');
- $server->setScheme('https')
- ->setHost('example.com:8080');
-
- $test = $this->helper->getBaseUrl();
- $this->assertEquals('https://example.com:8080/foo/bar/', $test);
- }
-
- public function testAllowsSettingDefaultFormat()
- {
- $this->helper->setDefaultFormat('png')
- ->setBaseUrl('http://example.com');
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertContains('/png/', $image);
- }
-
- public function testSettingInvalidDefaultFormatRaisesException()
- {
- $this->setExpectedException('Zend_View_Exception', 'Invalid format');
- $this->helper->setDefaultFormat('gif');
- }
-
- public function testPassingNullValueToDefaultFormatClearsSetFormat()
- {
- $this->helper->setDefaultFormat('png')
- ->setBaseUrl('http://example.com');
- $this->helper->setDefaultFormat(null);
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertNotContains('/png/', $image);
- }
-
- public function testAllowsPassingDefaultWidth()
- {
- $this->helper->setBaseUrl('http://example.com')
- ->setDefaultDimensions('-5');
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertContains('/-5/', $image);
- }
-
- /**
- * @dataProvider invalidDimensions
- */
- public function testRaisesExceptionOnInvalidDefaultWidthValue($dim)
- {
- $this->setExpectedException('Zend_View_Exception', 'Invalid dimension');
- $this->helper->setDefaultDimensions($dim);
- }
-
- public function testAllowsPassingDefaultWidthAndHeight()
- {
- $this->helper->setBaseUrl('http://example.com')
- ->setDefaultDimensions('5', 'x20');
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertContains('/5/x20/', $image);
- }
-
- /**
- * @dataProvider invalidDimensions
- */
- public function testRaisesExceptionOnInvalidDefaultHeightValue($dim)
- {
- $this->setExpectedException('Zend_View_Exception', 'Invalid dimension');
- $this->helper->setDefaultDimensions('10', $dim);
- }
-
- public function testPassingNullAsDefaultWidthValueClearsBothWidthAndHeight()
- {
- $this->helper->setBaseUrl('http://example.com')
- ->setDefaultDimensions('5', 'x20');
- $this->helper->setDefaultDimensions(null, 'x20');
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertNotContains('/5/x20/', $image);
- $this->assertNotContains('/5/', $image);
- $this->assertNotContains('/x20/', $image);
- }
-
- public function testPassingNullAsDefaultHeightValueClearsHeight()
- {
- $this->helper->setBaseUrl('http://example.com')
- ->setDefaultDimensions('5', 'x20');
- $this->helper->setDefaultDimensions('5');
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertNotContains('/5/x20/', $image);
- $this->assertContains('/5/', $image);
- }
-
- public function testCreatesImageTagByDefault()
- {
- $this->helper->setBaseUrl('http://example.com');
- $image = $this->helper->tinySrc('foo.jpg');
- $this->assertContains('helper->setBaseUrl('http://example.com')
- ->setCreateTag(false)
- ->setDefaultDimensions(320, 480);
- $image = $this->helper->tinySrc('foo.jpg', array(
- 'base_url' => 'https://example.org:8080/public',
- 'format' => 'png',
- 'width' => 160,
- 'height' => null,
- 'create_tag' => true,
- ));
- $this->assertContains('helper->setBaseUrl('http://example.com');
- $image = $this->helper->tinySrc('foo.jpg', array(
- 'alt' => 'Alt text for image',
- ));
- $this->assertContains('alt="Alt text for image"', $image);
- }
-
- public function invalidDimensions()
- {
- return array(
- array('foo'),
- array(true),
- array(array()),
- array(new stdClass),
- );
- }
-}
-
-// Call Zend_View_Helper_TinySrcTest::main() if this source file is executed directly.
-if (PHPUnit_MAIN_METHOD == 'Zend_View_Helper_TinySrcTest::main') {
- Zend_View_Helper_TinySrcTest::main();
-}