Controller/Action/Helper/Redirector.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Controller  
Subpackage
Zend_Controller_Action_Helper  
Version
$Id$  

\Zend_Controller_Action_Helper_Redirector

Package: Zend_Controller\Zend_Controller_Action_Helper
Parent(s)
\Zend_Controller_Action_Helper_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedboolean $_closeSessionOnExit = true
Whether or not to close the session before exiting
Default valuetrueDetails
Type
boolean
>VPropertyprotectedint $_code = 302
HTTP status code for redirects
Default value302Details
Type
int
>VPropertyprotectedboolean $_exit = true
Whether or not calls to _redirect() should exit script execution
Default valuetrueDetails
Type
boolean
>VPropertyprotectedboolean $_prependBase = true
Whether or not _redirect() should attempt to prepend the base URL to the passed URL (if it's a relative URL)
Default valuetrueDetails
Type
boolean
>VPropertyprotectedstring $_redirectUrl = null
Url to which to redirect
Default valuenullDetails
Type
string
>VPropertyprotectedboolean $_useAbsoluteUri = false
Whether or not to use an absolute URI when redirecting
Default valuefalseDetails
Type
boolean

Methods

methodpublic__call(string $method, array $args) : mixed

Overloading

Overloading for old 'goto', 'setGoto', and 'gotoAndExit' methods
Parameters
NameTypeDescription
$methodstring
$argsarray
Returns
TypeDescription
mixed
Throws
ExceptionDescription
\Zend_Controller_Action_Exceptionfor invalid methods
methodprotected_checkCode(int $code) : true

Validate HTTP status redirect code

Parameters
NameTypeDescription
$codeint
Returns
TypeDescription
true
Throws
ExceptionDescription
\Zend_Controller_Action_Exceptionon invalid HTTP status code
methodprotected_prependBase(string $url) : string

Determine if the baseUrl should be prepended, and prepend if necessary

Parameters
NameTypeDescription
$urlstring
Returns
TypeDescription
string
methodprotected_redirect( $url) : void

Set redirect in response object

Parameters
NameTypeDescription
$url
methodpublicdirect(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)

Parameters
NameTypeDescription
$actionstring
$controllerstring
$modulestring
$paramsarray
methodpublicgetCloseSessionOnExit() : boolean

Retrieve flag for whether or not {@link redirectAndExit()} shall close the session before exiting.

Returns
TypeDescription
boolean
methodpublicgetCode() : int

Retrieve HTTP status code to emit on {@link _redirect()} call

Returns
TypeDescription
int
methodpublicgetExit() : boolean

Retrieve flag for whether or not {@link _redirect()} will exit when finished.

Returns
TypeDescription
boolean
methodpublicgetPrependBase() : boolean

Retrieve flag for whether or not {@link _redirect()} will prepend the base URL on relative URLs

Returns
TypeDescription
boolean
methodpublicgetRedirectUrl() : string

Retrieve currently set URL for redirect

Returns
TypeDescription
string
methodpublicgetUseAbsoluteUri() : boolean

Return use absolute URI flag

Returns
TypeDescription
boolean
methodpublicgotoRoute(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.
Parameters
NameTypeDescription
$urlOptionsarray

Array of key/value pairs used to assemble URL

$namestring
$resetboolean
$encodeboolean
methodpublicgotoRouteAndExit(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.
Parameters
NameTypeDescription
$urlOptionsarray

Array of key/value pairs used to assemble URL

$namestring
$resetboolean
methodpublicgotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : void

Perform a redirect to an action/controller/module with params

Parameters
NameTypeDescription
$actionstring
$controllerstring
$modulestring
$paramsarray
methodpublicgotoSimpleAndExit(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

Parameters
NameTypeDescription
$actionmixed
$controllermixed
$modulemixed
$paramsarray
methodpublicgotoUrl(string $url, array $options = array()) : void

Perform a redirect to a url

Parameters
NameTypeDescription
$urlstring
$optionsarray
methodpublicgotoUrlAndExit(string $url, array $options = array()) : void

Set a URL string for a redirect, perform redirect, and immediately exit

Parameters
NameTypeDescription
$urlstring
$optionsarray
methodpublicredirectAndExit() : void

exit(): Perform exit for redirector

methodpublicsetCloseSessionOnExit(boolean $flag) : \Zend_Controller_Action_Helper_Redirector

Set flag for whether or not {@link redirectAndExit()} shall close the session before exiting.

Parameters
NameTypeDescription
$flagboolean
Returns
TypeDescription
\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface
methodpublicsetCode(int $code) : \Zend_Controller_Action_Helper_Redirector

Set HTTP status code for {@link _redirect()} behaviour

Parameters
NameTypeDescription
$codeint
Returns
TypeDescription
\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface
methodpublicsetExit(boolean $flag) : \Zend_Controller_Action_Helper_Redirector

Set exit flag for {@link _redirect()} behaviour

Parameters
NameTypeDescription
$flagboolean
Returns
TypeDescription
\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface
methodpublicsetGotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : void

Build a URL based on a route

Parameters
NameTypeDescription
$urlOptionsarray
$namestring

Route name

$resetboolean
$encodeboolean
methodpublicsetGotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : void

Set a redirect URL of the form /module/controller/action/params

Parameters
NameTypeDescription
$actionstring
$controllerstring
$modulestring
$paramsarray
methodpublicsetGotoUrl(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.
Parameters
NameTypeDescription
$urlstring
$optionsarray
methodpublicsetPrependBase(boolean $flag) : \Zend_Controller_Action_Helper_Redirector

Set 'prepend base' flag for {@link _redirect()} behaviour

Parameters
NameTypeDescription
$flagboolean
Returns
TypeDescription
\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface
methodpublicsetUseAbsoluteUri(boolean $flag = true) : \Zend_Controller_Action_Helper_Redirector

Set use absolute URI flag

Parameters
NameTypeDescription
$flagboolean
Returns
TypeDescription
\Zend_Controller_Action_Helper_RedirectorProvides a fluent interface
Documentation was generated by phpDocumentor 2.2.0 .