Methods summary
public static
string
|
#
getMethod( )
Gets the request method
Returns
string
|
public static
mixed
|
#
getVar( string $name, mixed $default = null, string $hash = 'default', string $type = 'none', integer $mask = 0 )
Fetches and returns a given variable.
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
- Source of variable value (POST, GET, FILES, COOKIE, METHOD)
- $type
Return type for the variable (INT, FLOAT, BOOLEAN, WORD,
ALNUM, CMD, BASE64, STRING, ARRAY, PATH, NONE) For more
information see Xoops\Core\FilterInput::clean().
- $mask
- Filter mask for the variable
Returns
mixed Requested variable
|
public static
integer
|
#
getInt( string $name, integer $default = 0, string $hash = 'default' )
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().
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
- $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
integer Requested variable
|
public static
float
|
#
getFloat( string $name, float $default = 0.0, string $hash = 'default' )
Fetches and returns a given filtered variable. The float
filter only allows digits and periods. This is currently
only a proxy function for getVar().
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
float Requested variable
|
public static
boolean
|
#
getBool( string $name, boolean $default = false, string $hash = 'default' )
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().
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
boolean Requested variable
|
public static
string
|
#
getWord( string $name, string $default = '', string $hash = 'default' )
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().
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
string Requested variable
|
public static
string
|
#
getCmd( string $name, string $default = '', string $hash = 'default' )
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().
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
string Requested variable
|
public static
string
|
#
getString( string $name, string $default = '', string $hash = 'default', integer $mask = 0 )
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().
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
string Requested variable
|
public static
array
|
#
getArray( string $name, mixed $default = array(), string $hash = 'default' )
Fetches and returns an array
Fetches and returns an array
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
array
|
public static
string
|
#
getText( string $name, string $default = '', string $hash = 'default' )
Fetches and returns raw text
Fetches and returns raw text
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
string Requested variable
|
public static
string
|
#
getUrl( string $name, string $default = '', string $hash = 'default' )
Fetches and returns a web url
Fetches and returns a web url
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
string Requested variable
|
public static
string
|
#
getPath( string $name, string $default = '', string $hash = 'default' )
Fetches and returns a file (or web) path
Fetches and returns a file (or web) path
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
string Requested variable
|
public static
string
|
#
getEmail( string $name, string $default = '', string $hash = 'default' )
Fetches and returns an email address
Fetches and returns an email address
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
string email address or default if invalid
|
public static
string
|
#
getIP( string $name, string $default = '', string $hash = 'default' )
Fetches and returns an IP address
Fetches and returns an IP address
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
string IP address or default if invalid
|
public static
DateTime
|
#
getDateTime( string $name, mixed $default = null, string $hash = 'default' )
Return a DateTime object from a Xoops\Form\DateSelect of Xoops\Form\DateTime field
Return a DateTime object from a Xoops\Form\DateSelect of Xoops\Form\DateTime field
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
DateTime object
|
public static
string
|
#
setVar( string $name, string $value = null, string $hash = 'method', boolean $overwrite = true )
Set a variable in one of the request variables
Set a variable in one of the request variables
Parameters
- $name
- Name
- $value
- Value
- $hash
- Hash
- $overwrite
- Boolean
Returns
string Previous value
|
public static
mixed
|
#
get( string $hash = 'default', integer $mask = 0 )
Fetches and returns a request array.
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
mixed Request hash
|
public static
|
#
set( array $array, string $hash = 'default', boolean $overwrite = true )
Sets a request variable
Parameters
- $array
- An associative array of key-value pairs
- $hash
- The request variable to set (POST, GET, FILES, METHOD)
- $overwrite
- If true and an existing key is found, the value is overwritten, otherwise it is ingored
|