Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
Dispatcher Class Reference

Public Member Functions

 _cacheContent ($contents)
 
 _displayCached (&$router, &$request)
 
_instantiateRouter ($routerName, $shortcut)
 
 addRouterName ($routerName, $shortcut)
 
 dispatch (&$request)
 
getApplication ()
 
getRouterNames ()
 
 handle404 ()
 
 setApplication (&$application)
 
 url (&$request, $shortcut, $newContext=null, $handler=null, $op=null, $path=null, $params=null, $anchor=null, $escape=false)
 

Detailed Description

Class dispatching HTTP requests to handlers.

Definition at line 17 of file Dispatcher.inc.php.

Member Function Documentation

Dispatcher::_cacheContent (   $contents)

Cache content as a local file.

Parameters
$contentsstring
Returns
string

Definition at line 229 of file Dispatcher.inc.php.

Dispatcher::_displayCached ( $router,
$request 
)

Display the request contents from cache.

Parameters
$routerPKPRouter

Definition at line 197 of file Dispatcher.inc.php.

References Config\getVar().

Referenced by dispatch().

& Dispatcher::_instantiateRouter (   $routerName,
  $shortcut 
)

Instantiate a router

Parameters
$routerNamestring
$shortcutstring

Definition at line 169 of file Dispatcher.inc.php.

Referenced by dispatch(), and url().

Dispatcher::addRouterName (   $routerName,
  $shortcut 
)

Add a router name.

NB: Routers will be called in the order that they have been added to the dispatcher. The first router that supports the request will be called. The last router should always be a "catch-all" router that supports all types of requests.

NB: Routers must be part of the core package to be accepted by this dispatcher implementation.

Parameters
$routerNamestring a class name of a router to be given the chance to route the request. NB: These are class names and not instantiated objects. We'll use lazy instantiation to reduce the performance/memory impact to a minimum.
$shortcutstring a shortcut name for the router to be used for quick router instance retrieval.

Definition at line 77 of file Dispatcher.inc.php.

Dispatcher::dispatch ( $request)

Determine the correct router for this request. Then let the router dispatch the request to the appropriate handler method.

Parameters
$requestPKPRequest

Definition at line 88 of file Dispatcher.inc.php.

References _displayCached(), _instantiateRouter(), getRouterNames(), Config\getVar(), and PluginRegistry\loadCategory().

& Dispatcher::getApplication ( )

Get the application

Returns
PKPApplication

Definition at line 37 of file Dispatcher.inc.php.

& Dispatcher::getRouterNames ( )

Get the router names

Returns
array an array of Router names

Definition at line 53 of file Dispatcher.inc.php.

Referenced by dispatch().

Dispatcher::handle404 ( )

Handle a 404 error (page not found).

Definition at line 244 of file Dispatcher.inc.php.

References PKPRequest\_checkThis().

Referenced by PKPHandler\index().

Dispatcher::setApplication ( $application)

Set the application

Parameters
$applicationPKPApplication

Definition at line 45 of file Dispatcher.inc.php.

Dispatcher::url ( $request,
  $shortcut,
  $newContext = null,
  $handler = null,
  $op = null,
  $path = null,
  $params = null,
  $anchor = null,
  $escape = false 
)

Build a handler request URL into PKPApplication.

Parameters
$requestPKPRequest the request to be routed
$shortcutstring the short name of the router that should be used to construct the URL
$newContextmixed Optional contextual paths
$handlerstring Optional name of the handler to invoke
$opstring Optional name of operation to invoke
$pathmixed Optional string or array of args to pass to handler
$paramsarray Optional set of name => value pairs to pass as user parameters
$anchorstring Optional name of anchor to add to URL
$escapeboolean Whether or not to escape ampersands for this URL; default false.
Returns
string the URL

Definition at line 150 of file Dispatcher.inc.php.

References _instantiateRouter().


The documentation for this class was generated from the following file: