detect possible FxOS tablet UA
authorRobert Kaiser <kairo@kairo.at>
Thu, 26 Sep 2013 01:24:15 +0000 (03:24 +0200)
committerRobert Kaiser <kairo@kairo.at>
Thu, 26 Sep 2013 01:24:15 +0000 (03:24 +0200)
include/classes/useragent.php-class
testbed/ua_list_raw.txt

index 98be8ddd8d2f9d4d7cc3a66c2a70689fd05f2b77..dffa0c8fe7633fcbb08b4d531b75384305f5d90d 100755 (executable)
@@ -1177,11 +1177,11 @@ class userAgent {
             $this->uadata['eng_version'] = $regs[3];
             $this->mobile = ($regs[2] == 'Mobile');
           }
-          elseif (preg_match('|Mozilla/5.0 \(Mobile; [^;]+; rv:([^\);]+)\)|', $this->uastring, $regs)) {
+          elseif (preg_match('#Mozilla/5.0 \((Mobile|Tablet); [^;]+; rv:([^\);]+)\)#', $this->uastring, $regs)) {
             $this->uadata['os'] = 'Firefox OS';
             $this->uadata['lang'] = null;
-            $this->uadata['eng_version'] = $regs[1];
-            $this->mobile = true;
+            $this->uadata['eng_version'] = $regs[2];
+            $this->mobile = ($regs[1] == 'Mobile');
           }
           elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
             if ((strpos($regs[2], 'Linux') !== false) && ($regs[1] != 'X11')) {
@@ -1198,11 +1198,11 @@ class userAgent {
             $this->uadata['lang'] = null;
             $this->uadata['eng_version'] = null;
           }
-          elseif (preg_match('|Mozilla/5.0 \(Mobile; rv:([^\);]+)\)|', $this->uastring, $regs)) {
+          elseif (preg_match('#Mozilla/5.0 \((Mobile|Tablet); rv:([^\);]+)\)#', $this->uastring, $regs)) {
             $this->uadata['os'] = 'Firefox OS';
             $this->uadata['lang'] = null;
-            $this->uadata['eng_version'] = $regs[1];
-            $this->mobile = true;
+            $this->uadata['eng_version'] = $regs[2];
+            $this->mobile = ($regs[1] == 'Mobile');
           }
           elseif (preg_match('|Mozilla/5.0 \(([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
             $this->uadata['os'] = $regs[1];
index 5116e0068b7146ff16ed18efc2257579424894ab..7715f1fd0eb6bd6eae343730e484f45850f7d880 100755 (executable)
@@ -77,6 +77,8 @@ Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3pre) Gecko/20100403 Lo
 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a9pre) Gecko/2007110108 prism/0.8
 Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0
 Mozilla/5.0 (Mobile; LG-D300; rv:18.1) Gecko/18.1 Firefox/18.1
+Mozilla/5.0 (Tablet; rv:26.0) Gecko/26.0 Firefox/26.0
+Mozilla/5.0 (Tablet; Saga G1; rv:26.0) Gecko/26.0 Firefox/26.0
 Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.4pre) Gecko/20090928 Lightning/1.0pre Shredder/3.0pre
 Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100514 Lanikai/3.1b1
 Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.0