Open Journal Systems  3.3.0
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)
 

Data Fields

 $_application
 
 $_requestCallbackHack
 
 $_router
 
 $_routerInstances = array()
 
 $_routerNames = array()
 

Detailed Description

Class dispatching HTTP requests to handlers.

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

Member Function Documentation

◆ _cacheContent()

Dispatcher::_cacheContent (   $contents)

Cache content as a local file.

Parameters
$contentsstring
Returns
string

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

◆ _displayCached()

Dispatcher::_displayCached (   $router,
  $request 
)

Display the request contents from cache.

Parameters
$routerPKPRouter

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

References Config\getVar().

Referenced by dispatch().

◆ _instantiateRouter()

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

Instantiate a router

Parameters
$routerNamestring
$shortcutstring

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

References fatalError(), and instantiate().

Referenced by dispatch(), and url().

◆ addRouterName()

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 92 of file Dispatcher.inc.php.

◆ dispatch()

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 103 of file Dispatcher.inc.php.

References _displayCached(), _instantiateRouter(), HookRegistry\call(), fatalError(), PKPServices\get(), getRouterNames(), Config\getVar(), AppLocale\initialize(), and PluginRegistry\loadCategory().

◆ getApplication()

& Dispatcher::getApplication ( )

Get the application

Returns
PKPApplication

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

References $_application.

◆ getRouterNames()

& Dispatcher::getRouterNames ( )

Get the router names

Returns
array an array of Router names

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

References $_routerNames.

Referenced by dispatch().

◆ handle404()

Dispatcher::handle404 ( )

Handle a 404 error (page not found).

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

References fatalError().

Referenced by PKPHandler\index().

◆ setApplication()

Dispatcher::setApplication (   $application)

Set the application

Parameters
$applicationPKPApplication

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

References $application.

◆ url()

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 174 of file Dispatcher.inc.php.

References $op, and _instantiateRouter().

Field Documentation

◆ $_application

PKPApplication Dispatcher::$_application

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

Referenced by getApplication().

◆ $_requestCallbackHack

PKPRequest Dispatcher::$_requestCallbackHack

Used for a callback hack - NOT GENERALLY SET.

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

◆ $_router

PKPRouter Dispatcher::$_router

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

◆ $_routerInstances

array Dispatcher::$_routerInstances = array()

an array of Router instances

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

◆ $_routerNames

array Dispatcher::$_routerNames = array()

an array of Router implementation class names

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

Referenced by getRouterNames().


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