diff --git a/library/Zend/Controller/Plugin/ActionStack.php b/library/Zend/Controller/Plugin/ActionStack.php old mode 100644 new mode 100755 index 8a96280..fbde00e --- a/library/Zend/Controller/Plugin/ActionStack.php +++ b/library/Zend/Controller/Plugin/ActionStack.php @@ -52,12 +52,21 @@ 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 +92,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 +104,7 @@ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract /** * Retrieve registry object - * + * * @return Zend_Registry */ public function getRegistry() @@ -125,9 +134,35 @@ 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 +174,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 +187,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 +200,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 +244,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,12 +265,17 @@ 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) { + if($this->getClearRequestParams()) + { + $this->getRequest()->clearParams(); + } + $this->getRequest()->setModuleName($next->getModuleName()) ->setControllerName($next->getControllerName()) ->setActionName($next->getActionName()) diff --git a/library/Zend/Controller/Request/Abstract.php b/library/Zend/Controller/Request/Abstract.php old mode 100644 new mode 100755 index 2e1e1a3..513d70b --- a/library/Zend/Controller/Request/Abstract.php +++ b/library/Zend/Controller/Request/Abstract.php @@ -321,6 +321,20 @@ abstract class Zend_Controller_Request_Abstract return $this; } + + /** + * Unset all action parameters + * + * @return Zend_Controller_Request_Abstract + */ + public function clearParams() + { + $this->_params = array(); + return $this; + } + + + /** * Set flag indicating whether or not request has been dispatched *