Elgg  Version 4.x
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Elgg\Http\Request Class Reference

Elgg HTTP request. More...

Inheritance diagram for Elgg\Http\Request:

Public Member Functions

 __construct (array $query=[], array $request=[], array $attributes=[], array $cookies=[], array $files=[], array $server=[], $content=null)
 {} More...
 
 initializeTrustedProxyConfiguration (Config $config)
 Configure trusted proxy servers to allow access to more client information. More...
 
 initializeContext ()
 Initialize context stack. More...
 
 getContextStack ()
 Returns context stack. More...
 
 setRoute (Route $route)
 Sets the route matched for this request by the router. More...
 
 getRoute ()
 Returns the route matched for this request by the router. More...
 
 setParam (string $key, $value, bool $override_request=false)
 Sets an input value that may later be retrieved by get_input. More...
 
 getParam (string $key, $default=null, bool $filter_result=true)
 Get some input from variables passed submitted through GET or POST. More...
 
 getParams (bool $filter_result=true)
 Returns all values parsed from the request. More...
 
 getCurrentURL ()
 Returns current page URL. More...
 
 getUrlSegments (bool $raw=false)
 Get the Elgg URL segments. More...
 
 setUrlSegments (array $segments)
 Get a cloned request with new Elgg URL segments. More...
 
 getFirstUrlSegment ()
 Get first Elgg URL segment. More...
 
 getElggPath ()
 Get the Request URI minus querystring. More...
 
 getClientIp ()
 {} More...
 
 isXmlHttpRequest ()
 {} More...
 
 sniffElggUrl ()
 Sniff the Elgg site URL with trailing slash. More...
 
 isRewriteCheck ()
 Is the request for checking URL rewriting? More...
 
 isAction ()
 Is the request an action. More...
 
 isCliServer ()
 Is PHP running the CLI server front controller. More...
 
 isCliServable ($root)
 Is the request pointing to a file that the CLI server can handle? More...
 
 getFiles ($input_name)
 Returns an array of uploaded file objects regardless of upload status/errors. More...
 
 getFile ($input_name, $check_for_validity=true)
 Returns the first file found based on the input name. More...
 
 validate ()
 Validate the request. More...
 

Public Attributes

const REWRITE_TEST_TOKEN = '__testing_rewrite'
 
const REWRITE_TEST_OUTPUT = 'success'
 

Protected Attributes

 $context_stack
 
 $route
 
 $request_overrides
 
 $filtered_params
 
 $unfiltered_params
 

Detailed Description

Elgg HTTP request.

Definition at line 17 of file Request.php.

Constructor & Destructor Documentation

Elgg\Http\Request::__construct ( array  $query = [],
array  $request = [],
array  $attributes = [],
array  $cookies = [],
array  $files = [],
array  $server = [],
  $content = null 
)

{}

Definition at line 50 of file Request.php.

Member Function Documentation

Elgg\Http\Request::getClientIp ( )

{}

Definition at line 291 of file Request.php.

Elgg\Http\Request::getContextStack ( )

Returns context stack.

Returns
Context

Definition at line 102 of file Request.php.

Elgg\Http\Request::getCurrentURL ( )

Returns current page URL.

Returns
string

Definition at line 207 of file Request.php.

Elgg\Http\Request::getElggPath ( )

Get the Request URI minus querystring.

Returns
string

Definition at line 278 of file Request.php.

Elgg\Http\Request::getFile (   $input_name,
  $check_for_validity = true 
)

Returns the first file found based on the input name.

Parameters
string$input_nameForm input name
bool$check_for_validityIf there is an uploaded file, is it required to be valid
Returns
UploadedFile|false

Definition at line 425 of file Request.php.

Elgg\Http\Request::getFiles (   $input_name)

Returns an array of uploaded file objects regardless of upload status/errors.

Parameters
string$input_nameForm input name
Returns
UploadedFile[]

Definition at line 404 of file Request.php.

Elgg\Http\Request::getFirstUrlSegment ( )

Get first Elgg URL segment.

See also
::getUrlSegments()
Returns
string

Definition at line 264 of file Request.php.

Elgg\Http\Request::getParam ( string  $key,
  $default = null,
bool  $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 169 of file Request.php.

Elgg\Http\Request::getParams ( bool  $filter_result = true)

Returns all values parsed from the request.

Parameters
bool$filter_resultSanitize input values
Returns
array

Definition at line 182 of file Request.php.

Elgg\Http\Request::getRoute ( )

Returns the route matched for this request by the router.

Returns
Route|null

Definition at line 127 of file Request.php.

Elgg\Http\Request::getUrlSegments ( bool  $raw = false)

Get the Elgg URL segments.

Parameters
bool$rawIf true, the segments will not be HTML escaped
Returns
string[]

Definition at line 230 of file Request.php.

Elgg\Http\Request::initializeContext ( )

Initialize context stack.

Returns
static

Definition at line 90 of file Request.php.

Elgg\Http\Request::initializeTrustedProxyConfiguration ( Config  $config)

Configure trusted proxy servers to allow access to more client information.

Returns
void

Definition at line 71 of file Request.php.

Elgg\Http\Request::isAction ( )

Is the request an action.

Returns
bool
Since
4.1

Definition at line 357 of file Request.php.

Elgg\Http\Request::isCliServable (   $root)

Is the request pointing to a file that the CLI server can handle?

Parameters
string$rootRoot directory
Returns
bool

Definition at line 377 of file Request.php.

Elgg\Http\Request::isCliServer ( )

Is PHP running the CLI server front controller.

Returns
bool

Definition at line 366 of file Request.php.

Elgg\Http\Request::isRewriteCheck ( )

Is the request for checking URL rewriting?

Returns
bool

Definition at line 339 of file Request.php.

Elgg\Http\Request::isXmlHttpRequest ( )

{}

Definition at line 310 of file Request.php.

Elgg\Http\Request::setParam ( string  $key,
  $value,
bool  $override_request = false 
)

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
mixed$valueThe value of the variable
bool$override_requestThe variable should override request values (default: false)
Returns
static

Definition at line 142 of file Request.php.

Elgg\Http\Request::setRoute ( Route  $route)

Sets the route matched for this request by the router.

Parameters
Route$routeRoute
Returns
static

Definition at line 113 of file Request.php.

Elgg\Http\Request::setUrlSegments ( array  $segments)

Get a cloned request with new Elgg URL segments.

Parameters
string[]$segments URL segments
Returns
Request

Definition at line 249 of file Request.php.

Elgg\Http\Request::sniffElggUrl ( )

Sniff the Elgg site URL with trailing slash.

Returns
string

Definition at line 321 of file Request.php.

Elgg\Http\Request::validate ( )

Validate the request.

Returns
void
Exceptions
BadRequestException

Definition at line 449 of file Request.php.

Member Data Documentation

Elgg\Http\Request::$context_stack
protected

Definition at line 25 of file Request.php.

Elgg\Http\Request::$filtered_params
protected

Definition at line 40 of file Request.php.

Elgg\Http\Request::$request_overrides
protected

Definition at line 35 of file Request.php.

Elgg\Http\Request::$route
protected

Definition at line 30 of file Request.php.

Elgg\Http\Request::$unfiltered_params
protected

Definition at line 45 of file Request.php.

const Elgg\Http\Request::REWRITE_TEST_OUTPUT = 'success'

Definition at line 20 of file Request.php.

const Elgg\Http\Request::REWRITE_TEST_TOKEN = '__testing_rewrite'

Definition at line 19 of file Request.php.


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