Update Zend to version 1.11.11

This commit is contained in:
Michael RICOIS 2012-05-21 07:28:59 +00:00
commit 505a8a5802
41 changed files with 619 additions and 153 deletions

View File

@ -17,7 +17,7 @@
* @subpackage Parse_Amf3
* @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: Deserializer.php 24138 2011-06-14 01:38:34Z adamlundrigan $
* @version $Id: Deserializer.php 24386 2011-08-15 18:24:49Z padraic $
*/
/** Zend_Amf_Parse_Deserializer */
@ -385,6 +385,7 @@ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
}
// Add properties back to the return object.
if (!is_array($properties)) $properties = array();
foreach($properties as $key=>$value) {
if($key) {
$returnObject->$key = $value;

View File

@ -17,7 +17,7 @@
* @subpackage Response
* @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: Http.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Http.php 24482 2011-09-29 14:19:21Z matthew $
*/
/** Zend_Amf_Response */
@ -41,11 +41,33 @@ class Zend_Amf_Response_Http extends Zend_Amf_Response
public function getResponse()
{
if (!headers_sent()) {
header('Cache-Control: no-cache, must-revalidate');
if ($this->isIeOverSsl()) {
header('Cache-Control: cache, must-revalidate');
header('Pragma: public');
} else {
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
}
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Pragma: no-cache');
header('Content-Type: application/x-amf');
}
return parent::getResponse();
}
protected function isIeOverSsl()
{
$ssl = $_SERVER['HTTPS'];
if (!$ssl || ($ssl == 'off')) {
// IIS reports "off", whereas other browsers simply don't populate
return false;
}
$ua = $_SERVER['HTTP_USER_AGENT'];
if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
// Not MicroSoft Internet Explorer
return false;
}
return true;
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Value
* @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: ArrayCollection.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: ArrayCollection.php 24473 2011-09-26 19:33:55Z matthew $
*/
/**
@ -30,6 +30,6 @@
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Amf_Value_Messaging_ArrayCollection
class Zend_Amf_Value_Messaging_ArrayCollection extends ArrayObject
{
}

View File

@ -17,7 +17,7 @@
* @subpackage Bootstrap
* @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: BootstrapAbstract.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: BootstrapAbstract.php 24394 2011-08-21 13:57:08Z padraic $
*/
/**
@ -352,7 +352,9 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
continue;
}
if (class_exists($plugin)) { //@SEE ZF-7550
if (class_exists($plugin)
&& is_subclass_of($plugin, 'Zend_Application_Resource_Resource')
) { //@SEE ZF-7550
$spec = (array) $spec;
$spec['bootstrap'] = $this;
$instance = new $plugin($spec);

View File

@ -17,7 +17,7 @@
* @subpackage Zend_Cache_Backend
* @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: Sqlite.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Sqlite.php 24348 2011-08-04 17:51:24Z mabe $
*/
@ -530,7 +530,6 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
$rand = rand(1, $this->_options['automatic_vacuum_factor']);
if ($rand == 1) {
$this->_query('VACUUM');
@sqlite_close($this->_getConnection());
}
}
}

View File

@ -17,7 +17,7 @@
* @subpackage 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: Class.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Class.php 24457 2011-09-11 13:34:44Z padraic $
*/
/**
@ -156,7 +156,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
if (is_array($docblock)) {
$docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
} elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
} elseif ((!is_null($docblock)) && (!$docblock instanceof Zend_CodeGenerator_Php_Docblock)) {
require_once 'Zend/CodeGenerator/Php/Exception.php';
throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
}

View File

@ -17,7 +17,7 @@
* @subpackage 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: Param.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Param.php 24390 2011-08-21 11:51:41Z padraic $
*/
/**
@ -53,7 +53,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
* fromReflection()
*
* @param Zend_Reflection_Docblock_Tag $reflectionTagParam
* @return Zend_CodeGenerator_Php_Docblock_Tag_Param
* @return Zend_CodeGenerator_Php_Docblock_Tag
*/
public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagParam)
{

View File

@ -17,7 +17,7 @@
* @subpackage 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: File.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: File.php 24457 2011-09-11 13:34:44Z padraic $
*/
/**
@ -394,7 +394,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
// if there are markers, put the body into the output
$body = $this->getBody();
if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker:#', $body)) {
if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker#', $body)) {
$output .= $body;
$body = '';
}
@ -428,6 +428,9 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
$classes = $this->getClasses();
if (!empty($classes)) {
foreach ($classes as $class) {
if($this->getDocblock() == $class->getDocblock()) {
$class->setDocblock(null);
}
$regex = str_replace('?', $class->getName(), self::$_markerClass);
$regex = preg_quote($regex, '#');
if (preg_match('#'.$regex.'#', $output)) {

View File

@ -16,7 +16,7 @@
* @package Zend_Controller
* @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: Abstract.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Abstract.php 24373 2011-08-13 21:50:10Z padraic $
*/
/**
@ -312,7 +312,7 @@ abstract class Zend_Controller_Request_Abstract
{
$this->_params = $this->_params + (array) $array;
foreach ($this->_params as $key => $value) {
foreach ($array as $key => $value) {
if (null === $value) {
unset($this->_params[$key]);
}

View File

@ -17,7 +17,7 @@
* @package Zend_Db
* @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: Db.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Db.php 24417 2011-08-28 10:15:47Z padraic $
*/
@ -90,6 +90,9 @@ class Zend_Db
* 'NULL_TO_STRING', 'ERR_NONE', 'FETCH_ORI_NEXT',
* 'FETCH_ORI_PRIOR', 'FETCH_ORI_FIRST', 'FETCH_ORI_LAST',
* 'FETCH_ORI_ABS', 'FETCH_ORI_REL', 'CURSOR_FWDONLY', 'CURSOR_SCROLL',
* 'ERR_CANT_MAP', 'ERR_SYNTAX', 'ERR_CONSTRAINT', 'ERR_NOT_FOUND',
* 'ERR_ALREADY_EXISTS', 'ERR_NOT_IMPLEMENTED', 'ERR_MISMATCH',
* 'ERR_TRUNCATED', 'ERR_DISCONNECTED', 'ERR_NO_PERM',
* );
*
* $const = array();
@ -122,7 +125,17 @@ class Zend_Db
const CASE_UPPER = 1;
const CURSOR_FWDONLY = 0;
const CURSOR_SCROLL = 1;
const ERR_ALREADY_EXISTS = NULL;
const ERR_CANT_MAP = NULL;
const ERR_CONSTRAINT = NULL;
const ERR_DISCONNECTED = NULL;
const ERR_MISMATCH = NULL;
const ERR_NO_PERM = NULL;
const ERR_NONE = '00000';
const ERR_NOT_FOUND = NULL;
const ERR_NOT_IMPLEMENTED = NULL;
const ERR_SYNTAX = NULL;
const ERR_TRUNCATED = NULL;
const ERRMODE_EXCEPTION = 2;
const ERRMODE_SILENT = 0;
const ERRMODE_WARNING = 1;

View File

@ -13,10 +13,10 @@
* to padraic dot brady at yahoo dot com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Feed_Writer_Entry_Rss
* @package Zend_Feed_Writer
* @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: RendererAbstract.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: RendererAbstract.php 24437 2011-09-03 19:31:11Z ramon $
*/
/**
@ -26,7 +26,7 @@ require_once 'Zend/Feed/Writer/Extension/RendererInterface.php';
/**
* @category Zend
* @package Zend_Feed_Writer_Entry_Rss
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

View File

@ -16,7 +16,7 @@
* @package Zend_Filter
* @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: Input.php 24268 2011-07-25 14:47:42Z guilhermeblanco $
* @version $Id: Input.php 24472 2011-09-26 17:11:35Z matthew $
*/
/**
@ -848,6 +848,17 @@ class Zend_Filter_Input
break 1;
}
if (is_array($rule)) {
$keys = array_keys($rule);
$classKey = array_shift($keys);
$ruleClass = $rule[$classKey];
if ($ruleClass === 'NotEmpty') {
$foundNotEmptyValidator = true;
// field may not be empty, we are ready
break 1;
}
}
// we must check if it is an object before using instanceof
if (!is_object($rule)) {
// it cannot be a NotEmpty validator, skip this one
@ -1074,7 +1085,7 @@ class Zend_Filter_Input
$validatorChain->addValidator($validatorRule[self::VALIDATOR_CHAIN]);
}
foreach ($field as $value) {
foreach ($field as $key => $value) {
if ($validatorRule[self::ALLOW_EMPTY] && !$notEmptyValidator->isValid($value)) {
// Field is empty AND it's allowed. Do nothing.
continue;

View File

@ -79,6 +79,8 @@ class Zend_Form_Decorator_Captcha_ReCaptcha extends Zend_Form_Decorator_Abstract
// Create a window.onload event so that we can bind to the form.
// Once bound, add an onsubmit event that will replace the hidden field
// values with those produced by ReCaptcha
// zendBindEvent mediates between Mozilla's addEventListener and
// IE's sole support for addEvent.
$js =<<<EOJ
<script type="text/javascript" language="JavaScript">
function windowOnLoad(fn) {
@ -90,11 +92,22 @@ function windowOnLoad(fn) {
fn();
};
}
function zendBindEvent(el, eventName, eventHandler) {
if (el.addEventListener){
el.addEventListener(eventName, eventHandler, false);
} else if (el.attachEvent){
el.attachEvent('on'+eventName, eventHandler);
}
}
windowOnLoad(function(){
document.getElementById("$challengeId").form.addEventListener("submit", function(e) {
document.getElementById("$challengeId").value = document.getElementById("recaptcha_challenge_field").value;
document.getElementById("$responseId").value = document.getElementById("recaptcha_response_field").value;
});
zendBindEvent(
document.getElementById("$challengeId").form,
'submit',
function(e) {
document.getElementById("$challengeId").value = document.getElementById("recaptcha_challenge_field").value;
document.getElementById("$responseId").value = document.getElementById("recaptcha_response_field").value;
}
);
});
</script>
EOJ;

View File

@ -37,7 +37,7 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* @subpackage Decorator
* @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: FormElements.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: FormElements.php 24453 2011-09-09 15:14:24Z matthew $
*/
class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
{
@ -76,6 +76,7 @@ class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
$belongsTo = ($form instanceof Zend_Form) ? $form->getElementsBelongTo() : null;
$elementContent = '';
$displayGroups = ($form instanceof Zend_Form) ? $form->getDisplayGroups() : array();
$separator = $this->getSeparator();
$translator = $form->getTranslator();
$items = array();
@ -84,6 +85,15 @@ class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
$item->setView($view)
->setTranslator($translator);
if ($item instanceof Zend_Form_Element) {
foreach ($displayGroups as $group) {
$elementName = $item->getName();
$element = $group->getElement($elementName);
if ($element) {
// Element belongs to display group; only render in that
// context.
continue 2;
}
}
$item->setBelongsTo($belongsTo);
} elseif (!empty($belongsTo) && ($item instanceof Zend_Form)) {
if ($item->isArray()) {

View File

@ -45,7 +45,7 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* @subpackage Decorator
* @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: HtmlTag.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: HtmlTag.php 24428 2011-09-02 14:10:03Z matthew $
*/
class Zend_Form_Decorator_HtmlTag extends Zend_Form_Decorator_Abstract
{
@ -85,8 +85,9 @@ class Zend_Form_Decorator_HtmlTag extends Zend_Form_Decorator_Abstract
$key = htmlspecialchars($key, ENT_COMPAT, $enc);
if (is_array($val)) {
if (array_key_exists('callback', $val)
&& is_callable($val['callback'])) {
$val = $val['callback']($this);
&& is_callable($val['callback'])
) {
$val = call_user_func($val['callback'], $this);
} else {
$val = implode(' ', $val);
}

View File

@ -38,7 +38,7 @@ require_once 'Zend/Validate/Abstract.php';
* @subpackage Element
* @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: Element.php 24198 2011-07-05 16:04:15Z matthew $
* @version $Id: Element.php 24428 2011-09-02 14:10:03Z matthew $
*/
class Zend_Form_Element implements Zend_Validate_Interface
{
@ -315,19 +315,31 @@ class Zend_Form_Element implements Zend_Validate_Interface
$decorators = $this->getDecorators();
if (empty($decorators)) {
$getId = create_function('$decorator',
'return $decorator->getElement()->getId()
. "-element";');
$this->addDecorator('ViewHelper')
->addDecorator('Errors')
->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
->addDecorator('HtmlTag', array('tag' => 'dd',
'id' => array('callback' => $getId)))
->addDecorator('HtmlTag', array(
'tag' => 'dd',
'id' => array('callback' => array(get_class($this), 'resolveElementId'))
))
->addDecorator('Label', array('tag' => 'dt'));
}
return $this;
}
/**
* Used to resolve and return an element ID
*
* Passed to the HtmlTag decorator as a callback in order to provide an ID.
*
* @param Zend_Form_Decorator_Interface $decorator
* @return string
*/
public static function resolveElementId(Zend_Form_Decorator_Interface $decorator)
{
return $decorator->getElement()->getId() . '-element';
}
/**
* Set object state from options array
*

View File

@ -18,7 +18,7 @@
* @subpackage Docs
* @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: Docs.php 23805 2011-03-16 00:55:40Z tjohns $
* @version $Id: Docs.php 24396 2011-08-21 14:28:50Z padraic $
*/
/**
@ -61,8 +61,8 @@ class Zend_Gdata_Docs extends Zend_Gdata
const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents/private/full';
const DOCUMENTS_FOLDER_FEED_URI = 'https://docs.google.com/feeds/folders/private/full';
const DOCUMENTS_CATEGORY_SCHEMA = 'https://schemas.google.com/g/2005#kind';
const DOCUMENTS_CATEGORY_TERM = 'https://schemas.google.com/docs/2007#folder';
const DOCUMENTS_CATEGORY_SCHEMA = 'http://schemas.google.com/g/2005#kind';
const DOCUMENTS_CATEGORY_TERM = 'http://schemas.google.com/docs/2007#folder';
const AUTH_SERVICE_NAME = 'writely';
protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI;

View File

@ -16,7 +16,7 @@
* @category Zend
* @package Zend_Http
* @subpackage Client
* @version $Id: Client.php 24337 2011-08-01 13:04:41Z ezimuel $
* @version $Id: Client.php 24461 2011-09-11 19:25:08Z padraic $
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -246,6 +246,20 @@ class Zend_Http_Client
*/
protected $redirectCounter = 0;
/**
* Status for unmasking GET array params
*
* @var boolean
*/
protected $_unmaskStatus = false;
/**
* Status if the http_build_query function escapes brackets
*
* @var boolean
*/
protected $_queryBracketsEscaped = true;
/**
* Fileinfo magic database resource
*
@ -271,6 +285,8 @@ class Zend_Http_Client
if ($config !== null) {
$this->setConfig($config);
}
$this->_queryBracketsEscaped = version_compare(phpversion(), '5.1.3', '>=');
}
/**
@ -790,6 +806,35 @@ class Zend_Http_Client
return $this;
}
/**
* Set the unmask feature for GET parameters as array
*
* Example:
* foo%5B0%5D=a&foo%5B1%5D=b
* becomes
* foo=a&foo=b
*
* This is usefull for some services
*
* @param boolean $status
* @return Zend_Http_Client
*/
public function setUnmaskStatus($status = true)
{
$this->_unmaskStatus = (BOOL)$status;
return $this;
}
/**
* Returns the currently configured unmask status
*
* @return boolean
*/
public function getUnmaskStatus()
{
return $this->_unmaskStatus;
}
/**
* Clear all GET and POST parameters
*
@ -987,6 +1032,15 @@ class Zend_Http_Client
$query = str_replace('+', '%20', $query);
}
// @see ZF-11671 to unmask for some services to foo=val1&foo=val2
if ($this->getUnmaskStatus()) {
if ($this->_queryBracketsEscaped) {
$query = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $query);
} else {
$query = preg_replace('/\\[(?:[0-9]|[1-9][0-9]+)\\]=/', '=', $query);
}
}
$uri->setQuery($query);
}

View File

@ -17,7 +17,7 @@
* @subpackage Zend_InfoCard_Xml
* @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: XmlEnc.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: XmlEnc.php 24375 2011-08-13 23:16:50Z padraic $
*/
/**
@ -52,7 +52,7 @@ class Zend_InfoCard_Xml_EncryptedData_XmlEnc extends Zend_InfoCard_Xml_Encrypted
if(!($cipherdata instanceof Zend_InfoCard_Xml_Element)) {
throw new Zend_InfoCard_Xml_Exception("Unable to find the enc:CipherData block");
}
$cipherdata->registerXPathNamespace('enc', 'http://www.w3.org/2001/04/xmlenc#');
list(,$ciphervalue) = $cipherdata->xpath("//enc:CipherValue");
if(!($ciphervalue instanceof Zend_InfoCard_Xml_Element)) {

View File

@ -16,7 +16,7 @@
* @package Zend_Json
* @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: Json.php 24040 2011-05-17 09:04:37Z ezimuel $
* @version $Id: Json.php 24421 2011-08-28 15:41:18Z adamlundrigan $
*/
/**
@ -179,12 +179,15 @@ class Zend_Json
* NOTE: This method is used internally by the encode method.
*
* @see encode
* @param mixed $valueToCheck a string - object property to be encoded
* @param array|object|Zend_Json_Expr $value a string - object property to be encoded
* @param array $javascriptExpressions
* @param null $currentKey
*
* @internal param mixed $valueToCheck
* @return void
*/
protected static function _recursiveJsonExprFinder(
&$value, array &$javascriptExpressions, $currentKey = null
) {
protected static function _recursiveJsonExprFinder(&$value, array &$javascriptExpressions, $currentKey = null)
{
if ($value instanceof Zend_Json_Expr) {
// TODO: Optimize with ascii keys, if performance is bad
$magicKey = "____" . $currentKey . "_" . (count($javascriptExpressions));
@ -206,6 +209,7 @@ class Zend_Json
}
return $value;
}
/**
* Return the value of an XML attribute text or the text between
* the XML tags
@ -248,7 +252,8 @@ class Zend_Json
* @param integer $recursionDepth
* @return array
*/
protected static function _processXml ($simpleXmlElementObject, $ignoreXmlAttributes, $recursionDepth=0) {
protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttributes, $recursionDepth=0)
{
// Keep an eye on how deeply we are involved in recursion.
if ($recursionDepth > self::$maxRecursionDepthAllowed) {
// XML tree is too deep. Exit now by throwing an exception.
@ -257,17 +262,19 @@ class Zend_Json
"Function _processXml exceeded the allowed recursion depth of " .
self::$maxRecursionDepthAllowed);
} // End of if ($recursionDepth > self::$maxRecursionDepthAllowed)
$childrens= $simpleXmlElementObject->children();
$name= $simpleXmlElementObject->getName();
$value= self::_getXmlValue($simpleXmlElementObject);
$attributes= (array) $simpleXmlElementObject->attributes();
if (count($childrens)==0) {
$children = $simpleXmlElementObject->children();
$name = $simpleXmlElementObject->getName();
$value = self::_getXmlValue($simpleXmlElementObject);
$attributes = (array) $simpleXmlElementObject->attributes();
if (count($children) == 0) {
if (!empty($attributes) && !$ignoreXmlAttributes) {
foreach ($attributes['@attributes'] as $k => $v) {
$attributes['@attributes'][$k]= self::_getXmlValue($v);
}
if (!empty($value)) {
$attributes['@text']= $value;
$attributes['@text'] = $value;
}
return array($name => $attributes);
} else {
@ -275,31 +282,32 @@ class Zend_Json
}
} else {
$childArray= array();
foreach ($childrens as $child) {
$childname= $child->getName();
$element= self::_processXml($child,$ignoreXmlAttributes,$recursionDepth+1);
foreach ($children as $child) {
$childname = $child->getName();
$element = self::_processXml($child,$ignoreXmlAttributes,$recursionDepth+1);
if (array_key_exists($childname, $childArray)) {
if (empty($subChild[$childname])) {
$childArray[$childname]=array($childArray[$childname]);
$subChild[$childname]=true;
$childArray[$childname] = array($childArray[$childname]);
$subChild[$childname] = true;
}
$childArray[$childname][]= $element[$childname];
$childArray[$childname][] = $element[$childname];
} else {
$childArray[$childname]= $element[$childname];
$childArray[$childname] = $element[$childname];
}
}
if (!empty($attributes) && !$ignoreXmlAttributes) {
foreach ($attributes['@attributes'] as $k => $v) {
$attributes['@attributes'][$k]= self::_getXmlValue($v);
$attributes['@attributes'][$k] = self::_getXmlValue($v);
}
$childArray['@attributes']= $attributes['@attributes'];
$childArray['@attributes'] = $attributes['@attributes'];
}
if (!empty($value)) {
$childArray['@text']= $value;
$childArray['@text'] = $value;
}
return array($name => $childArray);
}
}
/**
* fromXml - Converts XML to JSON
*
@ -326,7 +334,8 @@ class Zend_Json
* @return mixed - JSON formatted string on success
* @throws Zend_Json_Exception
*/
public static function fromXml ($xmlStringContents, $ignoreXmlAttributes=true) {
public static function fromXml($xmlStringContents, $ignoreXmlAttributes=true)
{
// Load the XML formatted string into a Simple XML Element object.
$simpleXmlElementObject = simplexml_load_string($xmlStringContents);
@ -345,14 +354,15 @@ class Zend_Json
// It is just that simple.
$jsonStringOutput = self::encode($resultArray);
return($jsonStringOutput);
} // End of function fromXml.
}
/**
* Pretty-print JSON string
*
* Use 'indent' option to select indentation string - by default it's a tab
* Use 'format' option to select output format - currently html and txt supported, txt is default
* Use 'indent' option to override the indentation string set in the format - by default for the 'txt' format it's a tab
*
* @param string $json Original JSON string
* @param array $options Encoding options
@ -361,32 +371,62 @@ class Zend_Json
public static function prettyPrint($json, $options = array())
{
$tokens = preg_split('|([\{\}\]\[,])|', $json, -1, PREG_SPLIT_DELIM_CAPTURE);
$result = "";
$result = '';
$indent = 0;
$format= 'txt';
$ind = "\t";
if(isset($options['indent'])) {
if (isset($options['format'])) {
$format = $options['format'];
}
switch ($format) {
case 'html':
$lineBreak = '<br />';
$ind = '&nbsp;&nbsp;&nbsp;&nbsp;';
break;
default:
case 'txt':
$lineBreak = "\n";
$ind = "\t";
break;
}
// override the defined indent setting with the supplied option
if (isset($options['indent'])) {
$ind = $options['indent'];
}
$inLiteral = false;
foreach($tokens as $token) {
if($token == "") continue;
if($token == '') {
continue;
}
$prefix = str_repeat($ind, $indent);
if($token == "{" || $token == "[") {
if (!$inLiteral && ($token == '{' || $token == '[')) {
$indent++;
if($result != "" && $result[strlen($result)-1] == "\n") {
if (($result != '') && ($result[(strlen($result)-1)] == $lineBreak)) {
$result .= $prefix;
}
$result .= "$token\n";
} else if($token == "}" || $token == "]") {
$result .= $token . $lineBreak;
} elseif (!$inLiteral && ($token == '}' || $token == ']')) {
$indent--;
$prefix = str_repeat($ind, $indent);
$result .= "\n$prefix$token";
} else if($token == ",") {
$result .= "$token\n";
$result .= $lineBreak . $prefix . $token;
} elseif (!$inLiteral && $token == ',') {
$result .= $token . $lineBreak;
} else {
$result .= $prefix.$token;
$result .= ( $inLiteral ? '' : $prefix ) . $token;
// Count # of unescaped double-quotes in token, subtract # of
// escaped double-quotes and if the result is odd then we are
// inside a string literal
if ((substr_count($token, "\"")-substr_count($token, "\\\"")) % 2 != 0) {
$inLiteral = !$inLiteral;
}
}
}
return $result;

View File

@ -16,7 +16,7 @@
* @package Zend_Json
* @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: Server.php 24272 2011-07-27 21:12:08Z mcleod@spaceweb.nl $
* @version $Id: Server.php 24461 2011-09-11 19:25:08Z padraic $
*/
/**

View File

@ -17,7 +17,7 @@
* @subpackage Server
* @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: Response.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Response.php 24464 2011-09-24 14:06:34Z mcleod@spaceweb.nl $
*/
/**
@ -173,7 +173,6 @@ class Zend_Json_Server_Response
{
if ($this->isError()) {
$response = array(
'result' => null,
'error' => $this->getError()->toArray(),
'id' => $this->getId(),
);
@ -181,7 +180,6 @@ class Zend_Json_Server_Response
$response = array(
'result' => $this->getResult(),
'id' => $this->getId(),
'error' => null,
);
}

View File

@ -16,7 +16,7 @@
* @package Zend_Ldap
* @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: Converter.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Converter.php 24354 2011-08-05 07:36:38Z sgehrig $
*/
/**
@ -219,7 +219,8 @@ class Zend_Ldap_Converter
break;
default:
if (is_numeric($value)) {
return (float)$value;
// prevent numeric values to be treated as date/time
return $value;
} else if ('TRUE' === $value || 'FALSE' === $value) {
return self::fromLdapBoolean($value);
}

View File

@ -17,7 +17,7 @@
* @subpackage Node
* @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: Node.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Node.php 24352 2011-08-04 20:53:04Z sgehrig $
*/
/**
@ -319,12 +319,17 @@ class Zend_Ldap_Node extends Zend_Ldap_Node_Abstract implements Iterator, Recurs
/**
* Ensures that teh RDN attributes are correctly set.
*
* @param boolean $overwrite True to overwrite the RDN attributes
* @return void
*/
protected function _ensureRdnAttributeValues()
protected function _ensureRdnAttributeValues($overwrite = false)
{
foreach ($this->getRdnArray() as $key => $value) {
Zend_Ldap_Attribute::setAttribute($this->_currentData, $key, $value, false);
if (!array_key_exists($key, $this->_currentData) || $overwrite) {
Zend_Ldap_Attribute::setAttribute($this->_currentData, $key, $value, false);
} else if (!in_array($value, $this->_currentData[$key])) {
Zend_Ldap_Attribute::setAttribute($this->_currentData, $key, $value, true);
}
}
}
@ -501,7 +506,7 @@ class Zend_Ldap_Node extends Zend_Ldap_Node_Abstract implements Iterator, Recurs
} else {
$this->_newDn = Zend_Ldap_Dn::factory($newDn);
}
$this->_ensureRdnAttributeValues();
$this->_ensureRdnAttributeValues(true);
return $this;
}

View File

@ -16,7 +16,7 @@
* @package Zend_Navigation
* @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: Container.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Container.php 24459 2011-09-11 18:36:38Z padraic $
*/
/**
@ -143,9 +143,12 @@ abstract class Zend_Navigation_Container implements RecursiveIterator, Countable
/**
* Adds several pages at once
*
* @param array|Zend_Config $pages pages to add
* @return Zend_Navigation_Container fluent interface, returns self
* @throws Zend_Navigation_Exception if $pages is not array or Zend_Config
* @param array|Zend_Config|Zend_Navigation_Container $pages pages to add
* @return Zend_Navigation_Container fluent interface,
* returns self
* @throws Zend_Navigation_Exception if $pages is not
* array, Zend_Config or
* Zend_Navigation_Container
*/
public function addPages($pages)
{
@ -153,11 +156,16 @@ abstract class Zend_Navigation_Container implements RecursiveIterator, Countable
$pages = $pages->toArray();
}
if ($pages instanceof Zend_Navigation_Container) {
$pages = iterator_to_array($pages);
}
if (!is_array($pages)) {
require_once 'Zend/Navigation/Exception.php';
throw new Zend_Navigation_Exception(
'Invalid argument: $pages must be an array or an ' .
'instance of Zend_Config');
'Invalid argument: $pages must be an array, an ' .
'instance of Zend_Config or an instance of ' .
'Zend_Navigation_Container');
}
foreach ($pages as $page) {

View File

@ -16,7 +16,7 @@
* @package Zend_Navigation
* @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: Page.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Page.php 24455 2011-09-11 12:51:54Z padraic $
*/
/**
@ -41,6 +41,20 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
*/
protected $_label;
/**
* Fragment identifier (anchor identifier)
*
* The fragment identifier (anchor identifier) pointing to an anchor within
* a resource that is subordinate to another, primary resource.
* The fragment identifier introduced by a hash mark "#".
* Example: http://www.example.org/foo.html#bar ("bar" is the fragment identifier)
*
* @link http://www.w3.org/TR/html401/intro/intro.html#fragment-uri
*
* @var string|null
*/
protected $_fragment;
/**
* Page id
*
@ -69,6 +83,18 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
*/
protected $_target;
/**
* Accessibility key character
*
* This attribute assigns an access key to an element. An access key is a
* single character from the document character set.
*
* @link http://www.w3.org/TR/html401/interact/forms.html#access-keys
*
* @var string|null
*/
protected $_accesskey;
/**
* Forward links to other pages
*
@ -329,6 +355,35 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
return $this->_label;
}
/**
* Sets a fragment identifier
*
* @param string $fragment new fragment identifier
* @return Zend_Navigation_Page fluent interface, returns self
* @throws Zend_Navigation_Exception if empty/no string is given
*/
public function setFragment($fragment)
{
if (null !== $fragment && !is_string($fragment)) {
require_once 'Zend/Navigation/Exception.php';
throw new Zend_Navigation_Exception(
'Invalid argument: $fragment must be a string or null');
}
$this->_fragment = $fragment;
return $this;
}
/**
* Returns fragment identifier
*
* @return string|null fragment identifier
*/
public function getFragment()
{
return $this->_fragment;
}
/**
* Sets page id
*
@ -450,6 +505,40 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
return $this->_target;
}
/**
* Sets access key for this page
*
* @param string|null $character [optional] access key to set. Default
* is null, which sets no access key.
* @return Zend_Navigation_Page fluent interface, returns self
* @throws Zend_Navigation_Exception if access key is not string or null or
* if the string length not equal to one
*/
public function setAccesskey($character = null)
{
if (null !== $character
&& (!is_string($character) || 1 != strlen($character)))
{
require_once 'Zend/Navigation/Exception.php';
throw new Zend_Navigation_Exception(
'Invalid argument: $character must be a single character or null'
);
}
$this->_accesskey = $character;
return $this;
}
/**
* Returns page access key
*
* @return string|null page access key or null
*/
public function getAccesskey()
{
return $this->_accesskey;
}
/**
* Sets the page's forward links to other pages
*
@ -740,6 +829,9 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
*/
public function setVisible($visible = true)
{
if (is_string($visible) && 'false' == strtolower($visible)) {
$visible = false;
}
$this->_visible = (bool) $visible;
return $this;
}
@ -1091,10 +1183,12 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
$this->getCustomProperties(),
array(
'label' => $this->getlabel(),
'fragment' => $this->getFragment(),
'id' => $this->getId(),
'class' => $this->getClass(),
'title' => $this->getTitle(),
'target' => $this->getTarget(),
'accesskey' => $this->getAccesskey(),
'rel' => $this->getRel(),
'rev' => $this->getRev(),
'order' => $this->getOrder(),

View File

@ -17,7 +17,7 @@
* @subpackage Page
* @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: Mvc.php 24235 2011-07-13 18:13:45Z matthew $
* @version $Id: Mvc.php 24474 2011-09-26 19:46:23Z matthew $
*/
/**
@ -94,6 +94,15 @@ class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
*/
protected $_resetParams = true;
/**
* Whether href should be encoded when assembling URL
*
* @see getHref()
* @var bool
*/
protected $_encodeUrl = true;
/**
* Cached href
*
@ -129,11 +138,14 @@ class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
public function isActive($recursive = false)
{
if (!$this->_active) {
$front = Zend_Controller_Front::getInstance();
$reqParams = $front->getRequest()->getParams();
if (!array_key_exists('module', $reqParams)) {
$reqParams['module'] = $front->getDefaultModule();
$front = Zend_Controller_Front::getInstance();
$request = $front->getRequest();
$reqParams = array();
if ($request) {
$reqParams = $request->getParams();
if (!array_key_exists('module', $reqParams)) {
$reqParams['module'] = $front->getDefaultModule();
}
}
$myParams = $this->_params;
@ -214,7 +226,16 @@ class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
$url = self::$_urlHelper->url($params,
$this->getRoute(),
$this->getResetParams());
$this->getResetParams(),
$this->getEncodeUrl());
// Add the fragment identifier if it is set
$fragment = $this->getFragment();
if (null !== $fragment) {
$url .= '#' . $fragment;
}
return $this->_hrefCache = $url;
return $this->_hrefCache = $url;
}
@ -417,6 +438,35 @@ class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
return $this->_resetParams;
}
/**
* Sets whether href should be encoded when assembling URL
*
* @see getHref()
*
* @param bool $resetParams whether href should be encoded when
* assembling URL
* @return Zend_Navigation_Page_Mvc fluent interface, returns self
*/
public function setEncodeUrl($encodeUrl)
{
$this->_encodeUrl = (bool) $encodeUrl;
$this->_hrefCache = null;
return $this;
}
/**
* Returns whether herf should be encoded when assembling URL
*
* @see getHref()
*
* @return bool whether herf should be encoded when assembling URL
*/
public function getEncodeUrl()
{
return $this->_encodeUrl;
}
/**
* Sets action helper for assembling URLs
*
@ -447,7 +497,8 @@ class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
'module' => $this->getModule(),
'params' => $this->getParams(),
'route' => $this->getRoute(),
'reset_params' => $this->getResetParams()
'reset_params' => $this->getResetParams(),
'encodeUrl' => $this->getEncodeUrl(),
));
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Page
* @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: Uri.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Uri.php 24455 2011-09-11 12:51:54Z padraic $
*/
/**
@ -79,7 +79,18 @@ class Zend_Navigation_Page_Uri extends Zend_Navigation_Page
*/
public function getHref()
{
return $this->getUri();
$uri = $this->getUri();
$fragment = $this->getFragment();
if (null !== $fragment) {
if ('#' == substr($uri, -1)) {
return $uri . $fragment;
} else {
return $uri . '#' . $fragment;
}
}
return $uri;
}
// Public methods:

View File

@ -16,7 +16,7 @@
* @package Zend_Oauth
* @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: Client.php 24311 2011-07-30 03:12:18Z ramon $
* @version $Id: Client.php 24415 2011-08-27 22:09:37Z adamlundrigan $
*/
/** Zend_Oauth */
@ -261,7 +261,7 @@ class Zend_Oauth_Client extends Zend_Http_Client
$this->setRawData($raw, 'application/x-www-form-urlencoded');
$this->paramsPost = array();
} elseif ($requestScheme == Zend_Oauth::REQUEST_SCHEME_QUERYSTRING) {
$params = array();
$params = $this->paramsGet;
$query = $this->getUri()->getQuery();
if ($query) {
$queryParts = explode('&', $this->getUri()->getQuery());

View File

@ -16,7 +16,7 @@
* @package Zend_Oauth
* @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: Config.php 23983 2011-05-03 19:27:35Z ralph $
* @version $Id: Config.php 24364 2011-08-13 14:45:17Z padraic $
*/
/** Zend_Oauth */
@ -390,7 +390,7 @@ class Zend_Oauth_Config implements Zend_Oauth_Config_ConfigInterface
*/
public function setCallbackUrl($url)
{
if (!Zend_Uri::check($url)) {
if (!Zend_Uri::check($url) && $url !== 'oob') {
require_once 'Zend/Oauth/Exception.php';
throw new Zend_Oauth_Exception(
'\'' . $url . '\' is not a valid URI'

View File

@ -17,7 +17,7 @@
* @package Zend_OpenId
* @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: OpenId.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: OpenId.php 24379 2011-08-14 12:01:10Z padraic $
*/
/**
@ -285,7 +285,7 @@ class Zend_OpenId
$port = $reg[4];
$path = $reg[5];
$query = $reg[6];
$fragment = $reg[7]; /* strip it */
$fragment = $reg[7]; /* strip it */ /* ZF-4358 Fragment retained under OpenID 2.0 */
if (empty($scheme) || empty($host)) {
return false;
@ -350,7 +350,8 @@ class Zend_OpenId
. $host
. (empty($port) ? '' : (':' . $port))
. $path
. $query;
. $query
. $fragment;
return true;
}

View File

@ -16,7 +16,7 @@
* @package Zend_Reflection
* @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: Param.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Param.php 24405 2011-08-26 17:33:02Z ralph $
*/
/** Zend_Reflection_Docblock_Tag */
@ -49,7 +49,7 @@ class Zend_Reflection_Docblock_Tag_Param extends Zend_Reflection_Docblock_Tag
{
$matches = array();
if (!preg_match('#^@(\w+)\s+([\w|\\\]+)(?:\s+(\$\S+))?(?:\s+(.*))?#s', $tagDocblockLine, $matches)) {
if (!preg_match('#^@(\w+)\s+([^\s]+)(?:\s+(\$\S+))?(?:\s+(.*))?#s', $tagDocblockLine, $matches)) {
require_once 'Zend/Reflection/Exception.php';
throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
}

View File

@ -16,7 +16,7 @@
* @package Zend_Reflection
* @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: Return.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Return.php 24405 2011-08-26 17:33:02Z ralph $
*/
/** Zend_Reflection_Docblock_Tag */
@ -39,11 +39,11 @@ class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
* Constructor
*
* @param string $tagDocblockLine
* @return void
* @return \Zend_Reflection_Docblock_Tag_Return
*/
public function __construct($tagDocblockLine)
{
if (!preg_match('#^@(\w+)\s+([\w|\\\]+)(?:\s+(.*))?#', $tagDocblockLine, $matches)) {
if (!preg_match('#^@(\w+)\s+([^\s]+)(?:\s+(.*))?#', $tagDocblockLine, $matches)) {
require_once 'Zend/Reflection/Exception.php';
throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
}

View File

@ -17,7 +17,7 @@
* @subpackage Amazon_Sqs
* @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: Sqs.php 23953 2011-05-03 05:47:39Z ralph $
* @version $Id: Sqs.php 24470 2011-09-26 16:26:44Z ezimuel $
*/
/**
@ -67,9 +67,17 @@ class Zend_Service_Amazon_Sqs extends Zend_Service_Amazon_Abstract
*/
protected $_sqsSignatureMethod = 'HmacSHA256';
protected $_sqsEndpoints = array('us-east-1' => 'sqs.us-east-1.amazonaws.com',
'us-west-1' => 'sqs.us-west-1.amazonaws.com',
'eu-west-1' => 'sqs.eu-west-1.amazonaws.com',
'ap-southeast-1' => 'sqs.ap-southeast-1.amazonaws.com',
'ap-northeast-1' => 'sqs.ap-northeast-1.amazonaws.com');
/**
* Constructor
*
* The default region is us-east-1. Use the region to set it to one of the regions that is build-in into ZF.
* To add a new AWS region use the setEndpoint() method.
*
* @param string $accessKey
* @param string $secretKey
* @param string $region
@ -77,6 +85,75 @@ class Zend_Service_Amazon_Sqs extends Zend_Service_Amazon_Abstract
public function __construct($accessKey = null, $secretKey = null, $region = null)
{
parent::__construct($accessKey, $secretKey, $region);
if (null !== $region) {
$this->_setEndpoint($region);
}
}
/**
* Set SQS endpoint
*
* Checks and sets endpoint if region exists in $_sqsEndpoints. If a new SQS region is added by amazon,
* please use the setEndpoint function to set it.
*
* @param string $region region
* @throws Zend_Service_Amazon_Sqs_Exception
*/
protected function _setEndpoint($region)
{
if (array_key_exists($region, $this->_sqsEndpoints)) {
$this->_sqsEndpoint = $this->_sqsEndpoints[$region];
} else {
throw new Zend_Service_Amazon_Sqs_Exception('Invalid SQS region specified.');
}
}
/**
* Set SQS endpoint
*
* You can set SQS to on of the build-in regions. If the region does not exsist it will be added.
*
* @param string $region region
* @throws Zend_Service_Amazon_Sqs_Exception
*/
public function setEndpoint($region)
{
if (!empty($region)) {
if (array_key_exists($region, $this->_sqsEndpoints)) {
$this->_sqsEndpoint = $this->_sqsEndpoints[$region];
} else {
$this->_sqsEndpoints[$region] = "sqs.$region.amazonaws.com";
$this->_sqsEndpoint = $this->_sqsEndpoints[$region];
}
} else {
throw new Zend_Service_Amazon_Sqs_Exception('Empty region specified.');
}
}
/**
* Get the SQS endpoint
*
* @return string
*/
public function getEndpoint()
{
return $this->_sqsEndpoint;
}
/**
* Get possible SQS endpoints
*
* Since there is not an SQS webserive to get all possible endpoints, a hardcoded list is available.
* For the actual region list please check:
* http://docs.amazonwebservices.com/AWSSimpleQueueService/2009-02-01/APIReference/index.html?QueueServiceWsdlArticle.html
*
* @param string $region region
* @return array
*/
public function getEndpoints()
{
return $this->_sqsEndpoints;
}
/**

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @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: Controller.php 24136 2011-06-14 00:35:46Z adamlundrigan $
* @version $Id: Controller.php 24466 2011-09-25 02:19:39Z jaguarnet7 $
*/
/**
@ -70,7 +70,7 @@ class Zend_Tool_Project_Provider_Controller
* @param Zend_Tool_Project_Profile $profile
* @param string $controllerName
* @param string $moduleName
* @return Zend_Tool_Project_Profile_Resource
* @return boolean
*/
public static function hasResource(Zend_Tool_Project_Profile $profile, $controllerName, $moduleName = null)
{
@ -79,7 +79,7 @@ class Zend_Tool_Project_Provider_Controller
}
$controllersDirectory = self::_getControllersDirectoryResource($profile, $moduleName);
return (($controllersDirectory->search(array('controllerFile' => array('controllerName' => $controllerName)))) instanceof Zend_Tool_Project_Profile_Resource);
return ($controllersDirectory &&($controllersDirectory->search(array('controllerFile' => array('controllerName' => $controllerName)))) instanceof Zend_Tool_Project_Profile_Resource);
}
/**

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @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: Layout.php 24165 2011-06-29 20:21:34Z adamlundrigan $
* @version $Id: Layout.php 24408 2011-08-26 22:05:35Z adamlundrigan $
*/
/**
@ -33,6 +33,10 @@ require_once 'Zend/Tool/Project/Provider/Abstract.php';
*/
class Zend_Tool_Project_Provider_Layout extends Zend_Tool_Project_Provider_Abstract implements Zend_Tool_Framework_Provider_Pretendable
{
/**
* @var string Layout path
*/
protected $_layoutPath = 'APPLICATION_PATH "/layouts/scripts/"';
public static function createResource(Zend_Tool_Project_Profile $profile, $layoutName = 'layout')
{
@ -75,34 +79,62 @@ class Zend_Tool_Project_Provider_Layout extends Zend_Tool_Project_Provider_Abstr
return;
}
$layoutPath = 'APPLICATION_PATH "/layouts/scripts/"';
if ($this->_registry->getRequest()->isPretend()) {
$this->_registry->getResponse()->appendContent('Would add "resources.layout.layoutPath" key to the application config file.');
} else {
$applicationConfigResource->addStringItem('resources.layout.layoutPath', $layoutPath, 'production', false);
$applicationConfigResource->addStringItem('resources.layout.layoutPath', $this->_layoutPath, 'production', false);
$applicationConfigResource->create();
$layoutScriptFile = self::createResource($profile);
$layoutScriptFile->create();
$this->_registry->getResponse()->appendContent(
'Layouts have been enabled, and a default layout created at '
. $layoutScriptFile->getPath()
);
$this->_registry->getResponse()->appendContent('A layout entry has been added to the application config file.');
}
$this->_storeProfile();
$layoutScriptFile = self::createResource($profile);
if (!$layoutScriptFile->exists()) {
$layoutScriptFile->create();
$this->_registry->getResponse()->appendContent(
'A default layout has been created at '
. $layoutScriptFile->getPath()
);
}
$this->_storeProfile();
}
}
public function disable()
{
// @todo
$profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
$applicationConfigResource = $this->_getApplicationConfigResource($profile);
$zc = $applicationConfigResource->getAsZendConfig();
if (isset($zc->resources) && !isset($zc->resources->layout)) {
$this->_registry->getResponse()->appendContent('No layout configuration exists in application config file.');
return;
}
if ($this->_registry->getRequest()->isPretend()) {
$this->_registry->getResponse()->appendContent('Would remove "resources.layout.layoutPath" key from the application config file.');
} else {
// Remove the resources.layout.layoutPath directive from application config
$applicationConfigResource->removeStringItem('resources.layout.layoutPath', $this->_layoutPath, 'production', false);
$applicationConfigResource->create();
// Tell the user about the good work we've done
$this->_registry->getResponse()->appendContent('Layout entry has been removed from the application config file.');
$this->_storeProfile();
}
}
protected function _getApplicationConfigResource(Zend_Tool_Project_Profile $profile)
{
$applicationConfigResource = $profile->search('ApplicationConfigFile');
if (!$applicationConfigResource) {
throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.');
}
return $applicationConfigResource;
}
}

View File

@ -16,7 +16,7 @@
* @package Zend_Version
* @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: Version.php 24344 2011-08-02 19:49:32Z matthew $
* @version $Id: Version.php 24483 2011-09-29 15:31:19Z matthew $
*/
/**
@ -32,7 +32,7 @@ final class Zend_Version
/**
* Zend Framework version identification - see compareVersion()
*/
const VERSION = '1.11.10';
const VERSION = '1.11.11';
/**
* The latest stable version Zend Framework available

View File

@ -16,7 +16,7 @@
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Form.php 24201 2011-07-05 16:22:04Z matthew $
* @version $Id: Form.php 24478 2011-09-26 19:52:58Z adamlundrigan $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -73,10 +73,11 @@ class Zend_View_Helper_Form extends Zend_View_Helper_FormElement
. '>';
if (false !== $content) {
$xhtml .= $content
. '</form>';
$xhtml .= $content;
}
$xhtml .= '</form>';
return $xhtml;
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Helper
* @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: HtmlElement.php 24201 2011-07-05 16:22:04Z matthew $
* @version $Id: HtmlElement.php 24399 2011-08-26 08:20:07Z padraic $
*/
/**
@ -109,7 +109,11 @@ abstract class Zend_View_Helper_HtmlElement extends Zend_View_Helper_Abstract
require_once 'Zend/Json.php';
$val = Zend_Json::encode($val);
}
$val = preg_replace('/"([^"]*)":/', '$1:', $val);
// Escape single quotes inside event attribute values.
// This will create html, where the attribute value has
// single quotes around it, and escaped single quotes or
// non-escaped double quotes inside of it
$val = str_replace('\'', '&#39;', $val);
} else {
if (is_array($val)) {
$val = implode(' ', $val);

View File

@ -17,7 +17,7 @@
* @subpackage Helper
* @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: Menu.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: Menu.php 24455 2011-09-11 12:51:54Z padraic $
*/
/**
@ -234,6 +234,7 @@ class Zend_View_Helper_Navigation_Menu
$element = 'a';
$attribs['href'] = $href;
$attribs['target'] = $page->getTarget();
$attribs['accesskey'] = $page->getAccessKey();
} else {
$element = 'span';
}

View File

@ -17,7 +17,7 @@
* @subpackage Generator
* @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: XmlWriter.php 23775 2011-03-01 17:25:24Z ralph $
* @version $Id: XmlWriter.php 24479 2011-09-26 20:10:08Z matthew $
*/
/**
@ -87,6 +87,7 @@ class Zend_XmlRpc_Generator_XmlWriter extends Zend_XmlRpc_Generator_GeneratorAbs
public function saveXml()
{
return $this->_xmlWriter->flush(false);
$xml = $this->_xmlWriter->flush(false);
return $xml;
}
}