Update Zend Framework to version 1.12.1

This commit is contained in:
Michael RICOIS 2012-12-21 09:07:54 +00:00
parent 250e5c9819
commit acb2313b99
50 changed files with 422 additions and 191 deletions

View File

@ -17,7 +17,7 @@
* @subpackage Bootstrap
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Bootstrap.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Bootstrap.php 25073 2012-11-06 19:31:53Z rob $
*/
/**
@ -120,7 +120,7 @@ class Zend_Application_Bootstrap_Bootstrap
public function getResourceLoader()
{
if ((null === $this->_resourceLoader)
&& (false !== ($namespace = $this->getAppNamespace()))
&& (false != ($namespace = $this->getAppNamespace()))
) {
$r = new ReflectionClass($this);
$path = $r->getFileName();

View File

@ -17,7 +17,7 @@
* @subpackage Resource
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Db.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Db.php 25123 2012-11-14 18:27:44Z matthew $
*/
/**
@ -140,6 +140,12 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
&& (null !== ($adapter = $this->getAdapter()))
) {
$this->_db = Zend_Db::factory($adapter, $this->getParams());
if ($this->_db instanceof Zend_Db_Adapter_Abstract
&& $this->isDefaultTableAdapter()
) {
Zend_Db_Table::setDefaultAdapter($this->_db);
}
}
return $this->_db;
}
@ -152,9 +158,6 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
public function init()
{
if (null !== ($db = $this->getDbAdapter())) {
if ($this->isDefaultTableAdapter()) {
Zend_Db_Table::setDefaultAdapter($db);
}
return $db;
}
}

View File

@ -19,7 +19,7 @@
require_once 'Zend/Cloud/StorageService/Adapter.php';
require_once 'Zend/Cloud/StorageService/Exception.php';
require_once 'Zend/Service/Rackspace/File.php';
require_once 'Zend/Service/Rackspace/Files.php';
require_once 'Zend/Service/Rackspace/Exception.php';
/**
@ -41,7 +41,7 @@ class Zend_Cloud_StorageService_Adapter_Rackspace
/**
* The Rackspace adapter
* @var Zend_Service_Rackspace_File
* @var Zend_Service_Rackspace_Files
*/
protected $_rackspace;
@ -68,7 +68,7 @@ class Zend_Cloud_StorageService_Adapter_Rackspace
}
try {
$this->_rackspace = new Zend_Service_Rackspace_File($options[self::USER], $options[self::API_KEY]);
$this->_rackspace = new Zend_Service_Rackspace_Files($options[self::USER], $options[self::API_KEY]);
} catch (Zend_Service_Rackspace_Exception $e) {
throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
}

View File

@ -16,7 +16,7 @@
* @package Zend_Controller
* @subpackage Router
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Chain.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Chain.php 25071 2012-11-06 19:07:27Z rob $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -72,9 +72,10 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
*/
public function match($request, $partial = null)
{
$path = trim($request->getPathInfo(), self::URI_DELIMITER);
$subPath = $path;
$values = array();
$path = trim($request->getPathInfo(), self::URI_DELIMITER);
$subPath = $path;
$values = array();
$numRoutes = count($this->_routes);
foreach ($this->_routes as $key => $route) {
if ($key > 0
@ -99,7 +100,7 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
$match = $request;
}
$res = $route->match($match, true);
$res = $route->match($match, true, ($key == $numRoutes - 1));
if ($res === false) {
return false;
}

View File

@ -17,7 +17,7 @@
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Sqlsrv.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Sqlsrv.php 25077 2012-11-06 20:06:24Z rob $
*/
/**
@ -630,9 +630,14 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
$sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl";
$start = $offset + 1;
$end = $offset + $count;
$sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end";
if ($count == PHP_INT_MAX) {
$sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" >= $start";
}
else {
$end = $offset + $count;
$sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end";
}
}
return $sql;

View File

@ -17,7 +17,7 @@
* @subpackage Profiler
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Profiler.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Profiler.php 25127 2012-11-16 15:17:42Z rob $
*/
@ -225,7 +225,9 @@ class Zend_Db_Profiler
}
/**
* @param integer $queryId
* Clone a profiler query
*
* @param Zend_Db_Profiler_Query $query
* @return integer or null
*/
public function queryClone(Zend_Db_Profiler_Query $query)
@ -287,12 +289,12 @@ class Zend_Db_Profiler
}
/**
* Ends a query. Pass it the handle that was returned by queryStart().
* Ends a query. Pass it the handle that was returned by queryStart().
* This will mark the query as ended and save the time.
*
* @param integer $queryId
* @throws Zend_Db_Profiler_Exception
* @return void
* @return string Inform that a query is stored or ignored.
*/
public function queryEnd($queryId)
{

View File

@ -16,7 +16,7 @@
* @package Zend_Debug
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Debug.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Debug.php 25095 2012-11-07 20:11:07Z rob $
*/
/**
@ -90,7 +90,12 @@ class Zend_Debug
. PHP_EOL;
} else {
if(!extension_loaded('xdebug')) {
$output = htmlspecialchars($output, ENT_QUOTES);
$flags = ENT_QUOTES;
// PHP 5.4.0+
if (defined('ENT_SUBSTITUTE')) {
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
}
$output = htmlspecialchars($output, $flags);
}
$output = '<pre>'

View File

@ -163,7 +163,7 @@ class Zend_EventManager_EventManager implements Zend_EventManager_EventCollectio
if (is_array($identifiers) || $identifiers instanceof Traversable) {
$this->identifiers = array_unique($this->identifiers + (array) $identifiers);
} elseif ($identifiers !== null) {
$this->identifiers = array_unique($this->identifiers + array($identifiers));
$this->identifiers = array_unique(array_merge($this->identifiers, array($identifiers)));
}
return $this;
}

View File

@ -17,7 +17,7 @@
* @package Zend_Feed
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Feed.php 25160 2012-12-18 15:17:16Z matthew $
*/
@ -191,7 +191,8 @@ class Zend_Feed
public static function importString($string)
{
// Load the feed as an XML DOMDocument object
$libxml_errflag = libxml_use_internal_errors(true);
$libxml_errflag = libxml_use_internal_errors(true);
$libxml_entity_loader = libxml_disable_entity_loader(true);
$doc = new DOMDocument;
if (trim($string) == '') {
require_once 'Zend/Feed/Exception.php';
@ -199,9 +200,9 @@ class Zend_Feed
. ' is an Empty string or comes from an empty HTTP response');
}
$status = $doc->loadXML($string);
libxml_disable_entity_loader($libxml_entity_loader);
libxml_use_internal_errors($libxml_errflag);
if (!$status) {
// prevent the class to generate an undefined variable notice (ZF-2590)
// Build error message

View File

@ -17,7 +17,7 @@
* @package Zend_Feed
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Abstract.php 25160 2012-12-18 15:17:16Z matthew $
*/
@ -81,9 +81,9 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator,
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus() . '; request: ' . $client->getLastRequest() . "\nresponse: " . $response->asString());
}
$this->_element = $response->getBody();
$this->_element = $this->_importFeedFromString($response->getBody());
$this->__wakeup();
} elseif ($string !== null) {
// Retrieve the feed from $string
@ -256,4 +256,49 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator,
* @return void
*/
abstract public function send();
/**
* Import a feed from a string
*
* Protects against XXE attack vectors.
*
* @param string $feed
* @return string
* @throws Zend_Feed_Exception on detection of an XXE vector
*/
protected function _importFeedFromString($feed)
{
// Load the feed as an XML DOMDocument object
$libxml_errflag = libxml_use_internal_errors(true);
$libxml_entity_loader = libxml_disable_entity_loader(true);
$doc = new DOMDocument;
if (trim($feed) == '') {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Remote feed being imported'
. ' is an Empty string or comes from an empty HTTP response');
}
$status = $doc->loadXML($feed);
libxml_disable_entity_loader($libxml_entity_loader);
libxml_use_internal_errors($libxml_errflag);
if (!$status) {
// prevent the class to generate an undefined variable notice (ZF-2590)
// Build error message
$error = libxml_get_last_error();
if ($error && $error->message) {
$errormsg = "DOMDocument cannot parse XML: {$error->message}";
} else {
$errormsg = "DOMDocument cannot parse XML";
}
/**
* @see Zend_Feed_Exception
*/
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception($errormsg);
}
return $doc->saveXML($doc->documentElement);
}
}

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Reader.php 25033 2012-08-17 19:50:08Z matthew $
* @version $Id: Reader.php 25103 2012-11-07 20:29:29Z rob $
*/
/**
@ -240,7 +240,7 @@ class Zend_Feed_Reader
$etag = $cache->load($cacheId.'_etag');
}
if ($lastModified === null) {
$lastModified = $cache->load($cacheId.'_lastmodified');;
$lastModified = $cache->load($cacheId.'_lastmodified');
}
if ($etag) {
$client->setHeaders('If-None-Match', $etag);

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Deleted.php 24710 2012-04-16 18:55:12Z bittarman $
* @version $Id: Deleted.php 25160 2012-12-18 15:17:16Z matthew $
*/
require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php';
@ -128,10 +128,10 @@ class Zend_Feed_Writer_Deleted
$zdate = null;
if ($date === null) {
$zdate = new Zend_Date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} elseif ($date instanceof Zend_Date) {
$zdate = $date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} else {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter');

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 24645 2012-02-25 21:47:06Z adamlundrigan $
* @version $Id: Entry.php 25160 2012-12-18 15:17:16Z matthew $
*/
/**
@ -114,7 +114,7 @@ class Zend_Feed_Writer_Entry
* Array notation (above) is preferred and will be the sole supported input from ZF 2.0
*/
} else {
if (empty($name['name']) || !is_string($name['name'])) {
if (empty($name) || !is_string($name)) {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value');
}
@ -214,10 +214,10 @@ class Zend_Feed_Writer_Entry
$zdate = null;
if ($date === null) {
$zdate = new Zend_Date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} elseif ($date instanceof Zend_Date) {
$zdate = $date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} else {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter');
@ -235,10 +235,10 @@ class Zend_Feed_Writer_Entry
$zdate = null;
if ($date === null) {
$zdate = new Zend_Date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} elseif ($date instanceof Zend_Date) {
$zdate = $date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} else {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter');

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Feed.php 25107 2012-11-07 20:42:00Z rob $
*/
/**
@ -205,7 +205,7 @@ class Zend_Feed_Writer_Extension_ITunes_Feed
/**
* Set "explicit" flag
*
* @param bool $value
* @param string $value Valid values: "yes", "no" or "clean"
* @return Zend_Feed_Writer_Extension_ITunes_Feed
*/
public function setItunesExplicit($value)

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FeedAbstract.php 24647 2012-02-25 22:01:16Z adamlundrigan $
* @version $Id: FeedAbstract.php 25160 2012-12-18 15:17:16Z matthew $
*/
/**
@ -117,7 +117,7 @@ class Zend_Feed_Writer_Feed_FeedAbstract
$author['uri'] = $name['uri'];
}
} else {
if (empty($name['name']) || !is_string($name['name'])) {
if (empty($name) || !is_string($name)) {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value');
}
@ -176,10 +176,10 @@ class Zend_Feed_Writer_Feed_FeedAbstract
$zdate = null;
if ($date === null) {
$zdate = new Zend_Date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} elseif ($date instanceof Zend_Date) {
$zdate = $date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} else {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter');
@ -197,10 +197,10 @@ class Zend_Feed_Writer_Feed_FeedAbstract
$zdate = null;
if ($date === null) {
$zdate = new Zend_Date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} elseif ($date instanceof Zend_Date) {
$zdate = $date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} else {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter');
@ -218,10 +218,10 @@ class Zend_Feed_Writer_Feed_FeedAbstract
$zdate = null;
if ($date === null) {
$zdate = new Zend_Date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} elseif ($date instanceof Zend_Date) {
$zdate = $date;
} elseif (ctype_digit((string)$date)) {
$zdate = new Zend_Date($date, Zend_Date::TIMESTAMP);
} else {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter');

View File

@ -16,7 +16,7 @@
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Http.php 25087 2012-11-06 21:15:45Z rob $
*/
/**
@ -128,6 +128,10 @@ class Zend_File_Transfer_Adapter_Http extends Zend_File_Transfer_Adapter_Abstrac
// Workaround for a PHP error returning empty $_FILES when form data exceeds php settings
if (empty($this->_files) && ($content > 0)) {
if (is_array($files)) {
if (0 === count($files)) {
return false;
}
$files = current($files);
}

View File

@ -28,7 +28,7 @@ require_once 'Zend/Validate/Interface.php';
* @package Zend_Form
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Form.php 24848 2012-05-31 19:28:48Z rob $
* @version $Id: Form.php 25117 2012-11-08 19:28:39Z rob $
*/
class Zend_Form implements Iterator, Countable, Zend_Validate_Interface
{
@ -1025,19 +1025,6 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface
throw new Zend_Form_Exception('Elements specified by string must have an accompanying name');
}
if (is_array($this->_elementDecorators)) {
if (null === $options) {
$options = array('decorators' => $this->_elementDecorators);
} elseif ($options instanceof Zend_Config) {
$options = $options->toArray();
}
if (is_array($options)
&& !array_key_exists('decorators', $options)
) {
$options['decorators'] = $this->_elementDecorators;
}
}
$this->_elements[$name] = $this->createElement($element, $name, $options);
} elseif ($element instanceof Zend_Form_Element) {
$prefixPaths = array();
@ -1101,12 +1088,22 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface
if ((null === $options) || !is_array($options)) {
$options = array('prefixPath' => $prefixPaths);
if (is_array($this->_elementDecorators)) {
$options['decorators'] = $this->_elementDecorators;
}
} elseif (is_array($options)) {
if (array_key_exists('prefixPath', $options)) {
$options['prefixPath'] = array_merge($prefixPaths, $options['prefixPath']);
} else {
$options['prefixPath'] = $prefixPaths;
}
if (is_array($this->_elementDecorators)
&& !array_key_exists('decorators', $options)
) {
$options['decorators'] = $this->_elementDecorators;
}
}
$class = $this->getPluginLoader(self::ELEMENT)->load($type);

View File

@ -38,7 +38,7 @@ require_once 'Zend/File/Transfer/Adapter/Http.php';
* @subpackage Decorator
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: File.php 25067 2012-11-03 14:20:28Z rob $
*/
class Zend_Form_Decorator_File
extends Zend_Form_Decorator_Abstract
@ -117,16 +117,17 @@ class Zend_Form_Decorator_File
$markup[] = $view->formHidden('UPLOAD_IDENTIFIER', uniqid(), array('id' => 'progress_key'));
}
$helper = $element->helper;
if ($element->isArray()) {
$name .= "[]";
$count = $element->getMultiFile();
for ($i = 0; $i < $count; ++$i) {
$htmlAttribs = $attribs;
$htmlAttribs['id'] .= '-' . $i;
$markup[] = $view->formFile($name, $htmlAttribs);
$markup[] = $view->$helper($name, $htmlAttribs);
}
} else {
$markup[] = $view->formFile($name, $attribs);
$markup[] = $view->$helper($name, $attribs);
}
$markup = implode($separator, $markup);

View File

@ -37,7 +37,7 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* @subpackage Decorator
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FormElements.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: FormElements.php 25093 2012-11-07 20:08:05Z rob $
*/
class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
{
@ -82,8 +82,13 @@ class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
$items = array();
$view = $form->getView();
foreach ($form as $item) {
$item->setView($view)
->setTranslator($translator);
$item->setView($view);
// Set translator
if (!$item->hasTranslator()) {
$item->setTranslator($translator);
}
if ($item instanceof Zend_Form_Element) {
foreach ($displayGroups as $group) {
$elementName = $item->getName();

View File

@ -25,7 +25,7 @@
* @package Zend_Form
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DisplayGroup.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: DisplayGroup.php 25093 2012-11-07 20:08:05Z rob $
*/
class Zend_Form_DisplayGroup implements Iterator,Countable
{
@ -976,6 +976,16 @@ class Zend_Form_DisplayGroup implements Iterator,Countable
return $this->_translator;
}
/**
* Does this display group have its own specific translator?
*
* @return bool
*/
public function hasTranslator()
{
return (bool) $this->getTranslator();
}
/**
* Indicate whether or not translation should be disabled
*

View File

@ -38,7 +38,7 @@ require_once 'Zend/Validate/Abstract.php';
* @subpackage Element
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Element.php 24848 2012-05-31 19:28:48Z rob $
* @version $Id: Element.php 25075 2012-11-06 19:44:47Z rob $
*/
class Zend_Form_Element implements Zend_Validate_Interface
{
@ -1072,14 +1072,12 @@ class Zend_Form_Element implements Zend_Validate_Interface
return $this;
case null:
$nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_';
$prefix = rtrim($prefix, $nsSeparator);
$path = rtrim($path, DIRECTORY_SEPARATOR);
$prefix = rtrim($prefix, $nsSeparator) . $nsSeparator;
$path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
foreach (array(self::DECORATOR, self::FILTER, self::VALIDATE) as $type) {
$cType = ucfirst(strtolower($type));
$pluginPath = $path . DIRECTORY_SEPARATOR . $cType . DIRECTORY_SEPARATOR;
$pluginPrefix = $prefix . $nsSeparator . $cType;
$loader = $this->getPluginLoader($type);
$loader->addPrefixPath($pluginPrefix, $pluginPath);
$loader->addPrefixPath($prefix . $cType, $path . $cType . DIRECTORY_SEPARATOR);
}
return $this;
default:

View File

@ -30,7 +30,7 @@ require_once 'Zend/Form/Element/Multi.php';
* @subpackage Element
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Radio.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Radio.php 25109 2012-11-07 20:48:04Z rob $
*/
class Zend_Form_Element_Radio extends Zend_Form_Element_Multi
{
@ -53,8 +53,14 @@ class Zend_Form_Element_Radio extends Zend_Form_Element_Multi
return $this;
}
parent::loadDefaultDecorators();
$this->addDecorator('Label', array('tag' => 'dt',
'disableFor' => true));
// Disable 'for' attribute
if (isset($this->_decorators['Label'])
&& !isset($this->_decorators['Label']['options']['disableFor']))
{
$this->_decorators['Label']['options']['disableFor'] = true;
}
return $this;
}
}

View File

@ -18,7 +18,7 @@
* @subpackage App
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: App.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: App.php 25063 2012-11-03 14:06:07Z rob $
*/
/**
@ -1060,6 +1060,9 @@ class Zend_Gdata_App
break;
} catch (Zend_Exception $e) {
// package wasn't here- continue searching
} catch (ErrorException $e) {
// package wasn't here- continue searching
// @see ZF-7013 and ZF-11959
}
}
if ($foundClassName != null) {

View File

@ -16,7 +16,7 @@
* @category Zend
* @package Zend_Http
* @subpackage Response
* @version $Id: Response.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Response.php 25081 2012-11-06 20:59:47Z rob $
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -641,7 +641,7 @@ class Zend_Http_Response
* @link http://framework.zend.com/issues/browse/ZF-6040
*/
$zlibHeader = unpack('n', substr($body, 0, 2));
if ($zlibHeader[1] % 31 == 0) {
if ($zlibHeader[1] % 31 == 0 && ord($body[0]) == 0x78 && in_array(ord($body[1]), array(0x01, 0x5e, 0x9c, 0xda))) {
return gzuncompress($body);
} else {
return gzinflate($body);

View File

@ -195,7 +195,7 @@ abstract class Zend_Http_UserAgent_AbstractDevice
*/
public function hasFeature($feature)
{
return (!empty($this->_aFeatures[$feature]));
return (isset($this->_aFeatures[$feature]) && !is_null($this->_aFeatures[$feature]));
}
/**

View File

@ -16,7 +16,7 @@
* @package Zend_Json
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Encoder.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Encoder.php 25059 2012-11-02 21:01:06Z rob $
*/
/**
@ -74,7 +74,6 @@ class Zend_Json_Encoder
public static function encode($value, $cycleCheck = false, $options = array())
{
$encoder = new self(($cycleCheck) ? true : false, $options);
return $encoder->_encodeValue($value);
}
@ -138,7 +137,9 @@ class Zend_Json_Encoder
if (method_exists($value, 'toJson')) {
$props =',' . preg_replace("/^\{(.*)\}$/","\\1",$value->toJson());
} else {
if ($value instanceof Iterator) {
if ($value instanceof IteratorAggregate) {
$propCollection = $value->getIterator();
} elseif ($value instanceof Iterator) {
$propCollection = $value;
} else {
$propCollection = get_object_vars($value);

View File

@ -16,7 +16,7 @@
* @package Zend_Json
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Server.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Server.php 25085 2012-11-06 21:11:41Z rob $
*/
/**
@ -547,7 +547,7 @@ class Zend_Json_Server extends Zend_Server_Abstract
if( isset( $params[ $refParam->getName() ] ) ) {
$orderedParams[ $refParam->getName() ] = $params[ $refParam->getName() ];
} elseif( $refParam->isOptional() ) {
$orderedParams[ $refParam->getName() ] = null;
$orderedParams[ $refParam->getName() ] = $refParam->getDefaultValue();
} else {
throw new Zend_Server_Exception(
'Missing required parameter: ' . $refParam->getName()

View File

@ -16,7 +16,7 @@
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Log.php 24703 2012-03-29 09:52:39Z andries $
* @version $Id: Log.php 25131 2012-11-16 15:29:18Z rob $
*/
/**
@ -24,7 +24,7 @@
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Log.php 24703 2012-03-29 09:52:39Z andries $
* @version $Id: Log.php 25131 2012-11-16 15:29:18Z rob $
*/
class Zend_Log
{
@ -595,7 +595,7 @@ class Zend_Log
{
$errorLevel = error_reporting();
if ($errorLevel && $errno) {
if ($errorLevel & $errno) {
if (isset($this->_errorHandlerMap[$errno])) {
$priority = $this->_errorHandlerMap[$errno];
} else {

View File

@ -55,8 +55,8 @@ class Zend_Mobile_Push_Apns extends Zend_Mobile_Push_Abstract
protected $_serverUriList = array(
'ssl://gateway.sandbox.push.apple.com:2195',
'ssl://gateway.push.apple.com:2195',
'ssl://feedback.push.apple.com:2196',
'ssl://feedback.sandbox.push.apple.com:2196'
'ssl://feedback.sandbox.push.apple.com:2196',
'ssl://feedback.push.apple.com:2196'
);
/**
@ -302,7 +302,9 @@ class Zend_Mobile_Push_Apns extends Zend_Mobile_Push_Abstract
if (!empty($alert)) {
$payload['aps']['alert'] = $alert;
}
$payload['aps']['badge'] = $message->getBadge();
if (!is_null($message->getBadge())) {
$payload['aps']['badge'] = $message->getBadge();
}
$payload['aps']['sound'] = $message->getSound();
foreach($message->getCustomData() as $k => $v) {

View File

@ -121,7 +121,7 @@ class Zend_Mobile_Push_Gcm extends Zend_Mobile_Push_Abstract
* Send Message
*
* @param Zend_Mobile_Push_Message_Gcm $message
* @return boolean
* @return Zend_Mobile_Push_Response_Gcm
* @throws Zend_Mobile_Push_Exception
*/
public function send(Zend_Mobile_Push_Message_Abstract $message)

View File

@ -40,7 +40,7 @@ class Zend_Mobile_Push_Message_Apns extends Zend_Mobile_Push_Message_Abstract
*
* @var int
*/
protected $_badge = 0;
protected $_badge;
/**
* Alert
@ -137,7 +137,7 @@ class Zend_Mobile_Push_Message_Apns extends Zend_Mobile_Push_Message_Abstract
*/
public function getBadge()
{
return (int) $this->_badge;
return $this->_badge;
}
/**
@ -149,13 +149,13 @@ class Zend_Mobile_Push_Message_Apns extends Zend_Mobile_Push_Message_Abstract
*/
public function setBadge($badge)
{
if (!is_numeric($badge)) {
if (!is_null($badge) && !is_numeric($badge)) {
throw new Zend_Mobile_Push_Message_Exception('$badge must be an integer');
}
if ($badge < 0) {
if (!is_null($badge) && $badge < 0) {
throw new Zend_Mobile_Push_Message_Exception('$badge must be greater or equal to 0');
}
$this->_badge = (int) $badge;
$this->_badge = $badge;
}
/**

View File

@ -32,6 +32,7 @@ require_once 'Zend/Mobile/Push/Message/Abstract.php';
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
* @method array getToken()
*/
class Zend_Mobile_Push_Message_Gcm extends Zend_Mobile_Push_Message_Abstract
{

View File

@ -324,7 +324,7 @@ class Zend_Mobile_Push_Message_Mpns_Tile extends Zend_Mobile_Push_Message_Mpns
{
$ret = '<?xml version="1.0" encoding="utf-8"?>'
. '<wp:Notification xmlns:wp="WPNotification">'
. '<wp:Tile' . (($this->_tileId) ? 'Id="' . htmlspecialchars($this->_tileId) . '"' : '') . '>'
. '<wp:Tile' . (($this->_tileId) ? ' Id="' . htmlspecialchars($this->_tileId) . '"' : '') . '>'
. '<wp:BackgroundImage>' . htmlspecialchars($this->_backgroundImage) . '</wp:BackgroundImage>'
. '<wp:Count>' . (int) $this->_count . '</wp:Count>'
. '<wp:Title>' . htmlspecialchars($this->_title) . '</wp:Title>';

View File

@ -16,7 +16,7 @@
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Page.php 24879 2012-06-06 13:09:21Z adamlundrigan $
* @version $Id: Page.php 25125 2012-11-16 15:12:06Z rob $
*/
/**
@ -255,7 +255,8 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
$hasUri = isset($options['uri']);
$hasMvc = isset($options['action']) || isset($options['controller']) ||
isset($options['module']) || isset($options['route']);
isset($options['module']) || isset($options['route']) ||
isset($options['params']);
if ($hasMvc) {
require_once 'Zend/Navigation/Page/Mvc.php';

View File

@ -17,7 +17,7 @@
* @subpackage FileParser
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: OpenType.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: OpenType.php 25137 2012-11-16 17:07:52Z rob $
*/
/** Zend_Pdf_FileParser_Font */
@ -582,12 +582,24 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
* outlines from fonts yet, so this means no embed.
*/
$this->isEmbeddable = false;
} else if ($this->isBitSet(1, $embeddingFlags)) {
/* Restricted license embedding. We currently don't have any way to
* enforce this, so interpret this as no embed. This may be revised
* in the future...
*/
$this->isEmbeddable = false;
} elseif ($this->isBitSet(2, $embeddingFlags)
|| $this->isBitSet(3, $embeddingFlags)
|| $this->isBitSet(4)
) {
/* One of:
* Restricted License embedding (0x0002)
* Preview & Print embedding (0x0004)
* Editable embedding (0x0008)
* is set.
*/
$this->isEmbeddable = true;
} elseif ($this->isBitSet(1, $embeddingFlags)) {
/* Restricted license embedding & no other embedding is set.
* We currently don't have any way to
* enforce this, so interpret this as no embed. This may be revised
* in the future...
*/
$this->isEmbeddable = false;
} else {
/* The remainder of the bit settings grant us permission to embed
* the font. There may be additional usage rights granted or denied

View File

@ -38,7 +38,7 @@ CREATE TABLE message
handle character(32),
body character varying(8192) NOT NULL,
md5 character(32) NOT NULL,
timeout real,
timeout double precision,
created integer,
CONSTRAINT message_pk PRIMARY KEY (message_id),
CONSTRAINT message_ibfk_1 FOREIGN KEY (queue_id)

View File

@ -338,9 +338,11 @@ class Zend_Service_Rackspace_Files extends Zend_Service_Rackspace_Abstract
* @param string $object
* @param string $content
* @param array $metadata
* @param string $content_type
*
* @return boolean
*/
public function storeObject($container,$object,$content,$metadata=array()) {
public function storeObject($container,$object,$content,$metadata=array(),$content_type=null) {
if (empty($container)) {
require_once 'Zend/Service/Rackspace/Exception.php';
throw new Zend_Service_Rackspace_Exception(self::ERROR_PARAM_NO_NAME_CONTAINER);
@ -353,6 +355,9 @@ class Zend_Service_Rackspace_Files extends Zend_Service_Rackspace_Abstract
require_once 'Zend/Service/Rackspace/Exception.php';
throw new Zend_Service_Rackspace_Exception(self::ERROR_PARAM_NO_CONTENT);
}
if (!empty($content_type)) {
$headers[self::HEADER_CONTENT_TYPE]= $content_type;
}
if (!empty($metadata) && is_array($metadata)) {
foreach ($metadata as $key => $value) {
$headers[self::METADATA_OBJECT_HEADER.$key]= $value;

View File

@ -36,7 +36,7 @@ require_once 'Zend/Service/ReCaptcha/Response.php';
* @subpackage ReCaptcha
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ReCaptcha.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: ReCaptcha.php 25153 2012-11-28 11:56:23Z cogo $
*/
class Zend_Service_ReCaptcha extends Zend_Service_Abstract
{
@ -467,21 +467,9 @@ HTML;
throw new Zend_Service_ReCaptcha_Exception('Missing ip address');
}
if (empty($challengeField)) {
/** @see Zend_Service_ReCaptcha_Exception */
require_once 'Zend/Service/ReCaptcha/Exception.php';
throw new Zend_Service_ReCaptcha_Exception('Missing challenge field');
}
if (empty($responseField)) {
/** @see Zend_Service_ReCaptcha_Exception */
require_once 'Zend/Service/ReCaptcha/Exception.php';
throw new Zend_Service_ReCaptcha_Exception('Missing response field');
}
/* Fetch an instance of the http client */
$httpClient = self::getHttpClient();
$httpClient->resetParameters(true);
$postParams = array('privatekey' => $this->_privateKey,
'remoteip' => $this->_ip,

View File

@ -27,7 +27,7 @@
* @subpackage ReCaptcha
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Response.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Response.php 25152 2012-11-28 11:55:44Z cogo $
*/
class Zend_Service_ReCaptcha_Response
{
@ -142,13 +142,18 @@ class Zend_Service_ReCaptcha_Response
{
$body = $response->getBody();
$parts = explode("\n", $body, 2);
// Default status and error code
$status = 'false';
$errorCode = '';
if (count($parts) !== 2) {
$status = 'false';
$errorCode = '';
} else {
list($status, $errorCode) = $parts;
$parts = explode("\n", $body);
if ($parts[0] === 'true') {
$status = 'true';
}
if (!empty($parts[1])) {
$errorCode = $parts[1];
}
$this->setStatus($status);

View File

@ -23,7 +23,7 @@
/**
* @see Zend_Service_Exception
*/
require_once 'Zend\Service\Exception.php';
require_once 'Zend/Service/Exception.php';
/**
* @category Zend

View File

@ -17,7 +17,7 @@
* @package Zend_Session
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Session.php 24819 2012-05-28 19:25:03Z rob $
* @version $Id: Session.php 25121 2012-11-13 21:51:23Z matthew $
* @since Preview Release 0.2
*/
@ -515,6 +515,14 @@ class Zend_Session extends Zend_Session_Abstract
*/
protected static function _checkId($id)
{
$saveHandler = ini_get('session.save_handler');
if ($saveHandler == 'cluster') { // Zend Server SC, validate only after last dash
$dashPos = strrpos($id, '-');
if ($dashPos) {
$id = substr($id, $dashPos + 1);
}
}
$hashBitsPerChar = ini_get('session.hash_bits_per_character');
if (!$hashBitsPerChar) {
$hashBitsPerChar = 5; // the default value

View File

@ -16,7 +16,7 @@
* @package Zend_Validate
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 24807 2012-05-15 12:10:42Z adamlundrigan $
* @version $Id: Abstract.php 25105 2012-11-07 20:33:22Z rob $
*/
/**
@ -230,16 +230,20 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
$value = $value->__toString();
}
} else {
$value = (string)$value;
$value = implode((array) $value);
}
if ($this->getObscureValue()) {
$value = str_repeat('*', strlen($value));
}
$message = str_replace('%value%', (string) $value, $message);
$message = str_replace('%value%', $value, $message);
foreach ($this->_messageVariables as $ident => $property) {
$message = str_replace("%$ident%", implode(' ',(array)$this->$property), $message);
$message = str_replace(
"%$ident%",
implode(' ', (array) $this->$property),
$message
);
}
$length = self::getMessageLength();

View File

@ -16,7 +16,7 @@
* @package Zend_Validate
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailAddress.php 24828 2012-05-30 12:24:06Z adamlundrigan $
* @version $Id: EmailAddress.php 25057 2012-11-02 20:35:40Z rob $
*/
/**
@ -63,17 +63,26 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
);
/**
* As of RFC5753 (JAN 2010), the following blocks are no logner reserved:
* - 128.0.0.0/16
* - 191.255.0.0/16
* - 223.255.255.0/24
* @see http://tools.ietf.org/html/rfc5735#page-6
*
* As of RFC6598 (APR 2012), the following blocks are now reserved:
* - 100.64.0.0/10
* @see http://tools.ietf.org/html/rfc6598#section-7
*
* @see http://en.wikipedia.org/wiki/IPv4
* @var array
*/
protected $_invalidIp = array(
'0' => '0.0.0.0/8',
'10' => '10.0.0.0/8',
'100' => '100.64.0.0/10',
'127' => '127.0.0.0/8',
'128' => '128.0.0.0/16',
'169' => '169.254.0.0/16',
'172' => '172.16.0.0/12',
'191' => '191.255.0.0/16',
'192' => array(
'192.0.0.0/24',
'192.0.2.0/24',
@ -81,7 +90,6 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract
'192.168.0.0/16'
),
'198' => '198.18.0.0/15',
'223' => '223.255.255.0/24',
'224' => '224.0.0.0/4',
'240' => '240.0.0.0/4'
);

View File

@ -16,7 +16,7 @@
* @package Zend_Validate
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Hostname.php 24631 2012-02-24 17:43:08Z adamlundrigan $
* @version $Id: Hostname.php 25061 2012-11-02 21:24:09Z rob $
*/
/**
@ -205,7 +205,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
'CN' => 'Hostname/Cn.php',
'COM' => 'Zend/Validate/Hostname/Com.php',
'DE' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
'DK' => array(1 => '/^[\x{002d}0-9a-zäéöü]{1,63}$/iu'),
'DK' => array(1 => '/^[\x{002d}0-9a-zäéöüæøå]{1,63}$/iu'),
'ES' => array(1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'),
'EU' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu',
2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',

View File

@ -16,7 +16,7 @@
* @package Zend_Version
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Version.php 25049 2012-08-27 15:33:58Z matthew $
* @version $Id: Version.php 25161 2012-12-18 15:55:50Z matthew $
*/
/**
@ -32,7 +32,7 @@ final class Zend_Version
/**
* Zend Framework version identification - see compareVersion()
*/
const VERSION = '1.12.0';
const VERSION = '1.12.1';
/**
* The latest stable version Zend Framework available

View File

@ -16,7 +16,7 @@
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Doctype.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Doctype.php 25101 2012-11-07 20:27:27Z rob $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -44,6 +44,7 @@ class Zend_View_Helper_Doctype extends Zend_View_Helper_Abstract
const XHTML1_TRANSITIONAL = 'XHTML1_TRANSITIONAL';
const XHTML1_FRAMESET = 'XHTML1_FRAMESET';
const XHTML1_RDFA = 'XHTML1_RDFA';
const XHTML1_RDFA11 = 'XHTML1_RDFA11';
const XHTML_BASIC1 = 'XHTML_BASIC1';
const XHTML5 = 'XHTML5';
const HTML4_STRICT = 'HTML4_STRICT';
@ -89,6 +90,7 @@ class Zend_View_Helper_Doctype extends Zend_View_Helper_Abstract
self::XHTML1_TRANSITIONAL => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
self::XHTML1_FRAMESET => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
self::XHTML1_RDFA => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
self::XHTML1_RDFA11 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
self::XHTML_BASIC1 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">',
self::XHTML5 => '<!DOCTYPE html>',
self::HTML4_STRICT => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
@ -120,6 +122,7 @@ class Zend_View_Helper_Doctype extends Zend_View_Helper_Abstract
case self::XHTML1_FRAMESET:
case self::XHTML_BASIC1:
case self::XHTML1_RDFA:
case self::XHTML1_RDFA11:
case self::XHTML5:
case self::HTML4_STRICT:
case self::HTML4_LOOSE:

View File

@ -17,7 +17,7 @@
* @subpackage Helper
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FormSelect.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: FormSelect.php 25053 2012-10-16 15:30:11Z matthew $
*/
@ -52,6 +52,9 @@ class Zend_View_Helper_FormSelect extends Zend_View_Helper_FormElement
* multiple-select elements).
*
* @param array|string $attribs Attributes added to the 'select' tag.
* the optional 'optionClasses' attribute is used to add a class to
* the options within the select (associative array linking the option
* value to the desired class)
*
* @param array $options An array of key-value pairs where the array
* key is the radio value, and the array value is the radio text.
@ -96,6 +99,13 @@ class Zend_View_Helper_FormSelect extends Zend_View_Helper_FormElement
unset($attribs['multiple']);
}
// handle the options classes
$optionClasses = array();
if (isset($attribs['optionClasses'])) {
$optionClasses = $attribs['optionClasses'];
unset($attribs['optionClasses']);
}
// now start building the XHTML.
$disabled = '';
if (true === $disable) {
@ -130,11 +140,11 @@ class Zend_View_Helper_FormSelect extends Zend_View_Helper_FormElement
. $opt_id
. ' label="' . $this->view->escape($opt_value) .'">';
foreach ($opt_label as $val => $lab) {
$list[] = $this->_build($val, $lab, $value, $disable);
$list[] = $this->_build($val, $lab, $value, $disable, $optionClasses);
}
$list[] = '</optgroup>';
} else {
$list[] = $this->_build($opt_value, $opt_label, $value, $disable);
$list[] = $this->_build($opt_value, $opt_label, $value, $disable, $optionClasses);
}
}
@ -151,18 +161,28 @@ class Zend_View_Helper_FormSelect extends Zend_View_Helper_FormElement
* @param string $label Options Label
* @param array $selected The option value(s) to mark as 'selected'
* @param array|bool $disable Whether the select is disabled, or individual options are
* @param array $optionClasses The classes to associate with each option value
* @return string Option Tag XHTML
*/
protected function _build($value, $label, $selected, $disable)
protected function _build($value, $label, $selected, $disable, $optionClasses = array())
{
if (is_bool($disable)) {
$disable = array();
}
$class = null;
if (array_key_exists($value, $optionClasses)) {
$class = $optionClasses[$value];
}
$opt = '<option'
. ' value="' . $this->view->escape($value) . '"'
. ' label="' . $this->view->escape($label) . '"';
if ($class) {
$opt .= ' class="' . $class . '"';
}
// selected?
if (in_array((string) $value, $selected)) {
$opt .= ' selected="selected"';

View File

@ -16,7 +16,7 @@
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Json.php 24829 2012-05-30 12:31:39Z adamlundrigan $
* @version $Id: Json.php 25091 2012-11-07 19:58:48Z rob $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -57,17 +57,19 @@ class Zend_View_Helper_Json extends Zend_View_Helper_Abstract
public function json($data, $keepLayouts = false, $encodeData = true)
{
$options = array();
if (is_array($keepLayouts))
{
$options = $keepLayouts;
$keepLayouts = (array_key_exists('keepLayouts', $keepLayouts))
? $keepLayouts['keepLayouts']
: false;
unset($options['keepLayouts']);
$encodeData = (array_key_exists('encodeData', $keepLayouts))
? $keepLayouts['encodeData']
: $encodeData;
unset($options['encodeData']);
if (is_array($keepLayouts)) {
$options = $keepLayouts;
$keepLayouts = false;
if (array_key_exists('keepLayouts', $options)) {
$keepLayouts = $options['keepLayouts'];
unset($options['keepLayouts']);
}
if (array_key_exists('encodeData', $options)) {
$encodeData = $options['encodeData'];
unset($options['encodeData']);
}
}
if ($encodeData) {

View File

@ -17,7 +17,7 @@
* @subpackage Helper
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Menu.php 24962 2012-06-15 14:28:42Z adamlundrigan $
* @version $Id: Menu.php 25113 2012-11-07 21:27:34Z rob $
*/
/**
@ -74,9 +74,18 @@ class Zend_View_Helper_Navigation_Menu
/**
* Expand all sibling nodes of active branch nodes
*
* @var bool
*/
protected $_expandSiblingNodesOfActiveBranch = false;
/**
* Adds CSS class from page to li element
*
* @var bool
*/
protected $_addPageClassToLi = false;
/**
* View helper entry point:
* Retrieves helper and optionally sets container to operate on
@ -260,6 +269,46 @@ class Zend_View_Helper_Navigation_Menu
return $this->_partial;
}
/**
* Adds CSS class from page to li element
*
* Before:
* <code>
* <li>
* <a href="#" class="foo">Bar</a>
* </li>
* </code>
*
* After:
* <code>
* <li class="foo">
* <a href="#">Bar</a>
* </li>
* </code>
*
* @param bool $flag [optional] adds CSS class from
* page to li element
*
* @return Zend_View_Helper_Navigation_Menu fluent interface, returns self
*/
public function addPageClassToLi($flag = true)
{
$this->_addPageClassToLi = (bool) $flag;
return $this;
}
/**
* Returns a flag indicating whether the CSS class from page to be added to
* li element
*
* @return bool
*/
public function getAddPageClassToLi()
{
return $this->_addPageClassToLi;
}
// Public methods:
/**
@ -291,9 +340,12 @@ class Zend_View_Helper_Navigation_Menu
$attribs = array(
'id' => $page->getId(),
'title' => $title,
'class' => $page->getClass()
);
if (false === $this->getAddPageClassToLi()) {
$attribs['class'] = $page->getClass();
}
// does page have a href?
if ($href = $page->getHref()) {
$element = 'a';
@ -371,6 +423,10 @@ class Zend_View_Helper_Navigation_Menu
$options['renderParents'] = $this->getRenderParents();
}
if (!isset($options['addPageClassToLi'])) {
$options['addPageClassToLi'] = $this->getAddPageClassToLi();
}
return $options;
}
@ -381,13 +437,14 @@ class Zend_View_Helper_Navigation_Menu
* from {@link renderMenu()})
*
* @param Zend_Navigation_Container $container container to render
* @param array $active active page and depth
* @param string $ulClass CSS class for first UL
* @param string $indent initial indentation
* @param int|null $minDepth minimum depth
* @param int|null $maxDepth maximum depth
* @param string|null $ulId unique identifier (id) for
* first UL
* @param bool $addPageClassToLi adds CSS class from
* page to li element
* @return string rendered menu
*/
protected function _renderDeepestMenu(Zend_Navigation_Container $container,
@ -395,7 +452,8 @@ class Zend_View_Helper_Navigation_Menu
$indent,
$minDepth,
$maxDepth,
$ulId)
$ulId,
$addPageClassToLi)
{
if (!$active = $this->findActive($container, $minDepth - 1, $maxDepth)) {
return '';
@ -435,7 +493,19 @@ class Zend_View_Helper_Navigation_Menu
if (!$this->accept($subPage)) {
continue;
}
$liClass = $subPage->isActive(true) ? ' class="active"' : '';
$liClass = '';
if ($subPage->isActive(true) && $addPageClassToLi) {
$liClass = $this->_htmlAttribs(
array('class' => 'active ' . $subPage->getClass())
);
} else if ($subPage->isActive(true)) {
$liClass = $this->_htmlAttribs(array('class' => 'active'));
} else if ($addPageClassToLi) {
$liClass = $this->_htmlAttribs(
array('class' => $subPage->getClass())
);
}
$html .= $indent . ' <li' . $liClass . '>' . self::EOL;
$html .= $indent . ' ' . $this->htmlify($subPage) . self::EOL;
$html .= $indent . ' </li>' . self::EOL;
@ -459,6 +529,8 @@ class Zend_View_Helper_Navigation_Menu
* branch nodes?
* @param string|null $ulId unique identifier (id) for
* first UL
* @param bool $addPageClassToLi adds CSS class from
* page to li element
* @return string
*/
protected function _renderMenu(Zend_Navigation_Container $container,
@ -468,7 +540,8 @@ class Zend_View_Helper_Navigation_Menu
$maxDepth,
$onlyActive,
$expandSibs,
$ulId)
$ulId,
$addPageClassToLi)
{
$html = '';
@ -574,7 +647,18 @@ class Zend_View_Helper_Navigation_Menu
}
// render li tag and page
$liClass = $isActive ? ' class="active"' : '';
$liClass = '';
if ($isActive && $addPageClassToLi) {
$liClass = $this->_htmlAttribs(
array('class' => 'active ' . $page->getClass())
);
} else if ($isActive) {
$liClass = $this->_htmlAttribs(array('class' => 'active'));
} else if ($addPageClassToLi) {
$liClass = $this->_htmlAttribs(
array('class' => $page->getClass())
);
}
$html .= $myIndent . ' <li' . $liClass . '>' . self::EOL
. $myIndent . ' ' . $this->htmlify($page) . self::EOL;
@ -628,7 +712,8 @@ class Zend_View_Helper_Navigation_Menu
$options['indent'],
$options['minDepth'],
$options['maxDepth'],
$options['ulId']);
$options['ulId'],
$options['addPageClassToLi']);
} else {
$html = $this->_renderMenu($container,
$options['ulClass'],
@ -637,7 +722,8 @@ class Zend_View_Helper_Navigation_Menu
$options['maxDepth'],
$options['onlyActiveBranch'],
$options['expandSiblingNodesOfActiveBranch'],
$options['ulId']);
$options['ulId'],
$options['addPageClassToLi']);
}
return $html;
@ -673,12 +759,15 @@ class Zend_View_Helper_Navigation_Menu
* {@link getIndent()}.
* @param string|null $ulId [optional] Unique identifier
* (id) use for UL element
* @param bool $addPageClassToLi adds CSS class from
* page to li element
* @return string rendered content
*/
public function renderSubMenu(Zend_Navigation_Container $container = null,
$ulClass = null,
$indent = null,
$ulId = null)
$ulId = null,
$addPageClassToLi = false)
{
return $this->renderMenu($container, array(
'indent' => $indent,
@ -688,6 +777,7 @@ class Zend_View_Helper_Navigation_Menu
'onlyActiveBranch' => true,
'renderParents' => false,
'ulId' => $ulId,
'addPageClassToLi' => $addPageClassToLi,
));
}
@ -712,6 +802,8 @@ class Zend_View_Helper_Navigation_Menu
* and the module where the
* script can be found.
* @return string helper output
*
* @throws Zend_View_Exception When no partial script is set
*/
public function renderPartial(Zend_Navigation_Container $container = null,
$partial = null)

View File

@ -17,7 +17,7 @@
* @subpackage Helper
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Sitemap.php 24593 2012-01-05 20:35:02Z matthew $
* @version $Id: Sitemap.php 25143 2012-11-20 20:21:57Z rob $
*/
/**
@ -269,15 +269,8 @@ class Zend_View_Helper_Navigation_Sitemap
$enc = $this->view->getEncoding();
}
// TODO: remove check when minimum PHP version is >= 5.2.3
if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
// do not encode existing HTML entities
return htmlspecialchars($string, ENT_QUOTES, $enc, false);
} else {
$string = preg_replace('/&(?!(?:#\d++|[a-z]++);)/ui', '&amp;', $string);
$string = str_replace(array('<', '>', '\'', '"'), array('&lt;', '&gt;', '&#39;', '&quot;'), $string);
return $string;
}
// do not encode existing HTML entities
return htmlspecialchars($string, ENT_QUOTES, $enc, false);
}
// Public methods: