Class Zend_Controller_Front

Description
  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Controller/Front.php (line 38)


	
			
Variable Summary
Method Summary
 static void run (string|array $controllerDirectory)
 void __construct ()
 Zend_Controller_Front addControllerDirectory (string $directory, [string $module = null])
 Zend_Controller_Front clearParams ([null|string|array $name = null])
 string getBaseUrl ()
 array|string|null getControllerDirectory ([string $name = null])
 string getDefaultAction ()
 string getDefaultModule ()
 string|null getModuleDirectory ([string $module = null])
 mixed getParam (string $name)
 array getParams ()
 false|Zend_Controller_Plugin_Abstract|array getPlugin (string $class)
 array getPlugins ()
 bool hasPlugin (string $class)
 bool removeControllerDirectory (string $module)
 void resetInstance ()
 boolean|Zend_Controller_Front returnResponse ([boolean $flag = null])
 Zend_Controller_Front setBaseUrl ([string $base = null])
 Zend_Controller_Front setControllerDirectory (string|array $directory, [string $module = null])
 Zend_Controller_Front setModuleControllerDirectoryName ([string $name = 'controllers'])
 Zend_Controller_Front setParam (string $name, mixed $value)
 boolean|Zend_Controller_Front throwExceptions ([boolean $flag = null])
Variables
static Zend_Controller_Front $_instance = null (line 67)

Singleton instance

Marked only as protected to allow extension of the class. To extend, simply override getInstance().

  • access: protected
string $_baseUrl = null (line 44)

Base URL

  • access: protected
string|array $_controllerDir = null (line 51)

Directory|ies where controllers are stored

  • access: protected
Zend_Controller_Dispatcher_Interface $_dispatcher = null (line 57)

Instance of Zend_Controller_Dispatcher_Interface

  • access: protected
array $_invokeParams = array() (line 74)

Array of invocation parameters to use when instantiating action

controllers

  • access: protected
string $_moduleControllerDirectoryName = 'controllers' (line 80)

Subdirectory within a module containing controllers; defaults to 'controllers'

  • access: protected
Zend_Controller_Plugin_Broker $_plugins = null (line 86)

Instance of Zend_Controller_Plugin_Broker

  • access: protected
Zend_Controller_Request_Abstract $_request = null (line 92)

Instance of Zend_Controller_Request_Abstract

  • access: protected
Zend_Controller_Response_Abstract $_response = null (line 98)

Instance of Zend_Controller_Response_Abstract

  • access: protected
boolean $_returnResponse = false (line 105)

Whether or not to return the response prior to rendering output while in dispatch(); default is to send headers and render output.

  • access: protected
Zend_Controller_Router_Interface $_router = null (line 111)

Instance of Zend_Controller_Router_Interface

  • access: protected
boolean $_throwExceptions = false (line 118)

Whether or not exceptions encountered in dispatch() should be

thrown or trapped in the response object

  • access: protected
Methods
static getInstance (line 149)

Singleton instance

  • access: public
static Zend_Controller_Front getInstance ()
static run (line 208)

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.

  • throws: Zend_Controller_Exception if called from an object instance
  • access: public
static void run (string|array $controllerDirectory)
  • string|array $controllerDirectory: Path to Zend_Controller_Action controller classes or array of such paths
Constructor __construct (line 130)

Constructor

Instantiate using getInstance(); front controller is a singleton object.

Instantiates the plugin broker.

  • access: protected
void __construct ()
addControllerDirectory (line 226)

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.

  • throws: Zend_Controller_Exception if directory not found or readable
  • access: public
Zend_Controller_Front addControllerDirectory (string $directory, [string $module = null])
  • string $directory
  • string $module: Optional argument; module with which to associate directory. If none provided, assumes 'default'
addModuleDirectory (line 286)

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.

  • access: public
Zend_Controller_Front addModuleDirectory (string $path)
  • string $path
clearParams (line 707)

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.

  • access: public
Zend_Controller_Front clearParams ([null|string|array $name = null])
  • null|string|array $name: single key or array of keys for params to clear
dispatch (line 835)

Dispatch an HTTP request to a controller/action.

  • return: Returns response object if returnResponse() is true
  • access: public
getBaseUrl (line 564)

Retrieve the currently set base URL

  • access: public
string getBaseUrl ()
getControllerDirectory (line 260)

Retrieve controller directory

Retrieves:

  • Array of all controller directories if no $name passed
  • String path if $name passed and exists as a key in controller directory array
  • null if $name passed but does not exist in controller directory keys

  • access: public
array|string|null getControllerDirectory ([string $name = null])
  • string $name: Default null
getDefaultAction (line 404)

Retrieve the default action (unformatted string)

  • access: public
string getDefaultAction ()
getDefaultControllerName (line 381)

Retrieve the default controller (unformatted string)

  • access: public
string getDefaultControllerName ()
getDefaultModule (line 427)

Retrieve the default module

  • access: public
string getDefaultModule ()
getDispatcher (line 593)

Return the dispatcher object.

  • access: public
getModuleControllerDirectoryName (line 358)

Return the directory name within a module containing controllers

  • access: public
string getModuleControllerDirectoryName ()
getModuleDirectory (line 319)

Return the path to a module directory (but not the controllers directory within)

  • access: public
string|null getModuleDirectory ([string $module = null])
  • string $module
getParam (line 678)

Retrieve a single parameter from the controller parameter stack

  • access: public
mixed getParam (string $name)
  • string $name
getParams (line 692)

Retrieve action controller instantiation parameters

  • access: public
array getParams ()
getPlugin (line 766)

Retrieve a plugin or plugins by class

  • access: public
false|Zend_Controller_Plugin_Abstract|array getPlugin (string $class)
  • string $class
getPlugins (line 776)

Retrieve all plugins

  • access: public
array getPlugins ()
getRequest (line 467)

Return the request object.

  • access: public
getResponse (line 641)

Return the response object.

  • access: public
null|Zend_Controller_Response_Abstract getResponse ()
getRouter (line 513)

Return the router object.

Instantiates a Zend_Controller_Router_Rewrite object if no router currently set.

  • access: public
hasPlugin (line 755)

Is a particular plugin registered?

  • access: public
bool hasPlugin (string $class)
  • string $class
registerPlugin (line 731)

Register a plugin.

  • access: public
Zend_Controller_Front registerPlugin (Zend_Controller_Plugin_Abstract $plugin, [int $stackIndex = null])
removeControllerDirectory (line 271)

Remove a controller directory by module name

  • access: public
bool removeControllerDirectory (string $module)
  • string $module
resetInstance (line 167)

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.

  • access: public
void resetInstance ()
returnResponse (line 815)

Set whether dispatch() should return the response without first rendering output. By default, output is rendered and dispatch() returns nothing.

  • return: Used as a setter, returns object; as a getter, returns boolean
  • access: public
boolean|Zend_Controller_Front returnResponse ([boolean $flag = null])
  • boolean $flag
setBaseUrl (line 543)

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:

  • /admin
  • /myapp
  • /subdir/index.php
Note that the URL should not include the full URI. Do not use:
  • http://example.com/admin
  • http://example.com/myapp
  • http://example.com/subdir/index.php
If a null value is passed, this can be used as well for autodiscovery (default).

  • throws: Zend_Controller_Exception for non-string $base
  • access: public
Zend_Controller_Front setBaseUrl ([string $base = null])
  • string $base
setControllerDirectory (line 243)

Set controller directory

Stores controller directory(ies) in dispatcher. May be an array of directories or a string containing a single directory.

  • access: public
Zend_Controller_Front setControllerDirectory (string|array $directory, [string $module = null])
  • 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 (line 392)

Set the default action (unformatted string)

  • access: public
Zend_Controller_Front setDefaultAction (string $action)
  • string $action
setDefaultControllerName (line 369)

Set the default controller (unformatted string)

  • access: public
Zend_Controller_Front setDefaultControllerName (string $controller)
  • string $controller
setDefaultModule (line 415)

Set the default module name

  • access: public
Zend_Controller_Front setDefaultModule (string $module)
  • string $module
setDispatcher (line 582)

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.

  • access: public
setModuleControllerDirectoryName (line 346)

Set the directory name within a module containing controllers

  • access: public
Zend_Controller_Front setModuleControllerDirectoryName ([string $name = 'controllers'])
  • string $name
setParam (line 653)

Add or modify a parameter to use when instantiating an action controller

  • access: public
Zend_Controller_Front setParam (string $name, mixed $value)
  • string $name
  • mixed $value
setParams (line 666)

Set parameters to pass to action controller constructors

  • access: public
Zend_Controller_Front setParams ( $params)
  • array $params
setRequest (line 443)

Set request class/object

Set the request object. The request holds the request environment.

If a class name is provided, it will instantiate it

  • throws: Zend_Controller_Exception if invalid request class
  • access: public
setResponse (line 617)

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.

  • throws: Zend_Controller_Exception if invalid response class
  • access: public
setRouter (line 485)

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().

  • throws: Zend_Controller_Exception if invalid router class
  • access: public
throwExceptions (line 797)

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.

  • return: Used as a setter, returns object; as a getter, returns boolean
  • access: public
boolean|Zend_Controller_Front throwExceptions ([boolean $flag = null])
  • boolean $flag: Defaults to null (return flag state)
unregisterPlugin (line 743)

Unregister a plugin.

  • access: public
Zend_Controller_Front unregisterPlugin (string|Zend_Controller_Plugin_Abstract $plugin)

Documentation generated on Mon, 21 Jun 2010 15:24:58 -0400 by phpDocumentor 1.4.3