core/model/modx/modrequest.class.php

Show: inherited
Table of Contents

MODX Revolution

Copyright 2006-2012 by MODX, LLC. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Package
modx  

\modRequest

Package: modx

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}.

Children
\modManagerRequest

Properties

Propertypublicarray  $headers= 'null'

The HTTP headers sent in the request

Default valuenullDetails
Type
array
Propertypublicstring  $method= 'null'

The current request method

Default valuenullDetails
Type
string
Propertypublic\modX  $modx= 'null'

A reference to the modX object

Default valuenullDetails
Type
\modX
Propertypublicarray  $parameters= 'null'

The parameters sent in the request

Default valuenullDetails
Type
array

Methods

methodpublic__construct( \modX $modx ) : void

Parameters
Name Type Description
$modx \modX

A reference to the modX object

methodpublic_cleanResourceIdentifier( string $identifier ) : string | integer

Cleans the resource identifier from the request params.

Parameters
Name Type Description
$identifier string

The raw identifier.

Returns
Type Description
string | integer The cleansed identifier.
methodpubliccheckPublishStatus( ) : void

Checks the current status of timed publishing events.

methodpublicgetActionIDs( array $actions = array(), string $namespace = 'core' ) : array

Get the IDs for a collection of string action keys

Parameters
Name Type Description
$actions array
$namespace string
Returns
Type Description
array
methodpublicgetAllActionIDs( string $namespace = '' ) : array

Get a list of all modAction IDs

Parameters
Name Type Description
$namespace string
Returns
Type Description
array
methodpublicgetClientIp( ) : 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
Returns
Type Description
array
Details
Access
public  
methodpublicgetHeaders( boolean $ucKeys = false ) : array

Return the HTTP headers sent through the request

Parameters
Name Type Description
$ucKeys boolean

if true, upper-case all keys for the headers

Returns
Type Description
array
methodpublicgetParameters( string | array $keys = array(), string $type = 'GET' ) : mixed

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

Parameters
Name Type Description
$keys string | array

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).

Returns
Type Description
mixed
methodpublicgetResource( string $method, string | integer $identifier, array $options = array() ) : \modResource

Gets a requested resource and all required data.

Parameters
Name Type Description
$method string

The method, 'id', or 'alias', by which to perform the resource lookup.

$identifier string | integer

The identifier with which to search.

$options array

An array of options for the resource fetching

Returns
Type Description
\modResource The requested modResource instance or request is forwarded to the error page, or unauthorized page.
methodpublicgetResourceIdentifier( string $method ) : string

Gets the idetifier used to request a resource.

Parameters
Name Type Description
$method string

'alias' or 'id'.

Returns
Type Description
string The identifier for the requested resource.
methodpublicgetResourceMethod( ) : string

Gets the method used to request a resource.

Returns
Type Description
string 'alias', 'id', or an empty string.
methodpublichandleRequest( ) : boolean

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

Returns
Type Description
boolean True if a request is handled without interruption.
methodpublicloadErrorHandler( string $class = 'modError' ) : void

Loads the error handling class for the request.

Parameters
Name Type Description
$class string

The class to use as the error handler.

methodpublicprepareResponse( array $options = array() ) : boolean

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

Parameters
Name Type Description
$options array

An array of options

Returns
Type Description
boolean True if the response is properly prepared.
methodpublicpreserveRequest( string $key = 'referrer' ) : void

Preserves the $_REQUEST superglobal to the $_SESSION.

Parameters
Name Type Description
$key string

A key to save the $_REQUEST as; default is 'referrer'.

methodpublicregisterLogging( array $options = array() ) : void

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)
Parameters
Name Type Description
$options array

An array containing all the options required to initiate and configure logging to a modRegister instance.

methodpublicretrieveRequest( string $key = 'referrer' ) : string

Retrieve a preserved $_REQUEST from $_SESSION.

Parameters
Name Type Description
$key string

A key to identify a specific $_REQUEST; default is 'referrer'.

Returns
Type Description
string
methodpublicsanitizeRequest( ) : void

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

Documentation was generated by DocBlox 0.18.1.