Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct () | |
_authorizeInitializeAndCallRequest (&$serviceEndpoint, $request, &$args, $validate=true) | |
_contextLevelToContextName ($contextLevel) | |
_contextNameToContextLevel ($contextName) | |
_urlCanonicalizeNewContext ($newContext) | |
_urlFromParts ($baseUrl, $pathInfoArray=array(), $queryParametersArray=array(), $anchor='', $escape=false) | |
_urlGetAdditionalParameters ($request, $params=null, $escape=true) | |
_urlGetBaseAndContext ($request, $newContext=array()) | |
& | getApplication () |
getCacheFilename ($request) | |
& | getContext ($request, $requestedContextLevel=1, $forceReload=false) |
& | getContextByName ($request, $requestedContextName) |
& | getDispatcher () |
getHandler () | |
getIndexUrl ($request) | |
getRequestedContextPath ($request, $requestedContextLevel=1) | |
getRequestedContextPaths ($request) | |
handleAuthorizationFailure ($request, $authorizationMessage) | |
isCacheable ($request) | |
route ($request) | |
setApplication ($application) | |
setDispatcher ($dispatcher) | |
setHandler ($handler) | |
supports ($request) | |
url ($request, $newContext=null, $handler=null, $op=null, $path=null, $params=null, $anchor=null, $escape=false) | |
Data Fields | |
$_application | |
$_contextDepth | |
$_contextList | |
$_contextPaths = array() | |
$_contexts = array() | |
$_dispatcher | |
$_flippedContextList | |
$_handler | |
Basic router class that has functionality common to all routers.
NB: All handlers provide the common basic workflow. The router calls the following methods in the given order. 1) constructor: Handlers should establish a mapping of remote operations to roles that may access them. They do so by calling PKPHandler::addRoleAssignment(). 2) authorize(): Authorizes the request, among other things based on the result of the role assignment created during object instantiation. If authorization fails then die with a fatal error or execute the "call- on-deny" advice if one has been defined in the authorization policy that denied access. 3) validate(): Let the handler execute non-fatal data integrity checks (FIXME: currently only for component handlers). Please make sure that data integrity checks that can lead to denial of access are being executed in the authorize() step via authorization policies and not here. 4) initialize(): Let the handler initialize its internal state based on authorized and valid data. Authorization and integrity checks should be kept out of here to get a clear separation of concerns. 5) execution: Executes the requested handler operation. The mapping of requests to operations depends on the router implementation (see the class doc of specific router implementations for more details). 6) client response: Handlers should return a string value that will then be returned to the client as a response. Handler operations should not output the response directly to the client so that we can run filter operations on the output if required. Outputting text from handler operations to the client is possible but deprecated.
Definition at line 57 of file PKPRouter.inc.php.
PKPRouter::__construct | ( | ) |
Constructor
Definition at line 107 of file PKPRouter.inc.php.
PKPRouter::_authorizeInitializeAndCallRequest | ( | & | $serviceEndpoint, |
$request, | |||
& | $args, | ||
$validate = true |
|||
) |
This is the method that implements the basic life-cycle of a handler request: 1) authorization 2) validation 3) initialization 4) execution 5) client response
$serviceEndpoint | callable the handler operation |
$request | PKPRequest |
$args | array |
$validate | boolean whether or not to execute the validation step. |
Definition at line 393 of file PKPRouter.inc.php.
References getDispatcher(), and handleAuthorizationFailure().
Referenced by PKPPageRouter\route(), and PKPComponentRouter\route().
PKPRouter::_contextLevelToContextName | ( | $contextLevel | ) |
Convert a context level to its corresponding context name.
$contextLevel | integer |
Definition at line 639 of file PKPRouter.inc.php.
Referenced by getContext().
PKPRouter::_contextNameToContextLevel | ( | $contextName | ) |
Convert a context name to its corresponding context level.
$contextName | string |
Definition at line 649 of file PKPRouter.inc.php.
Referenced by getContextByName().
PKPRouter::_urlCanonicalizeNewContext | ( | $newContext | ) |
Canonicalizes the new context.
A new context can be given as a scalar. In this case only the first context will be replaced. If the context depth of the current application is higher than one than the context can also be given as an array if more than the first context should be replaced. We therefore canonicalize the new context to an array.
When all entries are of the form 'contextName' => null or if $newContext == null then we'll return an empty array.
$newContext | the raw context array |
Definition at line 452 of file PKPRouter.inc.php.
Referenced by APIRouter\url(), PKPPageRouter\url(), and PKPComponentRouter\url().
PKPRouter::_urlFromParts | ( | $baseUrl, | |
$pathInfoArray = array() , |
|||
$queryParametersArray = array() , |
|||
$anchor = '' , |
|||
$escape = false |
|||
) |
Creates a valid URL from parts.
$baseUrl | string the protocol, domain and initial path/parameters, no anchors allowed here |
$pathInfoArray | array strings to be concatenated as path info |
$queryParametersArray | array strings to be concatenated as query string |
$anchor | string an additional anchor |
$escape | boolean whether to escape ampersands |
Definition at line 582 of file PKPRouter.inc.php.
Referenced by APIRouter\url(), PKPPageRouter\url(), and PKPComponentRouter\url().
PKPRouter::_urlGetAdditionalParameters | ( | $request, | |
$params = null , |
|||
$escape = true |
|||
) |
Build the additional parameters part of the URL.
$request | PKPRequest the request to be routed |
$params | array (optional) the parameter list to be transformed to a url part. |
$escape | boolean (optional) Whether or not to escape structural elements |
Definition at line 555 of file PKPRouter.inc.php.
Referenced by APIRouter\url(), PKPPageRouter\url(), and PKPComponentRouter\url().
PKPRouter::_urlGetBaseAndContext | ( | $request, | |
$newContext = array() |
|||
) |
Build the base URL and add the context part of the URL.
The new URL will be based on the current request's context if no new context is given.
The base URL for a given primary context can be overridden in the config file using the 'base_url[context]' syntax in the config file's 'general' section.
$request | PKPRequest the request to be routed |
$newContext | mixed (optional) context that differs from the current request's context |
Definition at line 487 of file PKPRouter.inc.php.
References $_contextList, getContextByName(), getIndexUrl(), and Config\getVar().
Referenced by APIRouter\url(), PKPPageRouter\url(), and PKPComponentRouter\url().
& PKPRouter::getApplication | ( | ) |
get the application
Definition at line 114 of file PKPRouter.inc.php.
References $_application.
Referenced by PKPComponentRouter\_retrieveServiceEndpointParts(), PKPPageRouter\getCacheFilename(), APIRouter\getPathInfoParts(), PKPPageRouter\isCacheable(), and PKPPageRouter\route().
PKPRouter::getCacheFilename | ( | $request | ) |
Determine the filename to use for a local cache file.
$request | PKPRequest |
Reimplemented in PKPPageRouter.
Definition at line 331 of file PKPRouter.inc.php.
& PKPRouter::getContext | ( | $request, | |
$requestedContextLevel = 1 , |
|||
$forceReload = false |
|||
) |
A Generic call to a context defining object (e.g. a Press, a Conference, or a SchedConf)
$request | PKPRequest the request to be routed |
$requestedContextLevel | int (optional) the desired context level |
$forceReload | boolean (optional) Reset a context even if it's already been loaded |
Definition at line 250 of file PKPRouter.inc.php.
References _contextLevelToContextName(), DAORegistry\getDAO(), and getRequestedContextPath().
Referenced by getContextByName(), and PKPPageRouter\getHomeUrl().
& PKPRouter::getContextByName | ( | $request, | |
$requestedContextName | |||
) |
Get the object that represents the desired context (e.g. Conference or Press)
$request | PKPRequest the request to be routed |
$requestedContextName | string page context |
Definition at line 289 of file PKPRouter.inc.php.
References _contextNameToContextLevel(), and getContext().
Referenced by _urlGetBaseAndContext().
& PKPRouter::getDispatcher | ( | ) |
get the dispatcher
Definition at line 136 of file PKPRouter.inc.php.
References $_dispatcher.
Referenced by _authorizeInitializeAndCallRequest(), and PKPPageRouter\route().
PKPRouter::getHandler | ( | ) |
Get the handler object.
Definition at line 161 of file PKPRouter.inc.php.
References $_handler.
Referenced by APIRouter\getRequestedOp().
PKPRouter::getIndexUrl | ( | $request | ) |
Get the URL to the index script.
$request | PKPRequest the request to be routed |
Definition at line 309 of file PKPRouter.inc.php.
References HookRegistry\call().
Referenced by _urlGetBaseAndContext().
PKPRouter::getRequestedContextPath | ( | $request, | |
$requestedContextLevel = 1 |
|||
) |
A generic method to return a single context path (e.g. a Press or a SchedConf path)
$request | PKPRequest the request to be routed |
$requestedContextLevel | int (optional) the context level to return |
Definition at line 229 of file PKPRouter.inc.php.
References getRequestedContextPaths().
Referenced by getContext().
PKPRouter::getRequestedContextPaths | ( | $request | ) |
A generic method to return an array of context paths (e.g. a Press or a Conference/SchedConf paths)
$request | PKPRequest the request to be routed |
$requestedContextLevel | int (optional) the context level to return in the path |
Definition at line 191 of file PKPRouter.inc.php.
References $_contextPaths, HookRegistry\call(), and Core\getContextPaths().
Referenced by getRequestedContextPath().
PKPRouter::handleAuthorizationFailure | ( | $request, | |
$authorizationMessage | |||
) |
Handle an authorization failure.
$request | Request |
$authorizationMessage | string a translation key with the authorization failure message. |
Reimplemented in PKPPageRouter, PKPComponentRouter, and APIRouter.
Definition at line 369 of file PKPRouter.inc.php.
Referenced by _authorizeInitializeAndCallRequest().
PKPRouter::isCacheable | ( | $request | ) |
Determine whether or not this request is cacheable
$request | PKPRequest |
Definition at line 180 of file PKPRouter.inc.php.
PKPRouter::route | ( | $request | ) |
Routes a given request to a handler operation
$request | PKPRequest |
Reimplemented in PKPComponentRouter, PKPPageRouter, and APIRouter.
Definition at line 340 of file PKPRouter.inc.php.
PKPRouter::setApplication | ( | $application | ) |
set the application
$application | PKPApplication |
Definition at line 123 of file PKPRouter.inc.php.
References $application.
PKPRouter::setDispatcher | ( | $dispatcher | ) |
set the dispatcher
$dispatcher | PKPDispatcher |
Definition at line 145 of file PKPRouter.inc.php.
PKPRouter::setHandler | ( | $handler | ) |
Set the handler object for later retrieval.
$handler | PKPHandler |
Definition at line 153 of file PKPRouter.inc.php.
Referenced by PKPComponentRouter\getRpcServiceEndpoint(), APIRouter\route(), and PKPPageRouter\route().
PKPRouter::supports | ( | $request | ) |
Determines whether this router can route the given request.
$request | PKPRequest |
Reimplemented in PKPComponentRouter, and APIRouter.
Definition at line 170 of file PKPRouter.inc.php.
PKPRouter::url | ( | $request, | |
$newContext = null , |
|||
$handler = null , |
|||
$op = null , |
|||
$path = null , |
|||
$params = null , |
|||
$anchor = null , |
|||
$escape = false |
|||
) |
Build a handler request URL into PKPApplication.
$request | PKPRequest the request to be routed |
$newContext | mixed Optional contextual paths |
$handler | string Optional name of the handler to invoke |
$op | string Optional name of operation to invoke |
$path | mixed Optional string or array of args to pass to handler |
$params | array Optional set of name => value pairs to pass as user parameters |
$anchor | string Optional name of anchor to add to URL |
$escape | boolean Whether or not to escape ampersands, square brackets, etc. for this URL; default false. |
Reimplemented in PKPPageRouter, APIRouter, and PKPComponentRouter.
Definition at line 357 of file PKPRouter.inc.php.
PKPApplication PKPRouter::$_application |
Definition at line 67 of file PKPRouter.inc.php.
Referenced by getApplication().
integer PKPRouter::$_contextDepth |
context depth
Definition at line 77 of file PKPRouter.inc.php.
integer PKPRouter::$_contextList |
context list
Definition at line 82 of file PKPRouter.inc.php.
Referenced by _urlGetBaseAndContext().
integer PKPRouter::$_contextPaths = array() |
context paths
Definition at line 92 of file PKPRouter.inc.php.
Referenced by getRequestedContextPaths().
integer PKPRouter::$_contexts = array() |
contexts
Definition at line 97 of file PKPRouter.inc.php.
Dispatcher PKPRouter::$_dispatcher |
Definition at line 72 of file PKPRouter.inc.php.
Referenced by getDispatcher().
integer PKPRouter::$_flippedContextList |
context list with keys and values flipped
Definition at line 87 of file PKPRouter.inc.php.
PKPHandler PKPRouter::$_handler |