## Zend_Controller_Front

Description

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

Located in /Zend/Controller/Front.php (line 46)

Variable Summary
static Zend_Controller_Front $_instance
string $_baseUrl
string|array $_controllerDir
Zend_Controller_Dispatcher_Interface $_dispatcher
array $_invokeParams
Zend_Controller_Plugin_Broker $_plugins
Zend_Controller_Request_Abstract $_request
Zend_Controller_Response_Abstract $_response
boolean $_returnResponse
Zend_Controller_Router_Interface $_router
boolean $_throwExceptions
Method Summary
static Zend_Controller_Front getInstance ()
static void run (string|array $controllerDirectory)
Zend_Controller_Front addControllerDirectory (string $directory, [string $module = 'default'])
Zend_Controller_Front clearParams ([null|string|array $name = null])
void|Zend_Controller_Response_Abstract dispatch ([Zend_Controller_Request_Abstract $request = null], [Zend_Controller_Response_Abstract $response = null])
string getBaseUrl ()
array getControllerDirectory ()
string getDefaultAction ()
string getDefaultControllerName ()
Zend_Controller_DispatcherInteface getDispatcher ()
mixed getParam (string $name)
array getParams ()
null|Zend_Controller_Request_Abstract getRequest ()
null|Zend_Controller_Response_Abstract getResponse ()
null|Zend_Controller_Router_Interface getRouter ()
Zend_Controller_Front registerPlugin (Zend_Controller_Plugin_Abstract $plugin)
void resetInstance ()
boolean|Zend_Controller_Front returnResponse ([boolean $flag = null])
Zend_Controller_Front setBaseUrl ([string $base = null])
Zend_Controller_Front setControllerDirectory (string|array $directory)
Zend_Controller_Front setDefaultAction (string $action)
Zend_Controller_Front setDefaultControllerName (string $controller)
Zend_Controller_Front setDispatcher (Zend_Controller_Dispatcher_Interface $dispatcher)
Zend_Controller_Front setParam (string $name, mixed $value)
Zend_Controller_Front setParams ( $params)
Zend_Controller_Front setRequest (string|Zend_Controller_Request_Abstract $request)
Zend_Controller_Front setResponse (string|Zend_Controller_Response_Abstract $response)
Zend_Controller_Front setRouter (string|Zend_Controller_Router_Interface $router)
boolean|Zend_Controller_Front throwExceptions ([boolean $flag = null])
Zend_Controller_Front unregisterPlugin (Zend_Controller_Plugin_Abstract $plugin)
Variables
static Zend_Controller_Front $_instance = null (line 75)

Singleton instance

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

- access: protected

string $_baseUrl = null (line 52)

Base URL

- access: protected

string|array $_controllerDir = null (line 59)

Directory|ies where controllers are stored

- access: protected

Zend_Controller_Dispatcher_Interface $_dispatcher = null (line 65)

Instance of Zend_Controller_Dispatcher_Interface

- access: protected

array $_invokeParams = array() (line 82)

Array of invocation parameters to use when instantiating action

controllers

- access: protected

Zend_Controller_Plugin_Broker $_plugins = null (line 88)

Instance of Zend_Controller_Plugin_Broker

- access: protected

Zend_Controller_Request_Abstract $_request = null (line 94)

Instance of Zend_Controller_Request_Abstract

- access: protected

Zend_Controller_Response_Abstract $_response = null (line 100)

Instance of Zend_Controller_Response_Abstract

- access: protected

boolean $_returnResponse = false (line 107)

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 113)

Instance of Zend_Controller_Router_Interface

- access: protected

boolean $_throwExceptions = false (line 120)

Whether or not exceptions encountered in dispatch() should be

thrown or trapped in the response object

- access: protected

Methods
static getInstance (line 142)

Singleton instance

- access: public

static Zend_Controller_Front getInstance ()
static run (line 195)

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.

- access: public
- throws: Zend_Controller_Exception if called from an object instance

static void run (string|array $controllerDirectory)

- string|array $controllerDirectory: Path to Zend_Controller_Action controller classes or array of such paths

addControllerDirectory (line 213)

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.

- access: public
- throws: Zend_Controller_Exception if directory not found or readable

Zend_Controller_Front addControllerDirectory (string $directory, [string $module = 'default'])

- string $directory
- string $module: Optional argument; module with which to associate directory. If none provided, assumes 'defualt'

clearParams (line 559)

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 651)

Dispatch an HTTP request to a controller/action.

- return: Returns response object if returnResponse() is true
- access: public

void|Zend_Controller_Response_Abstract dispatch ([Zend_Controller_Request_Abstract $request = null], [Zend_Controller_Response_Abstract $response = null])

- Zend_Controller_Request_Abstract|null $request
- Zend_Controller_Response_Abstract|null $response

getBaseUrl (line 425)

Retrieve the currently set base URL

- access: public

string getBaseUrl ()
getControllerDirectory (line 257)

Retrieve controller directory

Retrieves stored controller directory

- access: public

array getControllerDirectory ()
getDefaultAction (line 303)

Retrieve the default action (unformatted string)

- access: public

string getDefaultAction ()
getDefaultControllerName (line 280)

Retrieve the default controller (unformatted string)

- access: public

string getDefaultControllerName ()
getDispatcher (line 449)

Return the dispatcher object.

- access: public

Zend_Controller_DispatcherInteface getDispatcher ()
getParam (line 530)

Retrieve a single parameter from the controller parameter stack

- access: public

mixed getParam (string $name)

- string $name

getParams (line 544)

Retrieve action controller instantiation parameters

- access: public

array getParams ()
getRequest (line 339)

Return the request object.

- access: public

null|Zend_Controller_Request_Abstract getRequest ()
getResponse (line 493)

Return the response object.

- access: public

null|Zend_Controller_Response_Abstract getResponse ()
getRouter (line 379)

Return the router object.

Instantiates a Zend_Controller_Router_Rewrite object if no router currently set.

- access: public

null|Zend_Controller_Router_Interface getRouter ()
registerPlugin (line 582)

Register a plugin.

- access: public

Zend_Controller_Front registerPlugin (Zend_Controller_Plugin_Abstract $plugin)

- Zend_Controller_Plugin_Abstract $plugin

resetInstance (line 158)

Resets all object properties of the singleton instance

Primarily used for testing; could be used to chain front controllers.

- access: public

void resetInstance ()
returnResponse (line 631)

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 409)

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

- access: public
- throws: Zend_Controller_Exception for non-string $base

Zend_Controller_Front setBaseUrl ([string $base = null])

- string $base

setControllerDirectory (line 239)

Set controller directory

Stores controller directory to pass to dispatcher. May be an array of directories or a string containing a single directory.

- access: public

Zend_Controller_Front setControllerDirectory (string|array $directory)

- string|array $directory: Path to Zend_Controller_Action controller classes or array of such paths

setDefaultAction (line 291)

Set the default action (unformatted string)

- access: public

Zend_Controller_Front setDefaultAction (string $action)

- string $action

setDefaultControllerName (line 268)

Set the default controller (unformatted string)

- access: public

Zend_Controller_Front setDefaultControllerName (string $controller)

- string $controller

setDispatcher (line 438)

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

Zend_Controller_Front setDispatcher (Zend_Controller_Dispatcher_Interface $dispatcher)

- Zend_Controller_Dispatcher_Interface $dispatcher

setParam (line 505)

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 518)

Set parameters to pass to action controller constructors

- access: public

Zend_Controller_Front setParams ( $params)

- array $params

setRequest (line 319)

Set request class/object

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

If a class name is provided, it will instantiate it

- access: public
- throws: Zend_Controller_Exception if invalid request class

Zend_Controller_Front setRequest (string|Zend_Controller_Request_Abstract $request)

- string|Zend_Controller_Request_Abstract $request

setResponse (line 473)

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.

- access: public
- throws: Zend_Controller_Exception if invalid response class

Zend_Controller_Front setResponse (string|Zend_Controller_Response_Abstract $response)

- string|Zend_Controller_Response_Abstract $response

setRouter (line 357)

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

- access: public
- throws: Zend_Controller_Exception if invalid router class

Zend_Controller_Front setRouter (string|Zend_Controller_Router_Interface $router)

- string|Zend_Controller_Router_Interface $router

throwExceptions (line 610)

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.

- 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 true

unregisterPlugin (line 594)

Unregister a plugin.

- access: public

Zend_Controller_Front unregisterPlugin (Zend_Controller_Plugin_Abstract $plugin)

- Zend_Controller_Plugin_Abstract $plugin

Documentation generated on Wed, 21 Feb 2007 11:49:23 -0800 by phpDocumentor 1.3.1