@@ -90,6 +90,10 @@ class Browser
9090 const BROWSER_NETPOSITIVE = 'NetPositive ' ; // http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
9191 const BROWSER_PHOENIX = 'Phoenix ' ; // http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
9292 const BROWSER_PLAYSTATION = "PlayStation " ;
93+ const BROWSER_SAMSUNG = "SamsungBrowser " ;
94+ const BROWSER_SILK = "Silk " ;
95+ const BROWSER_I_FRAME = "Iframely " ;
96+ const BROWSER_COCOA = "CocoaRestClient " ;
9397
9498 const PLATFORM_UNKNOWN = 'unknown ' ;
9599 const PLATFORM_WINDOWS = 'Windows ' ;
@@ -112,6 +116,13 @@ class Browser
112116 const PLATFORM_PLAYSTATION = "Sony PlayStation " ;
113117 const PLATFORM_ROKU = "Roku " ;
114118 const PLATFORM_APPLE_TV = "Apple TV " ;
119+ const PLATFORM_TERMINAL = "Terminal " ;
120+ const PLATFORM_FIRE_OS = "Fire OS " ;
121+ const PLATFORM_SMART_TV = "SMART-TV " ;
122+ const PLATFORM_CHROME_OS = "Chrome OS " ;
123+ const PLATFORM_JAVA_ANDROID = "Java/Android " ;
124+ const PLATFORM_POSTMAN = "Postman " ;
125+ const PLATFORM_I_FRAME = "Iframely " ;
115126
116127 const OPERATING_SYSTEM_UNKNOWN = 'unknown ' ;
117128
@@ -420,6 +431,8 @@ protected function checkBrowsers()
420431 $ this ->checkFacebookExternalHit () ||
421432
422433 // WebKit base check (post mobile and others)
434+ $ this ->checkBrowserSamsung () ||
435+ $ this ->checkBrowserSilk () ||
423436 $ this ->checkBrowserSafari () ||
424437
425438 // everyone else
@@ -435,6 +448,8 @@ protected function checkBrowsers()
435448 $ this ->checkBrowserIceweasel () ||
436449 $ this ->checkBrowserW3CValidator () ||
437450 $ this ->checkBrowserPlayStation () ||
451+ $ this ->checkBrowserIframely () ||
452+ $ this ->checkBrowserCocoa () ||
438453 $ this ->checkBrowserMozilla () /* Mozilla is such an open standard that you must check it last */
439454
440455
@@ -1102,6 +1117,71 @@ protected function checkBrowserSafari()
11021117 return false ;
11031118 }
11041119
1120+ protected function checkBrowserSamsung ()
1121+ {
1122+ if (stripos ($ this ->_agent , 'SamsungBrowser ' ) !== false ) {
1123+
1124+ $ aresult = explode ('/ ' , stristr ($ this ->_agent , 'SamsungBrowser ' ));
1125+ if (isset ($ aresult [1 ])) {
1126+ $ aversion = explode (' ' , $ aresult [1 ]);
1127+ $ this ->setVersion ($ aversion [0 ]);
1128+ } else {
1129+ $ this ->setVersion (self ::VERSION_UNKNOWN );
1130+ }
1131+ $ this ->setBrowser (self ::BROWSER_SAMSUNG );
1132+ return true ;
1133+ }
1134+ return false ;
1135+ }
1136+
1137+ protected function checkBrowserSilk ()
1138+ {
1139+ if (stripos ($ this ->_agent , 'Silk ' ) !== false ) {
1140+ $ aresult = explode ('/ ' , stristr ($ this ->_agent , 'Silk ' ));
1141+ if (isset ($ aresult [1 ])) {
1142+ $ aversion = explode (' ' , $ aresult [1 ]);
1143+ $ this ->setVersion ($ aversion [0 ]);
1144+ } else {
1145+ $ this ->setVersion (self ::VERSION_UNKNOWN );
1146+ }
1147+ $ this ->setBrowser (self ::BROWSER_SILK );
1148+ return true ;
1149+ }
1150+ return false ;
1151+ }
1152+
1153+ protected function checkBrowserIframely ()
1154+ {
1155+ if (stripos ($ this ->_agent , 'Iframely ' ) !== false ) {
1156+ $ aresult = explode ('/ ' , stristr ($ this ->_agent , 'Iframely ' ));
1157+ if (isset ($ aresult [1 ])) {
1158+ $ aversion = explode (' ' , $ aresult [1 ]);
1159+ $ this ->setVersion ($ aversion [0 ]);
1160+ } else {
1161+ $ this ->setVersion (self ::VERSION_UNKNOWN );
1162+ }
1163+ $ this ->setBrowser (self ::BROWSER_I_FRAME );
1164+ return true ;
1165+ }
1166+ return false ;
1167+ }
1168+
1169+ protected function checkBrowserCocoa ()
1170+ {
1171+ if (stripos ($ this ->_agent , 'CocoaRestClient ' ) !== false ) {
1172+ $ aresult = explode ('/ ' , stristr ($ this ->_agent , 'CocoaRestClient ' ));
1173+ if (isset ($ aresult [1 ])) {
1174+ $ aversion = explode (' ' , $ aresult [1 ]);
1175+ $ this ->setVersion ($ aversion [0 ]);
1176+ } else {
1177+ $ this ->setVersion (self ::VERSION_UNKNOWN );
1178+ }
1179+ $ this ->setBrowser (self ::BROWSER_COCOA );
1180+ return true ;
1181+ }
1182+ return false ;
1183+ }
1184+
11051185 /**
11061186 * Detect if URL is loaded from FacebookExternalHit
11071187 * @return boolean True if it detects FacebookExternalHit otherwise false
@@ -1296,6 +1376,10 @@ protected function checkPlatform()
12961376 $ this ->_platform = self ::PLATFORM_APPLE ;
12971377 } elseif (stripos ($ this ->_agent , 'android ' ) !== false ) {
12981378 $ this ->_platform = self ::PLATFORM_ANDROID ;
1379+ } elseif (stripos ($ this ->_agent , 'Silk ' ) !== false ) {
1380+ $ this ->_platform = self ::PLATFORM_FIRE_OS ;
1381+ } elseif (stripos ($ this ->_agent , 'linux ' ) !== false && stripos ($ this ->_agent , 'SMART-TV ' ) !== false ) {
1382+ $ this ->_platform = self ::PLATFORM_LINUX .'/ ' .self ::PLATFORM_SMART_TV ;
12991383 } elseif (stripos ($ this ->_agent , 'linux ' ) !== false ) {
13001384 $ this ->_platform = self ::PLATFORM_LINUX ;
13011385 } else if (stripos ($ this ->_agent , 'Nokia ' ) !== false ) {
@@ -1326,6 +1410,16 @@ protected function checkPlatform()
13261410 $ this ->_platform = self ::PLATFORM_IPHONE . '/ ' . self ::PLATFORM_IPAD ;
13271411 } elseif (stripos ($ this ->_agent , 'tvOS ' ) !== false ) {
13281412 $ this ->_platform = self ::PLATFORM_APPLE_TV ;
1413+ } elseif (stripos ($ this ->_agent , 'curl ' ) !== false ) {
1414+ $ this ->_platform = self ::PLATFORM_TERMINAL ;
1415+ } elseif (stripos ($ this ->_agent , 'CrOS ' ) !== false ) {
1416+ $ this ->_platform = self ::PLATFORM_CHROME_OS ;
1417+ } elseif (stripos ($ this ->_agent , 'okhttp ' ) !== false ) {
1418+ $ this ->_platform = self ::PLATFORM_JAVA_ANDROID ;
1419+ } elseif (stripos ($ this ->_agent , 'PostmanRuntime ' ) !== false ) {
1420+ $ this ->_platform = self ::PLATFORM_POSTMAN ;
1421+ } elseif (stripos ($ this ->_agent , 'Iframely ' ) !== false ) {
1422+ $ this ->_platform = self ::PLATFORM_I_FRAME ;
13291423 }
13301424
13311425 }
0 commit comments