Controller/Action/Helper/Redirector.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Controller
- Subpackage
- Zend_Controller_Action_Helper
- Version
- $Id: Redirector.php 24843 2012-05-31 18:43:18Z rob $
\Zend_Controller_Action_Helper_Redirector
- Parent(s)
- \Zend_Controller_Action_Helper_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


\Zend_Controller_Action $_actionController = null
null
Details

boolean $_closeSessionOnExit = true
true
Details- Type
- boolean


boolean $_exit = true
true
Details- Type
- boolean


mixed $_frontController = null
null
Details- Type
- mixed
- Inherited_from
- \Zend_Controller_Action_Helper_Abstract::$$_frontController


boolean $_prependBase = true
true
Details- Type
- boolean
Methods


__call(string $method, array $args) : mixed
Overloading
Overloading for old 'goto', 'setGoto', and 'gotoAndExit' methods
Name | Type | Description |
---|---|---|
$method | string | |
$args | array |
Type | Description |
---|---|
mixed |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception | for invalid methods |


_checkCode(int $code) : true
Validate HTTP status redirect code
Name | Type | Description |
---|---|---|
$code | int |
Type | Description |
---|---|
true |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception | on invalid HTTP status code |


_prependBase(string $url) : string
Determine if the baseUrl should be prepended, and prepend if necessary
Name | Type | Description |
---|---|---|
$url | string |
Type | Description |
---|---|
string |


direct(string $action, string $controller = null, string $module = null, array $params = array()) : void
direct(): Perform helper when called as $this->_helper->redirector($action, $controller, $module, $params)
Name | Type | Description |
---|---|---|
$action | string | |
$controller | string | |
$module | string | |
$params | array |


getActionController() : \Zend_Controller_Action
Retrieve current action controller
Inherited from: \Zend_Controller_Action_Helper_Abstract::getActionController()Type | Description |
---|---|
\Zend_Controller_Action |


getCloseSessionOnExit() : boolean
Retrieve flag for whether or not {@link redirectAndExit()} shall close the session before exiting.
Type | Description |
---|---|
boolean |


getCode() : int
Retrieve HTTP status code to emit on {@link _redirect()} call
Type | Description |
---|---|
int |


getExit() : boolean
Retrieve flag for whether or not {@link _redirect()} will exit when finished.
Type | Description |
---|---|
boolean |


getFrontController() : \Zend_Controller_Front
Retrieve front controller instance
Inherited from: \Zend_Controller_Action_Helper_Abstract::getFrontController()Type | Description |
---|---|
\Zend_Controller_Front |


getPrependBase() : boolean
Retrieve flag for whether or not {@link _redirect()} will prepend the base URL on relative URLs
Type | Description |
---|---|
boolean |


getRequest() : \Zend_Controller_Request_Abstract
Type | Description |
---|---|
\Zend_Controller_Request_Abstract | $request |


getResponse() : \Zend_Controller_Response_Abstract
Type | Description |
---|---|
\Zend_Controller_Response_Abstract | $response |


gotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : void
Redirect to a route-based URL
Uses route's assemble method tobuild the URL; route is specified by $name; default route is used if none provided.
Name | Type | Description |
---|---|---|
$urlOptions | array | Array of key/value pairs used to assemble URL |
$name | string | |
$reset | boolean | |
$encode | boolean |


gotoRouteAndExit(array $urlOptions = array(), string $name = null, boolean $reset = false) : void
Redirect to a route-based URL, and immediately exit
Uses route's assemble method tobuild the URL; route is specified by $name; default route is used if none provided.
Name | Type | Description |
---|---|---|
$urlOptions | array | Array of key/value pairs used to assemble URL |
$name | string | |
$reset | boolean |


gotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : void
Perform a redirect to an action/controller/module with params
Name | Type | Description |
---|---|---|
$action | string | |
$controller | string | |
$module | string | |
$params | array |


gotoSimpleAndExit(mixed $action, mixed $controller = null, mixed $module = null, array $params = array()) : void
Perform a redirect to an action/controller/module with params, forcing an immdiate exit
Name | Type | Description |
---|---|---|
$action | mixed | |
$controller | mixed | |
$module | mixed | |
$params | array |


gotoUrl(string $url, array $options = array()) : void
Perform a redirect to a url
Name | Type | Description |
---|---|---|
$url | string | |
$options | array |


gotoUrlAndExit(string $url, array $options = array()) : void
Set a URL string for a redirect, perform redirect, and immediately exit
Name | Type | Description |
---|---|---|
$url | string | |
$options | array |


init() : void
Hook into action controller initialization
Inherited from: \Zend_Controller_Action_Helper_Abstract::init()

postDispatch() : void
Hook into action controller postDispatch() workflow
Inherited from: \Zend_Controller_Action_Helper_Abstract::postDispatch()

preDispatch() : void
Hook into action controller preDispatch() workflow
Inherited from: \Zend_Controller_Action_Helper_Abstract::preDispatch()

setActionController(\Zend_Controller_Action $actionController = null) : \Zend_Controller_ActionHelper_Abstract
setActionController()
Inherited from: \Zend_Controller_Action_Helper_Abstract::setActionController()Name | Type | Description |
---|---|---|
$actionController | \Zend_Controller_Action |
Type | Description |
---|---|
\Zend_Controller_ActionHelper_Abstract | Provides a fluent interface |


setCloseSessionOnExit(boolean $flag) : \Zend_Controller_Action_Helper_Redirector
Set flag for whether or not {@link redirectAndExit()} shall close the session before exiting.
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_Redirector | Provides a fluent interface |


setCode(int $code) : \Zend_Controller_Action_Helper_Redirector
Set HTTP status code for {@link _redirect()} behaviour
Name | Type | Description |
---|---|---|
$code | int |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_Redirector | Provides a fluent interface |


setExit(boolean $flag) : \Zend_Controller_Action_Helper_Redirector
Set exit flag for {@link _redirect()} behaviour
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_Redirector | Provides a fluent interface |


setGotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : void
Build a URL based on a route
Name | Type | Description |
---|---|---|
$urlOptions | array | |
$name | string | Route name |
$reset | boolean | |
$encode | boolean |


setGotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : void
Set a redirect URL of the form /module/controller/action/params
Name | Type | Description |
---|---|---|
$action | string | |
$controller | string | |
$module | string | |
$params | array |


setGotoUrl(string $url, array $options = array()) : void
Set a redirect URL string
By default, emits a 302 HTTP status header, prepends base URL as defined in request object if url is relative, and halts script execution by calling exit().
$options is an optional associative array that can be used to control redirect behaviour. The available option keys are: - exit: boolean flag indicating whether or not to halt script execution when done - prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided - code: integer HTTP status code to use with redirect. Should be between 300 and 307.
_redirect() sets the Location header in the response object. If you set the exit flag to false, you can override this header later in code execution.
If the exit flag is true (true by default), _redirect() will write and close the current session, if any.
Name | Type | Description |
---|---|---|
$url | string | |
$options | array |


setPrependBase(boolean $flag) : \Zend_Controller_Action_Helper_Redirector
Set 'prepend base' flag for {@link _redirect()} behaviour
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_Redirector | Provides a fluent interface |


setUseAbsoluteUri(boolean $flag = true) : \Zend_Controller_Action_Helper_Redirector
Set use absolute URI flag
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_Redirector | Provides a fluent interface |