MediaWiki REL1_39
|
WebRequest clone which takes values from a provided array. More...
Public Member Functions | |
__construct ( $data=[], $wasPosted=false, $session=null, $protocol='http') | |
getCookie ( $key, $prefix=null, $default=null) | |
Get a cookie from the $_COOKIE jar. | |
getMethod () | |
Get the HTTP method used for this request. | |
getPostValues () | |
Get the values passed via POST. | |
getProtocol () | |
Get the current URL protocol (http or https) | |
getQueryValues () | |
getRawInput () | |
FauxRequests shouldn't depend on raw request data (but that could be implemented here) | |
getRawPostString () | |
FauxRequests shouldn't depend on raw request data (but that could be implemented here) | |
getRawQueryString () | |
FauxRequests shouldn't depend on raw request data (but that could be implemented here) | |
getRequestURL () | |
getSessionArray () | |
getText ( $name, $default='') | |
getUpload ( $key) | |
Return a FauxRequestUpload object corresponding to the key. | |
setCookie ( $key, $value, $prefix=null) | |
setCookies ( $cookies, $prefix=null) | |
setHeader ( $name, $val) | |
setHeaders ( $headers) | |
setRequestURL ( $url) | |
setUpload ( $key, $data) | |
Set fake upload data for one file with specific key. | |
setUploadData ( $uploadData) | |
Set fake upload data for all files. | |
wasPosted () | |
Public Member Functions inherited from WebRequest | |
__construct () | |
appendQueryArray ( $array) | |
Appends or replaces value of query variables. | |
appendQueryValue ( $key, $value) | |
getAcceptLang () | |
Parse the Accept-Language header sent by the client into an array. | |
getAllHeaders () | |
Get an array containing all request headers. | |
getArray ( $name, $default=null) | |
Fetch an array from the input or return $default if it's not set. | |
getBool ( $name, $default=false) | |
Fetch a boolean value from the input or return $default if not set. | |
getCheck ( $name) | |
Return true if the named value is set in the input, whatever that value is (even "0"). | |
getCrossSiteCookie ( $key, $prefix='', $default=null) | |
Get a cookie set with SameSite=None possibly with a legacy fallback cookie. | |
getElapsedTime () | |
Get the number of seconds to have elapsed since request start, in fractional seconds, with microsecond resolution. | |
getFileName ( $key) | |
Return the original filename of the uploaded file, as reported by the submitting user agent. | |
getFileTempname ( $key) | |
Return the path to the temporary file where PHP has stored the upload. | |
getFloat ( $name, $default=0.0) | |
Fetch a floating point value from the input or return $default if not set. | |
getFullRequestURL () | |
Return the request URI with the canonical service and hostname, path, and query string. | |
getFuzzyBool ( $name, $default=false) | |
Fetch a boolean value from the input or return $default if not set. | |
getHeader ( $name, $flags=0) | |
Get a request header, or false if it isn't set. | |
getInt ( $name, $default=0) | |
Fetch an integer value from the input or return $default if not set. | |
getIntArray ( $name, $default=null) | |
Fetch an array of integers, or return $default if it's not set. | |
getIntOrNull ( $name) | |
Fetch an integer value from the input or return null if empty. | |
getIP () | |
Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain) | |
getLimitOffsetForUser (UserIdentity $user, $deflimit=50, $optionname='rclimit') | |
Check for limit and offset parameters on the input, and return sensible defaults if not given. | |
getQueryValuesOnly () | |
Get the values passed in the query string only, not including the path router parameters. | |
getRawVal ( $name, $default=null) | |
Fetch a string WITHOUT any Unicode or line break normalization. | |
getSession () | |
Return the session for this request. | |
getSessionData ( $key) | |
Get data from the session. | |
getSessionId () | |
Get the session id for this request, if any. | |
getUploadError ( $key) | |
Return the upload error or 0. | |
getVal ( $name, $default=null) | |
Fetch a text string and partially normalized it. | |
getValueNames ( $exclude=[]) | |
Returns the names of all input values excluding those in $exclude. | |
getValues (... $names) | |
Extracts the (given) named values into an array. | |
hasSafeMethod () | |
Check if this request uses a "safe" HTTP method. | |
interpolateTitle () | |
Check for title, action, and/or variant data in the URL and interpolate it into the GET variables. | |
isSafeRequest () | |
Whether this request should be identified as being "safe". | |
markAsSafeRequest () | |
Mark this request as identified as being nullipotent even if it is a POST request. | |
matchURLForCDN (array $cdnUrls) | |
Determine if the request URL matches one of a given set of canonical CDN URLs. | |
normalizeUnicode ( $data) | |
Recursively normalizes UTF-8 strings in the given array. | |
response () | |
Return a handle to WebResponse style object, for setting cookies, headers and other stuff, for Request being worked on. | |
setIP ( $ip) | |
setSessionData ( $key, $data) | |
setSessionId (SessionId $sessionId) | |
Set the session for this request. | |
setVal ( $key, $value) | |
Set an arbitrary value into our get/post data. | |
unsetVal ( $key) | |
Unset an arbitrary value from our get/post data. | |
Protected Member Functions | |
getRawIP () | |
initHeaders () | |
Initialise the header list. | |
Protected Attributes | |
$cookies = [] | |
Protected Attributes inherited from WebRequest | |
array | $data |
The parameters from $_GET, $_POST and the path router. | |
string[] | $headers = [] |
Lazy-initialized request headers indexed by upper-case header name. | |
bool | $markedAsSafe = false |
Whether this HTTP request is "safe" (even if it is an HTTP post) | |
string | $protocol |
Cached URL protocol. | |
string[] | $queryAndPathParams |
The parameters from $_GET. | |
string[] | $queryParams |
The parameters from $_GET only. | |
float | $requestTime |
The timestamp of the start of the request, with microsecond precision. | |
SessionId null | $sessionId = null |
Session ID to use for this request. | |
Additional Inherited Members | |
Static Public Member Functions inherited from WebRequest | |
static | canonicalizeIPv6LoopbackAddress ( $ip) |
Converts ::1 (IPv6 loopback address) to 127.0.0.1 (IPv4 loopback address); assists in matching trusted proxies. | |
static | detectProtocol () |
Detect the protocol from $_SERVER. | |
static | detectServer ( $assumeProxiesUseDefaultProtocolPorts=null) |
Work out an appropriate URL prefix containing scheme and host, based on information detected from $_SERVER. | |
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. | |
static | getGlobalRequestURL () |
Return the path and query string portion of the main request URI. | |
static | getRequestId () |
Get the current request ID. | |
static | getRequestPathSuffix ( $basePath) |
If the request URL matches a given base path, extract the path part of the request URL after that base, and decode escape sequences in it. | |
static | overrideRequestId ( $id) |
Override the unique request ID. | |
Public Attributes inherited from WebRequest | |
const | GETHEADER_LIST = 1 |
Flag to make WebRequest::getHeader return an array of values. | |
Static Protected Member Functions inherited from WebRequest | |
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. | |
WebRequest clone which takes values from a provided array.
Definition at line 37 of file FauxRequest.php.
FauxRequest::__construct | ( | $data = [], | |
$wasPosted = false, | |||
$session = null, | |||
$protocol = 'http' ) |
array | $data | Array of non-urlencoded key => value pairs, the fake GET/POST values |
bool | $wasPosted | Whether to treat the data as POST |
MediaWiki\\Session\\Session | array | null | $session | Session, session data array, or null |
string | $protocol | 'http' or 'https' |
MWException |
Definition at line 55 of file FauxRequest.php.
References WebRequest\$data, WebRequest\$protocol, and wasPosted().
FauxRequest::getCookie | ( | $key, | |
$prefix = null, | |||
$default = null ) |
Get a cookie from the $_COOKIE jar.
string | $key | The name of the cookie |
string | null | $prefix | A prefix to use for the cookie name, if not $wgCookiePrefix |
mixed | null | $default | What to return if the value isn't found |
Reimplemented from WebRequest.
Reimplemented in DerivativeRequest.
Definition at line 119 of file FauxRequest.php.
FauxRequest::getMethod | ( | ) |
Get the HTTP method used for this request.
Reimplemented from WebRequest.
Definition at line 108 of file FauxRequest.php.
References wasPosted().
FauxRequest::getPostValues | ( | ) |
Get the values passed via POST.
No transformation is performed on the values.
Reimplemented from WebRequest.
Definition at line 256 of file FauxRequest.php.
References wasPosted().
FauxRequest::getProtocol | ( | ) |
Get the current URL protocol (http or https)
Reimplemented from WebRequest.
Reimplemented in DerivativeRequest.
Definition at line 223 of file FauxRequest.php.
FauxRequest::getQueryValues | ( | ) |
Reimplemented from WebRequest.
Definition at line 100 of file FauxRequest.php.
References wasPosted().
FauxRequest::getRawInput | ( | ) |
FauxRequests shouldn't depend on raw request data (but that could be implemented here)
Reimplemented from WebRequest.
Definition at line 280 of file FauxRequest.php.
|
protected |
FauxRequest::getRawPostString | ( | ) |
FauxRequests shouldn't depend on raw request data (but that could be implemented here)
Reimplemented from WebRequest.
Definition at line 272 of file FauxRequest.php.
FauxRequest::getRawQueryString | ( | ) |
FauxRequests shouldn't depend on raw request data (but that could be implemented here)
Reimplemented from WebRequest.
Definition at line 264 of file FauxRequest.php.
FauxRequest::getRequestURL | ( | ) |
Reimplemented from WebRequest.
Definition at line 216 of file FauxRequest.php.
FauxRequest::getSessionArray | ( | ) |
Definition at line 249 of file FauxRequest.php.
References WebRequest\getSession().
FauxRequest::getText | ( | $name, | |
$default = '' ) |
string | $name | |
string | $default |
Reimplemented from WebRequest.
Definition at line 92 of file FauxRequest.php.
References WebRequest\getVal().
FauxRequest::getUpload | ( | $key | ) |
Return a FauxRequestUpload object corresponding to the key.
string | $key |
Reimplemented from WebRequest.
Reimplemented in DerivativeRequest.
Definition at line 199 of file FauxRequest.php.
|
protected |
Initialise the header list.
Reimplemented from WebRequest.
Definition at line 83 of file FauxRequest.php.
FauxRequest::setCookie | ( | $key, | |
$value, | |||
$prefix = null ) |
string | $key | Unprefixed name of the cookie to set |
string | null | $value | Value of the cookie to set |
string | null | $prefix | Cookie prefix. Defaults to $wgCookiePrefix |
Definition at line 134 of file FauxRequest.php.
References setCookies().
FauxRequest::setCookies | ( | $cookies, | |
$prefix = null ) |
array | $cookies | |
string | null | $prefix | Cookie prefix. Defaults to $wgCookiePrefix |
Definition at line 143 of file FauxRequest.php.
References $cookies.
Referenced by setCookie().
FauxRequest::setHeader | ( | $name, | |
$val ) |
string | $name | |
string | $val |
Definition at line 231 of file FauxRequest.php.
References setHeaders().
FauxRequest::setHeaders | ( | $headers | ) |
array | $headers |
Definition at line 239 of file FauxRequest.php.
References WebRequest\$headers.
Referenced by setHeader().
FauxRequest::setRequestURL | ( | $url | ) |
FauxRequest::setUpload | ( | $key, | |
$data ) |
Set fake upload data for one file with specific key.
string | $key | |
array | WebRequestUpload | $data |
Definition at line 173 of file FauxRequest.php.
References WebRequest\$data, and WebRequestUpload\REQUIRED_FILEINFO_KEYS.
Referenced by setUploadData().
FauxRequest::setUploadData | ( | $uploadData | ) |
Set fake upload data for all files.
(array|WebRequestUpload)[] | $uploadData |
Definition at line 160 of file FauxRequest.php.
References WebRequest\$data, and setUpload().
FauxRequest::wasPosted | ( | ) |
Reimplemented from WebRequest.
Definition at line 115 of file FauxRequest.php.
Referenced by __construct(), getMethod(), getPostValues(), and getQueryValues().
|
protected |
Definition at line 40 of file FauxRequest.php.
Referenced by setCookies().