detect possible FxOS tablet UA
[php-utility-classes.git] / include / classes / useragent.php-class
index 98be8dd..dffa0c8 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];