Zend Framework
1.12
|
Public Member Functions | |
resetInstance () | |
Resets all object properties of the singleton instance. | |
addControllerDirectory ($directory, $module=null) | |
Add a controller directory to the controller directory stack. | |
setControllerDirectory ($directory, $module=null) | |
Set controller directory. | |
getControllerDirectory ($name=null) | |
Retrieve controller directory. | |
removeControllerDirectory ($module) | |
Remove a controller directory by module name. | |
addModuleDirectory ($path) | |
Specify a directory as containing modules. | |
getModuleDirectory ($module=null) | |
Return the path to a module directory (but not the controllers directory within) | |
setModuleControllerDirectoryName ($name= 'controllers') | |
Set the directory name within a module containing controllers. | |
getModuleControllerDirectoryName () | |
Return the directory name within a module containing controllers. | |
setDefaultControllerName ($controller) | |
Set the default controller (unformatted string) | |
getDefaultControllerName () | |
Retrieve the default controller (unformatted string) | |
setDefaultAction ($action) | |
Set the default action (unformatted string) | |
getDefaultAction () | |
Retrieve the default action (unformatted string) | |
setDefaultModule ($module) | |
Set the default module name. | |
getDefaultModule () | |
Retrieve the default module. | |
setRequest ($request) | |
Set request class/object. | |
getRequest () | |
Return the request object. | |
setRouter ($router) | |
Set router class/object. | |
getRouter () | |
Return the router object. | |
setBaseUrl ($base=null) | |
Set the base URL used for requests. | |
getBaseUrl () | |
Retrieve the currently set base URL. | |
setDispatcher (Zend_Controller_Dispatcher_Interface $dispatcher) | |
Set the dispatcher object. | |
getDispatcher () | |
Return the dispatcher object. | |
setResponse ($response) | |
Set response class/object. | |
getResponse () | |
Return the response object. | |
setParam ($name, $value) | |
Add or modify a parameter to use when instantiating an action controller. | |
setParams (array $params) | |
Set parameters to pass to action controller constructors. | |
getParam ($name) | |
Retrieve a single parameter from the controller parameter stack. | |
getParams () | |
Retrieve action controller instantiation parameters. | |
clearParams ($name=null) | |
Clear the controller parameter stack. | |
registerPlugin (Zend_Controller_Plugin_Abstract $plugin, $stackIndex=null) | |
Register a plugin. | |
unregisterPlugin ($plugin) | |
Unregister a plugin. | |
hasPlugin ($class) | |
Is a particular plugin registered? | |
getPlugin ($class) | |
Retrieve a plugin or plugins by class. | |
getPlugins () | |
Retrieve all plugins. | |
throwExceptions ($flag=null) | |
Set the throwExceptions flag and retrieve current status. | |
returnResponse ($flag=null) | |
Set whether dispatch() should return the response without first rendering output. | |
dispatch (Zend_Controller_Request_Abstract $request=null, Zend_Controller_Response_Abstract $response=null) | |
Dispatch an HTTP request to a controller/action. | |
Static Public Member Functions | |
static | getInstance () |
Singleton instance. | |
static | run ($controllerDirectory) |
Convenience feature, calls setControllerDirectory()->setRouter()->dispatch() | |
Protected Member Functions | |
__construct () | |
Constructor. | |
Protected Attributes | |
$_baseUrl = null | |
$_controllerDir = null | |
$_dispatcher = null | |
$_invokeParams = array() | |
$_moduleControllerDirectoryName = 'controllers' | |
$_plugins = null | |
$_request = null | |
$_response = null | |
$_returnResponse = false | |
$_router = null | |
$_throwExceptions = false | |
Static Protected Attributes | |
static | $_instance = null |
|
protected |
Constructor.
Instantiate using getInstance(); front controller is a singleton object.
Instantiates the plugin broker.
addControllerDirectory | ( | $directory, | |
$module = null |
|||
) |
Add a controller directory to the controller directory stack.
If $args is presented and is a string, uses it for the array key mapping to the directory specified.
string | $directory | |
string | $module | Optional argument; module with which to associate directory. If none provided, assumes 'default' |
Zend_Controller_Exception | if directory not found or readable |
addModuleDirectory | ( | $path | ) |
Specify a directory as containing modules.
Iterates through the directory, adding any subdirectories as modules; the subdirectory within each module named after $_moduleControllerDirectoryName will be used as the controller directory path.
string | $path |
clearParams | ( | $name = null | ) |
Clear the controller parameter stack.
By default, clears all parameters. If a parameter name is given, clears only that parameter; if an array of parameter names is provided, clears each.
null|string|array | single key or array of keys for params to clear |
dispatch | ( | Zend_Controller_Request_Abstract | $request = null , |
Zend_Controller_Response_Abstract | $response = null |
||
) |
Dispatch an HTTP request to a controller/action.
Zend_Controller_Request_Abstract | null | $request | |
Zend_Controller_Response_Abstract | null | $response |
Instantiate default request object (HTTP version) if none provided
Set base URL of request object, if available
Instantiate default response object (HTTP version) if none provided
Register request and response objects with plugin broker
Initialize router
Initialize dispatcher
Route request to controller/action, if a router is provided
Notify plugins of router startup
Notify plugins of router completion
Notify plugins of dispatch loop startup
Attempt to dispatch the controller/action. If the $this->_request indicates that it needs to be dispatched, move to the next action in the request.
Notify plugins of dispatch startup
Skip requested action if preDispatch() has reset it
Dispatch request
Notify plugins of dispatch completion
Notify plugins of dispatch loop completion
getBaseUrl | ( | ) |
Retrieve the currently set base URL.
getControllerDirectory | ( | $name = null | ) |
Retrieve controller directory.
Retrieves:
string | $name | Default null |
getDefaultAction | ( | ) |
Retrieve the default action (unformatted string)
getDefaultControllerName | ( | ) |
Retrieve the default controller (unformatted string)
getDefaultModule | ( | ) |
Retrieve the default module.
getDispatcher | ( | ) |
Return the dispatcher object.
Instantiate the default dispatcher if one was not set.
|
static |
Singleton instance.
getModuleControllerDirectoryName | ( | ) |
Return the directory name within a module containing controllers.
getModuleDirectory | ( | $module = null | ) |
Return the path to a module directory (but not the controllers directory within)
string | $module |
getParam | ( | $name | ) |
Retrieve a single parameter from the controller parameter stack.
string | $name |
getParams | ( | ) |
Retrieve action controller instantiation parameters.
getPlugin | ( | $class | ) |
Retrieve a plugin or plugins by class.
string | $class |
getPlugins | ( | ) |
Retrieve all plugins.
getRequest | ( | ) |
Return the request object.
getResponse | ( | ) |
Return the response object.
getRouter | ( | ) |
Return the router object.
Instantiates a Zend_Controller_Router_Rewrite object if no router currently set.
hasPlugin | ( | $class | ) |
Is a particular plugin registered?
string | $class |
registerPlugin | ( | Zend_Controller_Plugin_Abstract | $plugin, |
$stackIndex = null |
|||
) |
Register a plugin.
Zend_Controller_Plugin_Abstract | $plugin | |
int | $stackIndex | Optional; stack index for plugin |
removeControllerDirectory | ( | $module | ) |
Remove a controller directory by module name.
string | $module |
resetInstance | ( | ) |
Resets all object properties of the singleton instance.
Primarily used for testing; could be used to chain front controllers.
Also resets action helper broker, clearing all registered helpers.
returnResponse | ( | $flag = null | ) |
Set whether dispatch() should return the response without first rendering output.
By default, output is rendered and dispatch() returns nothing.
boolean | $flag |
|
static |
Convenience feature, calls setControllerDirectory()->setRouter()->dispatch()
In PHP 5.1.x, a call to a static method never populates $this – so run() may actually be called after setting up your front controller.
string | array | $controllerDirectory | Path to Zend_Controller_Action controller classes or array of such paths |
Zend_Controller_Exception | if called from an object instance |
setBaseUrl | ( | $base = null | ) |
Set the base URL used for requests.
Use to set the base URL segment of the REQUEST_URI to use when determining PATH_INFO, etc. Examples:
Note that the URL should not include the full URI. Do not use:
If a null value is passed, this can be used as well for autodiscovery (default).
string | $base |
Zend_Controller_Exception | for non-string $base |
setControllerDirectory | ( | $directory, | |
$module = null |
|||
) |
Set controller directory.
Stores controller directory(ies) in dispatcher. May be an array of directories or a string containing a single directory.
string | array | $directory | Path to Zend_Controller_Action controller classes or array of such paths |
string | $module | Optional module name to use with string $directory |
setDefaultAction | ( | $action | ) |
setDefaultControllerName | ( | $controller | ) |
Set the default controller (unformatted string)
string | $controller |
setDefaultModule | ( | $module | ) |
setDispatcher | ( | Zend_Controller_Dispatcher_Interface | $dispatcher | ) |
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.
Zend_Controller_Dispatcher_Interface | $dispatcher |
setModuleControllerDirectoryName | ( | $name = 'controllers' | ) |
Set the directory name within a module containing controllers.
string | $name |
setParam | ( | $name, | |
$value | |||
) |
Add or modify a parameter to use when instantiating an action controller.
string | $name | |
mixed | $value |
setParams | ( | array | $params | ) |
Set parameters to pass to action controller constructors.
array | $params |
setRequest | ( | $request | ) |
Set request class/object.
Set the request object. The request holds the request environment.
If a class name is provided, it will instantiate it
string | Zend_Controller_Request_Abstract | $request |
Zend_Controller_Exception | if invalid request class |
setResponse | ( | $response | ) |
Set response class/object.
Set the response object. The response is a container for action responses and headers. Usage is optional.
If a class name is provided, instantiates a response object.
string | Zend_Controller_Response_Abstract | $response |
Zend_Controller_Exception | if invalid response class |
setRouter | ( | $router | ) |
Set router class/object.
Set the router object. The router is responsible for mapping the request to a controller and action.
If a class name is provided, instantiates router with any parameters registered via setParam() or setParams().
string | Zend_Controller_Router_Interface | $router |
Zend_Controller_Exception | if invalid router class |
throwExceptions | ( | $flag = null | ) |
Set the throwExceptions flag and retrieve current status.
Set whether exceptions encounted in the dispatch loop should be thrown or caught and trapped in the response object.
Default behaviour is to trap them in the response object; call this method to have them thrown.
Passing no value will return the current value of the flag; passing a boolean true or false value will set the flag and return the current object instance.
boolean | $flag | Defaults to null (return flag state) |
unregisterPlugin | ( | $plugin | ) |
Unregister a plugin.
string | Zend_Controller_Plugin_Abstract | $plugin | Plugin class or object to unregister |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |