XOOPS
2.6.0
|
Public Member Functions | |
addDetector ($name, $options) | |
clientAcceptsType ($mediaType) | |
getAcceptedLanguages () | |
getAcceptMediaTypes () | |
getClientIp ($considerProxy=false) | |
getDomain () | |
getEnv ($name, $default=null) | |
getHeader ($name=null) | |
getHost () | |
getReferer () | |
getScheme () | |
getScriptName () | |
getSubdomains () | |
getUrl () | |
is ($type) | |
Static Public Member Functions | |
static | getFiles ($name) |
static | getInstance () |
static | getUri () |
Protected Member Functions | |
detectByEnv ($detect) | |
detectByParam ($detect) | |
Protected Attributes | |
$detectors | |
$params | |
Private Member Functions | |
__construct () | |
WARNING: THIS IS A PLACEHOLDER ONLY. IMPLEMENTATION AND DETAILS WILL CHANGE.
This provides some of the functionality that was in the Xoops_Request classes. The majority of use for the class was the 'asXyz()' methods, and all such uses should move to Xoops::getXyz() methods.
These are methods which reveal some aspects of the HTTP request environment. This will eventually be reworked to depend on a full HTTP messasge library (anticipating an official PSR-7 implementation.)
For now, this is a reduced version of a Cake derivative.
Definition at line 38 of file HttpRequest.php.
|
private |
__construct
Definition at line 152 of file HttpRequest.php.
References Xoops\Core\HttpRequest\$params, and Xoops\Core\HttpRequest\getEnv().
Xoops\Core\HttpRequest::addDetector | ( | $name, | |
$options | |||
) |
Add a new detector to the list of detectors that a request can use. There are several different formats and types of detectors that can be set.
An environment value comparison, compares a value fetched from env()
to a known value the environment value is equality checked against the provided value. e.g `addDetector('post', array('env' => 'REQUEST_METHOD', 'value' => 'POST'))`
Pattern value comparison allows you to compare a value fetched from env()
to a regular expression. e.g `addDetector('iphone', array('env' => 'HTTP_USER_AGENT', 'pattern' => '/iPhone/i'));`
Option based comparisons use a list of options to create a regular expression. Subsequent calls to add an already defined options detector will merge the options. e.g `addDetector('mobile', array('env' => 'HTTP_USER_AGENT', 'options' => array('Fennec')));`
Callback detectors allow you to provide a 'callback' type to handle the check. The callback will receive the request object as its only parameter. e.g `addDetector('custom', array('callback' => array('SomeClass', 'somemethod')));`
Allows for custom detectors on the request parameters. e.g `addDetector('post', array('param' => 'requested', 'value' => 1)`
string | $name | The name of the detector. |
array | $options | The options for the detector definition. See above. |
Definition at line 542 of file HttpRequest.php.
References $name, $options, and Xoops_Utils\arrayRecursiveMerge().
Xoops\Core\HttpRequest::clientAcceptsType | ( | $mediaType | ) |
Determine if a client accepts a given media type
string | $mediaType | The content type to check for. |
Definition at line 558 of file HttpRequest.php.
References $type, and Xoops\Core\HttpRequest\getAcceptMediaTypes().
|
protected |
detectByEnv - perform detection on detectors with an 'env' component
array | $detect | a detectors array entry to test against |
Definition at line 484 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getEnv().
Referenced by Xoops\Core\HttpRequest\is().
|
protected |
detectByParam - perform detection on detectors with an 'param' component. To match an entry with the name in the 'param' key of the $detect rule must exist in the $params property and be equal to the 'value' entry specified in the $detect array.
array | $detect | a detectors array entry to test against. Param entries are of the form array('param' => name, 'value' => value) |
Definition at line 508 of file HttpRequest.php.
References $name.
Referenced by Xoops\Core\HttpRequest\is().
Xoops\Core\HttpRequest::getAcceptedLanguages | ( | ) |
getAcceptedLanguages returns the http-accept-language header as an array of language codes arranged by specified preference
Definition at line 610 of file HttpRequest.php.
References $l, and Xoops\Core\HttpRequest\getHeader().
Xoops\Core\HttpRequest::getAcceptMediaTypes | ( | ) |
getAcceptMediaTypes returns the http-accept header as an array of media types arranged by specified preference
Definition at line 581 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getHeader().
Referenced by Xoops\Core\HttpRequest\clientAcceptsType().
Xoops\Core\HttpRequest::getClientIp | ( | $considerProxy = false | ) |
Get the Client IP address, optionally attempting to peek behind any proxies to get a real routable address.
boolean | $considerProxy | true to enable proxy tests |
Definition at line 290 of file HttpRequest.php.
Xoops\Core\HttpRequest::getDomain | ( | ) |
Get the domain name and include $tldLength segments of the tld.
Definition at line 263 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getHost(), and Xoops\getInstance().
Xoops\Core\HttpRequest::getEnv | ( | $name, | |
$default = null |
|||
) |
Gets an environment variable from available sources, and provides emulation for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on IIS, or SCRIPT_NAME in CGI mode). Also exposes some additional custom environment information. Note : code modifications for XOOPS
string | $name | Environment variable name. |
mixed | $default | default value |
Definition at line 354 of file HttpRequest.php.
References $_SERVER, $name, and Xoops\getInstance().
Referenced by Xoops\Core\HttpRequest\__construct(), Xoops\Core\HttpRequest\detectByEnv(), Xoops\Core\HttpRequest\getHeader(), Xoops\Core\HttpRequest\getHost(), Xoops\Core\HttpRequest\getReferer(), Xoops\Core\HttpRequest\getScheme(), Xoops\Core\HttpRequest\getScriptName(), and Xoops\Core\HttpRequest\getUrl().
|
static |
Xoops\Core\HttpRequest::getHeader | ( | $name = null | ) |
null | string | $name | header name |
Definition at line 186 of file HttpRequest.php.
References $name, $res, and Xoops\Core\HttpRequest\getEnv().
Referenced by Xoops\Core\HttpRequest\getAcceptedLanguages(), and Xoops\Core\HttpRequest\getAcceptMediaTypes().
Xoops\Core\HttpRequest::getHost | ( | ) |
Definition at line 219 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getEnv().
Referenced by Xoops\Core\HttpRequest\getDomain(), Xoops\Core\HttpRequest\getSubdomains(), and Xoops\Core\HttpRequest\getUrl().
|
static |
Definition at line 171 of file HttpRequest.php.
Referenced by Xoops\Core\Session\Manager\__construct(), Xoops\Core\Session\Fingerprint\takePrint(), and Xoops\Core\Session\RememberMe\writeUserCookie().
Xoops\Core\HttpRequest::getReferer | ( | ) |
Definition at line 243 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getEnv().
Xoops\Core\HttpRequest::getScheme | ( | ) |
Definition at line 211 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getEnv().
Referenced by Xoops\Core\HttpRequest\getUrl().
Xoops\Core\HttpRequest::getScriptName | ( | ) |
Definition at line 251 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getEnv().
Xoops\Core\HttpRequest::getSubdomains | ( | ) |
Get the subdomains for a host.
Definition at line 275 of file HttpRequest.php.
References Xoops\Core\HttpRequest\getHost(), and Xoops\getInstance().
|
static |
Definition at line 227 of file HttpRequest.php.
References $_SERVER.
Referenced by Xoops\Core\HttpRequest\getUrl().
Xoops\Core\HttpRequest::getUrl | ( | ) |
Return current url
Definition at line 329 of file HttpRequest.php.
References $url, Xoops\Core\HttpRequest\getEnv(), Xoops\Core\HttpRequest\getHost(), Xoops\Core\HttpRequest\getScheme(), and Xoops\Core\HttpRequest\getUri().
Xoops\Core\HttpRequest::is | ( | $type | ) |
Check whether or not a Request is a certain type. Uses the built in detection rules as well as additional rules defined with HttpRequest::addDetector(). Any detector can be called as is($type)
or is$Type()
.
string | $type | The type of request you want to check. |
Definition at line 460 of file HttpRequest.php.
References $type, Xoops\Core\HttpRequest\detectByEnv(), and Xoops\Core\HttpRequest\detectByParam().
|
protected |
Definition at line 53 of file HttpRequest.php.
|
protected |
Definition at line 43 of file HttpRequest.php.
Referenced by Xoops\Core\HttpRequest\__construct().