Controller/Front.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Controller
- Version
- $Id$
\Zend_Controller_Front
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
string|array $_controllerDir = null
null
Details- Type
- string | array
\Zend_Controller_Dispatcher_Interface $_dispatcher = null
null
Details\Zend_Controller_Front $_instance = null
null
Detailsarray $_invokeParams = array()
array()
Details- Type
- array
string $_moduleControllerDirectoryName = 'controllers'
'controllers'
Details- Type
- string
\Zend_Controller_Plugin_Broker $_plugins = null
null
Details\Zend_Controller_Request_Abstract $_request = null
null
Details\Zend_Controller_Response_Abstract $_response = null
null
Detailsboolean $_returnResponse = false
false
Details- Type
- boolean
\Zend_Controller_Router_Interface $_router = null
null
DetailsMethods
__construct() : void
Constructor
addControllerDirectory(string $directory, string $module = null) : \Zend_Controller_Front
Add a controller directory to the controller directory stack
Name | Type | Description |
---|---|---|
$directory | string | |
$module | string | Optional argument; module with which to associate directory. If none provided, assumes 'default' |
Type | Description |
---|---|
\Zend_Controller_Front |
Exception | Description |
---|---|
\Zend_Controller_Exception | if directory not found or readable |
addModuleDirectory(string $path) : \Zend_Controller_Front
Specify a directory as containing modules
Name | Type | Description |
---|---|---|
$path | string |
Type | Description |
---|---|
\Zend_Controller_Front |
clearParams( $name = null) : \Zend_Controller_Front
Clear the controller parameter stack
Name | Type | Description |
---|---|---|
$name |
Type | Description |
---|---|
\Zend_Controller_Front |
dispatch(\Zend_Controller_Request_Abstract | null $request = null, \Zend_Controller_Response_Abstract | null $response = null) : void | \Zend_Controller_Response_Abstract
Dispatch an HTTP request to a controller/action.
Name | Type | Description |
---|---|---|
$request | \Zend_Controller_Request_Abstract | null | |
$response | \Zend_Controller_Response_Abstract | null |
Type | Description |
---|---|
void | \Zend_Controller_Response_Abstract | Returns response object if returnResponse() is true |
getControllerDirectory(string $name = null) : array | string | null
Retrieve controller directory
Name | Type | Description |
---|---|---|
$name | string | Default null |
Type | Description |
---|---|
array | string | null |
getDefaultAction() : string
Retrieve the default action (unformatted string)
Type | Description |
---|---|
string |
getDefaultControllerName() : string
Retrieve the default controller (unformatted string)
Type | Description |
---|---|
string |
getDispatcher() : \Zend_Controller_Dispatcher_Interface
Return the dispatcher object.
Type | Description |
---|---|
\Zend_Controller_Dispatcher_Interface |
getInstance() : \Zend_Controller_Front
Singleton instance
Type | Description |
---|---|
\Zend_Controller_Front |
getModuleControllerDirectoryName() : string
Return the directory name within a module containing controllers
Type | Description |
---|---|
string |
getModuleDirectory(string $module = null) : string | null
Return the path to a module directory (but not the controllers directory within)
Name | Type | Description |
---|---|---|
$module | string |
Type | Description |
---|---|
string | null |
getParam(string $name) : mixed
Retrieve a single parameter from the controller parameter stack
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
mixed |
getPlugin(string $class) : false | \Zend_Controller_Plugin_Abstract | array
Retrieve a plugin or plugins by class
Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
false | \Zend_Controller_Plugin_Abstract | array |
getRequest() : null | \Zend_Controller_Request_Abstract
Return the request object.
Type | Description |
---|---|
null | \Zend_Controller_Request_Abstract |
getResponse() : null | \Zend_Controller_Response_Abstract
Return the response object.
Type | Description |
---|---|
null | \Zend_Controller_Response_Abstract |
getRouter() : \Zend_Controller_Router_Interface
Return the router object.
Type | Description |
---|---|
\Zend_Controller_Router_Interface |
hasPlugin(string $class) : bool
Is a particular plugin registered?
Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
bool |
registerPlugin(\Zend_Controller_Plugin_Abstract $plugin, int $stackIndex = null) : \Zend_Controller_Front
Register a plugin.
Name | Type | Description |
---|---|---|
$plugin | \Zend_Controller_Plugin_Abstract | |
$stackIndex | int | Optional; stack index for plugin |
Type | Description |
---|---|
\Zend_Controller_Front |
removeControllerDirectory(string $module) : bool
Remove a controller directory by module name
Name | Type | Description |
---|---|---|
$module | string |
Type | Description |
---|---|
bool |
resetInstance() : void
Resets all object properties of the singleton instance
returnResponse(boolean $flag = null) : boolean | \Zend_Controller_Front
Set whether {@link dispatch()} should return the response without first rendering output. By default, output is rendered and dispatch() returns nothing.
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
boolean | \Zend_Controller_Front | Used as a setter, returns object; as a getter, returns boolean |
run(string | array $controllerDirectory) : void
Convenience feature, calls setControllerDirectory()->setRouter()->dispatch()
Name | Type | Description |
---|---|---|
$controllerDirectory | string | array | Path to Zend_Controller_Action controller classes or array of such paths |
Exception | Description |
---|---|
\Zend_Controller_Exception | if called from an object instance |
setBaseUrl(string $base = null) : \Zend_Controller_Front
Set the base URL used for requests
Name | Type | Description |
---|---|---|
$base | string |
Type | Description |
---|---|
\Zend_Controller_Front |
Exception | Description |
---|---|
\Zend_Controller_Exception | for non-string $base |
setControllerDirectory(string | array $directory, string $module = null) : \Zend_Controller_Front
Set controller directory
Name | Type | Description |
---|---|---|
$directory | string | array | Path to Zend_Controller_Action controller classes or array of such paths |
$module | string | Optional module name to use with string $directory |
Type | Description |
---|---|
\Zend_Controller_Front |
setDefaultAction(string $action) : \Zend_Controller_Front
Set the default action (unformatted string)
Name | Type | Description |
---|---|---|
$action | string |
Type | Description |
---|---|
\Zend_Controller_Front |
setDefaultControllerName(string $controller) : \Zend_Controller_Front
Set the default controller (unformatted string)
Name | Type | Description |
---|---|---|
$controller | string |
Type | Description |
---|---|
\Zend_Controller_Front |
setDefaultModule(string $module) : \Zend_Controller_Front
Set the default module name
Name | Type | Description |
---|---|---|
$module | string |
Type | Description |
---|---|
\Zend_Controller_Front |
setDispatcher(\Zend_Controller_Dispatcher_Interface $dispatcher) : \Zend_Controller_Front
Set the dispatcher object. The dispatcher is responsible for taking a Zend_Controller_Dispatcher_Token object, instantiating the controller, and call the action method of the controller.
Name | Type | Description |
---|---|---|
$dispatcher | \Zend_Controller_Dispatcher_Interface |
Type | Description |
---|---|
\Zend_Controller_Front |
setModuleControllerDirectoryName(string $name = 'controllers') : \Zend_Controller_Front
Set the directory name within a module containing controllers
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
\Zend_Controller_Front |
setParam(string $name, mixed $value) : \Zend_Controller_Front
Add or modify a parameter to use when instantiating an action controller
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Controller_Front |
setParams(array $params) : \Zend_Controller_Front
Set parameters to pass to action controller constructors
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
\Zend_Controller_Front |
setRequest(string | \Zend_Controller_Request_Abstract $request) : \Zend_Controller_Front
Set request class/object
Name | Type | Description |
---|---|---|
$request | string | \Zend_Controller_Request_Abstract |
Type | Description |
---|---|
\Zend_Controller_Front |
Exception | Description |
---|---|
\Zend_Controller_Exception | if invalid request class |
setResponse(string | \Zend_Controller_Response_Abstract $response) : \Zend_Controller_Front
Set response class/object
Name | Type | Description |
---|---|---|
$response | string | \Zend_Controller_Response_Abstract |
Type | Description |
---|---|
\Zend_Controller_Front |
Exception | Description |
---|---|
\Zend_Controller_Exception | if invalid response class |
setRouter(string | \Zend_Controller_Router_Interface $router) : \Zend_Controller_Front
Set router class/object
Name | Type | Description |
---|---|---|
$router | string | \Zend_Controller_Router_Interface |
Type | Description |
---|---|
\Zend_Controller_Front |
Exception | Description |
---|---|
\Zend_Controller_Exception | if invalid router class |
throwExceptions(boolean $flag = null) : boolean | \Zend_Controller_Front
Set the throwExceptions flag and retrieve current status
Name | Type | Description |
---|---|---|
$flag | boolean | Defaults to null (return flag state) |
Type | Description |
---|---|
boolean | \Zend_Controller_Front | Used as a setter, returns object; as a getter, returns boolean |
unregisterPlugin(string | \Zend_Controller_Plugin_Abstract $plugin) : \Zend_Controller_Front
Unregister a plugin.
Name | Type | Description |
---|---|---|
$plugin | string | \Zend_Controller_Plugin_Abstract | Plugin class or object to unregister |
Type | Description |
---|---|
\Zend_Controller_Front |