54         'get'       => array(
'env' => 
'REQUEST_METHOD', 
'value' => 
'GET'),
 
   55         'post'      => array(
'env' => 
'REQUEST_METHOD', 
'value' => 
'POST'),
 
   56         'put'       => array(
'env' => 
'REQUEST_METHOD', 
'value' => 
'PUT'),
 
   57         'delete'    => array(
'env' => 
'REQUEST_METHOD', 
'value' => 
'DELETE'),
 
   58         'head'      => array(
'env' => 
'REQUEST_METHOD', 
'value' => 
'HEAD'),
 
   59         'options'   => array(
'env' => 
'REQUEST_METHOD', 
'value' => 
'OPTIONS'),
 
   60         'safemethod'=> array(
'env' => 
'REQUEST_METHOD', 
'options' => array(
'GET', 
'HEAD')),
 
   61         'ssl'       => array(
'env' => 
'HTTPS', 
'value' => 1),
 
   62         'ajax'      => array(
'env' => 
'HTTP_X_REQUESTED_WITH', 
'value' => 
'XMLHttpRequest'),
 
   63         'flash'     => array(
'env' => 
'HTTP_USER_AGENT', 
'pattern' => 
'/^(Shockwave|Adobe) Flash/'),
 
   65             'env'     => 
'HTTP_USER_AGENT',
 
   96             'env'     => 
'HTTP_USER_AGENT',
 
  130                 'Mediapartners-Google',
 
  143                 'www\\.almaden\\.ibm\\.com\\/cs\\/crawler',
 
  154         switch (strtolower($this->
getEnv(
'REQUEST_METHOD'))) {
 
  159                 parse_str(file_get_contents(
'php://input'), $put);
 
  160                 $params = array_merge($_GET, $put);
 
  163                 $params = array_merge($_GET, $_POST);
 
  174         if (!isset($instance)) {
 
  175             $thisClass = get_called_class();
 
  176             $instance = 
new $thisClass();
 
  188         if (
$name === null) {
 
  193         if (
$res = $this->
getEnv(
'HTTP_' . strtoupper(str_replace(
'-', 
'_', 
$name)))) {
 
  199         if (function_exists(
'apache_request_headers')) {
 
  200             $headers = apache_request_headers();
 
  201             if (!empty($headers[
$name])) {
 
  202                 return $headers[
$name];
 
  213         return $this->
getEnv(
'HTTPS') ? 
'https' : 
'http';
 
  221         return $this->
getEnv(
'HTTP_HOST') ? (string) $this->
getEnv(
'HTTP_HOST') : 
'localhost';
 
  232             if (!empty(
$_SERVER[
'QUERY_STRING'])) {
 
  245         return $this->
getEnv(
'HTTP_REFERER') ? $this->
getEnv(
'HTTP_REFERER') : 
'';
 
  253         return $this->
getEnv(
'SCRIPT_NAME')
 
  254             ? $this->
getEnv(
'SCRIPT_NAME')
 
  255             : ($this->
getEnv(
'ORIG_SCRIPT_NAME') ? $this->
getEnv(
'ORIG_SCRIPT_NAME') : 
'');
 
  267         return is_null($domain) ? $host : $domain;
 
  279         $subdomain = $pdp->subdomain;
 
  280         return is_null($subdomain) ? 
'' : $subdomain;
 
  292         $default = (array_key_exists(
'REMOTE_ADDR', 
$_SERVER)) ? 
$_SERVER[
'REMOTE_ADDR'] : 
'0.0.0.0';
 
  294         if (!$considerProxy) {
 
  300             'HTTP_X_FORWARDED_FOR',
 
  302             'HTTP_X_CLUSTER_CLIENT_IP',
 
  303             'HTTP_FORWARDED_FOR',
 
  306         foreach (
$keys as $key) {
 
  307             if (array_key_exists($key, 
$_SERVER) === 
true) {
 
  308                 foreach (explode(
',', 
$_SERVER[$key]) as $ip) {
 
  310                     if (
false !== filter_var(
 
  313                         FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
 
  332         $port = $this->
getEnv(
'SERVER_PORT');
 
  356         if (
$name === 
'HTTPS') {
 
  360             return (strpos($this->
getEnv(
'SCRIPT_URI'), 
'https://') === 0);
 
  364             if ($this->
getEnv(
'CGI_MODE') && isset($_ENV[
'SCRIPT_URL'])) {
 
  365                 return $_ENV[
'SCRIPT_URL'];
 
  369         if ($name === 
'REMOTE_ADDR' && !isset(
$_SERVER[$name])) {
 
  370             $addr = $this->
getEnv(
'HTTP_PC_REMOTE_ADDR');
 
  371             if ($addr !== null) {
 
  379         } elseif (isset($_ENV[$name])) {
 
  388             case 'SCRIPT_FILENAME':
 
  389                 $val = preg_replace(
'#//+#', 
'/', $this->
getEnv(
'PATH_TRANSLATED'));
 
  390                 return preg_replace(
'#\\\\+#', 
'\\', $val);
 
  392             case 'DOCUMENT_ROOT':
 
  393                 $name = $this->
getEnv(
'SCRIPT_NAME');
 
  394                 $filename = $this->
getEnv(
'SCRIPT_FILENAME');
 
  396                 if (!strpos($name, 
'.php')) {
 
  399                 return substr($filename, 0, -(strlen($name) + $offset));
 
  402                 return str_replace($this->
getEnv(
'DOCUMENT_ROOT'), 
'', $this->
getEnv(
'SCRIPT_FILENAME'));
 
  405                 return (PHP_SAPI === 
'cgi');
 
  408                 $host = $this->
getEnv(
'HTTP_HOST');
 
  427         if (empty($_FILES)) {
 
  431         if (isset($_FILES[
$name])) {
 
  432             return $_FILES[
$name];
 
  435         if (
false === $pos = strpos($name, 
'[')) {
 
  439         $base = substr($name, 0, $pos);
 
  440         $key = str_replace(array(
']', 
'['), array(
'', 
'"]["'), substr($name, $pos + 1, -1));
 
  441         $code = array(sprintf(
'if (!isset($_FILES["%s"]["name"]["%s"])) return array();', 
$base, $key));
 
  442         $code[] = 
'$file = array();';
 
  443         foreach (array(
'name', 
'type', 
'size', 
'tmp_name', 
'error') as $property) {
 
  444             $code[] = sprintf(
'$file["%1$s"] = $_FILES["%2$s"]["%1$s"]["%3$s"];', $property, 
$base, $key);
 
  446         $code[] = 
'return $file;';
 
  448         return eval(implode(PHP_EOL, 
$code));
 
  463         if (!isset($this->detectors[
$type])) {
 
  466         $detect = $this->detectors[
$type];
 
  467         if (isset($detect[
'env'])) {
 
  469         } elseif (isset($detect[
'param'])) {
 
  471         } elseif (isset($detect[
'callback']) && is_callable($detect[
'callback'])) {
 
  472             return call_user_func($detect[
'callback'], $this);
 
  486         if (isset($detect[
'value'])) {
 
  487             return (
bool) $this->
getEnv($detect[
'env']) == $detect[
'value'];
 
  488         } elseif (isset($detect[
'pattern'])) {
 
  489             return (
bool) preg_match($detect[
'pattern'], $this->
getEnv($detect[
'env']));
 
  490         } elseif (isset($detect[
'options'])) {
 
  491             $pattern = 
'/' . implode(
'|', $detect[
'options']) . 
'/i';
 
  492             return (
bool) preg_match($pattern, $this->
getEnv($detect[
'env']));
 
  510         $name = $detect[
'param'];
 
  511         $value = $detect[
'value'];
 
  512         return isset($this->params[
$name]) ? $this->params[
$name] == $value : 
false;
 
  545         if (isset($this->detectors[
$name]) && isset(
$options[
'options'])) {
 
  562         $mediaType = trim($mediaType);
 
  563         if (isset($accepts[$mediaType])) {
 
  566         list(
$type, $subtype) = explode(
'/', $mediaType);
 
  567         if (isset($accepts[
$type.
'/*'])) {
 
  571         return isset($accepts[
'*/*']);
 
  586         if (!empty($accept)) {
 
  587             $entries = explode(
',', $accept);
 
  588             foreach ($entries as $e) {
 
  589                 $mt = explode(
';q=', $e);
 
  590                 if (!isset($mt[1])) {
 
  593                 $types[trim($mt[0])] = (float) $mt[1];
 
  597             arsort($types, SORT_NUMERIC);
 
  613         $accept = $this->
getHeader(
'ACCEPT_LANGUAGE');
 
  615         if (!empty($accept)) {
 
  616             $entries = explode(
',', $accept);
 
  617             foreach ($entries as $e) {
 
  618                 $l = explode(
';q=', $e);
 
  622                 $langs[trim(
$l[0])] = (float) 
$l[1];
 
  626             arsort($langs, SORT_NUMERIC);
 
if(!$dbm->isConnectable()) $res
clientAcceptsType($mediaType)
static arrayRecursiveMerge(array $data, $merge)
getClientIp($considerProxy=false)
addDetector($name, $options)
getEnv($name, $default=null)