Class JRequest

Description

JRequest Class

This class serves to provide the Joomla Platform with a common interface to access request variables. This includes $_POST, $_GET, and naturally $_REQUEST. Variables can be passed through an input filter to avoid injection or returned raw.

  • deprecated: 12.1 Get the JInput object from the application instead
  • since: 11.1

Located in /libraries/joomla/environment/request.php (line 38)


	
			
Method Summary
static boolean checkToken ([string $method = 'post'])
static void clean ()
static mixed get ([string $hash = 'default'], [integer $mask = 0])
static boolean getBool (string $name, [string $default = false], [string $hash = 'default'])
static string getCmd (string $name, [string $default = ''], [string $hash = 'default'])
static float getFloat (string $name, [string $default = 0.0], [string $hash = 'default'])
static integer getInt (string $name, [string $default = 0], [string $hash = 'default'])
static string getMethod ()
static string getString (string $name, [string $default = ''], [string $hash = 'default'], [integer $mask = 0])
static integer getUInt (string $name, [string $default = 0], [string $hash = 'default'])
static string getURI ()
static mixed getVar (string $name, [string $default = null], [string $hash = 'default'], [string $type = 'none'], [integer $mask = 0])
static string getWord (string $name, [string $default = ''], [string $hash = 'default'])
static void set (array $array, [string $hash = 'default'], [boolean $overwrite = true])
static string setVar (string $name, [string $value = null], [string $hash = 'method'], [boolean $overwrite = true])
static mixed _cleanVar (mixed $var, [integer $mask = 0], [string $type = null])
static array _stripSlashesRecursive (array $value)
Methods
static method checkToken (line 510)

Checks for a form token in the request.

Use in conjunction with JHtml::_('form.token').

  • return: True if found and valid, false otherwise.
  • deprecated: 12.1 Use JSession::checkToken() instead.
  • since: 11.1
  • access: public
static boolean checkToken ([string $method = 'post'])
  • string $method: The request method in which to look for the token key.
static method clean (line 544)

Cleans the request from script injection.

  • deprecated: 12.1
  • since: 11.1
  • access: public
static void clean ()
static method get (line 426)

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

  • return: Request hash.
  • see: JInput
  • deprecated: 12.1 User JInput::get
  • since: 11.1
  • access: public
static mixed get ([string $hash = 'default'], [integer $mask = 0])
  • string $hash: to get (POST, GET, FILES, METHOD).
  • integer $mask: Filter mask for the variable.
static method getBool (line 259)

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.

  • return: Requested variable.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static boolean getBool (string $name, [string $default = false], [string $hash = 'default'])
  • string $name: Variable name.
  • string $default: Default value if the variable does not exist.
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
static method getCmd (line 304)

Cmd (Word and Integer0 filter

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.

  • return: Requested variable
  • deprecated: 12.1
  • since: 11.1
  • access: public
static string getCmd (string $name, [string $default = ''], [string $hash = 'default'])
  • string $name: Variable name
  • string $default: Default value if the variable does not exist
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD)
static method getFloat (line 238)

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.

  • return: Requested variable.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static float getFloat (string $name, [string $default = 0.0], [string $hash = 'default'])
  • string $name: Variable name.
  • string $default: Default value if the variable does not exist.
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
static method getInt (line 195)

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

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

  • return: Requested variable.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static integer getInt (string $name, [string $default = 0], [string $hash = 'default'])
  • string $name: Variable name.
  • string $default: Default value if the variable does not exist.
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
static method getMethod (line 64)

Gets the request method.

  • deprecated: 12.1
  • since: 11.1
  • access: public
static string getMethod ()
static method getString (line 327)

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.

  • return: Requested variable
  • deprecated: 12.1
  • since: 11.1
  • access: public
static string getString (string $name, [string $default = ''], [string $hash = 'default'], [integer $mask = 0])
  • string $name: Variable name
  • string $default: Default value if the variable does not exist
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD)
  • integer $mask: Filter mask for the variable
static method getUInt (line 216)

Fetches and returns a given filtered variable. The unsigned 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.

  • return: Requested variable.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static integer getUInt (string $name, [string $default = 0], [string $hash = 'default'])
  • string $name: Variable name.
  • string $default: Default value if the variable does not exist.
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
static method getURI (line 49)

Gets the full request path.

  • deprecated: 12.1
  • since: 11.1
  • access: public
static string getURI ()
static method getVar (line 101)

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

  • return: Requested variable.
  • deprecated: 12.1 Use JInput::Get
  • since: 11.1
  • access: public
static mixed getVar (string $name, [string $default = null], [string $hash = 'default'], [string $type = 'none'], [integer $mask = 0])
  • string $name: Variable name.
  • string $default: Default value if the variable does not exist.
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
  • string $type: Return type for the variable, for valid values see JFilterInput::clean().
  • integer $mask: Filter mask for the variable.
static method getWord (line 281)

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.

  • return: Requested variable.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static string getWord (string $name, [string $default = ''], [string $hash = 'default'])
  • string $name: Variable name.
  • string $default: Default value if the variable does not exist.
  • string $hash: Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
static method set (line 490)

Sets a request variable.

  • see: JInput::Set
  • deprecated: 12.1 Use JInput::Set
  • since: 11.1
  • access: public
static void set (array $array, [string $hash = 'default'], [boolean $overwrite = true])
  • array $array: An associative array of key-value pairs.
  • string $hash: The request variable to set (POST, GET, FILES, METHOD).
  • boolean $overwrite: If true and an existing key is found, the value is overwritten, otherwise it is ignored.
static method setVar (line 347)

Set a variable in one of the request variables.

  • return: Previous value
  • deprecated: 12.1
  • since: 11.1
  • access: public
static string setVar (string $name, [string $value = null], [string $hash = 'method'], [boolean $overwrite = true])
  • string $name: Name
  • string $value: Value
  • string $hash: Hash
  • boolean $overwrite: Boolean
static method _cleanVar (line 607)

Clean up an input variable.

  • return: Same as $var
  • deprecated: 12.1
  • since: 11.1
static mixed _cleanVar (mixed $var, [integer $mask = 0], [string $type = null])
  • mixed $var: The input variable.
  • integer $mask: Filter 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 $type: The variable type {@see JFilterInput::clean()}.
static method _stripSlashesRecursive (line 647)

Strips slashes recursively on an array.

  • return: The input array with stripslashes applied to it.
  • deprecated: 12.1
  • since: 11.1
  • access: protected
static array _stripSlashesRecursive (array $value)
  • array $value: Array or (nested arrays) of strings.

Documentation generated on Mon, 25 Jun 2012 13:59:11 -0500 by phpDocumentor 1.4.4