Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe JRequest

Fonctions membres publiques statiques

static getUri ()
 
static getMethod ()
 
static getVar ($name, $default=null, $hash='default', $type='none', $mask=0)
 
static getInt ($name, $default=0, $hash='default')
 
static getUInt ($name, $default=0, $hash='default')
 
static getFloat ($name, $default=0.0, $hash='default')
 
static getBool ($name, $default=false, $hash='default')
 
static getWord ($name, $default='', $hash='default')
 
static getCmd ($name, $default='', $hash='default')
 
static getString ($name, $default='', $hash='default', $mask=0)
 
static setVar ($name, $value=null, $hash='method', $overwrite=true)
 
static get ($hash='default', $mask=0)
 
static set ($array, $hash='default', $overwrite=true)
 
static checkToken ($method='post')
 

Fonctions membres protégées statiques

static _cleanVar ($var, $mask=0, $type=null)
 

Description détaillée

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.

Depuis
1.5
Obsolète:
1.7 Get the JInput object from the application instead

Documentation des fonctions membres

◆ _cleanVar()

static _cleanVar (   $var,
  $mask = 0,
  $type = null 
)
staticprotected

Clean up an input variable.

Paramètres
mixed$varThe input variable.
integer$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 {
Voir également
JFilterInput::clean()}.
Renvoie
mixed Same as $var
Depuis
1.5
Obsolète:
1.7

Références $type, elseif, et null.

◆ checkToken()

static checkToken (   $method = 'post')
static

Checks for a form token in the request.

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

Paramètres
string$methodThe request method in which to look for the token key.
Renvoie
boolean True if found and valid, false otherwise.
Depuis
1.5
Obsolète:
1.7 Use JSession::checkToken() instead. Note that 'default' has to become 'request'.

◆ get()

static 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

Paramètres
string$hashto get (POST, GET, FILES, METHOD).
integer$maskFilter mask for the variable.
Renvoie
mixed Request hash.
Depuis
1.5
Obsolète:
1.7 Use JInput::get()
Voir également
JInput

Références $hash, et $input.

Référencé par FOFInput\__construct().

◆ getBool()

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

Paramètres
string$nameVariable name.
boolean$defaultDefault value if the variable does not exist.
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD).
Renvoie
boolean Requested variable.
Depuis
1.5
Obsolète:
1.7

Références $default, $hash, et $name.

◆ getCmd()

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

Cmd (Word and Integer) 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.

Paramètres
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
Renvoie
string Requested variable
Depuis
1.5
Obsolète:
1.7

Références $default, $hash, et $name.

◆ getFloat()

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

Paramètres
string$nameVariable name.
float$defaultDefault value if the variable does not exist.
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD).
Renvoie
float Requested variable.
Depuis
1.5
Obsolète:
1.7

Références $default, $hash, et $name.

◆ getInt()

static getInt (   $name,
  $default = 0,
  $hash = 'default' 
)
static

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.

Paramètres
string$nameVariable name.
integer$defaultDefault value if the variable does not exist.
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD).
Renvoie
integer Requested variable.
Depuis
1.5
Obsolète:
1.7

Références $default, $hash, et $name.

Référencé par FOFFormFieldRules\getInput25().

◆ getMethod()

static getMethod ( )
static

Gets the request method.

Renvoie
string
Depuis
1.5
Obsolète:
1.7 Use JInput::getMethod() instead

◆ getString()

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

Paramètres
string$nameVariable name
string$defaultDefault value if the variable does not exist
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD)
integer$maskFilter mask for the variable
Renvoie
string Requested variable
Depuis
1.5
Obsolète:
1.7

Références $default, $hash, et $name.

◆ getUInt()

static getUInt (   $name,
  $default = 0,
  $hash = 'default' 
)
static

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.

Paramètres
string$nameVariable name.
integer$defaultDefault value if the variable does not exist.
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD).
Renvoie
integer Requested variable.
Depuis
1.7
Obsolète:
1.7

Références $default, $hash, et $name.

◆ getUri()

static getUri ( )
static

Gets the full request path.

Renvoie
string
Depuis
1.5
Obsolète:
1.7

Références $uri.

◆ getVar()

static 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

Paramètres
string$nameVariable name.
mixed$defaultDefault value if the variable does not exist.
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD).
string$typeReturn type for the variable, for valid values see JFilterInput::clean().
integer$maskFilter mask for the variable.
Renvoie
mixed Requested variable.
Depuis
1.5
Obsolète:
1.7 Use JInput::get()

Références $default, $GLOBALS, $hash, $input, $name, $type, elseif, et null.

◆ getWord()

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

Paramètres
string$nameVariable name.
string$defaultDefault value if the variable does not exist.
string$hashWhere the var should come from (POST, GET, FILES, COOKIE, METHOD).
Renvoie
string Requested variable.
Depuis
1.5
Obsolète:
1.7

Références $default, $hash, et $name.

◆ set()

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

Sets a request variable.

Paramètres
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 ignored.
Renvoie
void
Depuis
1.5
Obsolète:
1.7 Use JInput::set()

Références $hash, $key, et $value.

◆ setVar()

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

Set a variable in one of the request variables.

Paramètres
string$nameName
string$valueValue
string$hashHash
boolean$overwriteBoolean
Renvoie
string Previous value
Depuis
1.5
Obsolète:
1.7

Références $GLOBALS, $hash, $name, $value, et null.

Référencé par FOFViewForm\onAdd(), FOFViewRaw\onAdd(), et FOFInput\setVar().


La documentation de cette classe a été générée à partir du fichier suivant :