Class modRequest

Description

Encapsulates the interaction of MODx with an HTTP request.

This class represents the functional portion of the MODx front- controller, and is responsible for sanitizing, interpretting, and dispatching a web request to the appropriate MODx Web Resource.

Located in /model/modx/modrequest.class.php (line 33)


	
			
Direct descendents
Class Description
 class modManagerRequest Encapsulates the interaction of MODx manager with an HTTP request.
Variable Summary
 mixed $headers
 mixed $method
 mixed $modx
 mixed $parameters
Method Summary
 modRequest __construct (modX &$modx)
 void getActionIDs ([ $actions = array()], [ $namespace = 'core'])
 void getAllActionIDs ([ $namespace = ''])
 void getHeaders ([ $ucKeys = false])
 void getParameters ([string|array $keys = array()], [string $type = 'GET'])
 modResource getResource (string $method, string|integer $identifier)
 string getResourceIdentifier (string $method)
 string getResourceMethod ()
 boolean handleRequest ()
 void loadErrorHandler ([string $class = 'modError'])
 boolean prepareResponse ([ $options = array()])
 void preserveRequest ([string $key = 'referrer'])
 void registerLogging ([ $options = array()])
 void retrieveRequest ([string $key = 'referrer'])
 void sanitizeRequest ()
 string|integer _cleanResourceIdentifier (string $identifier)
Variables
mixed $headers = null (line 37)
  • access: public
mixed $method = null (line 35)
  • access: public
mixed $modx = null (line 34)
  • access: public
mixed $parameters = null (line 36)
  • access: public
Methods
Constructor __construct (line 39)
modRequest __construct (modX &$modx)

Redefined in descendants as:
checkPublishStatus (line 392)

Checks the current status of timed publishing events.

  • todo: refactor checkPublishStatus...offload to cachemanager?
  • access: public
void checkPublishStatus ()
getActionIDs (line 457)
  • access: public
void getActionIDs ([ $actions = array()], [ $namespace = 'core'])
  • array $actions
  • $namespace
getAllActionIDs (line 445)
  • access: public
void getAllActionIDs ([ $namespace = ''])
  • $namespace
getHeaders (line 372)
  • access: public
void getHeaders ([ $ucKeys = false])
  • $ucKeys
getParameters (line 480)

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

  • access: public
void getParameters ([string|array $keys = array()], [string $type = 'GET'])
  • string|array $keys: A key or array of keys to retrieve from the GPC variable. An empty array means get all keys of the variable.
  • string $type: The type of GPC variable, GET by default (GET, POST, COOKIE or REQUEST).
getResource (line 137)

Gets a requested resource and all required data.

  • return: The requested modResource instance or request is forwarded to the error page, or unauthorized page.
  • access: public
modResource getResource (string $method, string|integer $identifier)
  • string $method: The method, 'id', or 'alias', by which to perform the resource lookup.
  • string|integer $identifier: The identifier with which to search.
getResourceIdentifier (line 228)

Gets the idetifier used to request a resource.

  • return: The identifier for the requested resource.
  • access: public
string getResourceIdentifier (string $method)
  • string $method: 'alias' or 'id'.
getResourceMethod (line 118)

Gets the method used to request a resource.

  • return: 'alias', 'id', or an empty string.
  • access: public
string getResourceMethod ()
handleRequest (line 52)

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

  • return: True if a request is handled without interruption.
  • access: public
boolean handleRequest ()

Redefined in descendants as:
loadErrorHandler (line 311)

Loads the error handling class for the request.

  • access: public
void loadErrorHandler ([string $class = 'modError'])
  • string $class: The class to use as the error handler.

Redefined in descendants as:
prepareResponse (line 103)

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

  • return: True if the response is properly prepared.
  • access: public
boolean prepareResponse ([ $options = array()])
  • array $options: An array of options

Redefined in descendants as:
preserveRequest (line 353)

Preserves the $_REQUEST superglobal to the $_SESSION.

  • access: public
void preserveRequest ([string $key = 'referrer'])
  • string $key: A key to save the $_REQUEST as; default is 'referrer'.
registerLogging (line 335)

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)

  • access: public
void registerLogging ([ $options = array()])
  • array $options: An array containing all the options required to initiate and configure logging to a modRegister instance.
retrieveRequest (line 364)

Retrieve's a preserved $_REQUEST from $_SESSION.

  • access: public
void retrieveRequest ([string $key = 'referrer'])
  • string $key: A key to identify a specific $_REQUEST; default is 'referrer'.
sanitizeRequest (line 290)

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

  • access: public
void sanitizeRequest ()
_cleanResourceIdentifier (line 251)

Cleans the resource identifier from the request params.

  • return: The cleansed identifier.
  • access: public
string|integer _cleanResourceIdentifier (string $identifier)
  • string $identifier: The raw identifier.

Documentation generated on Fri, 17 Jun 2011 10:03:45 -0600 by phpDocumentor 1.4.3