Class HttpRequest
HttpRequest
Package: Xoops\Core
Category: Xoops\Core\HttpRequest
Copyright: 2011-2015 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: trabis lusopoemas@gmail.com
Author: Kazumi Ono onokazu@gmail.com
Author: Richard Griffith richard@geekwright.com
Link: http://xoops.org
Located at oops_lib/Xoops/Core/HttpRequest.php
public static
|
|
public
null|string
|
|
public
string
|
|
public
string
|
|
public static
null|string
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
string
|
#
getClientIp( boolean $considerProxy = false )
Get the Client IP address, optionally attempting to peek behind any proxies to get a real routable address. |
public
string
|
|
public
string|boolean
|
#
getEnv( string $name, mixed $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 |
public static
array
|
|
public
boolean
|
|
protected
boolean
|
|
protected
boolean
|
#
detectByParam( array $detect )
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. |
public
|
#
addDetector( string $name, array $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. Environment value comparisonAn environment value comparison, compares a value fetched from Pattern value comparisonPattern value comparison allows you to compare a value fetched from Option based comparisonOption 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 Callback detectorsCallback 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 Request parameter detectorsAllows for custom detectors on the request parameters.
e.g |
public
boolean
|
|
public
array
|
#
getAcceptMediaTypes( )
getAcceptMediaTypes returns the http-accept header as an array of media types arranged by specified preference |
public
array
|
#
getAcceptedLanguages( )
getAcceptedLanguages returns the http-accept-language header as an array of language codes arranged by specified preference |
protected
array
|
$params
|
|
protected
array
|
$detectors
The built in detectors used with |
#
array(
'get' => array('env' => 'REQUEST_METHOD', 'value' => 'GET'),
'post' => array('env' => 'REQUEST_METHOD', 'value' => 'POST'),
'put' => array('env' => 'REQUEST_METHOD', 'value' => 'PUT'),
'delete' => array('env' => 'REQUEST_METHOD', 'value' => 'DELETE'),
'head' => array('env' => 'REQUEST_METHOD', 'value' => 'HEAD'),
'options' => array('env' => 'REQUEST_METHOD', 'value' => 'OPTIONS'),
'safemethod'=> array('env' => 'REQUEST_METHOD', 'options' => array('GET', 'HEAD')),
'ssl' => array('env' => 'HTTPS', 'value' => 1),
'ajax' => array('env' => 'HTTP_X_REQUESTED_WITH', 'value' => 'XMLHttpRequest'),
'flash' => array('env' => 'HTTP_USER_AGENT', 'pattern' => '/^(Shockwave|Adobe) Flash/'),
'mobile' => array(
'env' => 'HTTP_USER_AGENT',
'options' => array(
'Android',
'AvantGo',
'BlackBerry',
'DoCoMo',
'Fennec',
'iPod',
'iPhone',
'iPad',
'J2ME',
'MIDP',
'NetFront',
'Nokia',
'Opera Mini',
'Opera Mobi',
'PalmOS',
'PalmSource',
'portalmmm',
'Plucker',
'ReqwirelessWeb',
'SonyEricsson',
'Symbian',
'UP\\.Browser',
'webOS',
'Windows CE',
'Windows Phone OS',
'Xiino'
)
),
'robot' => array(
'env' => 'HTTP_USER_AGENT',
'options' => array(
/* The most common ones. */
'Googlebot',
'msnbot',
'Slurp',
'Yahoo',
/* The rest alphabetically. */
'Arachnoidea',
'ArchitextSpider',
'Ask Jeeves',
'B-l-i-t-z-Bot',
'Baiduspider',
'BecomeBot',
'cfetch',
'ConveraCrawler',
'ExtractorPro',
'FAST-WebCrawler',
'FDSE robot',
'fido',
'geckobot',
'Gigabot',
'Girafabot',
'grub-client',
'Gulliver',
'HTTrack',
'ia_archiver',
'InfoSeek',
'kinjabot',
'KIT-Fireball',
'larbin',
'LEIA',
'lmspider',
'Lycos_Spider',
'Mediapartners-Google',
'MuscatFerret',
'NaverBot',
'OmniExplorer_Bot',
'polybot',
'Pompos',
'Scooter',
'Teoma',
'TheSuBot',
'TurnitinBot',
'Ultraseek',
'ViolaBot',
'webbandit',
'www\\.almaden\\.ibm\\.com\\/cs\\/crawler',
'ZyBorg',
)
),
)
|