MediaWiki  1.23.2
FauxRequest Class Reference

WebRequest clone which takes values from a provided array. More...

Inheritance diagram for FauxRequest:
Collaboration diagram for FauxRequest:

Public Member Functions

 __construct ( $data=array(), $wasPosted=false, $session=null, $protocol='http')
 
 checkSessionCookie ()
 Returns true if there is a session cookie set. More...
 
 checkUrlExtension ( $extWhitelist=array())
 
 getCookie ( $key, $prefix=null, $default=null)
 Get a cookie from the $_COOKIE jar. More...
 
 getHeader ( $name)
 
 getMethod ()
 Get the HTTP method used for this request. More...
 
 getProtocol ()
 Get the current URL protocol (http or https) More...
 
 getQueryValues ()
 
 getRawInput ()
 FauxRequests shouldn't depend on raw request data (but that could be implemented here) More...
 
 getRawPostString ()
 FauxRequests shouldn't depend on raw request data (but that could be implemented here) More...
 
 getRawQueryString ()
 FauxRequests shouldn't depend on raw request data (but that could be implemented here) More...
 
 getRequestURL ()
 Return the path and query string portion of the request URI. More...
 
 getSessionArray ()
 
 getSessionData ( $key)
 
 getText ( $name, $default='')
 
 getValues ()
 
 setHeader ( $name, $val)
 
 setSessionData ( $key, $data)
 
 wasPosted ()
 
- Public Member Functions inherited from WebRequest
 __construct ()
 
 appendQuery ( $query)
 Take an arbitrary query and rewrite the present URL to include it. More...
 
 appendQueryArray ( $array, $onlyquery=false)
 Appends or replaces value of query variables. More...
 
 appendQueryValue ( $key, $value, $onlyquery=false)
 
 escapeAppendQuery ( $query)
 HTML-safe version of appendQuery(). More...
 
 getAcceptLang ()
 Parse the Accept-Language header sent by the client into an array. More...
 
 getAllHeaders ()
 Get an array containing all request headers. More...
 
 getArray ( $name, $default=null)
 Fetch an array from the input or return $default if it's not set. More...
 
 getBool ( $name, $default=false)
 Fetch a boolean value from the input or return $default if not set. More...
 
 getCheck ( $name)
 Return true if the named value is set in the input, whatever that value is (even "0"). More...
 
 getFileName ( $key)
 Return the original filename of the uploaded file, as reported by the submitting user agent. More...
 
 getFileTempname ( $key)
 Return the path to the temporary file where PHP has stored the upload. More...
 
 getFloat ( $name, $default=0)
 Fetch a floating point value from the input or return $default if not set. More...
 
 getFullRequestURL ()
 Return the request URI with the canonical service and hostname, path, and query string. More...
 
 getFuzzyBool ( $name, $default=false)
 Fetch a boolean value from the input or return $default if not set. More...
 
 getInt ( $name, $default=0)
 Fetch an integer value from the input or return $default if not set. More...
 
 getIntArray ( $name, $default=null)
 Fetch an array of integers, or return $default if it's not set. More...
 
 getIntOrNull ( $name)
 Fetch an integer value from the input or return null if empty. More...
 
 getIP ()
 Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain) More...
 
 getLimitOffset ( $deflimit=50, $optionname='rclimit')
 Check for limit and offset parameters on the input, and return sensible defaults if not given. More...
 
 getUpload ( $key)
 Return a WebRequestUpload object corresponding to the key. More...
 
 getUploadError ( $key)
 Return the upload error or 0. More...
 
 getVal ( $name, $default=null)
 Fetch a scalar from the input or return $default if it's not set. More...
 
 getValueNames ( $exclude=array())
 Returns the names of all input values excluding those in $exclude. More...
 
 interpolateTitle ()
 Check for title, action, and/or variant data in the URL and interpolate it into the GET variables. More...
 
 normalizeUnicode ( $data)
 Recursively normalizes UTF-8 strings in the given array. More...
 
 response ()
 Return a handle to WebResponse style object, for setting cookies, headers and other stuff, for Request being worked on. More...
 
 setIP ( $ip)
 
 setVal ( $key, $value)
 Set an arbitrary value into our get/post data. More...
 
 unsetVal ( $key)
 Unset an arbitrary value from our get/post data. More...
 

Protected Member Functions

 getRawIP ()
 
- Protected Member Functions inherited from WebRequest
 doSecurityRedirect ( $url)
 Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in IE 6. More...
 

Private Member Functions

 notImplemented ( $method)
 

Private Attributes

 $session = array()
 
 $wasPosted = false
 

Additional Inherited Members

- Static Public Member Functions inherited from WebRequest
static detectProtocol ()
 Detect the protocol from $_SERVER. More...
 
static detectServer ()
 Work out an appropriate URL prefix containing scheme and host, based on information detected from $_SERVER. More...
 
static extractTitle ( $path, $bases, $key=false)
 URL rewriting function; tries to extract page title and, optionally, one other fixed parameter value from a URL path. More...
 
static getPathInfo ( $want='all')
 Extract relevant query arguments from the http request uri's path to be merged with the normal php provided query arguments. More...
 
- Public Attributes inherited from WebRequest
 $headers = array()
 
- Protected Attributes inherited from WebRequest
 $data
 
string $protocol
 Cached URL protocol. More...
 

Detailed Description

WebRequest clone which takes values from a provided array.

Definition at line 1275 of file WebRequest.php.

Constructor & Destructor Documentation

◆ __construct()

FauxRequest::__construct (   $data = array(),
  $wasPosted = false,
  $session = null,
  $protocol = 'http' 
)
Parameters
array$dataof non-urlencoded key => value pairs, the fake GET/POST values
bool$wasPostedwhether to treat the data as POST
$sessionMixed: session array or null
string$protocol'http' or 'https'
Exceptions
MWException

Definition at line 1287 of file WebRequest.php.

Member Function Documentation

◆ checkSessionCookie()

FauxRequest::checkSessionCookie ( )

Returns true if there is a session cookie set.

This does not necessarily mean that the user is logged in!

If you want to check for an open session, use session_id() instead; that will also tell you if the session was opened during the current request (in which case the cookie will be sent back to the client at the end of the script run).

Returns
Boolean

Reimplemented from WebRequest.

Reimplemented in DerivativeRequest.

Definition at line 1351 of file WebRequest.php.

◆ checkUrlExtension()

FauxRequest::checkUrlExtension (   $extWhitelist = array())
Parameters
array$extWhitelist
Returns
bool

Reimplemented from WebRequest.

Definition at line 1435 of file WebRequest.php.

◆ getCookie()

FauxRequest::getCookie (   $key,
  $prefix = null,
  $default = null 
)

Get a cookie from the $_COOKIE jar.

Parameters
string$keythe name of the cookie
string$prefixa prefix to use for the cookie name, if not $wgCookiePrefix
$defaultMixed: what to return if the value isn't found
Returns
Mixed: cookie value or $default if the cookie not set

Reimplemented from WebRequest.

Reimplemented in DerivativeRequest.

Definition at line 1347 of file WebRequest.php.

◆ getHeader()

FauxRequest::getHeader (   $name)
Parameters
string$nameThe name of the header to get (case insensitive).
Returns
bool|string

Reimplemented from WebRequest.

Reimplemented in DerivativeRequest.

Definition at line 1367 of file WebRequest.php.

◆ getMethod()

FauxRequest::getMethod ( )

Get the HTTP method used for this request.

Returns
String

Reimplemented from WebRequest.

Definition at line 1336 of file WebRequest.php.

◆ getProtocol()

FauxRequest::getProtocol ( )

Get the current URL protocol (http or https)

Returns
string

Reimplemented from WebRequest.

Reimplemented in DerivativeRequest.

Definition at line 1359 of file WebRequest.php.

◆ getQueryValues()

FauxRequest::getQueryValues ( )
Returns
array

Reimplemented from WebRequest.

Definition at line 1328 of file WebRequest.php.

◆ getRawInput()

FauxRequest::getRawInput ( )

FauxRequests shouldn't depend on raw request data (but that could be implemented here)

Returns
String

Reimplemented from WebRequest.

Definition at line 1427 of file WebRequest.php.

◆ getRawIP()

FauxRequest::getRawIP ( )
protected
Returns
string

Reimplemented from WebRequest.

Definition at line 1442 of file WebRequest.php.

◆ getRawPostString()

FauxRequest::getRawPostString ( )

FauxRequests shouldn't depend on raw request data (but that could be implemented here)

Returns
String

Reimplemented from WebRequest.

Definition at line 1419 of file WebRequest.php.

◆ getRawQueryString()

FauxRequest::getRawQueryString ( )

FauxRequests shouldn't depend on raw request data (but that could be implemented here)

Returns
String

Reimplemented from WebRequest.

Definition at line 1411 of file WebRequest.php.

◆ getRequestURL()

FauxRequest::getRequestURL ( )

Return the path and query string portion of the request URI.

This will be suitable for use as a relative link in HTML output.

Exceptions
MWException
Returns
String

Reimplemented from WebRequest.

Definition at line 1355 of file WebRequest.php.

◆ getSessionArray()

FauxRequest::getSessionArray ( )
Returns
array|Mixed|null

Definition at line 1403 of file WebRequest.php.

◆ getSessionData()

FauxRequest::getSessionData (   $key)
Parameters
$key
Returns
mixed

Reimplemented from WebRequest.

Reimplemented in DerivativeRequest.

Definition at line 1385 of file WebRequest.php.

◆ getText()

FauxRequest::getText (   $name,
  $default = '' 
)
Parameters
$namestring
$defaultstring
Returns
string

Reimplemented from WebRequest.

Definition at line 1313 of file WebRequest.php.

◆ getValues()

FauxRequest::getValues ( )
Returns
Array

Reimplemented from WebRequest.

Definition at line 1321 of file WebRequest.php.

◆ notImplemented()

FauxRequest::notImplemented (   $method)
private
Parameters
$methodstring
Exceptions
MWException

Definition at line 1304 of file WebRequest.php.

References WebRequest\$data, $session, $wasPosted, data, and wasPosted().

◆ setHeader()

FauxRequest::setHeader (   $name,
  $val 
)
Parameters
$namestring
$valstring

Definition at line 1376 of file WebRequest.php.

References WebRequest\$protocol.

◆ setSessionData()

FauxRequest::setSessionData (   $key,
  $data 
)
Parameters
$key
$data

Reimplemented from WebRequest.

Reimplemented in DerivativeRequest.

Definition at line 1396 of file WebRequest.php.

◆ wasPosted()

FauxRequest::wasPosted ( )
Returns
bool

Reimplemented from WebRequest.

Definition at line 1343 of file WebRequest.php.

Referenced by notImplemented().

Member Data Documentation

◆ $session

FauxRequest::$session = array()
private

Definition at line 1277 of file WebRequest.php.

Referenced by notImplemented().

◆ $wasPosted

FauxRequest::$wasPosted = false
private

Definition at line 1276 of file WebRequest.php.

Referenced by DerivativeRequest\getAllHeaders(), and notImplemented().


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