summaryrefslogtreecommitdiffstats
path: root/system/libraries/User_agent.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-18 16:36:07 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-18 16:36:07 +0100
commitecaef964232f7889eb3eab35b69cebbf3221ad66 (patch)
tree56759ff61e0512db9debfceb6f119ea3ea4dc911 /system/libraries/User_agent.php
parent60f71be48a6b91cc314908c3c0007f13e9cb2f0a (diff)
parentb2a0e70585367e59bf2d106629c0e9c3ab1370c2 (diff)
Merge branch 'develop' into feature/output_compressed_cache
Diffstat (limited to 'system/libraries/User_agent.php')
-rw-r--r--system/libraries/User_agent.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 3a6b6bc98..1dfa3e72d 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -145,6 +145,15 @@ class CI_User_agent {
public $robot = '';
/**
+ * HTTP Referer
+ *
+ * @var mixed
+ */
+ public $referer;
+
+ // --------------------------------------------------------------------
+
+ /**
* Constructor
*
* Sets the User Agent and runs the compilation routine
@@ -358,7 +367,7 @@ class CI_User_agent {
{
if ((count($this->languages) === 0) && ! empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
- $this->languages = explode(',', preg_replace('/(;q=[0-9\.]+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE']))));
+ $this->languages = explode(',', preg_replace('/(;\s?q=[0-9\.]+)|\s/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE']))));
}
if (count($this->languages) === 0)
@@ -378,7 +387,7 @@ class CI_User_agent {
{
if ((count($this->charsets) === 0) && ! empty($_SERVER['HTTP_ACCEPT_CHARSET']))
{
- $this->charsets = explode(',', preg_replace('/(;q=.+)/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_CHARSET']))));
+ $this->charsets = explode(',', preg_replace('/(;\s?q=.+)|\s/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_CHARSET']))));
}
if (count($this->charsets) === 0)
@@ -471,24 +480,22 @@ class CI_User_agent {
*/
public function is_referral()
{
- static $result;
-
- if ( ! isset($result))
+ if ( ! isset($this->referer))
{
if (empty($_SERVER['HTTP_REFERER']))
{
- $result = FALSE;
+ $this->referer = FALSE;
}
else
{
$referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
$own_host = parse_url(config_item('base_url'), PHP_URL_HOST);
- $result = ($referer_host && $referer_host !== $own_host);
+ $this->referer = ($referer_host && $referer_host !== $own_host);
}
}
- return $result;
+ return $this->referer;
}
// --------------------------------------------------------------------