import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ActionStack.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: ActionStack.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_H
|
||||
* Constructor
|
||||
*
|
||||
* Register action stack plugin
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
@ -65,9 +65,9 @@ class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_H
|
||||
}
|
||||
|
||||
/**
|
||||
* Push onto the stack
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $next
|
||||
* Push onto the stack
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $next
|
||||
* @return Zend_Controller_Action_Helper_ActionStack Provides a fluent interface
|
||||
*/
|
||||
public function pushStack(Zend_Controller_Request_Abstract $next)
|
||||
@ -78,12 +78,12 @@ class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_H
|
||||
|
||||
/**
|
||||
* Push a new action onto the stack
|
||||
*
|
||||
* @param string $action
|
||||
* @param string $controller
|
||||
* @param string $module
|
||||
*
|
||||
* @param string $action
|
||||
* @param string $controller
|
||||
* @param string $module
|
||||
* @param array $params
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
* @return Zend_Controller_Action_Helper_ActionStack
|
||||
*/
|
||||
public function actionToStack($action, $controller = null, $module = null, array $params = array())
|
||||
@ -107,7 +107,7 @@ class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_H
|
||||
require_once 'Zend/Controller/Action/Exception.php';
|
||||
throw new Zend_Controller_Action_Exception('Request object not set yet');
|
||||
}
|
||||
|
||||
|
||||
$controller = (null === $controller) ? $request->getControllerName() : $controller;
|
||||
$module = (null === $module) ? $request->getModuleName() : $module;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AjaxContext.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: AjaxContext.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ class Zend_Controller_Action_Helper_AjaxContext extends Zend_Controller_Action_H
|
||||
* Constructor
|
||||
*
|
||||
* Add HTML context
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
@ -60,8 +60,8 @@ class Zend_Controller_Action_Helper_AjaxContext extends Zend_Controller_Action_H
|
||||
* Initialize AJAX context switching
|
||||
*
|
||||
* Checks for XHR requests; if detected, attempts to perform context switch.
|
||||
*
|
||||
* @param string $format
|
||||
*
|
||||
* @param string $format
|
||||
* @return void
|
||||
*/
|
||||
public function initContext($format = null)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_
|
||||
|
||||
/**
|
||||
* Validate autocompletion data
|
||||
*
|
||||
*
|
||||
* @param mixed $data
|
||||
* @return boolean
|
||||
*/
|
||||
@ -54,16 +54,16 @@ abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_
|
||||
|
||||
/**
|
||||
* Prepare autocompletion data
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param boolean $keepLayouts
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param boolean $keepLayouts
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function prepareAutoCompletion($data, $keepLayouts = false);
|
||||
|
||||
/**
|
||||
* Disable layouts and view renderer
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Action_Helper_AutoComplete_Abstract Provides a fluent interface
|
||||
*/
|
||||
public function disableLayouts()
|
||||
@ -83,9 +83,9 @@ abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_
|
||||
|
||||
/**
|
||||
* Encode data to JSON
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $keepLayouts
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $keepLayouts
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
* @return string
|
||||
*/
|
||||
@ -105,11 +105,11 @@ abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_
|
||||
/**
|
||||
* Send autocompletion data
|
||||
*
|
||||
* Calls prepareAutoCompletion, populates response body with this
|
||||
* Calls prepareAutoCompletion, populates response body with this
|
||||
* information, and sends response.
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $keepLayouts
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $keepLayouts
|
||||
* @return string|void
|
||||
*/
|
||||
public function sendAutoCompletion($data, $keepLayouts = false)
|
||||
@ -130,12 +130,12 @@ abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_
|
||||
/**
|
||||
* Strategy pattern: allow calling helper as broker method
|
||||
*
|
||||
* Prepares autocompletion data and, if $sendNow is true, immediately sends
|
||||
* Prepares autocompletion data and, if $sendNow is true, immediately sends
|
||||
* response.
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $sendNow
|
||||
* @param bool $keepLayouts
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $sendNow
|
||||
* @param bool $keepLayouts
|
||||
* @return string|void
|
||||
*/
|
||||
public function direct($data, $sendNow = true, $keepLayouts = false)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AutoCompleteDojo.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: AutoCompleteDojo.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -41,8 +41,8 @@ class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Act
|
||||
* Validate data for autocompletion
|
||||
*
|
||||
* Stub; unused
|
||||
*
|
||||
* @param mixed $data
|
||||
*
|
||||
* @param mixed $data
|
||||
* @return boolean
|
||||
*/
|
||||
public function validateData($data)
|
||||
@ -52,9 +52,9 @@ class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Act
|
||||
|
||||
/**
|
||||
* Prepare data for autocompletion
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param boolean $keepLayouts
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param boolean $keepLayouts
|
||||
* @return string
|
||||
*/
|
||||
public function prepareAutoCompletion($data, $keepLayouts = false)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AutoCompleteScriptaculous.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: AutoCompleteScriptaculous.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,8 +39,8 @@ class Zend_Controller_Action_Helper_AutoCompleteScriptaculous extends Zend_Contr
|
||||
{
|
||||
/**
|
||||
* Validate data for autocompletion
|
||||
*
|
||||
* @param mixed $data
|
||||
*
|
||||
* @param mixed $data
|
||||
* @return bool
|
||||
*/
|
||||
public function validateData($data)
|
||||
@ -54,9 +54,9 @@ class Zend_Controller_Action_Helper_AutoCompleteScriptaculous extends Zend_Contr
|
||||
|
||||
/**
|
||||
* Prepare data for autocompletion
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param boolean $keepLayouts
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param boolean $keepLayouts
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
* @return string
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ContextSwitch.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: ContextSwitch.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -157,9 +157,9 @@ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action
|
||||
/**
|
||||
* Initialize at start of action controller
|
||||
*
|
||||
* Reset the view script suffix to the original state, or store the
|
||||
* Reset the view script suffix to the original state, or store the
|
||||
* original state.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
|
@ -38,7 +38,7 @@ require_once 'Zend/Controller/Action/Helper/Abstract.php';
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FlashMessenger.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: FlashMessenger.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Action_Helper_Abstract implements IteratorAggregate, Countable
|
||||
{
|
||||
@ -221,10 +221,10 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
|
||||
unset(self::$_session->{$this->_namespace});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getIterator() - complete the IteratorAggregate interface, for iterating
|
||||
*
|
||||
@ -255,8 +255,8 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
|
||||
|
||||
/**
|
||||
* Strategy pattern: proxy to addMessage()
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public function direct($message)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action_Helper
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Url.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: Url.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -62,9 +62,9 @@ class Zend_Controller_Action_Helper_Url extends Zend_Controller_Action_Helper_Ab
|
||||
if ($module != $this->getFrontController()->getDispatcher()->getDefaultModule()) {
|
||||
$url = $module . '/' . $url;
|
||||
}
|
||||
|
||||
|
||||
if ('' !== ($baseUrl = $this->getFrontController()->getBaseUrl())) {
|
||||
$url = $baseUrl . '/' . $url;
|
||||
$url = $baseUrl . '/' . $url;
|
||||
}
|
||||
|
||||
if (null !== $params) {
|
||||
@ -98,7 +98,7 @@ class Zend_Controller_Action_Helper_Url extends Zend_Controller_Action_Helper_Ab
|
||||
$router = $this->getFrontController()->getRouter();
|
||||
return $router->assemble($urlOptions, $name, $reset, $encode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform helper when called as $this->_helper->url() from an action controller
|
||||
*
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: HelperBroker.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: HelperBroker.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -60,8 +60,8 @@ class Zend_Controller_Action_HelperBroker
|
||||
|
||||
/**
|
||||
* Set PluginLoader for use with broker
|
||||
*
|
||||
* @param Zend_Loader_PluginLoader_Interface $loader
|
||||
*
|
||||
* @param Zend_Loader_PluginLoader_Interface $loader
|
||||
* @return void
|
||||
*/
|
||||
public static function setPluginLoader($loader)
|
||||
@ -75,7 +75,7 @@ class Zend_Controller_Action_HelperBroker
|
||||
|
||||
/**
|
||||
* Retrieve PluginLoader
|
||||
*
|
||||
*
|
||||
* @return Zend_Loader_PluginLoader
|
||||
*/
|
||||
public static function getPluginLoader()
|
||||
@ -150,7 +150,7 @@ class Zend_Controller_Action_HelperBroker
|
||||
{
|
||||
$name = self::_normalizeHelperName($name);
|
||||
$stack = self::getStack();
|
||||
|
||||
|
||||
if (!isset($stack->{$name})) {
|
||||
self::_loadHelper($name);
|
||||
}
|
||||
@ -177,7 +177,7 @@ class Zend_Controller_Action_HelperBroker
|
||||
{
|
||||
$name = self::_normalizeHelperName($name);
|
||||
$stack = self::getStack();
|
||||
|
||||
|
||||
if (!isset($stack->{$name})) {
|
||||
require_once 'Zend/Controller/Action/Exception.php';
|
||||
throw new Zend_Controller_Action_Exception('Action helper "' . $name . '" has not been registered with the helper broker');
|
||||
@ -235,10 +235,10 @@ class Zend_Controller_Action_HelperBroker
|
||||
if (self::$_stack == null) {
|
||||
self::$_stack = new Zend_Controller_Action_HelperBroker_PriorityStack();
|
||||
}
|
||||
|
||||
|
||||
return self::$_stack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Controller_Action
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: PriorityStack.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: PriorityStack.php 17947 2009-09-02 03:58:21Z yoshida@zend.co.jp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -30,11 +30,10 @@
|
||||
class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggregate, ArrayAccess, Countable
|
||||
{
|
||||
|
||||
/** @protected */
|
||||
protected $_helpersByPriority = array();
|
||||
protected $_helpersByNameRef = array();
|
||||
protected $_nextDefaultPriority = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Magic property overloading for returning helper by name
|
||||
*
|
||||
@ -46,10 +45,10 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
if (!array_key_exists($helperName, $this->_helpersByNameRef)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $this->_helpersByNameRef[$helperName];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Magic property overloading for returning if helper is set by name
|
||||
*
|
||||
@ -60,7 +59,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return array_key_exists($helperName, $this->_helpersByNameRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Magic property overloading for unsetting if helper is exists by name
|
||||
*
|
||||
@ -71,7 +70,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return $this->offsetUnset($helperName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* push helper onto the stack
|
||||
*
|
||||
@ -83,7 +82,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
$this->offsetSet($this->getNextFreeHigherPriority(), $helper);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return something iterable
|
||||
*
|
||||
@ -93,11 +92,11 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return new ArrayObject($this->_helpersByPriority);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* offsetExists()
|
||||
*
|
||||
* @param int|string $priorityOrHelperName
|
||||
* @param int|string $priorityOrHelperName
|
||||
* @return Zend_Controller_Action_HelperBroker_PriorityStack
|
||||
*/
|
||||
public function offsetExists($priorityOrHelperName)
|
||||
@ -108,7 +107,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
return array_key_exists($priorityOrHelperName, $this->_helpersByPriority);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* offsetGet()
|
||||
*
|
||||
@ -119,16 +118,16 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
if (!$this->offsetExists($priorityOrHelperName)) {
|
||||
require_once 'Zend/Controller/Action/Exception.php';
|
||||
throw new Zend_Controller_Action_Exception('A helper with priority ' . $priority . ' does not exist.');
|
||||
throw new Zend_Controller_Action_Exception('A helper with priority ' . $priorityOrHelperName . ' does not exist.');
|
||||
}
|
||||
|
||||
|
||||
if (is_string($priorityOrHelperName)) {
|
||||
return $this->_helpersByNameRef[$priorityOrHelperName];
|
||||
} else {
|
||||
return $this->_helpersByPriority[$priorityOrHelperName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* offsetSet()
|
||||
*
|
||||
@ -144,29 +143,29 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
require_once 'Zend/Controller/Action/Exception.php';
|
||||
throw new Zend_Controller_Action_Exception('$helper must extend Zend_Controller_Action_Helper_Abstract.');
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists($helper->getName(), $this->_helpersByNameRef)) {
|
||||
// remove any object with the same name to retain BC compailitbility
|
||||
// @todo At ZF 2.0 time throw an exception here.
|
||||
$this->offsetUnset($helper->getName());
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists($priority, $this->_helpersByPriority)) {
|
||||
$priority = $this->getNextFreeHigherPriority($priority); // ensures LIFO
|
||||
trigger_error("A helper with the same priority already exists, reassigning to $priority", E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
$this->_helpersByPriority[$priority] = $helper;
|
||||
$this->_helpersByNameRef[$helper->getName()] = $helper;
|
||||
|
||||
if ($priority == ($nextFreeDefault = $this->getNextFreeHigherPriority($this->_nextDefaultPriority))) {
|
||||
$this->_nextDefaultPriority = $nextFreeDefault;
|
||||
}
|
||||
|
||||
|
||||
krsort($this->_helpersByPriority); // always make sure priority and LIFO are both enforced
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* offsetUnset()
|
||||
*
|
||||
@ -179,7 +178,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
require_once 'Zend/Controller/Action/Exception.php';
|
||||
throw new Zend_Controller_Action_Exception('A helper with priority or name ' . $priorityOrHelperName . ' does not exist.');
|
||||
}
|
||||
|
||||
|
||||
if (is_string($priorityOrHelperName)) {
|
||||
$helperName = $priorityOrHelperName;
|
||||
$helper = $this->_helpersByNameRef[$helperName];
|
||||
@ -188,12 +187,12 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
$priority = $priorityOrHelperName;
|
||||
$helperName = $this->_helpersByPriority[$priorityOrHelperName]->getName();
|
||||
}
|
||||
|
||||
|
||||
unset($this->_helpersByNameRef[$helperName]);
|
||||
unset($this->_helpersByPriority[$priority]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return the count of helpers
|
||||
*
|
||||
@ -203,7 +202,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return count($this->_helpersByPriority);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find the next free higher priority. If an index is given, it will
|
||||
* find the next free highest priority after it.
|
||||
@ -216,16 +215,16 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
if ($indexPriority == null) {
|
||||
$indexPriority = $this->_nextDefaultPriority;
|
||||
}
|
||||
|
||||
|
||||
$priorities = array_keys($this->_helpersByPriority);
|
||||
|
||||
while (in_array($indexPriority, $priorities)) {
|
||||
$indexPriority++;
|
||||
}
|
||||
|
||||
|
||||
return $indexPriority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find the next free lower priority. If an index is given, it will
|
||||
* find the next free lower priority before it.
|
||||
@ -238,16 +237,16 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
if ($indexPriority == null) {
|
||||
$indexPriority = $this->_nextDefaultPriority;
|
||||
}
|
||||
|
||||
|
||||
$priorities = array_keys($this->_helpersByPriority);
|
||||
|
||||
while (in_array($indexPriority, $priorities)) {
|
||||
$indexPriority--;
|
||||
}
|
||||
|
||||
return $indexPriority;
|
||||
|
||||
return $indexPriority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return the highest priority
|
||||
*
|
||||
@ -257,7 +256,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return max(array_keys($this->_helpersByPriority));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return the lowest priority
|
||||
*
|
||||
@ -267,7 +266,7 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return min(array_keys($this->_helpersByPriority));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return the helpers referenced by name
|
||||
*
|
||||
@ -277,5 +276,5 @@ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggre
|
||||
{
|
||||
return $this->_helpersByNameRef;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Dispatcher
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -185,21 +185,21 @@ interface Zend_Controller_Dispatcher_Interface
|
||||
|
||||
/**
|
||||
* Retrieve the default module name
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultModule();
|
||||
|
||||
/**
|
||||
* Retrieve the default controller name
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultControllerName();
|
||||
|
||||
/**
|
||||
* Retrieve the default action
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultAction();
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Dispatcher
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Standard.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Standard.php 19093 2009-11-20 14:59:00Z bate $
|
||||
*/
|
||||
|
||||
/** Zend_Loader */
|
||||
@ -260,7 +260,7 @@ class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abs
|
||||
* arguments; throw exception if it's not an action controller
|
||||
*/
|
||||
$controller = new $className($request, $this->getResponse(), $this->getParams());
|
||||
if (!($controller instanceof Zend_Controller_Action_Interface) &&
|
||||
if (!($controller instanceof Zend_Controller_Action_Interface) &&
|
||||
!($controller instanceof Zend_Controller_Action)) {
|
||||
require_once 'Zend/Controller/Dispatcher/Exception.php';
|
||||
throw new Zend_Controller_Dispatcher_Exception(
|
||||
@ -335,7 +335,9 @@ class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abs
|
||||
$dispatchDir = $this->getDispatchDirectory();
|
||||
$loadFile = $dispatchDir . DIRECTORY_SEPARATOR . $this->classToFilename($className);
|
||||
|
||||
if (!include_once $loadFile) {
|
||||
if (file_exists($loadFile)) {
|
||||
include_once $loadFile;
|
||||
} else {
|
||||
require_once 'Zend/Controller/Dispatcher/Exception.php';
|
||||
throw new Zend_Controller_Dispatcher_Exception('Cannot load controller class "' . $className . '" from file "' . $loadFile . "'");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ require_once 'Zend/Registry.php';
|
||||
* @subpackage Plugins
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ActionStack.php 16202 2009-06-21 18:53:49Z thomas $
|
||||
* @version $Id: ActionStack.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
@ -52,12 +52,20 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
* @var array
|
||||
*/
|
||||
protected $_validKeys = array(
|
||||
'module',
|
||||
'module',
|
||||
'controller',
|
||||
'action',
|
||||
'params'
|
||||
);
|
||||
|
||||
/**
|
||||
* Flag to determine whether request parameters are cleared between actions, or whether new parameters
|
||||
* are added to existing request parameters.
|
||||
*
|
||||
* @var Bool
|
||||
*/
|
||||
protected $_clearRequestParams = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -83,8 +91,8 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
/**
|
||||
* Set registry object
|
||||
*
|
||||
* @param Zend_Registry $registry
|
||||
*
|
||||
* @param Zend_Registry $registry
|
||||
* @return Zend_Controller_Plugin_ActionStack
|
||||
*/
|
||||
public function setRegistry(Zend_Registry $registry)
|
||||
@ -95,7 +103,7 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
/**
|
||||
* Retrieve registry object
|
||||
*
|
||||
*
|
||||
* @return Zend_Registry
|
||||
*/
|
||||
public function getRegistry()
|
||||
@ -125,9 +133,31 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set clearRequestParams flag
|
||||
*
|
||||
* @param bool $clearRequestParams
|
||||
* @return Zend_Controller_Plugin_ActionStack
|
||||
*/
|
||||
public function setClearRequestParams($clearRequestParams)
|
||||
{
|
||||
$this->_clearRequestParams = (bool) $clearRequestParams;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve clearRequestParams flag
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getClearRequestParams()
|
||||
{
|
||||
return $this->_clearRequestParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve action stack
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStack()
|
||||
@ -139,8 +169,8 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
/**
|
||||
* Save stack to registry
|
||||
*
|
||||
* @param array $stack
|
||||
*
|
||||
* @param array $stack
|
||||
* @return Zend_Controller_Plugin_ActionStack
|
||||
*/
|
||||
protected function _saveStack(array $stack)
|
||||
@ -152,8 +182,8 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
/**
|
||||
* Push an item onto the stack
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $next
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $next
|
||||
* @return Zend_Controller_Plugin_ActionStack
|
||||
*/
|
||||
public function pushStack(Zend_Controller_Request_Abstract $next)
|
||||
@ -165,7 +195,7 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
/**
|
||||
* Pop an item off the action stack
|
||||
*
|
||||
*
|
||||
* @return false|Zend_Controller_Request_Abstract
|
||||
*/
|
||||
public function popStack()
|
||||
@ -209,7 +239,7 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
*/
|
||||
public function postDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
// Don't move on to next request if this is already an attempt to
|
||||
// Don't move on to next request if this is already an attempt to
|
||||
// forward
|
||||
if (!$request->isDispatched()) {
|
||||
return;
|
||||
@ -230,16 +260,21 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
/**
|
||||
* Forward request with next action
|
||||
*
|
||||
* @param array $next
|
||||
*
|
||||
* @param array $next
|
||||
* @return void
|
||||
*/
|
||||
public function forward(Zend_Controller_Request_Abstract $next)
|
||||
{
|
||||
$this->getRequest()->setModuleName($next->getModuleName())
|
||||
->setControllerName($next->getControllerName())
|
||||
->setActionName($next->getActionName())
|
||||
->setParams($next->getParams())
|
||||
->setDispatched(false);
|
||||
$request = $this->getRequest();
|
||||
if ($this->getClearRequestParams()) {
|
||||
$request->clearParams();
|
||||
}
|
||||
|
||||
$request->setModuleName($next->getModuleName())
|
||||
->setControllerName($next->getControllerName())
|
||||
->setActionName($next->getActionName())
|
||||
->setParams($next->getParams())
|
||||
->setDispatched(false);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Abstract.php 18175 2009-09-17 17:05:48Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -321,6 +321,17 @@ abstract class Zend_Controller_Request_Abstract
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset all user parameters
|
||||
*
|
||||
* @return Zend_Controller_Request_Abstract
|
||||
*/
|
||||
public function clearParams()
|
||||
{
|
||||
$this->_params = array();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set flag indicating whether or not request has been dispatched
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Http.php 16933 2009-07-21 20:24:35Z matthew $
|
||||
* @version $Id: Http.php 19077 2009-11-20 00:29:56Z matthew $
|
||||
*/
|
||||
|
||||
/** Zend_Controller_Request_Abstract */
|
||||
@ -84,6 +84,12 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
|
||||
*/
|
||||
protected $_params = array();
|
||||
|
||||
/**
|
||||
* Raw request body
|
||||
* @var string|false
|
||||
*/
|
||||
protected $_rawBody;
|
||||
|
||||
/**
|
||||
* Alias keys for request parameters
|
||||
* @var array
|
||||
@ -386,6 +392,14 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
|
||||
if ($requestUri === null) {
|
||||
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch
|
||||
$requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
|
||||
} elseif (
|
||||
// IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
|
||||
isset($_SERVER['IIS_WasUrlRewritten'])
|
||||
&& $_SERVER['IIS_WasUrlRewritten'] == '1'
|
||||
&& isset($_SERVER['UNENCODED_URL'])
|
||||
&& $_SERVER['UNENCODED_URL'] != ''
|
||||
) {
|
||||
$requestUri = $_SERVER['UNENCODED_URL'];
|
||||
} elseif (isset($_SERVER['REQUEST_URI'])) {
|
||||
$requestUri = $_SERVER['REQUEST_URI'];
|
||||
// Http proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
|
||||
@ -708,18 +722,25 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
|
||||
* Retrieve an array of parameters
|
||||
*
|
||||
* Retrieves a merged array of parameters, with precedence of userland
|
||||
* params (see {@link setParam()}), $_GET, $POST (i.e., values in the
|
||||
* params (see {@link setParam()}), $_GET, $_POST (i.e., values in the
|
||||
* userland params will take precedence over all others).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
$return = $this->_params;
|
||||
if (isset($_GET) && is_array($_GET)) {
|
||||
$return = $this->_params;
|
||||
$paramSources = $this->getParamSources();
|
||||
if (in_array('_GET', $paramSources)
|
||||
&& isset($_GET)
|
||||
&& is_array($_GET)
|
||||
) {
|
||||
$return += $_GET;
|
||||
}
|
||||
if (isset($_POST) && is_array($_POST)) {
|
||||
if (in_array('_POST', $paramSources)
|
||||
&& isset($_POST)
|
||||
&& is_array($_POST)
|
||||
) {
|
||||
$return += $_POST;
|
||||
}
|
||||
return $return;
|
||||
@ -919,13 +940,16 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
|
||||
*/
|
||||
public function getRawBody()
|
||||
{
|
||||
$body = file_get_contents('php://input');
|
||||
if (null === $this->_rawBody) {
|
||||
$body = file_get_contents('php://input');
|
||||
|
||||
if (strlen(trim($body)) > 0) {
|
||||
return $body;
|
||||
if (strlen(trim($body)) > 0) {
|
||||
$this->_rawBody = $body;
|
||||
} else {
|
||||
$this->_rawBody = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return $this->_rawBody;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: HttpTestCase.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: HttpTestCase.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
* Request method
|
||||
* @var string
|
||||
*/
|
||||
protected $_method;
|
||||
protected $_method = 'GET';
|
||||
|
||||
/**
|
||||
* Raw POST body
|
||||
@ -68,7 +68,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Clear GET values
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function clearQuery()
|
||||
@ -79,7 +79,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Clear POST values
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function clearPost()
|
||||
@ -90,8 +90,8 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Set raw POST body
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @param string $content
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function setRawBody($content)
|
||||
@ -102,7 +102,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Get RAW POST body
|
||||
*
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRawBody()
|
||||
@ -112,7 +112,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Clear raw POST body
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function clearRawBody()
|
||||
@ -123,9 +123,9 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Set a cookie
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function setCookie($key, $value)
|
||||
@ -136,8 +136,8 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Set multiple cookies at once
|
||||
*
|
||||
* @param array $cookies
|
||||
*
|
||||
* @param array $cookies
|
||||
* @return void
|
||||
*/
|
||||
public function setCookies(array $cookies)
|
||||
@ -150,7 +150,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Clear all cookies
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function clearCookies()
|
||||
@ -161,8 +161,8 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Set request method
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @param string $type
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function setMethod($type)
|
||||
@ -178,7 +178,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Get request method
|
||||
*
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMethod()
|
||||
@ -188,9 +188,9 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Set a request header
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function setHeader($key, $value)
|
||||
@ -202,8 +202,8 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Set request headers
|
||||
*
|
||||
* @param array $headers
|
||||
*
|
||||
* @param array $headers
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function setHeaders(array $headers)
|
||||
@ -216,9 +216,9 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Get request header
|
||||
*
|
||||
* @param string $header
|
||||
* @param mixed $default
|
||||
*
|
||||
* @param string $header
|
||||
* @param mixed $default
|
||||
* @return string|null
|
||||
*/
|
||||
public function getHeader($header, $default = null)
|
||||
@ -232,7 +232,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Get all request headers
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders()
|
||||
@ -242,7 +242,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Clear request headers
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Request_HttpTestCase
|
||||
*/
|
||||
public function clearHeaders()
|
||||
@ -253,7 +253,7 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Get REQUEST_URI
|
||||
*
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getRequestUri()
|
||||
@ -263,8 +263,8 @@ class Zend_Controller_Request_HttpTestCase extends Zend_Controller_Request_Http
|
||||
|
||||
/**
|
||||
* Normalize a header name for setting and retrieval
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function _normalizeHeaderName($name)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Request
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Simple.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Simple.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Controller_Request_Abstract */
|
||||
@ -32,24 +32,24 @@ require_once 'Zend/Controller/Request/Abstract.php';
|
||||
*/
|
||||
class Zend_Controller_Request_Simple extends Zend_Controller_Request_Abstract
|
||||
{
|
||||
|
||||
|
||||
public function __construct($action = null, $controller = null, $module = null, array $params = array())
|
||||
{
|
||||
if ($action) {
|
||||
$this->setActionName($action);
|
||||
}
|
||||
|
||||
|
||||
if ($controller) {
|
||||
$this->setControllerName($controller);
|
||||
}
|
||||
|
||||
|
||||
if ($module) {
|
||||
$this->setModuleName($module);
|
||||
}
|
||||
|
||||
|
||||
if ($params) {
|
||||
$this->setParams($params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 17708 2009-08-21 13:43:39Z matthew $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -87,8 +87,8 @@ abstract class Zend_Controller_Response_Abstract
|
||||
* Normalize a header name
|
||||
*
|
||||
* Normalizes a header name to X-Capitalized-Names
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function _normalizeHeader($name)
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: HttpTestCase.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: HttpTestCase.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -29,13 +29,13 @@ require_once 'Zend/Controller/Response/Http.php';
|
||||
*
|
||||
* @uses Zend_Controller_Response_Http
|
||||
* @package Zend_Controller
|
||||
* @subpackage Request
|
||||
* @subpackage Response
|
||||
*/
|
||||
class Zend_Controller_Response_HttpTestCase extends Zend_Controller_Response_Http
|
||||
{
|
||||
/**
|
||||
* "send" headers by returning array of all headers that would be sent
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sendHeaders()
|
||||
@ -60,8 +60,8 @@ class Zend_Controller_Response_HttpTestCase extends Zend_Controller_Response_Htt
|
||||
|
||||
/**
|
||||
* Can we send headers?
|
||||
*
|
||||
* @param bool $throw
|
||||
*
|
||||
* @param bool $throw
|
||||
* @return void
|
||||
*/
|
||||
public function canSendHeaders($throw = false)
|
||||
@ -71,7 +71,7 @@ class Zend_Controller_Response_HttpTestCase extends Zend_Controller_Response_Htt
|
||||
|
||||
/**
|
||||
* Return the concatenated body segments
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function outputBody()
|
||||
@ -85,8 +85,8 @@ class Zend_Controller_Response_HttpTestCase extends Zend_Controller_Response_Htt
|
||||
|
||||
/**
|
||||
* Get body and/or body segments
|
||||
*
|
||||
* @param bool|string $spec
|
||||
*
|
||||
* @param bool|string $spec
|
||||
* @return string|array|null
|
||||
*/
|
||||
public function getBody($spec = false)
|
||||
@ -105,9 +105,9 @@ class Zend_Controller_Response_HttpTestCase extends Zend_Controller_Response_Htt
|
||||
/**
|
||||
* "send" Response
|
||||
*
|
||||
* Concats all response headers, and then final body (separated by two
|
||||
* Concats all response headers, and then final body (separated by two
|
||||
* newlines)
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sendResponse()
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,19 +39,19 @@ interface Zend_Controller_Router_Interface
|
||||
public function route(Zend_Controller_Request_Abstract $dispatcher);
|
||||
|
||||
/**
|
||||
* Generates a URL path that can be used in URL creation, redirection, etc.
|
||||
*
|
||||
* May be passed user params to override ones from URI, Request or even defaults.
|
||||
* Generates a URL path that can be used in URL creation, redirection, etc.
|
||||
*
|
||||
* May be passed user params to override ones from URI, Request or even defaults.
|
||||
* If passed parameter has a value of null, it's URL variable will be reset to
|
||||
* default.
|
||||
*
|
||||
* default.
|
||||
*
|
||||
* If null is passed as a route name assemble will use the current Route or 'default'
|
||||
* if current is not yet set.
|
||||
*
|
||||
* Reset is used to signal that all parameters should be reset to it's defaults.
|
||||
*
|
||||
* Reset is used to signal that all parameters should be reset to it's defaults.
|
||||
* Ignoring all URL specified values. User specified params still get precedence.
|
||||
*
|
||||
* Encode tells to url encode resulting path parts.
|
||||
*
|
||||
* Encode tells to url encode resulting path parts.
|
||||
*
|
||||
* @param array $userParams Options passed by a user used to override parameters
|
||||
* @param mixed $name The name of a Route to use
|
||||
@ -61,7 +61,7 @@ interface Zend_Controller_Router_Interface
|
||||
* @return string Resulting URL path
|
||||
*/
|
||||
public function assemble($userParams, $name = null, $reset = false, $encode = true);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve Front Controller
|
||||
*
|
||||
@ -76,7 +76,7 @@ interface Zend_Controller_Router_Interface
|
||||
* @return Zend_Controller_Router_Interface
|
||||
*/
|
||||
public function setFrontController(Zend_Controller_Front $controller);
|
||||
|
||||
|
||||
/**
|
||||
* Add or modify a parameter with which to instantiate any helper objects
|
||||
*
|
||||
@ -120,5 +120,5 @@ interface Zend_Controller_Router_Interface
|
||||
* @return Zend_Controller_Router_Interface
|
||||
*/
|
||||
public function clearParams($name = null);
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Rewrite.php 16644 2009-07-11 14:12:17Z dasprid $
|
||||
* @version $Id: Rewrite.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -40,42 +40,42 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
|
||||
/**
|
||||
* Whether or not to use default routes
|
||||
*
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_useDefaultRoutes = true;
|
||||
|
||||
/**
|
||||
* Array of routes to match against
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_routes = array();
|
||||
|
||||
/**
|
||||
* Currently matched route
|
||||
*
|
||||
*
|
||||
* @var Zend_Controller_Router_Route_Interface
|
||||
*/
|
||||
protected $_currentRoute = null;
|
||||
|
||||
/**
|
||||
* Global parameters given to all routes
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_globalParams = array();
|
||||
|
||||
|
||||
/**
|
||||
* Separator to use with chain names
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_chainNameSeparator = '-';
|
||||
|
||||
|
||||
/**
|
||||
* Add default routes which are used to mimic basic router behaviour
|
||||
*
|
||||
*
|
||||
* @return Zend_Controller_Router_Rewrite
|
||||
*/
|
||||
public function addDefaultRoutes()
|
||||
@ -89,27 +89,27 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
|
||||
$this->_routes = array_merge(array('default' => $compat), $this->_routes);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add route to the route chain
|
||||
*
|
||||
*
|
||||
* If route contains method setRequest(), it is initialized with a request object
|
||||
*
|
||||
* @param string $name Name of the route
|
||||
* @param Zend_Controller_Router_Route_Interface $route Instance of the route
|
||||
* @return Zend_Controller_Router_Rewrite
|
||||
*/
|
||||
public function addRoute($name, Zend_Controller_Router_Route_Interface $route)
|
||||
public function addRoute($name, Zend_Controller_Router_Route_Interface $route)
|
||||
{
|
||||
if (method_exists($route, 'setRequest')) {
|
||||
$route->setRequest($this->getFrontController()->getRequest());
|
||||
}
|
||||
|
||||
|
||||
$this->_routes[$name] = $route;
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
foreach ($routes as $name => $route) {
|
||||
$this->addRoute($name, $route);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -158,30 +158,30 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
require_once 'Zend/Controller/Router/Exception.php';
|
||||
throw new Zend_Controller_Router_Exception("No route configuration in section '{$section}'");
|
||||
}
|
||||
|
||||
|
||||
$config = $config->{$section};
|
||||
}
|
||||
|
||||
|
||||
foreach ($config as $name => $info) {
|
||||
$route = $this->_getRouteFromConfig($info);
|
||||
|
||||
|
||||
if ($route instanceof Zend_Controller_Router_Route_Chain) {
|
||||
if (!isset($info->chain)) {
|
||||
require_once 'Zend/Controller/Router/Exception.php';
|
||||
throw new Zend_Controller_Router_Exception("No chain defined");
|
||||
throw new Zend_Controller_Router_Exception("No chain defined");
|
||||
}
|
||||
|
||||
|
||||
if ($info->chain instanceof Zend_Config) {
|
||||
$childRouteNames = $info->chain;
|
||||
} else {
|
||||
$childRouteNames = explode(',', $info->chain);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($childRouteNames as $childRouteName) {
|
||||
$childRoute = $this->getRoute(trim($childRouteName));
|
||||
$route->chain($childRoute);
|
||||
}
|
||||
|
||||
|
||||
$this->addRoute($name, $route);
|
||||
} elseif (isset($info->chains) && $info->chains instanceof Zend_Config) {
|
||||
$this->_addChainRoutesFromConfig($name, $route, $info->chains);
|
||||
@ -192,7 +192,7 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a route frm a config instance
|
||||
*
|
||||
@ -206,16 +206,16 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
require_once 'Zend/Loader.php';
|
||||
Zend_Loader::loadClass($class);
|
||||
}
|
||||
|
||||
|
||||
$route = call_user_func(array($class, 'getInstance'), $info);
|
||||
|
||||
|
||||
if (isset($info->abstract) && $info->abstract && method_exists($route, 'isAbstract')) {
|
||||
$route->isAbstract(true);
|
||||
}
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add chain routes from a config route
|
||||
*
|
||||
@ -235,16 +235,16 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
} else {
|
||||
$childRoute = $this->_getRouteFromConfig($childRouteInfo);
|
||||
}
|
||||
|
||||
|
||||
if ($route instanceof Zend_Controller_Router_Route_Chain) {
|
||||
$chainRoute = clone $route;
|
||||
$chainRoute->chain($childRoute);
|
||||
} else {
|
||||
$chainRoute = $route->chain($childRoute);
|
||||
}
|
||||
|
||||
|
||||
$chainName = $name . $this->_chainNameSeparator . $childRouteName;
|
||||
|
||||
|
||||
if (isset($childRouteInfo->chains)) {
|
||||
$this->_addChainRoutesFromConfig($chainName, $chainRoute, $childRouteInfo->chains);
|
||||
} else {
|
||||
@ -266,9 +266,9 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
require_once 'Zend/Controller/Router/Exception.php';
|
||||
throw new Zend_Controller_Router_Exception("Route $name is not defined");
|
||||
}
|
||||
|
||||
|
||||
unset($this->_routes[$name]);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
public function removeDefaultRoutes()
|
||||
{
|
||||
$this->_useDefaultRoutes = false;
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
require_once 'Zend/Controller/Router/Exception.php';
|
||||
throw new Zend_Controller_Router_Exception("Route $name is not defined");
|
||||
}
|
||||
|
||||
|
||||
return $this->_routes[$name];
|
||||
}
|
||||
|
||||
@ -377,14 +377,14 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
if (method_exists($route, 'isAbstract') && $route->isAbstract()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Should be an interface method. Hack for 1.0 BC
|
||||
|
||||
// TODO: Should be an interface method. Hack for 1.0 BC
|
||||
if (!method_exists($route, 'getVersion') || $route->getVersion() == 1) {
|
||||
$match = $request->getPathInfo();
|
||||
} else {
|
||||
$match = $request;
|
||||
}
|
||||
|
||||
|
||||
if ($params = $route->match($match)) {
|
||||
$this->_setRequestParams($request, $params);
|
||||
$this->_currentRoute = $name;
|
||||
@ -417,14 +417,14 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
|
||||
/**
|
||||
* Generates a URL path that can be used in URL creation, redirection, etc.
|
||||
*
|
||||
*
|
||||
* @param array $userParams Options passed by a user used to override parameters
|
||||
* @param mixed $name The name of a Route to use
|
||||
* @param bool $reset Whether to reset to the route defaults ignoring URL params
|
||||
* @param bool $encode Tells to encode URL parts on output
|
||||
* @throws Zend_Controller_Router_Exception
|
||||
* @return string Resulting absolute URL path
|
||||
*/
|
||||
*/
|
||||
public function assemble($userParams, $name = null, $reset = false, $encode = true)
|
||||
{
|
||||
if ($name == null) {
|
||||
@ -434,9 +434,9 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
$name = 'default';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$params = array_merge($this->_globalParams, $userParams);
|
||||
|
||||
|
||||
$route = $this->getRoute($name);
|
||||
$url = $route->assemble($params, $reset, $encode);
|
||||
|
||||
@ -446,10 +446,10 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a global parameter
|
||||
*
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return Zend_Controller_Router_Rewrite
|
||||
@ -457,25 +457,25 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
|
||||
public function setGlobalParam($name, $value)
|
||||
{
|
||||
$this->_globalParams[$name] = $value;
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the separator to use with chain names
|
||||
*
|
||||
*
|
||||
* @param string $separator The separator to use
|
||||
* @return Zend_Controller_Router_Rewrite
|
||||
*/
|
||||
public function setChainNameSeparator($separator) {
|
||||
$this->_chainNameSeparator = $separator;
|
||||
|
||||
return $this;
|
||||
$this->_chainNameSeparator = $separator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the separator to use for chain names
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChainNameSeparator() {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Route.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Route.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -47,28 +47,28 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
* @var Zend_Translate
|
||||
*/
|
||||
protected $_translator;
|
||||
|
||||
|
||||
/**
|
||||
* Default locale
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected static $_defaultLocale;
|
||||
|
||||
|
||||
/**
|
||||
* Locale
|
||||
*
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_locale;
|
||||
|
||||
|
||||
/**
|
||||
* Wether this is a translated route or not
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_isTranslated = false;
|
||||
|
||||
|
||||
/**
|
||||
* Translatable variables
|
||||
*
|
||||
@ -132,7 +132,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
public function getVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates route based on passed Zend_Config structure
|
||||
*
|
||||
@ -174,20 +174,20 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
$this->_translatable[] = $name;
|
||||
$this->_isTranslated = true;
|
||||
}
|
||||
|
||||
|
||||
$this->_parts[$pos] = (isset($reqs[$name]) ? $reqs[$name] : $this->_defaultRegex);
|
||||
$this->_variables[$pos] = $name;
|
||||
} else {
|
||||
if (substr($part, 0, 1) == $this->_urlVariable) {
|
||||
$part = substr($part, 1);
|
||||
}
|
||||
|
||||
|
||||
if (substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@') {
|
||||
$this->_isTranslated = true;
|
||||
}
|
||||
|
||||
|
||||
$this->_parts[$pos] = $part;
|
||||
|
||||
|
||||
if ($part !== '*') {
|
||||
$this->_staticCount++;
|
||||
}
|
||||
@ -208,15 +208,15 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
if ($this->_isTranslated) {
|
||||
$translateMessages = $this->getTranslator()->getMessages();
|
||||
}
|
||||
|
||||
|
||||
$pathStaticCount = 0;
|
||||
$values = array();
|
||||
$matchedPath = '';
|
||||
|
||||
|
||||
if (!$partial) {
|
||||
$path = trim($path, $this->_urlDelimiter);
|
||||
}
|
||||
|
||||
|
||||
if ($path !== '') {
|
||||
$path = explode($this->_urlDelimiter, $path);
|
||||
|
||||
@ -229,9 +229,9 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matchedPath .= $pathPart . $this->_urlDelimiter;
|
||||
|
||||
|
||||
// If it's a wildcard, get the rest of URL as wildcard data and stop matching
|
||||
if ($this->_parts[$pos] == '*') {
|
||||
$count = count($path);
|
||||
@ -253,12 +253,12 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
if (substr($part, 0, 1) === '@') {
|
||||
$part = substr($part, 1);
|
||||
}
|
||||
|
||||
|
||||
if (($originalPathPart = array_search($pathPart, $translateMessages)) !== false) {
|
||||
$pathPart = $originalPathPart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (substr($part, 0, 2) === '@@') {
|
||||
$part = substr($part, 1);
|
||||
}
|
||||
@ -278,7 +278,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
$values[$name] = $pathPart;
|
||||
} else {
|
||||
$pathStaticCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,11 +295,11 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->setMatchedPath(rtrim($matchedPath, $this->_urlDelimiter));
|
||||
|
||||
$this->_values = $values;
|
||||
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
@ -315,7 +315,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
if ($this->_isTranslated) {
|
||||
$translator = $this->getTranslator();
|
||||
|
||||
|
||||
if (isset($data['@locale'])) {
|
||||
$locale = $data['@locale'];
|
||||
unset($data['@locale']);
|
||||
@ -323,7 +323,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
$locale = $this->getLocale();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$url = array();
|
||||
$flag = false;
|
||||
|
||||
@ -349,12 +349,12 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
require_once 'Zend/Controller/Router/Exception.php';
|
||||
throw new Zend_Controller_Router_Exception($name . ' is not specified');
|
||||
}
|
||||
|
||||
|
||||
if ($this->_isTranslated && in_array($name, $this->_translatable)) {
|
||||
$url[$key] = $translator->translate($value, $locale);
|
||||
} else {
|
||||
$url[$key] = $value;
|
||||
}
|
||||
}
|
||||
} elseif ($part != '*') {
|
||||
if ($this->_isTranslated && substr($part, 0, 1) === '@') {
|
||||
if (substr($part, 1, 1) !== '@') {
|
||||
@ -366,7 +366,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
if (substr($part, 0, 2) === '@@') {
|
||||
$part = substr($part, 1);
|
||||
}
|
||||
|
||||
|
||||
$url[$key] = $part;
|
||||
}
|
||||
} else {
|
||||
@ -385,15 +385,15 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
|
||||
foreach (array_reverse($url, true) as $key => $value) {
|
||||
$defaultValue = null;
|
||||
|
||||
|
||||
if (isset($this->_variables[$key])) {
|
||||
$defaultValue = $this->getDefault($this->_variables[$key]);
|
||||
|
||||
|
||||
if ($this->_isTranslated && $defaultValue !== null && isset($this->_translatable[$this->_variables[$key]])) {
|
||||
$defaultValue = $translator->translate($defaultValue, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($flag || $value !== $defaultValue || $partial) {
|
||||
if ($encode) $value = urlencode($value);
|
||||
$return = $this->_urlDelimiter . $value . $return;
|
||||
@ -426,7 +426,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
public function getDefaults() {
|
||||
return $this->_defaults;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all variables which are used by the route
|
||||
*
|
||||
@ -439,7 +439,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
|
||||
/**
|
||||
* Set a default translator
|
||||
*
|
||||
*
|
||||
* @param Zend_Translate $translator
|
||||
* @return void
|
||||
*/
|
||||
@ -447,7 +447,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
self::$_defaultTranslator = $translator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the default translator
|
||||
*
|
||||
@ -457,10 +457,10 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
return self::$_defaultTranslator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a translator
|
||||
*
|
||||
*
|
||||
* @param Zend_Translate $translator
|
||||
* @return void
|
||||
*/
|
||||
@ -468,10 +468,10 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
$this->_translator = $translator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the translator
|
||||
*
|
||||
*
|
||||
* @throws Zend_Controller_Router_Exception When no translator can be found
|
||||
* @return Zend_Translate
|
||||
*/
|
||||
@ -487,19 +487,19 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
} catch (Zend_Exception $e) {
|
||||
$translator = null;
|
||||
}
|
||||
|
||||
if ($translator instanceof Zend_Translate) {
|
||||
|
||||
if ($translator instanceof Zend_Translate) {
|
||||
return $translator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
require_once 'Zend/Controller/Router/Exception.php';
|
||||
throw new Zend_Controller_Router_Exception('Could not find a translator');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a default locale
|
||||
*
|
||||
*
|
||||
* @param mixed $locale
|
||||
* @return void
|
||||
*/
|
||||
@ -507,7 +507,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
self::$_defaultLocale = $locale;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the default locale
|
||||
*
|
||||
@ -517,10 +517,10 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
return self::$_defaultLocale;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a locale
|
||||
*
|
||||
*
|
||||
* @param mixed $locale
|
||||
* @return void
|
||||
*/
|
||||
@ -528,10 +528,10 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
{
|
||||
$this->_locale = $locale;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the locale
|
||||
*
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLocale()
|
||||
@ -546,12 +546,12 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
|
||||
} catch (Zend_Exception $e) {
|
||||
$locale = null;
|
||||
}
|
||||
|
||||
if ($locale !== null) {
|
||||
|
||||
if ($locale !== null) {
|
||||
return $locale;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -50,7 +50,7 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
* @var string
|
||||
*/
|
||||
protected $_matchedPath = null;
|
||||
|
||||
|
||||
/**
|
||||
* Get the version of the route
|
||||
*
|
||||
@ -60,7 +60,7 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set partially matched path
|
||||
*
|
||||
@ -71,7 +71,7 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
{
|
||||
$this->_matchedPath = $path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get partially matched path
|
||||
*
|
||||
@ -81,10 +81,10 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
{
|
||||
return $this->_matchedPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check or set wether this is an abstract route or not
|
||||
*
|
||||
*
|
||||
* @param boolean $flag
|
||||
* @return boolean
|
||||
*/
|
||||
@ -93,17 +93,17 @@ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_
|
||||
if ($flag !== null) {
|
||||
$this->_isAbstract = $flag;
|
||||
}
|
||||
|
||||
|
||||
return $this->_isAbstract;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new chain
|
||||
*
|
||||
*
|
||||
* @param Zend_Controller_Router_Route_Abstract $route
|
||||
* @param string $separator
|
||||
* @return Zend_Controller_Router_Route_Chain
|
||||
*/
|
||||
*/
|
||||
public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/')
|
||||
{
|
||||
require_once 'Zend/Controller/Router/Route/Chain.php';
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Chain.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Chain.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -46,10 +46,10 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
$defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();
|
||||
return new self($config->route, $defs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a route to this chain
|
||||
*
|
||||
*
|
||||
* @param Zend_Controller_Router_Route_Abstract $route
|
||||
* @param string $separator
|
||||
* @return Zend_Controller_Router_Route_Chain
|
||||
@ -79,29 +79,29 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
foreach ($this->_routes as $key => $route) {
|
||||
if ($key > 0 && $matchedPath !== null) {
|
||||
$separator = substr($subPath, 0, strlen($this->_separators[$key]));
|
||||
|
||||
|
||||
if ($separator !== $this->_separators[$key]) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$subPath = substr($subPath, strlen($separator));
|
||||
}
|
||||
|
||||
// TODO: Should be an interface method. Hack for 1.0 BC
|
||||
|
||||
// TODO: Should be an interface method. Hack for 1.0 BC
|
||||
if (!method_exists($route, 'getVersion') || $route->getVersion() == 1) {
|
||||
$match = $subPath;
|
||||
} else {
|
||||
$request->setPathInfo($subPath);
|
||||
$match = $request;
|
||||
$match = $request;
|
||||
}
|
||||
|
||||
|
||||
$res = $route->match($match, true);
|
||||
if ($res === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$matchedPath = $route->getMatchedPath();
|
||||
|
||||
|
||||
if ($matchedPath !== null) {
|
||||
$subPath = substr($subPath, strlen($matchedPath));
|
||||
$separator = substr($subPath, 0, strlen($this->_separators[$key]));
|
||||
@ -109,9 +109,9 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
|
||||
$values = $res + $values;
|
||||
}
|
||||
|
||||
|
||||
$request->setPathInfo($path);
|
||||
|
||||
|
||||
if ($subPath !== '' && $subPath !== false) {
|
||||
return false;
|
||||
}
|
||||
@ -129,17 +129,17 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
{
|
||||
$value = '';
|
||||
$numRoutes = count($this->_routes);
|
||||
|
||||
|
||||
foreach ($this->_routes as $key => $route) {
|
||||
if ($key > 0) {
|
||||
$value .= $this->_separators[$key];
|
||||
}
|
||||
|
||||
|
||||
$value .= $route->assemble($data, $reset, $encode, (($numRoutes - 1) > $key));
|
||||
|
||||
|
||||
if (method_exists($route, 'getVariables')) {
|
||||
$variables = $route->getVariables();
|
||||
|
||||
|
||||
foreach ($variables as $variable) {
|
||||
$data[$variable] = null;
|
||||
}
|
||||
@ -151,7 +151,7 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
|
||||
|
||||
/**
|
||||
* Set the request object for this and the child routes
|
||||
*
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract|null $request
|
||||
* @return void
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Module.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Module.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -80,11 +80,11 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
public static function getInstance(Zend_Config $config)
|
||||
{
|
||||
$frontController = Zend_Controller_Front::getInstance();
|
||||
|
||||
|
||||
$defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();
|
||||
$dispatcher = $frontController->getDispatcher();
|
||||
$request = $frontController->getRequest();
|
||||
|
||||
|
||||
return new self($defs, $dispatcher, $request);
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
|
||||
$values = array();
|
||||
$params = array();
|
||||
|
||||
|
||||
if (!$partial) {
|
||||
$path = trim($path, self::URI_DELIMITER);
|
||||
} else {
|
||||
@ -182,7 +182,7 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($partial) {
|
||||
$this->setMatchedPath($matchedPath);
|
||||
}
|
||||
@ -233,9 +233,10 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
|
||||
unset($params[$this->_actionKey]);
|
||||
|
||||
foreach ($params as $key => $value) {
|
||||
$key = ($encode) ? urlencode($key) : $key;
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $arrayValue) {
|
||||
if ($encode) $arrayValue = urlencode($arrayValue);
|
||||
$arrayValue = ($encode) ? urlencode($arrayValue) : $arrayValue;
|
||||
$url .= '/' . $key;
|
||||
$url .= '/' . $arrayValue;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Regex.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Regex.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -63,7 +63,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
public function getVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Matches a user submitted path with a previously defined route.
|
||||
* Assigns and returns an array of defaults on a successful match.
|
||||
@ -79,13 +79,13 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
} else {
|
||||
$regex = '#^' . $this->_regex . '#i';
|
||||
}
|
||||
|
||||
|
||||
$res = preg_match($regex, $path, $values);
|
||||
|
||||
|
||||
if ($res === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($partial) {
|
||||
$this->setMatchedPath($values[0]);
|
||||
}
|
||||
@ -185,7 +185,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
foreach ($mergedData as $key => &$value) {
|
||||
$value = urlencode($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($mergedData);
|
||||
|
||||
@ -220,7 +220,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
public function getDefaults() {
|
||||
return $this->_defaults;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all variables which are used by the route
|
||||
*
|
||||
@ -229,7 +229,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
public function getVariables()
|
||||
{
|
||||
$variables = array();
|
||||
|
||||
|
||||
foreach ($this->_map as $key => $value) {
|
||||
if (is_numeric($key)) {
|
||||
$variables[] = $value;
|
||||
@ -237,7 +237,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
|
||||
$variables[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $variables;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Controller
|
||||
* @subpackage Router
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Static.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Static.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -42,7 +42,7 @@ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_A
|
||||
public function getVersion() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates route based on passed Zend_Config structure
|
||||
*
|
||||
@ -85,7 +85,7 @@ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_A
|
||||
return $this->_defaults;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user