Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Commit

Permalink
Built WhichBrowser from commit 88ae9de on branch dev
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsLeenheer committed Sep 22, 2015
1 parent 34d47e5 commit 9fc2e74
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 20 deletions.
3 changes: 3 additions & 0 deletions data/build-android.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
'LRX22C' => '5.0.1',
'LRX22G' => '5.0.2',
'LRX22L' => '5.0.2',
'LGZ23.S15' => '5.0.2', // Sony Bravia Android TV
'LGZ23.S37' => '5.0.2', // Sony Bravia Android TV
'LGZ23.S49' => '5.0.2', // Sony Bravia Android TV
'LMY47D' => '5.1',
'LMY47E' => '5.1',
'LMY47I' => '5.1',
Expand Down
10 changes: 7 additions & 3 deletions data/models-android.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@

/* Android TV */
'Nexus Player' => array( 'Asus', 'Nexus Player', TYPE_TELEVISION, FLAG_ANDROIDTV),
'BRAVIA 2015' => array( 'Sony', 'Bravia', TYPE_TELEVISION, FLAG_ANDROIDTV),
'BRAVIA 2015' => array( 'Sony', 'Bravia Android TV (2015)', TYPE_TELEVISION, FLAG_ANDROIDTV),
'QM152E' => array( 'Philips', 'Android TV (2015)', TYPE_TELEVISION, FLAG_ANDROIDTV),



Expand Down Expand Up @@ -3703,6 +3704,7 @@
'MT2L03' => array( 'Huawei', 'Ascend Mate 2' ),
'HUAWEI MT7-(L09|CL00|TL00|TL10|UL00)!' => array( 'Huawei', 'Ascend Mate 7' ),
'Z100-(L09|TL00)!' => array( 'Huawei', 'Ascend Mate 7' ),
'M200-(UL00)!' => array( 'Huawei', 'Mate 8' ),
'Huawei S8520' => array( 'Huawei', 'S8520' ),
'Huawei S8600' => array( 'Huawei', 'S8600' ),
'Huawei T8100' => array( 'Huawei', 'T8100' ),
Expand Down Expand Up @@ -5193,7 +5195,7 @@
'LG-F510!' => array( 'LG', 'G Flex 2' ),
'LG-F520!' => array( 'LG', 'AKA' ),
'LG-F540!' => array( 'LG', 'Volt' ),
'LG-F580!' => array( 'LG', 'F580' ), // Unknown
'LG-F580!' => array( 'LG', 'Gentle' ),
'LG-GT540!' => array( 'LG', 'Optimus' ),
'LG-GW620' => array( 'LG', 'GW620 Eve' ),
'LG-H2(20|22)!' => array( 'LG', 'Joy' ),
Expand Down Expand Up @@ -7276,7 +7278,7 @@
'GT-I9063!' => array( 'Samsung', 'Galaxy Grand Neo Duos' ),
'GT-I9070!' => array( 'Samsung', 'Galaxy S Advance' ),
'GT-I9080!' => array( 'Samsung', 'Galaxy Grand' ),
'GT-I9082!' => array( 'Samsung', 'Galaxy Grand Neo+' ),
'GT-I9082!' => array( 'Samsung', 'Galaxy Grand Duos' ),
'GT-I91(00|08)!' => array( 'Samsung', 'Galaxy S II' ),
'GT-I9103!' => array( 'Samsung', 'Galaxy R' ),
'GT-I9105!' => array( 'Samsung', 'Galaxy S II Plus' ),
Expand Down Expand Up @@ -8049,6 +8051,8 @@
'E23(12|33|63)!' => array( 'Sony', 'Xperia M4 Aqua dual' ), // ...
'E53(03|06|53)!' => array( 'Sony', 'Xperia C4' ), // ...
'E53(33|43|63)!' => array( 'Sony', 'Xperia C4 dual' ), // ...
'E55(06|53)!' => array( 'Sony', 'Xperia C5 Ultra' ), // ...
'E55(33|63)!' => array( 'Sony', 'Xperia C5 Ultra dual' ), // ...
'E58(03)!' => array( 'Sony', 'E580x' ), // ...
'E63(33)!' => array( 'Sony', 'Xperia Z3+ dual' ), // ...
'E65(08)!' => array( 'Sony', 'Xperia Z4v' ), // ...
Expand Down
12 changes: 7 additions & 5 deletions data/profiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@
'http://www.htcmms.com.tw/Android/Vodafone/PPzlrbleWf/ua-profile.xml' => array( 'HTC', 'One (M8s)', 'Android', TYPE_MOBILE ),
'http://www.htcmms.com.tw/Android/Common/RBuZib3xtL/ua-profile.xml' => array( 'HTC', 'One (M9 Plus)', 'Android', TYPE_MOBILE ),
'http://device.sprintpcs.com/HTC/0PJA2-SPRINT/13265130.rdf' => array( 'HTC', 'One (M9)', 'Android', TYPE_MOBILE ),
'http://device.sprintpcs.com/HTC/0PJA2-SPRINT/2665111.rdf' => array( 'HTC', 'One (M9)', 'Android', TYPE_MOBILE ),
'http://www.htcmms.com.tw/Android/ATT/xbKGNh1DoH/ua-profile.xml' => array( 'HTC', 'One (M9)', 'Android', TYPE_MOBILE ),
'http://www.htcmms.com.tw/Android/CMCC/c8HDMjoq7Q/ua-profile.xml' => array( 'HTC', 'One (M9)', 'Android', TYPE_MOBILE ),
'http://www.htcmms.com.tw/Android/Common/WDfCkeuHE6/ua-profile.xml' => array( 'HTC', 'One (M9)', 'Android', TYPE_MOBILE ),
Expand Down Expand Up @@ -1841,6 +1842,7 @@
'http://uaprof.metropcs.net/UAProf/Huawei-M860.xml' => array( 'Huawei', 'M860', 'Android', TYPE_MOBILE ),
'http://uaprof.metropcs.net/UAProf/Huawei-M860F.xml' => array( 'Huawei', 'M860', 'Android', TYPE_MOBILE ),
'http://wap1.huawei.com/uaprof/HW_HUAWEI_H871G.xml' => array( 'Huawei', 'Magna', 'Android', TYPE_MOBILE ),
'http://wap1.huawei.com/uaprof/HUAWEI_M200_L09_UAProfile.xml' => array( 'Huawei', 'Mate 8', 'Android', TYPE_MOBILE ),
'http://wap1.huawei.com/uaprof/HuaweiMediaPadEVDODataOnly.xml' => array( 'Huawei', 'MediaPad', 'Android', TYPE_TABLET ),
'http://wap1.huawei.com/uaprof/HuaweiMediaPadWCDMADataOnly.xml' => array( 'Huawei', 'MediaPad', 'Android', TYPE_TABLET ),
'http://wap1.huawei.com/uaprof/HuaweiMediaPadWCDMA_ICS.xml' => array( 'Huawei', 'MediaPad', 'Android', TYPE_TABLET ),
Expand Down Expand Up @@ -5409,6 +5411,11 @@
'http://wap.samsungmobile.com/uaprof/SM-G357M.xml' => array( 'Samsung', 'Galaxy Ace Style', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G357MPET.xml' => array( 'Samsung', 'Galaxy Ace Style', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-S765C.xml' => array( 'Samsung', 'Galaxy Ace Style', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850A.xml' => array( 'Samsung', 'Galaxy Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850F.xml' => array( 'Samsung', 'Galaxy Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850M.xml' => array( 'Samsung', 'Galaxy Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850W.xml' => array( 'Samsung', 'Galaxy Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850Y.xml' => array( 'Samsung', 'Galaxy Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SGH-I407.xml' => array( 'Samsung', 'Galaxy Amp', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/GT-i5800.xml' => array( 'Samsung', 'Galaxy Apollo', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/GT-i5800L.xml' => array( 'Samsung', 'Galaxy Apollo', 'Android', TYPE_MOBILE ),
Expand Down Expand Up @@ -6077,13 +6084,8 @@
'http://wap.samsungmobile.com/uaprof/SM-G900W8MTA.xml' => array( 'Samsung', 'Galaxy S5', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G901F.xml' => array( 'Samsung', 'Galaxy S5', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G906L.xml' => array( 'Samsung', 'Galaxy S5', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850F.xml' => array( 'Samsung', 'Galaxy S5 Active', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850W.xml' => array( 'Samsung', 'Galaxy S5 Active', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G870A.xml' => array( 'Samsung', 'Galaxy S5 Active', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G870W.xml' => array( 'Samsung', 'Galaxy S5 Active', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850A.xml' => array( 'Samsung', 'Galaxy S5 Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850M.xml' => array( 'Samsung', 'Galaxy S5 Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G850Y.xml' => array( 'Samsung', 'Galaxy S5 Alpha', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G800A.xml' => array( 'Samsung', 'Galaxy S5 Mini', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G800F.xml' => array( 'Samsung', 'Galaxy S5 Mini', 'Android', TYPE_MOBILE ),
'http://wap.samsungmobile.com/uaprof/SM-G800H.xml' => array( 'Samsung', 'Galaxy S5 Mini', 'Android', TYPE_MOBILE ),
Expand Down
19 changes: 11 additions & 8 deletions detect.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
WhichBrowser.prototype = {
initialize: function(options) {
this.options = {
}
};

<?php $detected->toJavaScript(); ?>
},
Expand Down Expand Up @@ -116,14 +116,14 @@
channel: this.channel,
mode: this.mode,
hidden: this.hidden
}
};
},

toString: function() {
var name = this.alias ? this.alias : (this.name ? this.name : '');
return (name ? name + (this.channel ? ' ' + this.channel : '') + (this.version && !this.version.hidden ? ' ' + this.version.toString() : '') : '');
}
}
};

var Engine = function() { this.initialize.apply(this, Array.prototype.slice.call(arguments)) };
Engine.prototype = {
Expand All @@ -137,35 +137,38 @@
return {
name: this.name,
version: (this.version) ? this.version.toJSON() : null
}
};
},

toString: function() {
var name = this.alias ? this.alias : (this.name ? this.name : '');
return name;
}
}
};

var Os = function() { this.initialize.apply(this, Array.prototype.slice.call(arguments)) };
Os.prototype = {
initialize: function(v) {
this.name = v.name || null;
this.family = v.family || null;
this.alias = v.alias || null;
this.version = v.version || null;
},

toJSON: function() {
return {
name: this.name,
family: this.family,
alias: this.alias,
version: (this.version) ? this.version.toJSON() : null
}
};
},

toString: function() {
var name = this.alias ? this.alias : (this.name ? this.name : '');
return (name ? name + (this.version && !this.version.hidden ? ' ' + this.version.toString() : '') : '');
}
}
};

var Device = function() { this.initialize.apply(this, Array.prototype.slice.call(arguments)) };
Device.prototype = {
Expand Down Expand Up @@ -193,7 +196,7 @@
else
return (this.model ? 'unrecognized device (' + this.model + ')' : '');
}
}
};

var Version = function() { this.initialize.apply(this, Array.prototype.slice.call(arguments)) };
Version.prototype = {
Expand Down
29 changes: 25 additions & 4 deletions libraries/whichbrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,16 @@ function analyseUserAgent($ua) {
}
}

if (preg_match('/\(Linux; ([^;]+) Build/u', $ua, $match)) {
$device = DeviceModels::identify('android', $match[1]);
if ($device->identified) {
$device->identified |= ID_PATTERN;
$device->identified |= $this->device->identified;

$this->os->name = 'Android';
$this->device = $device;
}
}


/****************************************************
Expand Down Expand Up @@ -1747,9 +1757,13 @@ function analyseUserAgent($ua) {
* Jolla Sailfish
*/

if (preg_match('/Jolla; Sailfish;/u', $ua)) {
if (preg_match('/Sailfish;/u', $ua)) {
$this->os->name = 'Sailfish';
$this->device->manufacturer = 'Jolla';
$this->os->version = null;

if (preg_match('/Jolla;/u', $ua)) {
$this->device->manufacturer = 'Jolla';
}

if (preg_match('/Mobile/u', $ua)) {
$this->device->model = 'Phone';
Expand Down Expand Up @@ -4407,6 +4421,9 @@ function analyseUserAgent($ua) {
case '40.0.2214':
case '41.0.2272':
case '42.0.2311':
case '43.0.2357':
case '44.0.2403':
case '45.0.2454':
$this->browser->version->details = 1;
break;
default:
Expand Down Expand Up @@ -4552,6 +4569,8 @@ function analyseUserAgent($ua) {
case '41.0.2272':
case '42.0.2311':
case '43.0.2357':
case '44.0.2403':
case '45.0.2454':
$this->browser->version->details = 1;
break;
default:
Expand Down Expand Up @@ -5741,8 +5760,10 @@ function analyseUserAgent($ua) {
array('name' => 'HeartRails Capture', 'regexp' => '/HeartRails_Capture\/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'iAsk Spider', 'regexp' => '/iaskspider\/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'PowerMapper', 'regexp' => '/CrawlerProcess \(http:\/\/www\.PowerMapper\.com\) \/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'Scrapy', 'regexp' => '/Scrapy\/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'Sogou Web Spider', 'regexp' => '/sogou spider/u', 'type' => TYPE_BOT),
array('name' => 'Sogou Web Spider', 'regexp' => '/Sogou web spider\/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'Soso Web Spider', 'regexp' => '/Sosospider\/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'Yahoo Slurp', 'regexp' => '/Yahoo\! Slurp\/([0-9.]*)/u', 'type' => TYPE_BOT),
array('name' => 'Yahoo Slurp', 'regexp' => '/Yahoo\! Slurp China/u', 'type' => TYPE_BOT),
array('name' => 'Wget', 'regexp' => '/Wget\/([0-9.]*)/u', 'type' => TYPE_BOT)
Expand Down Expand Up @@ -5871,7 +5892,7 @@ function analyseUserAgent($ua) {

if (preg_match('/Edge\/([0-9.]*)/u', $ua, $match)) {
$this->engine->name = 'EdgeHTML';
$this->engine->version = null;
$this->engine->version = new Version(array('value' => $match[1], 'details' => 1));
}


Expand Down Expand Up @@ -6084,7 +6105,7 @@ function analyseUserAgent($ua) {
}


if (isset($this->os->name) && $this->os->name == 'Android') {
if ((isset($this->os->name) && $this->os->name == 'Android') || isset($this->os->name) && $this->os->name == 'Android TV') {
if (preg_match('/Build\/([^\);]+)/u', $ua, $match)) {
$version = BuildIds::identify('android', $match[1]);

Expand Down

0 comments on commit 9fc2e74

Please sign in to comment.