Zend Framework
1.12
|
Public Member Functions | |
__construct (array $params=array()) | |
Constructor: Set current module to default value. | |
addControllerDirectory ($path, $module=null) | |
Add a single path to the controller directory stack. | |
setControllerDirectory ($directory, $module=null) | |
Set controller directory. | |
getControllerDirectory ($module=null) | |
Return the currently set directories for Zend_Controller_Action class lookup. | |
removeControllerDirectory ($module) | |
Remove a controller directory by module name. | |
formatModuleName ($unformatted) | |
Format the module name. | |
formatClassName ($moduleName, $className) | |
Format action class name. | |
classToFilename ($class) | |
Convert a class name to a filename. | |
isDispatchable (Zend_Controller_Request_Abstract $request) | |
Returns TRUE if the Zend_Controller_Request_Abstract object can be dispatched to a controller. | |
dispatch (Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response) | |
Dispatch to a controller/action. | |
loadClass ($className) | |
Load a controller class. | |
getControllerClass (Zend_Controller_Request_Abstract $request) | |
Get controller class name. | |
isValidModule ($module) | |
Determine if a given module is valid. | |
getDefaultControllerClass (Zend_Controller_Request_Abstract $request) | |
Retrieve default controller class. | |
getDispatchDirectory () | |
Return the value of the currently selected dispatch directory (as set by getController()) | |
getActionMethod (Zend_Controller_Request_Abstract $request) | |
Determine the action name. | |
![]() | |
__construct (array $params=array()) | |
Constructor. | |
formatControllerName ($unformatted) | |
Formats a string into a controller name. | |
formatActionName ($unformatted) | |
Formats a string into an action name. | |
_verifyDelimiter ($spec) | |
Verify delimiter. | |
getWordDelimiter () | |
Retrieve the word delimiter character(s) used in controller or action names. | |
setWordDelimiter ($spec) | |
Set word delimiter. | |
getPathDelimiter () | |
Retrieve the path delimiter character(s) used in controller names. | |
setPathDelimiter ($spec) | |
Set path delimiter. | |
getFrontController () | |
Retrieve front controller instance. | |
setFrontController (Zend_Controller_Front $controller) | |
Set front controller instance. | |
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. | |
setResponse (Zend_Controller_Response_Abstract $response=null) | |
Set response object to pass to action controllers. | |
getResponse () | |
Return the registered response object. | |
setDefaultControllerName ($controller) | |
Set the default controller (minus any formatting) | |
getDefaultControllerName () | |
Retrieve the default controller name (minus formatting) | |
setDefaultAction ($action) | |
Set the default action (minus any formatting) | |
getDefaultAction () | |
Retrieve the default action name (minus formatting) | |
setDefaultModule ($module) | |
Set the default module. | |
getDefaultModule () | |
Retrieve the default module. | |
![]() | |
setControllerDirectory ($path) | |
Set the directory where controller files are stored. | |
getControllerDirectory () | |
Return the currently set directory(ies) for controller file lookup. | |
Protected Attributes | |
$_curDirectory | |
$_curModule | |
$_controllerDirectory = array() | |
![]() | |
$_defaultAction = 'index' | |
$_defaultController = 'index' | |
$_defaultModule = 'default' | |
$_frontController | |
$_invokeParams = array() | |
$_pathDelimiter = '_' | |
$_response = null | |
$_wordDelimiter = array('-', '.') | |
Additional Inherited Members | |
![]() | |
_formatName ($unformatted, $isAction=false) | |
Formats a string from a URI into a PHP-friendly name. | |
__construct | ( | array | $params = array() | ) |
Constructor: Set current module to default value.
array | $params |
addControllerDirectory | ( | $path, | |
$module = null |
|||
) |
Add a single path to the controller directory stack.
string | $path | |
string | $module |
Implements Zend_Controller_Dispatcher_Interface.
classToFilename | ( | $class | ) |
Convert a class name to a filename.
string | $class |
dispatch | ( | Zend_Controller_Request_Abstract | $request, |
Zend_Controller_Response_Abstract | $response | ||
) |
Dispatch to a controller/action.
By default, if a controller is not dispatchable, dispatch() will throw an exception. If you wish to use the default controller instead, set the param 'useDefaultControllerAlways' via setParam().
Zend_Controller_Request_Abstract | $request | |
Zend_Controller_Response_Abstract | $response |
Zend_Controller_Dispatcher_Exception |
Get controller class
If we're in a module or prefixDefaultModule is on, we must add the module name prefix to the contents of $className, as getControllerClass does not do that automatically. We must keep a separate variable because modules are not strictly PSR-0: We need the no-module-prefix class name to do the class->file mapping, but the full class name to insantiate the controller
Load the controller class file
Instantiate controller with request, response, and invocation arguments; throw exception if it's not an action controller
Retrieve the action name
Dispatch the method call
Implements Zend_Controller_Dispatcher_Interface.
formatClassName | ( | $moduleName, | |
$className | |||
) |
Format action class name.
string | $moduleName | Name of the current module |
string | $className | Name of the action class |
formatModuleName | ( | $unformatted | ) |
Format the module name.
string | $unformatted |
Implements Zend_Controller_Dispatcher_Interface.
getActionMethod | ( | Zend_Controller_Request_Abstract | $request | ) |
Determine the action name.
First attempt to retrieve from request; then from request params using action key; default to default action
Returns formatted action name
Zend_Controller_Request_Abstract | $request |
getControllerClass | ( | Zend_Controller_Request_Abstract | $request | ) |
Get controller class name.
Try request first; if not found, try pulling from request parameter; if still not found, fallback to default
Zend_Controller_Request_Abstract | $request |
getControllerDirectory | ( | $module = null | ) |
Return the currently set directories for Zend_Controller_Action class lookup.
If a module is specified, returns just that directory.
string | $module | Module name |
getDefaultControllerClass | ( | Zend_Controller_Request_Abstract | $request | ) |
Retrieve default controller class.
Determines whether the default controller to use lies within the requested module, or if the global default should be used.
By default, will only use the module default unless that controller does not exist; if this is the case, it falls back to the default controller in the default module.
Zend_Controller_Request_Abstract | $request |
getDispatchDirectory | ( | ) |
Return the value of the currently selected dispatch directory (as set by getController())
isDispatchable | ( | Zend_Controller_Request_Abstract | $request | ) |
Returns TRUE if the Zend_Controller_Request_Abstract object can be dispatched to a controller.
Use this method wisely. By default, the dispatcher will fall back to the default controller (either in the module specified or the global default) if a given controller does not exist. This method returning false does not necessarily indicate the dispatcher will not still dispatch the call.
Zend_Controller_Request_Abstract | $action |
Implements Zend_Controller_Dispatcher_Interface.
isValidModule | ( | $module | ) |
Determine if a given module is valid.
string | $module |
Implements Zend_Controller_Dispatcher_Interface.
loadClass | ( | $className | ) |
Load a controller class.
Attempts to load the controller class file from getControllerDirectory(). If the controller belongs to a module, looks for the module prefix to the controller class.
string | $className |
Zend_Controller_Dispatcher_Exception | if class not loaded |
removeControllerDirectory | ( | $module | ) |
Remove a controller directory by module name.
string | $module |
setControllerDirectory | ( | $directory, | |
$module = null |
|||
) |
Set controller directory.
array | string | $directory |
|
protected |
|
protected |
|
protected |