From 13f776e0ff0df6fcb02420811118e3e4cb1b7a49 Mon Sep 17 00:00:00 2001 From: sgiehl Date: Thu, 13 Feb 2014 14:37:36 +0100 Subject: added detection for some android powered cameras and gaming console --- .../UserAgentParserEnhanced.php | 5 ++++- .../UserAgentParserEnhanced/regexes/mobiles.yml | 19 +++++++++++++++++-- .../UserAgentParserEnhanced/regexes/oss.yml | 2 +- plugins/DevicesDetection/functions.php | 6 ++++-- plugins/DevicesDetection/images/screens/camera.png | Bin 0 -> 644 bytes plugins/DevicesDetection/lang/en.json | 1 + 6 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 plugins/DevicesDetection/images/screens/camera.png (limited to 'plugins/DevicesDetection') diff --git a/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php b/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php index 0e51996f3d..fa5ad4ac60 100644 --- a/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php +++ b/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php @@ -19,7 +19,8 @@ class UserAgentParserEnhanced 'console', // 4 'tv', // 5 'car browser', // 6 - 'smart display' // 7 + 'smart display', // 7 + 'camera' // 8 ); public static $deviceBrands = array( @@ -106,12 +107,14 @@ class UserAgentParserEnhanced 'NG' => 'NGM', 'NI' => 'Nintendo', 'NK' => 'Nokia', + 'NN' => 'Nikon', 'NW' => 'Newgen', 'NX' => 'Nexian', 'OD' => 'Onda', 'OP' => 'OPPO', 'OR' => 'Orange', 'OT' => 'O2', + 'OU' => 'OUYA', 'PA' => 'Panasonic', 'PE' => 'PEAQ', 'PH' => 'Philips', diff --git a/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/mobiles.yml b/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/mobiles.yml index e8e987462e..14ae68db3d 100644 --- a/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/mobiles.yml +++ b/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/mobiles.yml @@ -761,7 +761,13 @@ Nexian: model: '$1' - regex: 'S?Nexian-([a-z0-9]+)' model: '$1' - + +#Nikon +Nikon: + regex: 'Coolpix S800c' + device: 'camera' + model: 'Coolpix S800c' + # o2 O2: regex: 'Xda|O2[ \-]|COCOON' @@ -798,6 +804,12 @@ Orange: device: 'smartphone' model: 'SPV $1' +#OUYA +OUYA: + regex: 'OUYA' + device: 'console' + model: 'OUYA' + # panasonic Panasonic: regex: 'Panasonic' @@ -851,7 +863,7 @@ Siemens: # Samsung Samsung: - regex: 'SAMSUNG|S(?:CH|GH|PH|EC|AM|HV|HW)-|SMART-TV|GT-|Galaxy|(?:portalmmm|o2imode)/2\.0 [SZ]|sam[rua]' + regex: 'SAMSUNG|S(?:CH|GH|PH|EC|AM|HV|HW)-|SMART-TV|GT-|Galaxy|(?:portalmmm|o2imode)/2\.0 [SZ]|sam[rua]|EK-GC[0-9]{3}' device: 'smartphone' models: - regex: '(GT-(P|N8|N5)[0-9]+[a-z]?)' @@ -867,6 +879,9 @@ Samsung: model: '$1' - regex: '((?:SCH|SGH|SPH|SHV|SHW|GT)-[a-z0-9]+)' model: '$1' + - regex: 'EK-GC([0-9]{3})' + device: 'camera' + model: 'Galaxy Camera $1' - regex: 'SEC-([a-z0-9]+)' model: '$1' - regex: 'SAM-([a-z0-9]+)' diff --git a/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/oss.yml b/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/oss.yml index a42f74c941..5c950d50af 100644 --- a/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/oss.yml +++ b/plugins/DevicesDetection/UserAgentParserEnhanced/regexes/oss.yml @@ -47,7 +47,7 @@ ########## # Android ########## -- regex: 'Android[ /](\d+\.\d+)' +- regex: 'Android[ /](?:[a-z]+ )?(\d+\.\d+)' name: 'Android' version: '$1' diff --git a/plugins/DevicesDetection/functions.php b/plugins/DevicesDetection/functions.php index 37b5ec3ea2..21cfa8ae33 100644 --- a/plugins/DevicesDetection/functions.php +++ b/plugins/DevicesDetection/functions.php @@ -107,7 +107,8 @@ function getDeviceTypeLabel($label) 'console' => 'DevicesDetection_Console', 'tv' => 'DevicesDetection_TV', 'car browser' => 'DevicesDetection_CarBbrowser', - 'smart display' => 'DevicesDetection_SmartDisplay' + 'smart display' => 'DevicesDetection_SmartDisplay', + 'camera' => 'DevicesDetection_Camera' ); if (isset(UserAgentParserEnhanced::$deviceTypes[$label]) && isset($translations[UserAgentParserEnhanced::$deviceTypes[$label]])) { return Piwik::translate($translations[UserAgentParserEnhanced::$deviceTypes[$label]]); @@ -133,7 +134,8 @@ function getDeviceTypeLogo($label) "tv" => "tv.png", "feature phone" => "mobile.gif", "console" => "console.gif", - "car browser" => "carbrowser.png"); + "car browser" => "carbrowser.png", + "camera" => "camera.png"); if (!array_key_exists($label, $deviceTypeLogos) || $label == "Unknown") { $label = 'unknown.gif'; diff --git a/plugins/DevicesDetection/images/screens/camera.png b/plugins/DevicesDetection/images/screens/camera.png new file mode 100644 index 0000000000..bd9deed867 Binary files /dev/null and b/plugins/DevicesDetection/images/screens/camera.png differ diff --git a/plugins/DevicesDetection/lang/en.json b/plugins/DevicesDetection/lang/en.json index d364dfb21c..c10124efef 100644 --- a/plugins/DevicesDetection/lang/en.json +++ b/plugins/DevicesDetection/lang/en.json @@ -19,6 +19,7 @@ "UserAgent": "User-Agent", "Smartphone": "Smartphone", "CarBrowser": "Car browser", + "Camera": "Camera", "Tablet": "Tablet", "SmartDisplay": "Smart display", "FeaturePhone": "Feature phone", -- cgit v1.2.3