Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PKPRequest Class Reference
Inheritance diagram for PKPRequest:
Request Request

Public Member Functions

_checkThis ()
 
_delegateToRouter ($method)
 
 cleanUserVar (&$var)
 
 encodeBasePathFragment ($fragment)
 
 getBasePath ()
 
 getBaseUrl ()
 
 getCompleteUrl ()
 
getContext ()
 
 getCookieVar ($key)
 
getDispatcher ()
 
 getIfModifiedSince ()
 
 getIndexUrl ()
 
 getProtocol ()
 
 getQueryArray ()
 
 getQueryString ()
 
 getRemoteAddr ()
 
 getRemoteDomain ()
 
 getRequestedArgs ()
 
 getRequestedContextPath ($contextLevel=null)
 
 getRequestedOp ()
 
 getRequestedPage ()
 
 getRequestMethod ()
 
 getRequestPath ()
 
 getRequestUrl ()
 
getRouter ()
 
 getServerHost ($default= 'localhost')
 
getSession ()
 
getSite ()
 
getUser ()
 
 getUserAgent ()
 
 getUserDateVar ($prefix, $defaultDay=null, $defaultMonth=null, $defaultYear=null, $defaultHour=0, $defaultMinute=0, $defaultSecond=0)
 
 getUserVar ($key)
 
getUserVars ()
 
 isBot ()
 
 isGet ()
 
 isPathInfoEnabled ()
 
 isPost ()
 
 isRestfulUrlsEnabled ()
 
 redirect ($context=null, $page=null, $op=null, $path=null, $params=null, $anchor=null)
 
 redirectNonSSL ()
 
 redirectSSL ()
 
 redirectUrl ($url)
 
 redirectUrlJson ($url)
 
 setCookieVar ($key, $value, $expire=0)
 
 setDispatcher ($dispatcher)
 
 setRouter ($router)
 
 url ($context=null, $page=null, $op=null, $path=null, $params=null, $anchor=null, $escape=false)
 

Public Attributes

 $_basePath
 
 $_baseUrl
 
 $_dispatcher = null
 
 $_isBot
 
 $_isPathInfoEnabled
 
 $_isRestfulUrlsEnabled
 
 $_protocol
 
 $_requestPath
 
 $_requestVars = null
 
 $_router = null
 
 $_serverHost
 
 $_userAgent
 

Detailed Description

Class providing operations associated with HTTP requests.

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

Member Function Documentation

& PKPRequest::_checkThis ( )

This method exists to maintain backwards compatibility with static calls to PKPRequest.

If it is called non-statically then it will simply return $this. Otherwise a global singleton instance from the registry will be returned instead.

NB: This method is protected and may not be used by external classes. It should also only be used in legacy methods.

Returns
PKPRequest

Definition at line 794 of file PKPRequest.inc.php.

Referenced by Dispatcher\_cacheContent(), cleanUserVar(), getCompleteUrl(), Request\getContext(), Request\getContextByName(), Request\getPress(), Request\getRequestedContextPath(), Request\getRequestedPressPath(), getUserDateVar(), Request\redirectHome(), setCookieVar(), and Request\url().

& PKPRequest::_delegateToRouter (   $method)

This method exists to maintain backwards compatibility with calls to methods that have been factored into the Router implementations.

It delegates the call to the router and returns the result.

NB: This method is protected and may not be used by external classes. It should also only be used in legacy methods.

Returns
mixed depends on the called method

Definition at line 825 of file PKPRequest.inc.php.

PKPRequest::cleanUserVar ( $var)

Sanitize a user-submitted variable (i.e., GET/POST/Cookie variable). Strips slashes if necessary, then sanitizes variable as per Core::cleanVar().

Parameters
$varmixed

Definition at line 658 of file PKPRequest.inc.php.

References _checkThis().

PKPRequest::encodeBasePathFragment (   $fragment)

Callback function for getBasePath() to correctly encode (or not encode) a basepath fragment.

Parameters
string$fragment
Returns
string

Definition at line 243 of file PKPRequest.inc.php.

PKPRequest::getBasePath ( )

Get the base path of the request (excluding trailing slash).

Returns
string

Definition at line 212 of file PKPRequest.inc.php.

PKPRequest::getBaseUrl ( )

Get the base URL of the request (excluding script).

Returns
string

Definition at line 190 of file PKPRequest.inc.php.

PKPRequest::getCompleteUrl ( )

Get the complete URL to this page, including parameters.

Returns
string

Definition at line 272 of file PKPRequest.inc.php.

References _checkThis(), and HookRegistry\call().

PKPRequest::getCookieVar (   $key)

Get the value of a cookie variable.

Returns
mixed

Definition at line 677 of file PKPRequest.inc.php.

& PKPRequest::getDispatcher ( )

Get the dispatcher

Returns
Dispatcher

Definition at line 122 of file PKPRequest.inc.php.

PKPRequest::getIfModifiedSince ( )

Get the IF_MODIFIED_SINCE date (as a numerical timestamp) if available

Returns
int

Definition at line 181 of file PKPRequest.inc.php.

PKPRequest::getIndexUrl ( )

Deprecated

See Also
PKPPageRouter::getIndexUrl()

Definition at line 254 of file PKPRequest.inc.php.

PKPRequest::getProtocol ( )

Get the protocol used for the request (HTTP or HTTPS).

Returns
string

Definition at line 382 of file PKPRequest.inc.php.

PKPRequest::getQueryArray ( )

Get the complete set of URL parameters to the current request as an associative array.

Returns
array

Definition at line 325 of file PKPRequest.inc.php.

PKPRequest::getQueryString ( )

Get the complete set of URL parameters to the current request.

Returns
string

Definition at line 308 of file PKPRequest.inc.php.

References HookRegistry\call().

PKPRequest::getRemoteAddr ( )

Get the remote IP address of the current request.

Returns
string

Definition at line 427 of file PKPRequest.inc.php.

Referenced by Comment\Comment().

PKPRequest::getRemoteDomain ( )

Get the remote domain of the current request

Returns
string

Definition at line 454 of file PKPRequest.inc.php.

PKPRequest::getRequestedArgs ( )

Deprecated

See Also
PKPPageRouter::getRequestedArgs()

Definition at line 764 of file PKPRequest.inc.php.

PKPRequest::getRequestedContextPath (   $contextLevel = null)

Deprecated

See Also
PKPPageRouter::getRequestedContextPath()

Definition at line 730 of file PKPRequest.inc.php.

PKPRequest::getRequestedOp ( )

Deprecated

See Also
PKPPageRouter::getRequestedOp()

Definition at line 755 of file PKPRequest.inc.php.

PKPRequest::getRequestedPage ( )

Deprecated

See Also
PKPPageRouter::getRequestedPage()

Definition at line 746 of file PKPRequest.inc.php.

PKPRequest::getRequestMethod ( )

Get the request method

Returns
string

Definition at line 396 of file PKPRequest.inc.php.

PKPRequest::getRequestPath ( )

Get the completed path of the request.

Returns
string

Definition at line 342 of file PKPRequest.inc.php.

PKPRequest::getRequestUrl ( )

Get the complete URL of the request.

Returns
string

Definition at line 291 of file PKPRequest.inc.php.

& PKPRequest::getRouter ( )

get the router instance

Returns
PKPRouter

Definition at line 98 of file PKPRequest.inc.php.

PKPRequest::getServerHost (   $default = 'localhost')

Get the server hostname in the request. May optionally include the port number if non-standard.

Returns
string

Definition at line 365 of file PKPRequest.inc.php.

& PKPRequest::getSession ( )

Get the user session associated with the current request.

Returns
Session

Definition at line 548 of file PKPRequest.inc.php.

& PKPRequest::getSite ( )

Get site data.

Returns
Site

Definition at line 530 of file PKPRequest.inc.php.

PKPRequest::getUserAgent ( )

Get the user agent of the current request.

Returns
string

Definition at line 470 of file PKPRequest.inc.php.

PKPRequest::getUserDateVar (   $prefix,
  $defaultDay = null,
  $defaultMonth = null,
  $defaultYear = null,
  $defaultHour = 0,
  $defaultMinute = 0,
  $defaultSecond = 0 
)

Get the value of a GET/POST variable generated using the Smarty html_select_date and/or html_select_time function.

Parameters
$prefixstring
$defaultDayint
$defaultMonthint
$defaultYearint
$defaultHourint
$defaultMinuteint
$defaultSecondint
Returns
Date

Definition at line 622 of file PKPRequest.inc.php.

References _checkThis(), and Core\cleanVar().

PKPRequest::getUserVar (   $key)

Get the value of a GET/POST variable.

Returns
mixed

Definition at line 582 of file PKPRequest.inc.php.

Referenced by RepresentativeForm\RepresentativeForm().

& PKPRequest::getUserVars ( )

Get all GET/POST variables as an array

Returns
array

Definition at line 599 of file PKPRequest.inc.php.

PKPRequest::isBot ( )

Determine whether the user agent is a bot or not.

Returns
boolean

Definition at line 492 of file PKPRequest.inc.php.

PKPRequest::isGet ( )

Determine whether the request is a GET request

Returns
boolean

Definition at line 417 of file PKPRequest.inc.php.

PKPRequest::isPathInfoEnabled ( )

Return true if PATH_INFO is enabled.

Definition at line 505 of file PKPRequest.inc.php.

PKPRequest::isPost ( )

Determine whether the request is a POST request

Returns
boolean

Definition at line 407 of file PKPRequest.inc.php.

PKPRequest::isRestfulUrlsEnabled ( )

Return true if RESTFUL_URLS is enabled.

Definition at line 517 of file PKPRequest.inc.php.

References SessionManager\getManager().

PKPRequest::redirect (   $context = null,
  $page = null,
  $op = null,
  $path = null,
  $params = null,
  $anchor = null 
)

Redirect to the specified page within a PKP Application. Shorthand for a common call to $request->redirect($dispatcher->url($request, ROUTE_PAGE, ...)).

Parameters
$contextArray The optional contextual paths
$pagestring The name of the op to redirect to.
$opstring optional The name of the op to redirect to.
$pathmixed string or array containing path info for redirect.
$paramsarray Map of name => value pairs for additional parameters
$anchorstring Name of desired anchor on the target page

Definition at line 711 of file PKPRequest.inc.php.

Referenced by PKPUsageStatsReportPlugin\display(), ReportPlugin\manage(), PKPValidation\redirectLogin(), and PKPToolsHandler\report().

PKPRequest::redirectNonSSL ( )

Redirect to the current URL, forcing the HTTP protocol to be used.

Definition at line 168 of file PKPRequest.inc.php.

PKPRequest::redirectSSL ( )

Redirect to the current URL, forcing the HTTPS protocol to be used.

Definition at line 156 of file PKPRequest.inc.php.

References HookRegistry\call(), and Config\getVar().

PKPRequest::redirectUrl (   $url)

Perform an HTTP redirect to an absolute or relative (to base system URL) URL.

Parameters
$urlstring (exclude protocol for local redirects)

Definition at line 131 of file PKPRequest.inc.php.

PKPRequest::redirectUrlJson (   $url)

Request an HTTP redirect via JSON to be used from components.

Parameters
$urlstring

Definition at line 146 of file PKPRequest.inc.php.

PKPRequest::setCookieVar (   $key,
  $value,
  $expire = 0 
)

Set a cookie variable.

Parameters
$keystring
$valuemixed

Definition at line 694 of file PKPRequest.inc.php.

References _checkThis().

PKPRequest::setDispatcher (   $dispatcher)

Set the dispatcher

Parameters
$dispatcherDispatcher

Definition at line 114 of file PKPRequest.inc.php.

PKPRequest::setRouter (   $router)

set the router instance

Parameters
$routerinstance PKPRouter

Definition at line 106 of file PKPRequest.inc.php.

PKPRequest::url (   $context = null,
  $page = null,
  $op = null,
  $path = null,
  $params = null,
  $anchor = null,
  $escape = false 
)

Deprecated

See Also
PKPPageRouter::url()

Definition at line 773 of file PKPRequest.inc.php.

Member Data Documentation

string PKPRequest::$_basePath

request base path

Definition at line 43 of file PKPRequest.inc.php.

string PKPRequest::$_baseUrl

base url

Definition at line 73 of file PKPRequest.inc.php.

Dispatcher PKPRequest::$_dispatcher = null

dispatcher instance used to dispatch this request

Definition at line 31 of file PKPRequest.inc.php.

boolean PKPRequest::$_isBot

bot flag

Definition at line 85 of file PKPRequest.inc.php.

boolean PKPRequest::$_isPathInfoEnabled

true if path info is enabled for this server

Definition at line 61 of file PKPRequest.inc.php.

boolean PKPRequest::$_isRestfulUrlsEnabled

true if restful URLs are enabled in the config

Definition at line 55 of file PKPRequest.inc.php.

string PKPRequest::$_protocol

request protocol

Definition at line 79 of file PKPRequest.inc.php.

string PKPRequest::$_requestPath

request path

Definition at line 49 of file PKPRequest.inc.php.

array PKPRequest::$_requestVars = null

the request variables cache (GET/POST)

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

PKPRouter PKPRequest::$_router = null

router instance used to route this request

Definition at line 25 of file PKPRequest.inc.php.

string PKPRequest::$_serverHost

server host

Definition at line 67 of file PKPRequest.inc.php.

string PKPRequest::$_userAgent

user agent

Definition at line 91 of file PKPRequest.inc.php.


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