Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Fix Nexus
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxsoft committed Apr 10, 2016
1 parent 466f6c8 commit ece0e9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/useragent_detect_device.php
Expand Up @@ -411,10 +411,11 @@ public static function analyze($useragent) {
// Google
elseif (preg_match('/Nexus/i', $useragent)) {
$link = "https://www.google.com/nexus/";
$brand = "Nexus";
$brand = "Google";
$image_url = "google-nexusone";
$model = "Nexus";
if (preg_match('/Nexus ([.0-9a-zA-Z]+)/i', $useragent, $regmatch)) {
$model = $regmatch[1];
$model .= " " . $regmatch[1];
}
}

Expand Down
10 changes: 7 additions & 3 deletions tests/UserAgentList.php
Expand Up @@ -8,6 +8,10 @@
array('Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13'),
array('img/16/browser/nokia.png', 'img/16/device/nokia.png', 'Nokia Browser', '8.5.0', 'Nokia Browser 8.5.0', 'Meego', '', 'Meego', 'Nokia N9', 'device'),
),
array(
array('Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263'),
array('img/16/browser/edge.png', 'img/16/device/microsoft.png', 'Edge', '14.14263', 'Edge 14.14263', 'Windows', '10 Mobile', 'Windows 10 Mobile', 'Microsoft Lumia 950', 'device'),
),
array(
array('Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 114Browser/5.0'),
array('img/16/browser/114browser.png', 'img/16/os/win-2.png', '114Browser', '5.0', '114Browser 5.0', 'Windows', 'XP', 'Windows XP', '', 'os'),
Expand Down Expand Up @@ -54,7 +58,7 @@
),
array(
array('Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'),
array('img/16/browser/android-webkit.png', 'img/16/device/google-nexusone.png', 'Android Webkit', '4.0', 'Android Webkit 4.0', 'Android', '2.2', 'Android 2.2', 'Nexus One', 'device'),
array('img/16/browser/android-webkit.png', 'img/16/device/google-nexusone.png', 'Android Webkit', '4.0', 'Android Webkit 4.0', 'Android', '2.2', 'Android 2.2', 'Google Nexus One', 'device'),
),
array(
array('Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22'),
Expand Down Expand Up @@ -102,7 +106,7 @@
),
array(
array('Mozilla/5.0 (Linux; Android 4.4.4; Nexus 4 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36'),
array('img/16/browser/chrome.png', 'img/16/device/google-nexusone.png', 'Google Chrome', '33.0.0.0', 'Google Chrome 33.0.0.0', 'Android', '4.4.4', 'Android 4.4.4', 'Nexus 4', 'device'),
array('img/16/browser/chrome.png', 'img/16/device/google-nexusone.png', 'Google Chrome', '33.0.0.0', 'Google Chrome 33.0.0.0', 'Android', '4.4.4', 'Android 4.4.4', 'Google Nexus 4', 'device'),
),
array(
array('Mozilla/5.0 (Linux; Android 4.4.4; MI 4W Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 MxBrowser/4.3.5.2000'),
Expand Down Expand Up @@ -306,7 +310,7 @@
),
array(
array('Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13'),
array('img/16/browser/nokia.png', 'img/16/device/nokia.png', 'Nokia Browser', '8.5.0', 'Nokia Browser 8.5.0', '', '', '', 'Nokia N9', 'device'),
array('img/16/browser/nokia.png', 'img/16/device/nokia.png', 'Nokia Browser', '8.5.0', 'Nokia Browser 8.5.0', 'Meego', '', 'Meego', 'Nokia N9', 'device'),
),
array(
array('Nokia5320di'),
Expand Down

0 comments on commit ece0e9c

Please sign in to comment.