From 4c6f77b86ade3b13630a18ec305a5bf94de60feb Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Fri, 20 Feb 2015 15:50:04 -0600 Subject: [PATCH] Adds support for Tizen --- Source/UserAgentParser.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/UserAgentParser.php b/Source/UserAgentParser.php index 6fcc6b4..f38414e 100644 --- a/Source/UserAgentParser.php +++ b/Source/UserAgentParser.php @@ -29,11 +29,11 @@ function parse_user_agent( $u_agent = null ) { if( preg_match('/\((.*?)\)/im', $u_agent, $parent_matches) ) { - preg_match_all('/(?PBB\d+;|Android|CrOS|iPhone|iPad|Linux|Macintosh|Windows(\ Phone)?|Silk|linux-gnu|BlackBerry|PlayBook|(New\ )?Nintendo\ (WiiU?|3DS)|Xbox(\ One)?) + preg_match_all('/(?PBB\d+;|Android|CrOS|Tizen|iPhone|iPad|Linux|Macintosh|Windows(\ Phone)?|Silk|linux-gnu|BlackBerry|PlayBook|(New\ )?Nintendo\ (WiiU?|3DS)|Xbox(\ One)?) (?:\ [^;]*)? (?:;|$)/imx', $parent_matches[1], $result, PREG_PATTERN_ORDER); - $priority = array( 'Android', 'Xbox One', 'Xbox' ); + $priority = array( 'Android', 'Xbox One', 'Xbox', 'Tizen' ); $result['platform'] = array_unique($result['platform']); if( count($result['platform']) > 1 ) { if( $keys = array_intersect($priority, $result['platform']) ) { @@ -52,7 +52,7 @@ function parse_user_agent( $u_agent = null ) { $platform = 'Chrome OS'; } - preg_match_all('%(?PCamino|Kindle(\ Fire\ Build)?|Firefox|Iceweasel|Safari|MSIE|Trident|AppleWebKit|Chrome| + preg_match_all('%(?PCamino|Kindle(\ Fire\ Build)?|Firefox|Iceweasel|Safari|MSIE|Trident|AppleWebKit|TizenBrowser|Chrome| Vivaldi|IEMobile|Opera|OPR|Silk|Midori|Edge| Baiduspider|Googlebot|YandexBot|bingbot|Lynx|Version|Wget|curl| NintendoBrowser|PLAYSTATION\ (\d|Vita)+) @@ -144,6 +144,8 @@ function parse_user_agent( $u_agent = null ) { $browser = 'BlackBerry Browser'; } elseif( $find('Safari', $key) ) { $browser = 'Safari'; + } elseif( $find('TizenBrowser', $key) ) { + $browser = 'TizenBrowser'; } $find('Version', $key); @@ -157,5 +159,4 @@ function parse_user_agent( $u_agent = null ) { } return array( 'platform' => $platform ?: null, 'browser' => $browser ?: null, 'version' => $version ?: null ); - }