model/modx/modrequest.class.php

Classes 
package
modx
Classes
modRequest

Description

Encapsulates the interaction of MODX with an HTTP request.

This class represents the functional portion of the MODX {@link http://www.martinfowler.com/eaaCatalog/frontController.html front- controller}, and is responsible for sanitizing, interpretting, and dispatching a web request to the appropriate MODX {@link modResource Web Resource}.

\modRequest

package
modx
Properties
$headers
$method
$modx
$parameters
Methods
__construct
_cleanResourceIdentifier
checkPublishStatus
getActionIDs
getAllActionIDs
getClientIp
getHeaders
getParameters
getResource
getResourceIdentifier
getResourceMethod
handleRequest
loadErrorHandler
prepareResponse
preserveRequest
registerLogging
retrieveRequest
sanitizeRequest

Description

Encapsulates the interaction of MODX with an HTTP request.

This class represents the functional portion of the MODX {@link http://www.martinfowler.com/eaaCatalog/frontController.html front- controller}, and is responsible for sanitizing, interpretting, and dispatching a web request to the appropriate MODX {@link modResource Web Resource}.

Properties

$headers

 $headers = 'null'

Details

visibility
public
default
null
final
false
static
false

$method

 $method = 'null'

Details

visibility
public
default
null
final
false
static
false

$modx

 $modx = 'null'

Details

visibility
public
default
null
final
false
static
false

$parameters

 $parameters = 'null'

Details

visibility
public
default
null
final
false
static
false

Methods

__construct

__construct(  $modx ) :
Arguments
$modx
Details
visibility
public
final
false
static
false

_cleanResourceIdentifier

_cleanResourceIdentifier( string $identifier ) : string|integer

Cleans the resource identifier from the request params.

Arguments
$identifier
string
The raw identifier.
Output
string|integer
The cleansed identifier.
Details
visibility
public
final
false
static
false

checkPublishStatus

checkPublishStatus( ) :

Checks the current status of timed publishing events.

Details
visibility
public
final
false
static
false

getActionIDs

getActionIDs(  $actions = array,  $namespace = core ) :
Arguments
$actions
$namespace
Details
visibility
public
final
false
static
false

getAllActionIDs

getAllActionIDs(  $namespace ) :
Arguments
$namespace
Details
visibility
public
final
false
static
false

getClientIp

getClientIp( ) : array

Get the true client IP. Returns an array of values:

  • ip - The real, true client IP
  • suspected - The suspected IP, if not alike to REMOTE_ADDR
  • network - The client's network IP
Output
array
Details
visibility
public
final
false
static
false
access
public

getHeaders

getHeaders(  $ucKeys = false ) :
Arguments
$ucKeys
Details
visibility
public
final
false
static
false

getParameters

getParameters( string|array $keys = array, string $type = GET ) :

Get a GPC/REQUEST variable value or an array of values from the request.

Arguments
$keys
stringarray
A key or array of keys to retrieve from the GPC variable. An empty array means get all keys of the variable.
$type
string
The type of GPC variable, GET by default (GET, POST, COOKIE or REQUEST).
Details
visibility
public
final
false
static
false

getResource

getResource( string $method, string|integer $identifier,  $options = array ) : \modResource

Gets a requested resource and all required data.

Arguments
$method
string
The method, 'id', or 'alias', by which to perform the resource lookup.
$identifier
stringinteger
The identifier with which to search.
$options
Output
\modResource
The requested modResource instance or request is forwarded to the error page, or unauthorized page.
Details
visibility
public
final
false
static
false

getResourceIdentifier

getResourceIdentifier( string $method ) : string

Gets the idetifier used to request a resource.

Arguments
$method
string
'alias' or 'id'.
Output
string
The identifier for the requested resource.
Details
visibility
public
final
false
static
false

getResourceMethod

getResourceMethod( ) : string

Gets the method used to request a resource.

Output
string
'alias', 'id', or an empty string.
Details
visibility
public
final
false
static
false

handleRequest

handleRequest( ) : boolean

The primary MODX request handler (a.k.a. controller).

Output
boolean
True if a request is handled without interruption.
Details
visibility
public
final
false
static
false

loadErrorHandler

loadErrorHandler( string $class = modError ) :

Loads the error handling class for the request.

Arguments
$class
string
The class to use as the error handler.
Details
visibility
public
final
false
static
false

prepareResponse

prepareResponse( array $options = array ) : boolean

Prepares the MODX response to a web request that is being handled.

Arguments
$options
array
An array of options
Output
boolean
True if the response is properly prepared.
Details
visibility
public
final
false
static
false

preserveRequest

preserveRequest( string $key = referrer ) :

Preserves the $_REQUEST superglobal to the $_SESSION.

Arguments
$key
string
A key to save the $_REQUEST as; default is 'referrer'.
Details
visibility
public
final
false
static
false

registerLogging

registerLogging( array $options = array ) :

Provides an easy way to initiate register logging.

Through an array of options, you can have all calls to modX::log() recorded in a topic of a modRegister instance. The options include:

  • register: the name of the register (required)
  • topic: the topic to record to (required)
  • register_class: the modRegister class (defaults to modFileRegister)
  • log_level: the logging level (defaults to MODX_LOG_LEVEL_INFO)
Arguments
$options
array
An array containing all the options required to initiate and configure logging to a modRegister instance.
Details
visibility
public
final
false
static
false

retrieveRequest

retrieveRequest( string $key = referrer ) :

Retrieve's a preserved $_REQUEST from $_SESSION.

Arguments
$key
string
A key to identify a specific $_REQUEST; default is 'referrer'.
Details
visibility
public
final
false
static
false

sanitizeRequest

sanitizeRequest( ) :

Harden GPC variables by removing any MODX tags, Javascript, or entities.

Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox 0.11.2.