Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-05-24 13:11:15 +0400
committermattab <matthieu.aubry@gmail.com>2013-05-24 13:11:15 +0400
commit4f4d377876adcf698c00ca2141f9cff26bf75a83 (patch)
tree1c2c084f0e339e3c9b087c67ec487be184515b15 /plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php
parent6804733ddcb9fcf72b2df3f796a0d5b228bb0ab2 (diff)
Refs #3612
* making some tests pass == fixing bugs
Diffstat (limited to 'plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php')
-rw-r--r--plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php b/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php
index c0a2825811..9031b0fd33 100644
--- a/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php
+++ b/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php
@@ -228,7 +228,7 @@ class UserAgentParserEnhanced
public static $browserFamilies = array(
'Android Browser' => array('AN'),
'BlackBerry Browser' => array('BB'),
- 'Chrome' => array('CH', 'CM', 'CI', 'CF', 'CR'),
+ 'Chrome' => array('CH', 'CM', 'CI', 'CF', 'CR', 'RM'),
'Firefox' => array('FF', 'FE', 'SX', 'FB', 'PX', 'MB'),
'Internet Explorer' => array('IE', 'IM'),
'Konqueror' => array('KO'),
@@ -314,6 +314,8 @@ class UserAgentParserEnhanced
'WO' => 'wOSBrowser',
'YA' => 'Yandex Browser'
);
+
+ const UNKNOWN = "UNK";
protected static $regexesDir = '/regexes/';
protected static $osRegexesFile = 'oss.yml';
protected static $browserRegexesFile = 'browsers.yml';
@@ -406,7 +408,7 @@ class UserAgentParserEnhanced
if (in_array($browserRegex['name'], self::$browsers)) {
$short = array_search($browserRegex['name'], self::$browsers);
} else {
- $short = 'UN';
+ $short = 'XX';
}
$this->browser = array(
@@ -630,8 +632,9 @@ class UserAgentParserEnhanced
public function isDesktop()
{
$osName = $this->getOs('name');
- if (empty($osName))
+ if (empty($osName) || empty(self::$osShorts[$osName])) {
return false;
+ }
$osShort = self::$osShorts[$osName];
foreach (self::$osFamilies as $family => $familyOs) {
@@ -650,7 +653,7 @@ class UserAgentParserEnhanced
}
if (!isset($this->os[$attr])) {
- return '';
+ return self::UNKNOWN;
}
if ($attr == 'version') {
@@ -666,7 +669,7 @@ class UserAgentParserEnhanced
}
if (!isset($this->browser[$attr])) {
- return '';
+ return self::UNKNOWN;
}
return $this->browser[$attr];
@@ -701,7 +704,7 @@ class UserAgentParserEnhanced
return $osFamily;
}
}
- error_log($osLabel);
+
return 'Other';
}