XOOPS  2.6.0
Xoops\Core\Request Class Reference
Inheritance diagram for Xoops\Core\Request:
Inheritance graph

Static Public Member Functions

static get ($hash= 'default', $mask=0)
 
static getArray ($name, $default=array(), $hash= 'default')
 
static getBool ($name, $default=false, $hash= 'default')
 
static getCmd ($name, $default= '', $hash= 'default')
 
static getEmail ($name, $default= '', $hash= 'default')
 
static getFloat ($name, $default=0.0, $hash= 'default')
 
static getInt ($name, $default=0, $hash= 'default')
 
static getIP ($name, $default= '', $hash= 'default')
 
static getMethod ()
 
static getPath ($name, $default= '', $hash= 'default')
 
static getString ($name, $default= '', $hash= 'default', $mask=0)
 
static getText ($name, $default= '', $hash= 'default')
 
static getUrl ($name, $default= '', $hash= 'default')
 
static getVar ($name, $default=null, $hash= 'default', $type= 'none', $mask=0)
 
static getWord ($name, $default= '', $hash= 'default')
 
static set ($array, $hash= 'default', $overwrite=true)
 
static setVar ($name, $value=null, $hash= 'method', $overwrite=true)
 

Public Attributes

const ALLOWHTML = 4
 
const ALLOWRAW = 2
 
const NOTRIM = 1
 

Static Private Member Functions

static cleanVar ($var, $mask=0, $type=null)
 
static cleanVars ($var, $mask=0, $type=null)
 
static stripSlashesRecursive ($value)
 

Detailed Description

Definition at line 34 of file Request.php.

Member Function Documentation

static Xoops\Core\Request::cleanVar (   $var,
  $mask = 0,
  $type = null 
)
staticprivate

Clean up an input variable.

Parameters
mixed$varThe input variable.
int$maskFilter bit mask.
  • 1=no trim: If this flag is cleared and the input is a string, the string will have leading and trailing whitespace trimmed.
  • 2=allow_raw: If set, no more filtering is performed, higher bits are ignored.
  • 4=allow_html: HTML is allowed, but passed through a safe HTML filter first. If set, no more filtering is performed.
  • If no bits other than the 1 bit is set, a strict filter is applied.
string$typeThe variable type. See FilterInput::clean().
Returns
string

Definition at line 492 of file Request.php.

References $type, $var, and Xoops\Core\FilterInput\getInstance().

Here is the call graph for this function:

static Xoops\Core\Request::cleanVars (   $var,
  $mask = 0,
  $type = null 
)
staticprivate

Clean up an array of variables.

Parameters
mixed$varThe input variable.
int$maskFilter bit mask. See Request::cleanVar()
string$typeThe variable type. See FilterInput::clean().
Returns
string

Definition at line 539 of file Request.php.

References $type, and $var.

static Xoops\Core\Request::get (   $hash = 'default',
  $mask = 0 
)
static

Fetches and returns a request array.

The default behaviour is fetching variables depending on the current request method: GET and HEAD will result in returning $_GET, POST and PUT will result in returning $_POST.

You can force the source by setting the $hash parameter:

  • post $_POST
  • get $_GET
  • files $_FILES
  • cookie $_COOKIE
  • env $_ENV
  • server $_SERVER
  • method via current $_SERVER['REQUEST_METHOD']
  • default $_REQUEST
Parameters
string$hashto get (POST, GET, FILES, METHOD)
int$maskFilter mask for the variable
Returns
mixed Request hash

Definition at line 419 of file Request.php.

References $_SERVER, and $result.

static Xoops\Core\Request::getArray (   $name,
  $default = array(),
  $hash = 'default' 
)
static

Fetches and returns an array

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
array

Definition at line 259 of file Request.php.

References $name.

static Xoops\Core\Request::getBool (   $name,
  $default = false,
  $hash = 'default' 
)
static

Fetches and returns a given filtered variable. The bool filter will only return true/false bool values. This is currently only a proxy function for getVar().

See getVar() for more in-depth documentation on the parameters.

Parameters
string$nameVariable name
bool$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
bool Requested variable

Definition at line 189 of file Request.php.

References $name.

static Xoops\Core\Request::getCmd (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns a given filtered variable. The cmd filter only allows the characters [A-Za-z0-9.-_]. This is currently only a proxy function for getVar().

See getVar() for more in-depth documentation on the parameters.

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string Requested variable

Definition at line 225 of file Request.php.

References $name.

static Xoops\Core\Request::getEmail (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns an email address

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string email address or default if invalid

Definition at line 315 of file Request.php.

References $name.

static Xoops\Core\Request::getFloat (   $name,
  $default = 0.0,
  $hash = 'default' 
)
static

Fetches and returns a given filtered variable. The float filter only allows digits and periods. This is currently only a proxy function for getVar().

See getVar() for more in-depth documentation on the parameters.

Parameters
string$nameVariable name
float$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
float Requested variable

Definition at line 171 of file Request.php.

References $name.

static Xoops\Core\Request::getInt (   $name,
  $default = 0,
  $hash = 'default' 
)
static

Fetches and returns a given filtered variable. The integer filter will allow only digits to be returned. This is currently only a proxy function for getVar().

See getVar() for more in-depth documentation on the parameters.

Parameters
string$nameVariable name
int$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
int Requested variable

Definition at line 153 of file Request.php.

References $name.

static Xoops\Core\Request::getIP (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns an IP address

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string IP address or default if invalid

Definition at line 330 of file Request.php.

References $name.

static Xoops\Core\Request::getMethod ( )
static

Gets the request method

Returns
string

Definition at line 49 of file Request.php.

References $_SERVER.

static Xoops\Core\Request::getPath (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns a file (or web) path

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string Requested variable

Definition at line 301 of file Request.php.

References $name.

static Xoops\Core\Request::getString (   $name,
  $default = '',
  $hash = 'default',
  $mask = 0 
)
static

Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask. This is currently only a proxy function for getVar().

See getVar() for more in-depth documentation on the parameters.

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
int$maskFilter mask for the variable
Returns
string Requested variable

Definition at line 244 of file Request.php.

References $name.

Referenced by Xoops\Core\Session\RememberMe\readUserCookie().

Here is the caller graph for this function:

static Xoops\Core\Request::getText (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns raw text

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string Requested variable

Definition at line 273 of file Request.php.

References $name.

static Xoops\Core\Request::getUrl (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns a web url

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string Requested variable

Definition at line 287 of file Request.php.

References $name.

static Xoops\Core\Request::getVar (   $name,
  $default = null,
  $hash = 'default',
  $type = 'none',
  $mask = 0 
)
static

Fetches and returns a given variable.

The default behaviour is fetching variables depending on the current request method: GET and HEAD will result in returning an entry from $_GET, POST and PUT will result in returning an entry from $_POST.

You can force the source by setting the $hash parameter:

  • post $_POST
  • get $_GET
  • files $_FILES
  • cookie $_COOKIE
  • env $_ENV
  • server $_SERVER
  • method via current $_SERVER['REQUEST_METHOD']
  • default $_REQUEST
Parameters
string$nameVariable name
mixed$defaultDefault value if the variable does not exist
string$hashSource of variable value (POST, GET, FILES, COOKIE, METHOD)
string$typeReturn type for the variable (INT, FLOAT, BOOLEAN, WORD, ALNUM, CMD, BASE64, STRING, ARRAY, PATH, NONE) For more information see Xoops::clean().
int$maskFilter mask for the variable
Returns
mixed Requested variable

Definition at line 85 of file Request.php.

References $_SERVER, $name, $type, and $var.

static Xoops\Core\Request::getWord (   $name,
  $default = '',
  $hash = 'default' 
)
static

Fetches and returns a given filtered variable. The word filter only allows the characters [A-Za-z_]. This is currently only a proxy function for getVar().

See getVar() for more in-depth documentation on the parameters.

Parameters
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns
string Requested variable

Definition at line 207 of file Request.php.

References $name.

static Xoops\Core\Request::set (   $array,
  $hash = 'default',
  $overwrite = true 
)
static

Sets a request variable

Parameters
array$arrayAn associative array of key-value pairs
string$hashThe request variable to set (POST, GET, FILES, METHOD)
boolean$overwriteIf true and an existing key is found, the value is overwritten, otherwise it is ingored
Returns
void

Definition at line 470 of file Request.php.

static Xoops\Core\Request::setVar (   $name,
  $value = null,
  $hash = 'method',
  $overwrite = true 
)
static

Set a variable in one of the request variables

Parameters
string$nameName
string$valueValue
string$hashHash
boolean$overwriteBoolean
Returns
string Previous value

Definition at line 346 of file Request.php.

References $_SERVER, and $name.

static Xoops\Core\Request::stripSlashesRecursive (   $value)
staticprivate

Strips slashes recursively on an array

Parameters
array$valueArray of (nested arrays of) strings
Returns
array The input array with stripshlashes applied to it

Definition at line 560 of file Request.php.

Member Data Documentation

const Xoops\Core\Request::ALLOWHTML = 4

Definition at line 42 of file Request.php.

const Xoops\Core\Request::ALLOWRAW = 2

Definition at line 41 of file Request.php.

const Xoops\Core\Request::NOTRIM = 1

Available masks for cleaning variables

Definition at line 40 of file Request.php.


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