Документация по Joomla 1.7

Joomla.Platform\JRequest
libraries/joomla/environment/request.php at line 39

Class JRequest

JRequest

public class JRequest

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.

Subpackage:
Environment
Deprecated:
12.1 Get the JInput object from the application instead
Since:
11.1

Method Summary
static string

getURI()

Gets the full request path.

static string

getMethod()

Gets the request method.

static mixed

getVar(string name, string default, string hash, string type, integer mask)

Fetches and returns a given variable.

static integer

getInt(string name, string default, string hash)

Fetches and returns a given filtered variable.

static integer

getUInt(string name, string default, string hash)

Fetches and returns a given filtered variable.

static float

getFloat(string name, string default, string hash)

Fetches and returns a given filtered variable.

static bool

getBool(string name, string default, string hash)

Fetches and returns a given filtered variable.

static string

getWord(string name, string default, string hash)

Fetches and returns a given filtered variable.

static string

getCmd(string name, string default, string hash)

Cmd (Word and Integer0 filterFetches and returns a given filtered variable.

static string

getString(string name, string default, string hash, integer mask)

Fetches and returns a given filtered variable.

static string

setVar(string name, string value, string hash, boolean overwrite)

Set a variabe in one of the request variables.

static mixed

get(string hash, integer mask)

Fetches and returns a request array.

static void

set(array An, string The, boolean If, mixed array, str hash, bool overwrite)

Sets a request variable.

static boolean

checkToken(string The, str method)

Checks for a form token in the request.

static void

clean()

Cleans the request from script injection.

private static

_cleanArray(array array, boolean gloabalise, bool globalise)

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

private static mixed

_cleanVar(mixed var, integer mask, string type)

Clean up an input variable.

protected static array

_stripSlashesRecursive(array value)

Strips slashes recursively on an array.

Method Detail

libraries/joomla/environment/request.php at line 50

getURI

public static string getURI()

Gets the full request path.

Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 68

getMethod

public static string getMethod()

Gets the request method.

Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 108

getVar

public static mixed getVar(string name, string default, string hash, string type, integer mask)

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:
name - Variable name.
default - Default value if the variable does not exist.
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
type - Return type for the variable, for valid values see {@link JFilterInput::clean()}.
mask - Filter mask for the variable.
Returns:
Requested variable.
Since:
11.1
Deprecated:
12.1 Use JInput::Get

libraries/joomla/environment/request.php at line 197

getInt

public static integer getInt(string name, string default, string hash)

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:
name - Variable name.
default - Default value if the variable does not exist.
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
Returns:
Requested variable.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 221

getUInt

public static integer getUInt(string name, string default, string hash)

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:
name - Variable name.
default - Default value if the variable does not exist.
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
Returns:
Requested variable.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 246

getFloat

public static float getFloat(string name, string default, string hash)

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:
name - Variable name.
default - Default value if the variable does not exist.
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
Returns:
Requested variable.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 271

getBool

public static bool getBool(string name, string default, string hash)

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:
name - Variable name.
default - Default value if the variable does not exist.
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
Returns:
Requested variable.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 296

getWord

public static string getWord(string name, string default, string hash)

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:
name - Variable name.
default - Default value if the variable does not exist.
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
Returns:
Requested variable.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 322

getCmd

public static string getCmd(string name, string default, string hash)

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:
name - Variable name
default - Default value if the variable does not exist
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD)
Returns:
Requested variable
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 348

getString

public static string getString(string name, string default, string hash, integer mask)

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:
name - Variable name
default - Default value if the variable does not exist
hash - Where the var should come from (POST, GET, FILES, COOKIE, METHOD)
mask - Filter mask for the variable
Returns:
Requested variable
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 371

setVar

public static string setVar(string name, string value, string hash, boolean overwrite)

Set a variabe in one of the request variables.

Parameters:
name - Name
value - Value
hash - Hash
overwrite - Boolean
Returns:
Previous value
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 452

get

public static mixed get(string hash, integer mask)

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:
hash - to get (POST, GET, FILES, METHOD).
mask - Filter mask for the variable.
Returns:
Request hash.
Since:
11.1
Deprecated:
12.1 User JInput::get
See Also:
JInput

libraries/joomla/environment/request.php at line 516

set

public static void set(array An, string The, boolean If, mixed array, str hash, bool overwrite)

Sets a request variable.

Parameters:
An - associative array of key-value pairs.
The - request variable to set (POST, GET, FILES, METHOD).
If - true and an existing key is found, the value is overwritten, otherwise it is ignored.
Since:
11.1
Deprecated:
12.1 Use JInput::Set
See Also:
JInput::Set

libraries/joomla/environment/request.php at line 539

checkToken

public static boolean checkToken(string The, str method)

Checks for a form token in the request.

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

Parameters:
The - request method in which to look for the token key.
Returns:
True if found and valid, false otherwise.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 570

clean

public static void clean()

Cleans the request from script injection.

Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 632

_cleanArray

private static _cleanArray(array array, boolean gloabalise, bool globalise)

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

Parameters:
array - Array to clean.
gloabalise - True if the array is to be added to the GLOBALS.
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 676

_cleanVar

private static mixed _cleanVar(mixed var, integer mask, string type)

Clean up an input variable.

Parameters:
var - The input variable.
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.
type - The variable type {@see JFilterInput::clean()}.
Returns:
Same as $var
Since:
11.1
Deprecated:
12.1

libraries/joomla/environment/request.php at line 727

_stripSlashesRecursive

protected static array _stripSlashesRecursive(array value)

Strips slashes recursively on an array.

Parameters:
value - Array or (nested arrays) of strings.
Returns:
The input array with stripshlashes applied to it.
Since:
11.1
Deprecated:
12.1

Документация по Joomla 1.7