Elgg  Version master
Public Member Functions | List of all members
Elgg\Http\Input Class Reference

Provides unified access to the $_GET and $_POST inputs. More...

Public Member Functions

 __construct (protected Request $request)
 Constructor. More...
 
 set ($key, $value)
 Sets an input value that may later be retrieved by get_input. More...
 
 get ($key, $default=null, $filter_result=true)
 Get some input from variables passed submitted through GET or POST. More...
 
 all ($filter_result=true)
 Returns all values parsed from the request. More...
 

Detailed Description

Provides unified access to the $_GET and $_POST inputs.

Since
1.10.0

Definition at line 11 of file Input.php.

Constructor & Destructor Documentation

Elgg\Http\Input::__construct ( protected Request  $request)

Constructor.

Parameters
Request$requestHttp Request object

Definition at line 18 of file Input.php.

Member Function Documentation

Elgg\Http\Input::all (   $filter_result = true)

Returns all values parsed from the request.

Parameters
bool$filter_resultSanitize input values
Returns
array

Definition at line 74 of file Input.php.

Elgg\Http\Input::get (   $key,
  $default = null,
  $filter_result = true 
)

Get some input from variables passed submitted through GET or POST.

If using any data obtained from get_input() in a web page, please be aware that it is a possible vector for a reflected XSS attack. If you are expecting an integer, cast it to an int. If it is a string, escape quotes.

Parameters
string$keyThe variable name we want.
mixed$defaultA default value for the variable if it is not found.
bool$filter_resultIf true, then the result is filtered for bad tags.
Returns
mixed

Definition at line 48 of file Input.php.

Elgg\Http\Input::set (   $key,
  $value 
)

Sets an input value that may later be retrieved by get_input.

Note: this function does not handle nested arrays (ex: form input of param[m][n])

Parameters
string$keyThe name of the variable
string|string[]$value The value of the variable
Returns
void

Definition at line 31 of file Input.php.


The documentation for this class was generated from the following file: