API Documentation

Controller/Action/Helper/Redirector.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Controller
subpackage
Zend_Controller_Action_Helper
version
$Id: Redirector.php 22959 2010-09-17 21:00:04Z dragonbe $
Classes
Zend_Controller_Action_Helper_Redirector

Description

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.

Zend_Controller_Action_Helper_Redirector

Extends from
Zend_Controller_Action_Helper_Abstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Controller
subpackage
Zend_Controller_Action_Helper
Properties
$_code
$_exit
$_prependBase
$_redirectUrl
$_useAbsoluteUri
$_closeSessionOnExit
Methods
getCode
_checkCode
setCode
getExit
setExit
getPrependBase
setPrependBase
getCloseSessionOnExit
setCloseSessionOnExit
getUseAbsoluteUri
setUseAbsoluteUri
_redirect
getRedirectUrl
_prependBase
setGotoSimple
setGotoRoute
setGotoUrl
gotoSimple
gotoSimpleAndExit
gotoRoute
gotoRouteAndExit
gotoUrl
gotoUrlAndExit
redirectAndExit
direct
__call

Description

Properties

$_closeSessionOnExit

boolean $_closeSessionOnExit = 'true'

Whether or not to close the session before exiting

Details

$_closeSessionOnExit
boolean
visibility
protected
default
true
final
false
static
false

$_code

int $_code = '302'

HTTP status code for redirects

Details

$_code
int
visibility
protected
default
302
final
false
static
false

$_exit

boolean $_exit = 'true'

Whether or not calls to _redirect() should exit script execution

Details

$_exit
boolean
visibility
protected
default
true
final
false
static
false

$_prependBase

boolean $_prependBase = 'true'

Whether or not _redirect() should attempt to prepend the base URL to the passed URL (if it's a relative URL)

Details

$_prependBase
boolean
visibility
protected
default
true
final
false
static
false

$_redirectUrl

string $_redirectUrl = 'null'

Url to which to redirect

Details

$_redirectUrl
string
visibility
protected
default
null
final
false
static
false

$_useAbsoluteUri

boolean $_useAbsoluteUri = 'false'

Whether or not to use an absolute URI when redirecting

Details

$_useAbsoluteUri
boolean
visibility
protected
default
false
final
false
static
false

Methods

__call

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

Overloading

Overloading for old 'goto', 'setGoto', and 'gotoAndExit' methods

Arguments
$method
string
$args
array
Output
mixed
Details
visibility
public
final
false
static
false
throws
for invalid methods

_checkCode

_checkCode( int $code ) : true

Validate HTTP status redirect code

Arguments
$code
int
Output
true
Details
visibility
protected
final
false
static
false
throws
on invalid HTTP status code

_prependBase

_prependBase( string $url ) : string

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

Arguments
$url
string
Output
string
Details
visibility
protected
final
false
static
false

_redirect

_redirect(  $url ) : void

Set redirect in response object

Arguments
$url
Details
visibility
protected
final
false
static
false

direct

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)

Arguments
$action
string
$controller
string
$module
string
$params
array
Details
visibility
public
final
false
static
false

getCloseSessionOnExit

getCloseSessionOnExit( ) : boolean

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

Output
boolean
Details
visibility
public
final
false
static
false

getCode

getCode( ) : int

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

Output
int
Details
visibility
public
final
false
static
false

getExit

getExit( ) : boolean

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

Output
boolean
Details
visibility
public
final
false
static
false

getPrependBase

getPrependBase( ) : boolean

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

Output
boolean
Details
visibility
public
final
false
static
false

getRedirectUrl

getRedirectUrl( ) : string

Retrieve currently set URL for redirect

Output
string
Details
visibility
public
final
false
static
false

getUseAbsoluteUri

getUseAbsoluteUri( ) : boolean

Return use absolute URI flag

Output
boolean
Details
visibility
public
final
false
static
false

gotoRoute

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.

Arguments
$urlOptions
array
Array of key/value pairs used to assemble URL
$name
string
$reset
boolean
$encode
boolean
Details
visibility
public
final
false
static
false

gotoRouteAndExit

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.

Arguments
$urlOptions
array
Array of key/value pairs used to assemble URL
$name
string
$reset
boolean
Details
visibility
public
final
false
static
false

gotoSimple

gotoSimple( string $action, string $controller = null, string $module = null, array $params = array ) : void

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

Arguments
$action
string
$controller
string
$module
string
$params
array
Details
visibility
public
final
false
static
false

gotoSimpleAndExit

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

Arguments
$action
mixed
$controller
mixed
$module
mixed
$params
array
Details
visibility
public
final
false
static
false

gotoUrl

gotoUrl( string $url, array $options = array ) : void

Perform a redirect to a url

Arguments
$url
string
$options
array
Details
visibility
public
final
false
static
false

gotoUrlAndExit

gotoUrlAndExit( string $url, array $options = array ) : void

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

Arguments
$url
string
$options
array
Details
visibility
public
final
false
static
false

redirectAndExit

redirectAndExit( ) : void

exit(): Perform exit for redirector

Details
visibility
public
final
false
static
false

setCloseSessionOnExit

setCloseSessionOnExit( boolean $flag ) : Zend_Controller_Action_Helper_Redirector

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

Arguments
$flag
boolean
Output
Zend_Controller_Action_Helper_Redirector
Provides a fluent interface
Details
visibility
public
final
false
static
false

setCode

setCode( int $code ) : Zend_Controller_Action_Helper_Redirector

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

Arguments
$code
int
Output
Zend_Controller_Action_Helper_Redirector
Provides a fluent interface
Details
visibility
public
final
false
static
false

setExit

setExit( boolean $flag ) : Zend_Controller_Action_Helper_Redirector

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

Arguments
$flag
boolean
Output
Zend_Controller_Action_Helper_Redirector
Provides a fluent interface
Details
visibility
public
final
false
static
false

setGotoRoute

setGotoRoute( array $urlOptions = array, string $name = null, boolean $reset = false, boolean $encode = true ) : void

Build a URL based on a route

Arguments
$urlOptions
array
$name
string
Route name
$reset
boolean
$encode
boolean
Details
visibility
public
final
false
static
false

setGotoSimple

setGotoSimple( string $action, string $controller = null, string $module = null, array $params = array ) : void

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

Arguments
$action
string
$controller
string
$module
string
$params
array
Details
visibility
public
final
false
static
false

setGotoUrl

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.

Arguments
$url
string
$options
array
Details
visibility
public
final
false
static
false

setPrependBase

setPrependBase( boolean $flag ) : Zend_Controller_Action_Helper_Redirector

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

Arguments
$flag
boolean
Output
Zend_Controller_Action_Helper_Redirector
Provides a fluent interface
Details
visibility
public
final
false
static
false

setUseAbsoluteUri

setUseAbsoluteUri( boolean $flag = true ) : Zend_Controller_Action_Helper_Redirector

Set use absolute URI flag

Arguments
$flag
boolean
Output
Zend_Controller_Action_Helper_Redirector
Provides a fluent interface
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.