Skip to content
This repository was archived by the owner on Dec 9, 2022. It is now read-only.

Commit 4c6f77b

Browse files
committed
Adds support for Tizen
1 parent ea239f0 commit 4c6f77b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Source/UserAgentParser.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ function parse_user_agent( $u_agent = null ) {
2929

3030
if( preg_match('/\((.*?)\)/im', $u_agent, $parent_matches) ) {
3131

32-
preg_match_all('/(?P<platform>BB\d+;|Android|CrOS|iPhone|iPad|Linux|Macintosh|Windows(\ Phone)?|Silk|linux-gnu|BlackBerry|PlayBook|(New\ )?Nintendo\ (WiiU?|3DS)|Xbox(\ One)?)
32+
preg_match_all('/(?P<platform>BB\d+;|Android|CrOS|Tizen|iPhone|iPad|Linux|Macintosh|Windows(\ Phone)?|Silk|linux-gnu|BlackBerry|PlayBook|(New\ )?Nintendo\ (WiiU?|3DS)|Xbox(\ One)?)
3333
(?:\ [^;]*)?
3434
(?:;|$)/imx', $parent_matches[1], $result, PREG_PATTERN_ORDER);
3535

36-
$priority = array( 'Android', 'Xbox One', 'Xbox' );
36+
$priority = array( 'Android', 'Xbox One', 'Xbox', 'Tizen' );
3737
$result['platform'] = array_unique($result['platform']);
3838
if( count($result['platform']) > 1 ) {
3939
if( $keys = array_intersect($priority, $result['platform']) ) {
@@ -52,7 +52,7 @@ function parse_user_agent( $u_agent = null ) {
5252
$platform = 'Chrome OS';
5353
}
5454

55-
preg_match_all('%(?P<browser>Camino|Kindle(\ Fire\ Build)?|Firefox|Iceweasel|Safari|MSIE|Trident|AppleWebKit|Chrome|
55+
preg_match_all('%(?P<browser>Camino|Kindle(\ Fire\ Build)?|Firefox|Iceweasel|Safari|MSIE|Trident|AppleWebKit|TizenBrowser|Chrome|
5656
Vivaldi|IEMobile|Opera|OPR|Silk|Midori|Edge|
5757
Baiduspider|Googlebot|YandexBot|bingbot|Lynx|Version|Wget|curl|
5858
NintendoBrowser|PLAYSTATION\ (\d|Vita)+)
@@ -144,6 +144,8 @@ function parse_user_agent( $u_agent = null ) {
144144
$browser = 'BlackBerry Browser';
145145
} elseif( $find('Safari', $key) ) {
146146
$browser = 'Safari';
147+
} elseif( $find('TizenBrowser', $key) ) {
148+
$browser = 'TizenBrowser';
147149
}
148150

149151
$find('Version', $key);
@@ -157,5 +159,4 @@ function parse_user_agent( $u_agent = null ) {
157159
}
158160

159161
return array( 'platform' => $platform ?: null, 'browser' => $browser ?: null, 'version' => $version ?: null );
160-
161162
}

0 commit comments

Comments
 (0)