⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 action.php

📁 Bug tracker, and reporter.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
     *     * @param array $args     * @return Zend_Controller_Action     */    protected function _setInvokeArgs(array $args = array())    {        $this->_invokeArgs = $args;        return $this;    }    /**     * Return the array of constructor arguments (minus the Request object)     *     * @return array     */    public function getInvokeArgs()    {        return $this->_invokeArgs;    }    /**     * Return a single invocation argument     *     * @param string $key     * @return mixed     */    public function getInvokeArg($key)    {        if (isset($this->_invokeArgs[$key])) {            return $this->_invokeArgs[$key];        }        return null;    }    /**     * Get a helper by name     *     * @param  string $helperName     * @return Zend_Controller_Action_Helper_Abstract     */    public function getHelper($helperName)    {        return $this->_helper->{$helperName};    }    /**     * Get a clone of a helper by name     *     * @param  string $helperName     * @return Zend_Controller_Action_Helper_Abstract     */    public function getHelperCopy($helperName)    {        return clone $this->_helper->{$helperName};    }    /**     * Set the front controller instance     *     * @param Zend_Controller_Front $front     * @return Zend_Controller_Action     */    public function setFrontController(Zend_Controller_Front $front)    {        $this->_frontController = $front;        return $this;    }    /**     * Retrieve Front Controller     *     * @return Zend_Controller_Front     */    public function getFrontController()    {        // Used cache version if found        if (null !== $this->_frontController) {            return $this->_frontController;        }        // Grab singleton instance, if class has been loaded        if (class_exists('Zend_Controller_Front')) {            $this->_frontController = Zend_Controller_Front::getInstance();            return $this->_frontController;        }        // Throw exception in all other cases        require_once 'Zend/Controller/Exception.php';        throw new Zend_Controller_Exception('Front controller class has not been loaded');    }    /**     * Pre-dispatch routines     *     * Called before action method. If using class with     * {@link Zend_Controller_Front}, it may modify the     * {@link $_request Request object} and reset its dispatched flag in order     * to skip processing the current action.     *     * @return void     */    public function preDispatch()    {    }    /**     * Post-dispatch routines     *     * Called after action method execution. If using class with     * {@link Zend_Controller_Front}, it may modify the     * {@link $_request Request object} and reset its dispatched flag in order     * to process an additional action.     *     * Common usages for postDispatch() include rendering content in a sitewide     * template, link url correction, setting headers, etc.     *     * @return void     */    public function postDispatch()    {    }    /**     * Proxy for undefined methods.  Default behavior is to throw an     * exception on undefined methods, however this function can be     * overridden to implement magic (dynamic) actions, or provide run-time     * dispatching.     *     * @param string $methodName     * @param array $args     */    public function __call($methodName, $args)    {        if ('Action' == substr($methodName, -6)) {            require_once 'Zend/Controller/Action/Exception.php';            $action = substr($methodName, 0, strlen($methodName) - 6);            throw new Zend_Controller_Action_Exception(sprintf('Action "%s" does not exist and was not trapped in __call()', $action), 404);        }        require_once 'Zend/Controller/Action/Exception.php';        throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does not exist and was not trapped in __call()', $methodName), 500);    }    /**     * Dispatch the requested action     *     * @param string $action Method name of action     * @return void     */    public function dispatch($action)    {        // Notify helpers of action preDispatch state        $this->_helper->notifyPreDispatch();        $this->preDispatch();        if ($this->getRequest()->isDispatched()) {            // preDispatch() didn't change the action, so we can continue            if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, get_class_methods($this))) {                if ($this->getInvokeArg('useCaseSensitiveActions')) {                    trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"');                }                $this->$action();            } else {                $this->__call($action, array());            }            $this->postDispatch();        }        // whats actually important here is that this action controller is        // shutting down, regardless of dispatching; notify the helpers of this        // state        $this->_helper->notifyPostDispatch();    }    /**     * Call the action specified in the request object, and return a response     *     * Not used in the Action Controller implementation, but left for usage in     * Page Controller implementations. Dispatches a method based on the     * request.     *     * Returns a Zend_Controller_Response_Abstract object, instantiating one     * prior to execution if none exists in the controller.     *     * {@link preDispatch()} is called prior to the action,     * {@link postDispatch()} is called following it.     *     * @param null|Zend_Controller_Request_Abstract $request Optional request     * object to use     * @param null|Zend_Controller_Response_Abstract $response Optional response     * object to use     * @return Zend_Controller_Response_Abstract     */    public function run(Zend_Controller_Request_Abstract $request = null, Zend_Controller_Response_Abstract $response = null)    {        if (null !== $request) {            $this->setRequest($request);        } else {            $request = $this->getRequest();        }        if (null !== $response) {            $this->setResponse($response);        }        $action = $request->getActionName();        if (empty($action)) {            $action = 'index';        }        $action = $action . 'Action';        $request->setDispatched(true);        $this->dispatch($action);        return $this->getResponse();    }    /**     * Gets a parameter from the {@link $_request Request object}.  If the     * parameter does not exist, NULL will be returned.     *     * If the parameter does not exist and $default is set, then     * $default will be returned instead of NULL.     *     * @param string $paramName     * @param mixed $default     * @return mixed     */    final protected function _getParam($paramName, $default = null)    {        $value = $this->getRequest()->getParam($paramName);        if ((null == $value) && (null !== $default)) {            $value = $default;        }        return $value;    }    /**     * Set a parameter in the {@link $_request Request object}.     *     * @param string $paramName     * @param mixed $value     * @return Zend_Controller_Action     */    final protected function _setParam($paramName, $value)    {        $this->getRequest()->setParam($paramName, $value);        return $this;    }    /**     * Determine whether a given parameter exists in the     * {@link $_request Request object}.     *     * @param string $paramName     * @return boolean     */    final protected function _hasParam($paramName)    {        return null !== $this->getRequest()->getParam($paramName);    }    /**     * Return all parameters in the {@link $_request Request object}     * as an associative array.     *     * @return array     */    final protected function _getAllParams()    {        return $this->getRequest()->getParams();    }    /**     * Forward to another controller/action.     *     * It is important to supply the unformatted names, i.e. "article"     * rather than "ArticleController".  The dispatcher will do the     * appropriate formatting when the request is received.     *     * If only an action name is provided, forwards to that action in this     * controller.     *     * If an action and controller are specified, forwards to that action and     * controller in this module.     *     * Specifying an action, controller, and module is the most specific way to     * forward.     *     * A fourth argument, $params, will be used to set the request parameters.     * If either the controller or module are unnecessary for forwarding,     * simply pass null values for them before specifying the parameters.     *     * @param string $action     * @param string $controller     * @param string $module     * @param array $params     * @return void     */    final protected function _forward($action, $controller = null, $module = null, array $params = null)    {        $request = $this->getRequest();        if (null !== $params) {            $request->setParams($params);        }        if (null !== $controller) {            $request->setControllerName($controller);            // Module should only be reset if controller has been specified            if (null !== $module) {                $request->setModuleName($module);            }        }        $request->setActionName($action)                ->setDispatched(false);    }    /**     * Redirect to another URL     *     * Proxies to {@link Zend_Controller_Action_Helper_Redirector::gotoUrl()}.     *     * @param string $url     * @param array $options Options to be used when redirecting     * @return void     */    protected function _redirect($url, array $options = array())    {        $this->_helper->redirector->gotoUrl($url, $options);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -