class JRequest


Located at : UKNOWVA_ROOT/libraries/joomla/environment/request.php

deprecated 12.1 Get the JInput object from the application instead

JRequest Class

This class serves to provide the Joomla Framework 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.

Methods

static string
getURI() deprecated

Gets the full request path.

static string
getMethod() deprecated

Gets the request method.

static mixed
getVar(string $name, string $default = null, string $hash = 'default', string $type = 'none', integer $mask) deprecated

Fetches and returns a given variable.

static integer
getInt(string $name, string $default, string $hash = 'default') deprecated

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

static integer
getUInt(string $name, string $default, string $hash = 'default') deprecated

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

static float
getFloat(string $name, string $default = 0.0, string $hash = 'default') deprecated

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

static bool
getBool(string $name, string $default = false, string $hash = 'default') deprecated

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

static string
getWord(string $name, string $default = '', string $hash = 'default') deprecated

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

static string
getCmd(string $name, string $default = '', string $hash = 'default') deprecated

Cmd (Word and Integer0 filter

static string
getString(string $name, string $default = '', string $hash = 'default', integer $mask) deprecated

Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask.

static array
getUsers(string $name, string $default, string $hash = 'default')

Fetches and returns a given filtered variable. The user filter will convert the string in request to an array of user ids. This is currently only a proxy function for getVar().

static string
setVar(string $name, string $value = null, string $hash = 'method', boolean $overwrite = true) deprecated

Set a variabe in one of the request variables.

static mixed
get(string $hash = 'default', integer $mask) deprecated

Fetches and returns a request array.

static 
set(array $array, string $hash = 'default', boolean $overwrite = true) deprecated

Sets a request variable.

static 
checkToken($method = 'post', $check_referer = true)

No description

static void
clean() deprecated

Cleans the request from script injection.

static 
_cleanArray($array, $globalise = false) deprecated

Adds an array to the GLOBALS array and checks that the GLOBALS variable is not being attacked.

static mixed
_cleanVar(mixed $var, integer $mask, string $type = null) deprecated

Clean up an input variable.

Details

at line 50
static string getURI() deprecated

deprecated 12.1

Gets the full request path.

Return Value

string

at line 68
static string getMethod() deprecated

deprecated 12.1

Gets the request method.

Return Value

string

at line 108
static mixed getVar(string $name, string $default = null, string $hash = 'default', string $type = 'none', integer $mask) deprecated

deprecated 12.1 Use JInput::Get

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['REQUESTMETHOD'] default $_REQUEST

Parameters

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 {@link JFilterInput::clean()}.
integer $mask Filter mask for the variable.

Return Value

mixed Requested variable.

at line 197
static integer getInt(string $name, string $default, string $hash = 'default') deprecated

deprecated 12.1

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.

Parameters

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

Return Value

integer Requested variable.

at line 221
static integer getUInt(string $name, string $default, string $hash = 'default') deprecated

deprecated 12.1

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.

Parameters

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

Return Value

integer Requested variable.

at line 246
static float getFloat(string $name, string $default = 0.0, string $hash = 'default') deprecated

deprecated 12.1

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

Return Value

float Requested variable.

at line 271
static bool getBool(string $name, string $default = false, string $hash = 'default') deprecated

deprecated 12.1

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

Return Value

bool Requested variable.

at line 296
static string getWord(string $name, string $default = '', string $hash = 'default') deprecated

deprecated 12.1

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

Return Value

string Requested variable.

at line 322
static string getCmd(string $name, string $default = '', string $hash = 'default') deprecated

deprecated 12.1

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.

Parameters

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)

Return Value

string Requested variable

at line 348
static string getString(string $name, string $default = '', string $hash = 'default', integer $mask) deprecated

deprecated 12.1

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 $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

Return Value

string Requested variable

at line 371
static array getUsers(string $name, string $default, string $hash = 'default')

Fetches and returns a given filtered variable. The user filter will convert the string in request to an array of user ids. This is currently only a proxy function for getVar().

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

Parameters

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

Return Value

array Requested variable.

introuduced in 2.4.4 onwards

at line 392
static string setVar(string $name, string $value = null, string $hash = 'method', boolean $overwrite = true) deprecated

deprecated 12.1

Set a variabe in one of the request variables.

Parameters

string $name Name
string $value Value
string $hash Hash
boolean $overwrite Boolean

Return Value

string Previous value

at line 473
static mixed get(string $hash = 'default', integer $mask) deprecated

deprecated 12.1 User JInput::get

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['REQUESTMETHOD'] default $_REQUEST

Parameters

string $hash to get (POST, GET, FILES, METHOD).
integer $mask Filter mask for the variable.

Return Value

mixed Request hash.

See also

JInput

at line 537
static set(array $array, string $hash = 'default', boolean $overwrite = true) deprecated

deprecated 12.1 Use JInput::Set

Sets a request variable.

Parameters

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.

See also

JInput::Set

at line 560
static checkToken($method = 'post', $check_referer = true)

Parameters

$method
$check_referer

at line 605
static void clean() deprecated

deprecated 12.1

Cleans the request from script injection.

Return Value

void

at line 667
static _cleanArray($array, $globalise = false) deprecated

deprecated 12.1

Adds an array to the GLOBALS array and checks that the GLOBALS variable is not being attacked.

Parameters

$array
$globalise

at line 711
static mixed _cleanVar(mixed $var, integer $mask, string $type = null) deprecated

deprecated 12.1

Clean up an input variable.

Parameters

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=allowraw: If set, no more filtering is performed, higher bits are ignored. 4=allowhtml: 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()}.

Return Value

mixed Same as $var