| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreStart-- This is a library so phpcs is ignored here. |
| 3 |
|
| 4 |
/** |
| 5 |
* File: Browser.php |
| 6 |
* Author: Chris Schuld (http://chrisschuld.com/) |
| 7 |
* Last Modified: April 14th, 2020 |
| 8 |
* |
| 9 |
* @version 1.9.6 |
| 10 |
* |
| 11 |
* Copyright 2019 Chris Schuld |
| 12 |
* |
| 13 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 14 |
* copy of this software and associated documentation files (the "Software"), |
| 15 |
* to deal in the Software without restriction, including without |
| 16 |
* limitation the rights to use, copy, modify, merge, publish, distribute, |
| 17 |
* sublicense, and/or sell copies of the Software, and to permit persons to |
| 18 |
* whom the Software is furnished to do so, subject to the following |
| 19 |
* conditions: |
| 20 |
* |
| 21 |
* The above copyright notice and this permission notice shall be included |
| 22 |
* in all copies or substantial portions of the Software. |
| 23 |
* |
| 24 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 25 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 26 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 27 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 28 |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 29 |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 30 |
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 31 |
* |
| 32 |
* Typical Usage: |
| 33 |
* |
| 34 |
* $browser = new Browser(); |
| 35 |
* if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) { |
| 36 |
* echo 'You have FireFox version 2 or greater'; |
| 37 |
* } |
| 38 |
* |
| 39 |
* User Agents Sampled from: http://www.useragentstring.com/ |
| 40 |
* |
| 41 |
* This implementation is based on the original work from Gary White |
| 42 |
* http://apptools.com/phptools/browser/ |
| 43 |
*/ |
| 44 |
|
| 45 |
namespace SRFM\Inc\Lib\Browser; |
| 46 |
|
| 47 |
if ( ! defined( 'ABSPATH' ) ) { |
| 48 |
exit; // Exit if accessed directly. |
| 49 |
} |
| 50 |
|
| 51 |
class Browser { |
| 52 |
|
| 53 |
private $_agent = ''; |
| 54 |
private $_browser_name = ''; |
| 55 |
private $_version = ''; |
| 56 |
private $_platform = ''; |
| 57 |
private $_os = ''; |
| 58 |
private $_is_aol = false; |
| 59 |
private $_is_mobile = false; |
| 60 |
private $_is_tablet = false; |
| 61 |
private $_is_robot = false; |
| 62 |
private $_is_facebook = false; |
| 63 |
private $_aol_version = ''; |
| 64 |
|
| 65 |
const BROWSER_UNKNOWN = 'unknown'; |
| 66 |
const VERSION_UNKNOWN = 'unknown'; |
| 67 |
|
| 68 |
const BROWSER_OPERA = 'Opera'; // http://www.opera.com/ |
| 69 |
const BROWSER_OPERA_MINI = 'Opera Mini'; // http://www.opera.com/mini/ |
| 70 |
const BROWSER_WEBTV = 'WebTV'; // http://www.webtv.net/pc/ |
| 71 |
const BROWSER_EDGE = 'Edge'; // https://www.microsoft.com/edge |
| 72 |
const BROWSER_IE = 'Internet Explorer'; // http://www.microsoft.com/ie/ |
| 73 |
const BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // http://en.wikipedia.org/wiki/Internet_Explorer_Mobile |
| 74 |
const BROWSER_KONQUEROR = 'Konqueror'; // http://www.konqueror.org/ |
| 75 |
const BROWSER_ICAB = 'iCab'; // http://www.icab.de/ |
| 76 |
const BROWSER_OMNIWEB = 'OmniWeb'; // http://www.omnigroup.com/applications/omniweb/ |
| 77 |
const BROWSER_FIREBIRD = 'Firebird'; // http://www.ibphoenix.com/ |
| 78 |
const BROWSER_FIREFOX = 'Firefox'; // https://www.mozilla.org/en-US/firefox/ |
| 79 |
const BROWSER_BRAVE = 'Brave'; // https://brave.com/ |
| 80 |
const BROWSER_PALEMOON = 'Palemoon'; // https://www.palemoon.org/ |
| 81 |
const BROWSER_ICEWEASEL = 'Iceweasel'; // http://www.geticeweasel.org/ |
| 82 |
const BROWSER_SHIRETOKO = 'Shiretoko'; // http://wiki.mozilla.org/Projects/shiretoko |
| 83 |
const BROWSER_MOZILLA = 'Mozilla'; // http://www.mozilla.com/en-US/ |
| 84 |
const BROWSER_AMAYA = 'Amaya'; // http://www.w3.org/Amaya/ |
| 85 |
const BROWSER_LYNX = 'Lynx'; // http://en.wikipedia.org/wiki/Lynx |
| 86 |
const BROWSER_SAFARI = 'Safari'; // http://apple.com |
| 87 |
const BROWSER_IPHONE = 'iPhone'; // http://apple.com |
| 88 |
const BROWSER_IPOD = 'iPod'; // http://apple.com |
| 89 |
const BROWSER_IPAD = 'iPad'; // http://apple.com |
| 90 |
const BROWSER_CHROME = 'Chrome'; // http://www.google.com/chrome |
| 91 |
const BROWSER_ANDROID = 'Android'; // http://www.android.com/ |
| 92 |
const BROWSER_GOOGLEBOT = 'GoogleBot'; // http://en.wikipedia.org/wiki/Googlebot |
| 93 |
const BROWSER_CURL = 'cURL'; // https://en.wikipedia.org/wiki/CURL |
| 94 |
const BROWSER_WGET = 'Wget'; // https://en.wikipedia.org/wiki/Wget |
| 95 |
const BROWSER_UCBROWSER = 'UCBrowser'; // https://www.ucweb.com/ |
| 96 |
|
| 97 |
|
| 98 |
const BROWSER_YANDEXBOT = 'YandexBot'; // http://yandex.com/bots |
| 99 |
const BROWSER_YANDEXIMAGERESIZER_BOT = 'YandexImageResizer'; // http://yandex.com/bots |
| 100 |
const BROWSER_YANDEXIMAGES_BOT = 'YandexImages'; // http://yandex.com/bots |
| 101 |
const BROWSER_YANDEXVIDEO_BOT = 'YandexVideo'; // http://yandex.com/bots |
| 102 |
const BROWSER_YANDEXMEDIA_BOT = 'YandexMedia'; // http://yandex.com/bots |
| 103 |
const BROWSER_YANDEXBLOGS_BOT = 'YandexBlogs'; // http://yandex.com/bots |
| 104 |
const BROWSER_YANDEXFAVICONS_BOT = 'YandexFavicons'; // http://yandex.com/bots |
| 105 |
const BROWSER_YANDEXWEBMASTER_BOT = 'YandexWebmaster'; // http://yandex.com/bots |
| 106 |
const BROWSER_YANDEXDIRECT_BOT = 'YandexDirect'; // http://yandex.com/bots |
| 107 |
const BROWSER_YANDEXMETRIKA_BOT = 'YandexMetrika'; // http://yandex.com/bots |
| 108 |
const BROWSER_YANDEXNEWS_BOT = 'YandexNews'; // http://yandex.com/bots |
| 109 |
const BROWSER_YANDEXCATALOG_BOT = 'YandexCatalog'; // http://yandex.com/bots |
| 110 |
|
| 111 |
const BROWSER_SLURP = 'Yahoo! Slurp'; // http://en.wikipedia.org/wiki/Yahoo!_Slurp |
| 112 |
const BROWSER_W3CVALIDATOR = 'W3C Validator'; // http://validator.w3.org/ |
| 113 |
const BROWSER_BLACKBERRY = 'BlackBerry'; // http://www.blackberry.com/ |
| 114 |
const BROWSER_ICECAT = 'IceCat'; // http://en.wikipedia.org/wiki/GNU_IceCat |
| 115 |
const BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // http://en.wikipedia.org/wiki/Web_Browser_for_S60 |
| 116 |
const BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform |
| 117 |
const BROWSER_MSN = 'MSN Browser'; // http://explorer.msn.com/ |
| 118 |
const BROWSER_MSNBOT = 'MSN Bot'; // http://search.msn.com/msnbot.htm |
| 119 |
const BROWSER_BINGBOT = 'Bing Bot'; // http://en.wikipedia.org/wiki/Bingbot |
| 120 |
const BROWSER_VIVALDI = 'Vivaldi'; // https://vivaldi.com/ |
| 121 |
const BROWSER_YANDEX = 'Yandex'; // https://browser.yandex.ua/ |
| 122 |
|
| 123 |
const BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // http://browser.netscape.com/ (DEPRECATED) |
| 124 |
const BROWSER_GALEON = 'Galeon'; // http://galeon.sourceforge.net/ (DEPRECATED) |
| 125 |
const BROWSER_NETPOSITIVE = 'NetPositive'; // http://en.wikipedia.org/wiki/NetPositive (DEPRECATED) |
| 126 |
const BROWSER_PHOENIX = 'Phoenix'; // http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED) |
| 127 |
const BROWSER_PLAYSTATION = 'PlayStation'; |
| 128 |
const BROWSER_SAMSUNG = 'SamsungBrowser'; |
| 129 |
const BROWSER_SILK = 'Silk'; |
| 130 |
const BROWSER_I_FRAME = 'Iframely'; |
| 131 |
const BROWSER_COCOA = 'CocoaRestClient'; |
| 132 |
|
| 133 |
const PLATFORM_UNKNOWN = 'unknown'; |
| 134 |
const PLATFORM_WINDOWS = 'Windows'; |
| 135 |
const PLATFORM_WINDOWS_CE = 'Windows CE'; |
| 136 |
const PLATFORM_APPLE = 'Apple'; |
| 137 |
const PLATFORM_LINUX = 'Linux'; |
| 138 |
const PLATFORM_OS2 = 'OS/2'; |
| 139 |
const PLATFORM_BEOS = 'BeOS'; |
| 140 |
const PLATFORM_IPHONE = 'iPhone'; |
| 141 |
const PLATFORM_IPOD = 'iPod'; |
| 142 |
const PLATFORM_IPAD = 'iPad'; |
| 143 |
const PLATFORM_BLACKBERRY = 'BlackBerry'; |
| 144 |
const PLATFORM_NOKIA = 'Nokia'; |
| 145 |
const PLATFORM_FREEBSD = 'FreeBSD'; |
| 146 |
const PLATFORM_OPENBSD = 'OpenBSD'; |
| 147 |
const PLATFORM_NETBSD = 'NetBSD'; |
| 148 |
const PLATFORM_SUNOS = 'SunOS'; |
| 149 |
const PLATFORM_OPENSOLARIS = 'OpenSolaris'; |
| 150 |
const PLATFORM_ANDROID = 'Android'; |
| 151 |
const PLATFORM_PLAYSTATION = 'Sony PlayStation'; |
| 152 |
const PLATFORM_ROKU = 'Roku'; |
| 153 |
const PLATFORM_APPLE_TV = 'Apple TV'; |
| 154 |
const PLATFORM_TERMINAL = 'Terminal'; |
| 155 |
const PLATFORM_FIRE_OS = 'Fire OS'; |
| 156 |
const PLATFORM_SMART_TV = 'SMART-TV'; |
| 157 |
const PLATFORM_CHROME_OS = 'Chrome OS'; |
| 158 |
const PLATFORM_JAVA_ANDROID = 'Java/Android'; |
| 159 |
const PLATFORM_POSTMAN = 'Postman'; |
| 160 |
const PLATFORM_I_FRAME = 'Iframely'; |
| 161 |
|
| 162 |
const OPERATING_SYSTEM_UNKNOWN = 'unknown'; |
| 163 |
|
| 164 |
/** |
| 165 |
* Class constructor |
| 166 |
* |
| 167 |
* @param string $userAgent |
| 168 |
*/ |
| 169 |
public function __construct( $userAgent = '' ) { |
| 170 |
if ( $userAgent != '' ) { |
| 171 |
$this->setUserAgent( $userAgent ); |
| 172 |
} else { |
| 173 |
$this->reset(); |
| 174 |
$this->determine(); |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
/** |
| 179 |
* Reset all properties |
| 180 |
*/ |
| 181 |
public function reset() { |
| 182 |
$this->_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; |
| 183 |
$this->_browser_name = self::BROWSER_UNKNOWN; |
| 184 |
$this->_version = self::VERSION_UNKNOWN; |
| 185 |
$this->_platform = self::PLATFORM_UNKNOWN; |
| 186 |
$this->_os = self::OPERATING_SYSTEM_UNKNOWN; |
| 187 |
$this->_is_aol = false; |
| 188 |
$this->_is_mobile = false; |
| 189 |
$this->_is_tablet = false; |
| 190 |
$this->_is_robot = false; |
| 191 |
$this->_is_facebook = false; |
| 192 |
$this->_aol_version = self::VERSION_UNKNOWN; |
| 193 |
} |
| 194 |
|
| 195 |
/** |
| 196 |
* Check to see if the specific browser is valid |
| 197 |
* |
| 198 |
* @param string $browserName |
| 199 |
* @return bool True if the browser is the specified browser |
| 200 |
*/ |
| 201 |
function isBrowser( $browserName ) { |
| 202 |
return ( 0 == strcasecmp( $this->_browser_name, trim( $browserName ) ) ); |
| 203 |
} |
| 204 |
|
| 205 |
/** |
| 206 |
* The name of the browser. All return types are from the class contants |
| 207 |
* |
| 208 |
* @return string Name of the browser |
| 209 |
*/ |
| 210 |
public function getBrowser() { |
| 211 |
return $this->_browser_name; |
| 212 |
} |
| 213 |
|
| 214 |
/** |
| 215 |
* Set the name of the browser |
| 216 |
* |
| 217 |
* @param $browser string The name of the Browser |
| 218 |
*/ |
| 219 |
public function setBrowser( $browser ) { |
| 220 |
$this->_browser_name = $browser; |
| 221 |
} |
| 222 |
|
| 223 |
/** |
| 224 |
* The name of the platform. All return types are from the class contants |
| 225 |
* |
| 226 |
* @return string Name of the browser |
| 227 |
*/ |
| 228 |
public function getPlatform() { |
| 229 |
return $this->_platform; |
| 230 |
} |
| 231 |
|
| 232 |
/** |
| 233 |
* Set the name of the platform |
| 234 |
* |
| 235 |
* @param string $platform The name of the Platform |
| 236 |
*/ |
| 237 |
public function setPlatform( $platform ) { |
| 238 |
$this->_platform = $platform; |
| 239 |
} |
| 240 |
|
| 241 |
/** |
| 242 |
* The version of the browser. |
| 243 |
* |
| 244 |
* @return string Version of the browser (will only contain alpha-numeric characters and a period) |
| 245 |
*/ |
| 246 |
public function getVersion() { |
| 247 |
return $this->_version; |
| 248 |
} |
| 249 |
|
| 250 |
/** |
| 251 |
* Set the version of the browser |
| 252 |
* |
| 253 |
* @param string $version The version of the Browser |
| 254 |
*/ |
| 255 |
public function setVersion( $version ) { |
| 256 |
$this->_version = preg_replace( '/[^0-9,.,a-z,A-Z-]/', '', $version ); |
| 257 |
} |
| 258 |
|
| 259 |
/** |
| 260 |
* The version of AOL. |
| 261 |
* |
| 262 |
* @return string Version of AOL (will only contain alpha-numeric characters and a period) |
| 263 |
*/ |
| 264 |
public function getAolVersion() { |
| 265 |
return $this->_aol_version; |
| 266 |
} |
| 267 |
|
| 268 |
/** |
| 269 |
* Set the version of AOL |
| 270 |
* |
| 271 |
* @param string $version The version of AOL |
| 272 |
*/ |
| 273 |
public function setAolVersion( $version ) { |
| 274 |
$this->_aol_version = preg_replace( '/[^0-9,.,a-z,A-Z]/', '', $version ); |
| 275 |
} |
| 276 |
|
| 277 |
/** |
| 278 |
* Is the browser from AOL? |
| 279 |
* |
| 280 |
* @return boolean True if the browser is from AOL otherwise false |
| 281 |
*/ |
| 282 |
public function isAol() { |
| 283 |
return $this->_is_aol; |
| 284 |
} |
| 285 |
|
| 286 |
/** |
| 287 |
* Is the browser from a mobile device? |
| 288 |
* |
| 289 |
* @return boolean True if the browser is from a mobile device otherwise false |
| 290 |
*/ |
| 291 |
public function isMobile() { |
| 292 |
return $this->_is_mobile; |
| 293 |
} |
| 294 |
|
| 295 |
/** |
| 296 |
* Is the browser from a tablet device? |
| 297 |
* |
| 298 |
* @return boolean True if the browser is from a tablet device otherwise false |
| 299 |
*/ |
| 300 |
public function isTablet() { |
| 301 |
return $this->_is_tablet; |
| 302 |
} |
| 303 |
|
| 304 |
/** |
| 305 |
* Is the browser from a robot (ex Slurp,GoogleBot)? |
| 306 |
* |
| 307 |
* @return boolean True if the browser is from a robot otherwise false |
| 308 |
*/ |
| 309 |
public function isRobot() { |
| 310 |
return $this->_is_robot; |
| 311 |
} |
| 312 |
|
| 313 |
/** |
| 314 |
* Is the browser from facebook? |
| 315 |
* |
| 316 |
* @return boolean True if the browser is from facebook otherwise false |
| 317 |
*/ |
| 318 |
public function isFacebook() { |
| 319 |
return $this->_is_facebook; |
| 320 |
} |
| 321 |
|
| 322 |
/** |
| 323 |
* Set the browser to be from AOL |
| 324 |
* |
| 325 |
* @param $isAol |
| 326 |
*/ |
| 327 |
public function setAol( $isAol ) { |
| 328 |
$this->_is_aol = $isAol; |
| 329 |
} |
| 330 |
|
| 331 |
/** |
| 332 |
* Set the Browser to be mobile |
| 333 |
* |
| 334 |
* @param boolean $value is the browser a mobile browser or not |
| 335 |
*/ |
| 336 |
protected function setMobile( $value = true ) { |
| 337 |
$this->_is_mobile = $value; |
| 338 |
} |
| 339 |
|
| 340 |
/** |
| 341 |
* Set the Browser to be tablet |
| 342 |
* |
| 343 |
* @param boolean $value is the browser a tablet browser or not |
| 344 |
*/ |
| 345 |
protected function setTablet( $value = true ) { |
| 346 |
$this->_is_tablet = $value; |
| 347 |
} |
| 348 |
|
| 349 |
/** |
| 350 |
* Set the Browser to be a robot |
| 351 |
* |
| 352 |
* @param boolean $value is the browser a robot or not |
| 353 |
*/ |
| 354 |
protected function setRobot( $value = true ) { |
| 355 |
$this->_is_robot = $value; |
| 356 |
} |
| 357 |
|
| 358 |
/** |
| 359 |
* Set the Browser to be a Facebook request |
| 360 |
* |
| 361 |
* @param boolean $value is the browser a robot or not |
| 362 |
*/ |
| 363 |
protected function setFacebook( $value = true ) { |
| 364 |
$this->_is_facebook = $value; |
| 365 |
} |
| 366 |
|
| 367 |
/** |
| 368 |
* Get the user agent value in use to determine the browser |
| 369 |
* |
| 370 |
* @return string The user agent from the HTTP header |
| 371 |
*/ |
| 372 |
public function getUserAgent() { |
| 373 |
return $this->_agent; |
| 374 |
} |
| 375 |
|
| 376 |
/** |
| 377 |
* Set the user agent value (the construction will use the HTTP header value - this will overwrite it) |
| 378 |
* |
| 379 |
* @param string $agent_string The value for the User Agent |
| 380 |
*/ |
| 381 |
public function setUserAgent( $agent_string ) { |
| 382 |
$this->reset(); |
| 383 |
$this->_agent = $agent_string; |
| 384 |
$this->determine(); |
| 385 |
} |
| 386 |
|
| 387 |
/** |
| 388 |
* Used to determine if the browser is actually "chromeframe" |
| 389 |
* |
| 390 |
* @since 1.7 |
| 391 |
* @return boolean True if the browser is using chromeframe |
| 392 |
*/ |
| 393 |
public function isChromeFrame() { |
| 394 |
return ( strpos( $this->_agent, 'chromeframe' ) !== false ); |
| 395 |
} |
| 396 |
|
| 397 |
/** |
| 398 |
* Returns a formatted string with a summary of the details of the browser. |
| 399 |
* |
| 400 |
* @return string formatted string with a summary of the browser |
| 401 |
*/ |
| 402 |
public function __toString() { |
| 403 |
return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
| 404 |
"<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
| 405 |
"<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n" . |
| 406 |
"<strong>Platform:</strong> {$this->getPlatform()}<br/>"; |
| 407 |
} |
| 408 |
|
| 409 |
/** |
| 410 |
* Protected routine to calculate and determine what the browser is in use (including platform) |
| 411 |
*/ |
| 412 |
protected function determine() { |
| 413 |
$this->checkPlatform(); |
| 414 |
$this->checkBrowsers(); |
| 415 |
$this->checkForAol(); |
| 416 |
} |
| 417 |
|
| 418 |
/** |
| 419 |
* Protected routine to determine the browser type |
| 420 |
* |
| 421 |
* @return boolean True if the browser was detected otherwise false |
| 422 |
*/ |
| 423 |
protected function checkBrowsers() { |
| 424 |
return ( |
| 425 |
// well-known, well-used |
| 426 |
// Special Notes: |
| 427 |
// (1) Opera must be checked before FireFox due to the odd |
| 428 |
// user agents used in some older versions of Opera |
| 429 |
// (2) WebTV is strapped onto Internet Explorer so we must |
| 430 |
// check for WebTV before IE |
| 431 |
// (3) (deprecated) Galeon is based on Firefox and needs to be |
| 432 |
// tested before Firefox is tested |
| 433 |
// (4) OmniWeb is based on Safari so OmniWeb check must occur |
| 434 |
// before Safari |
| 435 |
// (5) Netscape 9+ is based on Firefox so Netscape checks |
| 436 |
// before FireFox are necessary |
| 437 |
// (6) Vivaldi is UA contains both Firefox and Chrome so Vivaldi checks |
| 438 |
// before Firefox and Chrome |
| 439 |
$this->checkBrowserWebTv() || |
| 440 |
$this->checkBrowserBrave() || |
| 441 |
$this->checkBrowserUCBrowser() || |
| 442 |
$this->checkBrowserEdge() || |
| 443 |
$this->checkBrowserInternetExplorer() || |
| 444 |
$this->checkBrowserOpera() || |
| 445 |
$this->checkBrowserGaleon() || |
| 446 |
$this->checkBrowserNetscapeNavigator9Plus() || |
| 447 |
$this->checkBrowserVivaldi() || |
| 448 |
$this->checkBrowserYandex() || |
| 449 |
$this->checkBrowserPalemoon() || |
| 450 |
$this->checkBrowserFirefox() || |
| 451 |
$this->checkBrowserChrome() || |
| 452 |
$this->checkBrowserOmniWeb() || |
| 453 |
|
| 454 |
// common mobile |
| 455 |
$this->checkBrowserAndroid() || |
| 456 |
$this->checkBrowseriPad() || |
| 457 |
$this->checkBrowseriPod() || |
| 458 |
$this->checkBrowseriPhone() || |
| 459 |
$this->checkBrowserBlackBerry() || |
| 460 |
$this->checkBrowserNokia() || |
| 461 |
|
| 462 |
// common bots |
| 463 |
$this->checkBrowserGoogleBot() || |
| 464 |
$this->checkBrowserMSNBot() || |
| 465 |
$this->checkBrowserBingBot() || |
| 466 |
$this->checkBrowserSlurp() || |
| 467 |
|
| 468 |
// Yandex bots |
| 469 |
$this->checkBrowserYandexBot() || |
| 470 |
$this->checkBrowserYandexImageResizerBot() || |
| 471 |
$this->checkBrowserYandexBlogsBot() || |
| 472 |
$this->checkBrowserYandexCatalogBot() || |
| 473 |
$this->checkBrowserYandexDirectBot() || |
| 474 |
$this->checkBrowserYandexFaviconsBot() || |
| 475 |
$this->checkBrowserYandexImagesBot() || |
| 476 |
$this->checkBrowserYandexMediaBot() || |
| 477 |
$this->checkBrowserYandexMetrikaBot() || |
| 478 |
$this->checkBrowserYandexNewsBot() || |
| 479 |
$this->checkBrowserYandexVideoBot() || |
| 480 |
$this->checkBrowserYandexWebmasterBot() || |
| 481 |
|
| 482 |
// check for facebook external hit when loading URL |
| 483 |
$this->checkFacebookExternalHit() || |
| 484 |
|
| 485 |
// WebKit base check (post mobile and others) |
| 486 |
$this->checkBrowserSamsung() || |
| 487 |
$this->checkBrowserSilk() || |
| 488 |
$this->checkBrowserSafari() || |
| 489 |
|
| 490 |
// everyone else |
| 491 |
$this->checkBrowserNetPositive() || |
| 492 |
$this->checkBrowserFirebird() || |
| 493 |
$this->checkBrowserKonqueror() || |
| 494 |
$this->checkBrowserIcab() || |
| 495 |
$this->checkBrowserPhoenix() || |
| 496 |
$this->checkBrowserAmaya() || |
| 497 |
$this->checkBrowserLynx() || |
| 498 |
$this->checkBrowserShiretoko() || |
| 499 |
$this->checkBrowserIceCat() || |
| 500 |
$this->checkBrowserIceweasel() || |
| 501 |
$this->checkBrowserW3CValidator() || |
| 502 |
$this->checkBrowserCurl() || |
| 503 |
$this->checkBrowserWget() || |
| 504 |
$this->checkBrowserPlayStation() || |
| 505 |
$this->checkBrowserIframely() || |
| 506 |
$this->checkBrowserCocoa() || |
| 507 |
$this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */ ); |
| 508 |
} |
| 509 |
|
| 510 |
/** |
| 511 |
* Determine if the user is using a BlackBerry (last updated 1.7) |
| 512 |
* |
| 513 |
* @return boolean True if the browser is the BlackBerry browser otherwise false |
| 514 |
*/ |
| 515 |
protected function checkBrowserBlackBerry() { |
| 516 |
if ( stripos( $this->_agent, 'blackberry' ) !== false ) { |
| 517 |
$aresult = explode( '/', stristr( $this->_agent, 'BlackBerry' ) ); |
| 518 |
if ( isset( $aresult[1] ) ) { |
| 519 |
$aversion = explode( ' ', $aresult[1] ); |
| 520 |
$this->setVersion( $aversion[0] ); |
| 521 |
$this->_browser_name = self::BROWSER_BLACKBERRY; |
| 522 |
$this->setMobile( true ); |
| 523 |
return true; |
| 524 |
} |
| 525 |
} |
| 526 |
return false; |
| 527 |
} |
| 528 |
|
| 529 |
/** |
| 530 |
* Determine if the user is using an AOL User Agent (last updated 1.7) |
| 531 |
* |
| 532 |
* @return boolean True if the browser is from AOL otherwise false |
| 533 |
*/ |
| 534 |
protected function checkForAol() { |
| 535 |
$this->setAol( false ); |
| 536 |
$this->setAolVersion( self::VERSION_UNKNOWN ); |
| 537 |
|
| 538 |
if ( stripos( $this->_agent, 'aol' ) !== false ) { |
| 539 |
$aversion = explode( ' ', stristr( $this->_agent, 'AOL' ) ); |
| 540 |
if ( isset( $aversion[1] ) ) { |
| 541 |
$this->setAol( true ); |
| 542 |
$this->setAolVersion( preg_replace( '/[^0-9\.a-z]/i', '', $aversion[1] ) ); |
| 543 |
return true; |
| 544 |
} |
| 545 |
} |
| 546 |
return false; |
| 547 |
} |
| 548 |
|
| 549 |
/** |
| 550 |
* Determine if the browser is the GoogleBot or not (last updated 1.7) |
| 551 |
* |
| 552 |
* @return boolean True if the browser is the GoogletBot otherwise false |
| 553 |
*/ |
| 554 |
protected function checkBrowserGoogleBot() { |
| 555 |
if ( stripos( $this->_agent, 'googlebot' ) !== false ) { |
| 556 |
$aresult = explode( '/', stristr( $this->_agent, 'googlebot' ) ); |
| 557 |
if ( isset( $aresult[1] ) ) { |
| 558 |
$aversion = explode( ' ', $aresult[1] ); |
| 559 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 560 |
$this->_browser_name = self::BROWSER_GOOGLEBOT; |
| 561 |
$this->setRobot( true ); |
| 562 |
return true; |
| 563 |
} |
| 564 |
} |
| 565 |
return false; |
| 566 |
} |
| 567 |
|
| 568 |
/** |
| 569 |
* Determine if the browser is the YandexBot or not |
| 570 |
* |
| 571 |
* @return boolean True if the browser is the YandexBot otherwise false |
| 572 |
*/ |
| 573 |
protected function checkBrowserYandexBot() { |
| 574 |
if ( stripos( $this->_agent, 'YandexBot' ) !== false ) { |
| 575 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexBot' ) ); |
| 576 |
if ( isset( $aresult[1] ) ) { |
| 577 |
$aversion = explode( ' ', $aresult[1] ); |
| 578 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 579 |
$this->_browser_name = self::BROWSER_YANDEXBOT; |
| 580 |
$this->setRobot( true ); |
| 581 |
return true; |
| 582 |
} |
| 583 |
} |
| 584 |
return false; |
| 585 |
} |
| 586 |
|
| 587 |
/** |
| 588 |
* Determine if the browser is the YandexImageResizer or not |
| 589 |
* |
| 590 |
* @return boolean True if the browser is the YandexImageResizer otherwise false |
| 591 |
*/ |
| 592 |
protected function checkBrowserYandexImageResizerBot() { |
| 593 |
if ( stripos( $this->_agent, 'YandexImageResizer' ) !== false ) { |
| 594 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexImageResizer' ) ); |
| 595 |
if ( isset( $aresult[1] ) ) { |
| 596 |
$aversion = explode( ' ', $aresult[1] ); |
| 597 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 598 |
$this->_browser_name = self::BROWSER_YANDEXIMAGERESIZER_BOT; |
| 599 |
$this->setRobot( true ); |
| 600 |
return true; |
| 601 |
} |
| 602 |
} |
| 603 |
return false; |
| 604 |
} |
| 605 |
|
| 606 |
/** |
| 607 |
* Determine if the browser is the YandexCatalog or not |
| 608 |
* |
| 609 |
* @return boolean True if the browser is the YandexCatalog otherwise false |
| 610 |
*/ |
| 611 |
protected function checkBrowserYandexCatalogBot() { |
| 612 |
if ( stripos( $this->_agent, 'YandexCatalog' ) !== false ) { |
| 613 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexCatalog' ) ); |
| 614 |
if ( isset( $aresult[1] ) ) { |
| 615 |
$aversion = explode( ' ', $aresult[1] ); |
| 616 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 617 |
$this->_browser_name = self::BROWSER_YANDEXCATALOG_BOT; |
| 618 |
$this->setRobot( true ); |
| 619 |
return true; |
| 620 |
} |
| 621 |
} |
| 622 |
return false; |
| 623 |
} |
| 624 |
|
| 625 |
/** |
| 626 |
* Determine if the browser is the YandexNews or not |
| 627 |
* |
| 628 |
* @return boolean True if the browser is the YandexNews otherwise false |
| 629 |
*/ |
| 630 |
protected function checkBrowserYandexNewsBot() { |
| 631 |
if ( stripos( $this->_agent, 'YandexNews' ) !== false ) { |
| 632 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexNews' ) ); |
| 633 |
if ( isset( $aresult[1] ) ) { |
| 634 |
$aversion = explode( ' ', $aresult[1] ); |
| 635 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 636 |
$this->_browser_name = self::BROWSER_YANDEXNEWS_BOT; |
| 637 |
$this->setRobot( true ); |
| 638 |
return true; |
| 639 |
} |
| 640 |
} |
| 641 |
return false; |
| 642 |
} |
| 643 |
|
| 644 |
/** |
| 645 |
* Determine if the browser is the YandexMetrika or not |
| 646 |
* |
| 647 |
* @return boolean True if the browser is the YandexMetrika otherwise false |
| 648 |
*/ |
| 649 |
protected function checkBrowserYandexMetrikaBot() { |
| 650 |
if ( stripos( $this->_agent, 'YandexMetrika' ) !== false ) { |
| 651 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexMetrika' ) ); |
| 652 |
if ( isset( $aresult[1] ) ) { |
| 653 |
$aversion = explode( ' ', $aresult[1] ); |
| 654 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 655 |
$this->_browser_name = self::BROWSER_YANDEXMETRIKA_BOT; |
| 656 |
$this->setRobot( true ); |
| 657 |
return true; |
| 658 |
} |
| 659 |
} |
| 660 |
return false; |
| 661 |
} |
| 662 |
|
| 663 |
/** |
| 664 |
* Determine if the browser is the YandexDirect or not |
| 665 |
* |
| 666 |
* @return boolean True if the browser is the YandexDirect otherwise false |
| 667 |
*/ |
| 668 |
protected function checkBrowserYandexDirectBot() { |
| 669 |
if ( stripos( $this->_agent, 'YandexDirect' ) !== false ) { |
| 670 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexDirect' ) ); |
| 671 |
if ( isset( $aresult[1] ) ) { |
| 672 |
$aversion = explode( ' ', $aresult[1] ); |
| 673 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 674 |
$this->_browser_name = self::BROWSER_YANDEXDIRECT_BOT; |
| 675 |
$this->setRobot( true ); |
| 676 |
return true; |
| 677 |
} |
| 678 |
} |
| 679 |
return false; |
| 680 |
} |
| 681 |
|
| 682 |
/** |
| 683 |
* Determine if the browser is the YandexWebmaster or not |
| 684 |
* |
| 685 |
* @return boolean True if the browser is the YandexWebmaster otherwise false |
| 686 |
*/ |
| 687 |
protected function checkBrowserYandexWebmasterBot() { |
| 688 |
if ( stripos( $this->_agent, 'YandexWebmaster' ) !== false ) { |
| 689 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexWebmaster' ) ); |
| 690 |
if ( isset( $aresult[1] ) ) { |
| 691 |
$aversion = explode( ' ', $aresult[1] ); |
| 692 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 693 |
$this->_browser_name = self::BROWSER_YANDEXWEBMASTER_BOT; |
| 694 |
$this->setRobot( true ); |
| 695 |
return true; |
| 696 |
} |
| 697 |
} |
| 698 |
return false; |
| 699 |
} |
| 700 |
|
| 701 |
/** |
| 702 |
* Determine if the browser is the YandexFavicons or not |
| 703 |
* |
| 704 |
* @return boolean True if the browser is the YandexFavicons otherwise false |
| 705 |
*/ |
| 706 |
protected function checkBrowserYandexFaviconsBot() { |
| 707 |
if ( stripos( $this->_agent, 'YandexFavicons' ) !== false ) { |
| 708 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexFavicons' ) ); |
| 709 |
if ( isset( $aresult[1] ) ) { |
| 710 |
$aversion = explode( ' ', $aresult[1] ); |
| 711 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 712 |
$this->_browser_name = self::BROWSER_YANDEXFAVICONS_BOT; |
| 713 |
$this->setRobot( true ); |
| 714 |
return true; |
| 715 |
} |
| 716 |
} |
| 717 |
return false; |
| 718 |
} |
| 719 |
|
| 720 |
/** |
| 721 |
* Determine if the browser is the YandexBlogs or not |
| 722 |
* |
| 723 |
* @return boolean True if the browser is the YandexBlogs otherwise false |
| 724 |
*/ |
| 725 |
protected function checkBrowserYandexBlogsBot() { |
| 726 |
if ( stripos( $this->_agent, 'YandexBlogs' ) !== false ) { |
| 727 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexBlogs' ) ); |
| 728 |
if ( isset( $aresult[1] ) ) { |
| 729 |
$aversion = explode( ' ', $aresult[1] ); |
| 730 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 731 |
$this->_browser_name = self::BROWSER_YANDEXBLOGS_BOT; |
| 732 |
$this->setRobot( true ); |
| 733 |
return true; |
| 734 |
} |
| 735 |
} |
| 736 |
return false; |
| 737 |
} |
| 738 |
|
| 739 |
/** |
| 740 |
* Determine if the browser is the YandexMedia or not |
| 741 |
* |
| 742 |
* @return boolean True if the browser is the YandexMedia otherwise false |
| 743 |
*/ |
| 744 |
protected function checkBrowserYandexMediaBot() { |
| 745 |
if ( stripos( $this->_agent, 'YandexMedia' ) !== false ) { |
| 746 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexMedia' ) ); |
| 747 |
if ( isset( $aresult[1] ) ) { |
| 748 |
$aversion = explode( ' ', $aresult[1] ); |
| 749 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 750 |
$this->_browser_name = self::BROWSER_YANDEXMEDIA_BOT; |
| 751 |
$this->setRobot( true ); |
| 752 |
return true; |
| 753 |
} |
| 754 |
} |
| 755 |
return false; |
| 756 |
} |
| 757 |
|
| 758 |
/** |
| 759 |
* Determine if the browser is the YandexVideo or not |
| 760 |
* |
| 761 |
* @return boolean True if the browser is the YandexVideo otherwise false |
| 762 |
*/ |
| 763 |
protected function checkBrowserYandexVideoBot() { |
| 764 |
if ( stripos( $this->_agent, 'YandexVideo' ) !== false ) { |
| 765 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexVideo' ) ); |
| 766 |
if ( isset( $aresult[1] ) ) { |
| 767 |
$aversion = explode( ' ', $aresult[1] ); |
| 768 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 769 |
$this->_browser_name = self::BROWSER_YANDEXVIDEO_BOT; |
| 770 |
$this->setRobot( true ); |
| 771 |
return true; |
| 772 |
} |
| 773 |
} |
| 774 |
return false; |
| 775 |
} |
| 776 |
|
| 777 |
/** |
| 778 |
* Determine if the browser is the YandexImages or not |
| 779 |
* |
| 780 |
* @return boolean True if the browser is the YandexImages otherwise false |
| 781 |
*/ |
| 782 |
protected function checkBrowserYandexImagesBot() { |
| 783 |
if ( stripos( $this->_agent, 'YandexImages' ) !== false ) { |
| 784 |
$aresult = explode( '/', stristr( $this->_agent, 'YandexImages' ) ); |
| 785 |
if ( isset( $aresult[1] ) ) { |
| 786 |
$aversion = explode( ' ', $aresult[1] ); |
| 787 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 788 |
$this->_browser_name = self::BROWSER_YANDEXIMAGES_BOT; |
| 789 |
$this->setRobot( true ); |
| 790 |
return true; |
| 791 |
} |
| 792 |
} |
| 793 |
return false; |
| 794 |
} |
| 795 |
|
| 796 |
/** |
| 797 |
* Determine if the browser is the MSNBot or not (last updated 1.9) |
| 798 |
* |
| 799 |
* @return boolean True if the browser is the MSNBot otherwise false |
| 800 |
*/ |
| 801 |
protected function checkBrowserMSNBot() { |
| 802 |
if ( stripos( $this->_agent, 'msnbot' ) !== false ) { |
| 803 |
$aresult = explode( '/', stristr( $this->_agent, 'msnbot' ) ); |
| 804 |
if ( isset( $aresult[1] ) ) { |
| 805 |
$aversion = explode( ' ', $aresult[1] ); |
| 806 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 807 |
$this->_browser_name = self::BROWSER_MSNBOT; |
| 808 |
$this->setRobot( true ); |
| 809 |
return true; |
| 810 |
} |
| 811 |
} |
| 812 |
return false; |
| 813 |
} |
| 814 |
|
| 815 |
/** |
| 816 |
* Determine if the browser is the BingBot or not (last updated 1.9) |
| 817 |
* |
| 818 |
* @return boolean True if the browser is the BingBot otherwise false |
| 819 |
*/ |
| 820 |
protected function checkBrowserBingBot() { |
| 821 |
if ( stripos( $this->_agent, 'bingbot' ) !== false ) { |
| 822 |
$aresult = explode( '/', stristr( $this->_agent, 'bingbot' ) ); |
| 823 |
if ( isset( $aresult[1] ) ) { |
| 824 |
$aversion = explode( ' ', $aresult[1] ); |
| 825 |
$this->setVersion( str_replace( ';', '', $aversion[0] ) ); |
| 826 |
$this->_browser_name = self::BROWSER_BINGBOT; |
| 827 |
$this->setRobot( true ); |
| 828 |
return true; |
| 829 |
} |
| 830 |
} |
| 831 |
return false; |
| 832 |
} |
| 833 |
|
| 834 |
/** |
| 835 |
* Determine if the browser is the W3C Validator or not (last updated 1.7) |
| 836 |
* |
| 837 |
* @return boolean True if the browser is the W3C Validator otherwise false |
| 838 |
*/ |
| 839 |
protected function checkBrowserW3CValidator() { |
| 840 |
if ( stripos( $this->_agent, 'W3C-checklink' ) !== false ) { |
| 841 |
$aresult = explode( '/', stristr( $this->_agent, 'W3C-checklink' ) ); |
| 842 |
if ( isset( $aresult[1] ) ) { |
| 843 |
$aversion = explode( ' ', $aresult[1] ); |
| 844 |
$this->setVersion( $aversion[0] ); |
| 845 |
$this->_browser_name = self::BROWSER_W3CVALIDATOR; |
| 846 |
return true; |
| 847 |
} |
| 848 |
} elseif ( stripos( $this->_agent, 'W3C_Validator' ) !== false ) { |
| 849 |
// Some of the Validator versions do not delineate w/ a slash - add it back in |
| 850 |
$ua = str_replace( 'W3C_Validator ', 'W3C_Validator/', $this->_agent ); |
| 851 |
$aresult = explode( '/', stristr( $ua, 'W3C_Validator' ) ); |
| 852 |
if ( isset( $aresult[1] ) ) { |
| 853 |
$aversion = explode( ' ', $aresult[1] ); |
| 854 |
$this->setVersion( $aversion[0] ); |
| 855 |
$this->_browser_name = self::BROWSER_W3CVALIDATOR; |
| 856 |
return true; |
| 857 |
} |
| 858 |
} elseif ( stripos( $this->_agent, 'W3C-mobileOK' ) !== false ) { |
| 859 |
$this->_browser_name = self::BROWSER_W3CVALIDATOR; |
| 860 |
$this->setMobile( true ); |
| 861 |
return true; |
| 862 |
} |
| 863 |
return false; |
| 864 |
} |
| 865 |
|
| 866 |
/** |
| 867 |
* Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7) |
| 868 |
* |
| 869 |
* @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false |
| 870 |
*/ |
| 871 |
protected function checkBrowserSlurp() { |
| 872 |
if ( stripos( $this->_agent, 'slurp' ) !== false ) { |
| 873 |
$aresult = explode( '/', stristr( $this->_agent, 'Slurp' ) ); |
| 874 |
if ( isset( $aresult[1] ) ) { |
| 875 |
$aversion = explode( ' ', $aresult[1] ); |
| 876 |
$this->setVersion( $aversion[0] ); |
| 877 |
$this->_browser_name = self::BROWSER_SLURP; |
| 878 |
$this->setRobot( true ); |
| 879 |
$this->setMobile( false ); |
| 880 |
return true; |
| 881 |
} |
| 882 |
} |
| 883 |
return false; |
| 884 |
} |
| 885 |
|
| 886 |
/** |
| 887 |
* Determine if the browser is Brave or not |
| 888 |
* |
| 889 |
* @return boolean True if the browser is Brave otherwise false |
| 890 |
*/ |
| 891 |
protected function checkBrowserBrave() { |
| 892 |
if ( stripos( $this->_agent, 'Brave/' ) !== false ) { |
| 893 |
$aResult = explode( '/', stristr( $this->_agent, 'Brave' ) ); |
| 894 |
if ( isset( $aResult[1] ) ) { |
| 895 |
$aversion = explode( ' ', $aResult[1] ); |
| 896 |
$this->setVersion( $aversion[0] ); |
| 897 |
$this->setBrowser( self::BROWSER_BRAVE ); |
| 898 |
return true; |
| 899 |
} |
| 900 |
} elseif ( stripos( $this->_agent, ' Brave ' ) !== false ) { |
| 901 |
$this->setBrowser( self::BROWSER_BRAVE ); |
| 902 |
// this version of the UA did not ship with a version marker |
| 903 |
// e.g. Mozilla/5.0 (Linux; Android 7.0; SM-G955F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Brave Chrome/68.0.3440.91 Mobile Safari/537.36 |
| 904 |
$this->setVersion( '' ); |
| 905 |
return true; |
| 906 |
} |
| 907 |
return false; |
| 908 |
} |
| 909 |
|
| 910 |
/** |
| 911 |
* Determine if the browser is Edge or not |
| 912 |
* |
| 913 |
* @return boolean True if the browser is Edge otherwise false |
| 914 |
*/ |
| 915 |
protected function checkBrowserEdge() { |
| 916 |
if ( $name = ( stripos( $this->_agent, 'Edge/' ) !== false ? 'Edge' : ( ( stripos( $this->_agent, 'Edg/' ) !== false || stripos( $this->_agent, 'EdgA/' ) !== false ) ? 'Edg' : false ) ) ) { |
| 917 |
$aresult = explode( '/', stristr( $this->_agent, $name ) ); |
| 918 |
if ( isset( $aresult[1] ) ) { |
| 919 |
$aversion = explode( ' ', $aresult[1] ); |
| 920 |
$this->setVersion( $aversion[0] ); |
| 921 |
$this->setBrowser( self::BROWSER_EDGE ); |
| 922 |
if ( stripos( $this->_agent, 'Windows Phone' ) !== false || stripos( $this->_agent, 'Android' ) !== false ) { |
| 923 |
$this->setMobile( true ); |
| 924 |
} |
| 925 |
return true; |
| 926 |
} |
| 927 |
} |
| 928 |
return false; |
| 929 |
} |
| 930 |
|
| 931 |
/** |
| 932 |
* Determine if the browser is Internet Explorer or not (last updated 1.7) |
| 933 |
* |
| 934 |
* @return boolean True if the browser is Internet Explorer otherwise false |
| 935 |
*/ |
| 936 |
protected function checkBrowserInternetExplorer() { |
| 937 |
// Test for IE11 |
| 938 |
if ( stripos( $this->_agent, 'Trident/7.0; rv:11.0' ) !== false ) { |
| 939 |
$this->setBrowser( self::BROWSER_IE ); |
| 940 |
$this->setVersion( '11.0' ); |
| 941 |
return true; |
| 942 |
} // Test for v1 - v1.5 IE |
| 943 |
elseif ( stripos( $this->_agent, 'microsoft internet explorer' ) !== false ) { |
| 944 |
$this->setBrowser( self::BROWSER_IE ); |
| 945 |
$this->setVersion( '1.0' ); |
| 946 |
$aresult = stristr( $this->_agent, '/' ); |
| 947 |
if ( preg_match( '/308|425|426|474|0b1/i', $aresult ) ) { |
| 948 |
$this->setVersion( '1.5' ); |
| 949 |
} |
| 950 |
return true; |
| 951 |
} // Test for versions > 1.5 |
| 952 |
elseif ( stripos( $this->_agent, 'msie' ) !== false && stripos( $this->_agent, 'opera' ) === false ) { |
| 953 |
// See if the browser is the odd MSN Explorer |
| 954 |
if ( stripos( $this->_agent, 'msnb' ) !== false ) { |
| 955 |
$aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'MSN' ) ); |
| 956 |
if ( isset( $aresult[1] ) ) { |
| 957 |
$this->setBrowser( self::BROWSER_MSN ); |
| 958 |
$this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) ); |
| 959 |
return true; |
| 960 |
} |
| 961 |
} |
| 962 |
$aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'msie' ) ); |
| 963 |
if ( isset( $aresult[1] ) ) { |
| 964 |
$this->setBrowser( self::BROWSER_IE ); |
| 965 |
$this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) ); |
| 966 |
if ( stripos( $this->_agent, 'IEMobile' ) !== false ) { |
| 967 |
$this->setBrowser( self::BROWSER_POCKET_IE ); |
| 968 |
$this->setMobile( true ); |
| 969 |
} |
| 970 |
return true; |
| 971 |
} |
| 972 |
} // Test for versions > IE 10 |
| 973 |
elseif ( stripos( $this->_agent, 'trident' ) !== false ) { |
| 974 |
$this->setBrowser( self::BROWSER_IE ); |
| 975 |
$result = explode( 'rv:', $this->_agent ); |
| 976 |
if ( isset( $result[1] ) ) { |
| 977 |
$this->setVersion( preg_replace( '/[^0-9.]+/', '', $result[1] ) ); |
| 978 |
$this->_agent = str_replace( array( 'Mozilla', 'Gecko' ), 'MSIE', $this->_agent ); |
| 979 |
} |
| 980 |
} // Test for Pocket IE |
| 981 |
elseif ( stripos( $this->_agent, 'mspie' ) !== false || stripos( $this->_agent, 'pocket' ) !== false ) { |
| 982 |
$aresult = explode( ' ', stristr( $this->_agent, 'mspie' ) ); |
| 983 |
if ( isset( $aresult[1] ) ) { |
| 984 |
$this->setPlatform( self::PLATFORM_WINDOWS_CE ); |
| 985 |
$this->setBrowser( self::BROWSER_POCKET_IE ); |
| 986 |
$this->setMobile( true ); |
| 987 |
|
| 988 |
if ( stripos( $this->_agent, 'mspie' ) !== false ) { |
| 989 |
$this->setVersion( $aresult[1] ); |
| 990 |
} else { |
| 991 |
$aversion = explode( '/', $this->_agent ); |
| 992 |
if ( isset( $aversion[1] ) ) { |
| 993 |
$this->setVersion( $aversion[1] ); |
| 994 |
} |
| 995 |
} |
| 996 |
return true; |
| 997 |
} |
| 998 |
} |
| 999 |
return false; |
| 1000 |
} |
| 1001 |
|
| 1002 |
/** |
| 1003 |
* Determine if the browser is Opera or not (last updated 1.7) |
| 1004 |
* |
| 1005 |
* @return boolean True if the browser is Opera otherwise false |
| 1006 |
*/ |
| 1007 |
protected function checkBrowserOpera() { |
| 1008 |
if ( stripos( $this->_agent, 'opera mini' ) !== false ) { |
| 1009 |
$resultant = stristr( $this->_agent, 'opera mini' ); |
| 1010 |
if ( preg_match( '/\//', $resultant ) ) { |
| 1011 |
$aresult = explode( '/', $resultant ); |
| 1012 |
if ( isset( $aresult[1] ) ) { |
| 1013 |
$aversion = explode( ' ', $aresult[1] ); |
| 1014 |
$this->setVersion( $aversion[0] ); |
| 1015 |
} |
| 1016 |
} else { |
| 1017 |
$aversion = explode( ' ', stristr( $resultant, 'opera mini' ) ); |
| 1018 |
if ( isset( $aversion[1] ) ) { |
| 1019 |
$this->setVersion( $aversion[1] ); |
| 1020 |
} |
| 1021 |
} |
| 1022 |
$this->_browser_name = self::BROWSER_OPERA_MINI; |
| 1023 |
$this->setMobile( true ); |
| 1024 |
return true; |
| 1025 |
} elseif ( stripos( $this->_agent, 'opera' ) !== false ) { |
| 1026 |
$resultant = stristr( $this->_agent, 'opera' ); |
| 1027 |
if ( preg_match( '/Version\/(1*.*)$/', $resultant, $matches ) ) { |
| 1028 |
$this->setVersion( $matches[1] ); |
| 1029 |
} elseif ( preg_match( '/\//', $resultant ) ) { |
| 1030 |
$aresult = explode( '/', str_replace( '(', ' ', $resultant ) ); |
| 1031 |
if ( isset( $aresult[1] ) ) { |
| 1032 |
$aversion = explode( ' ', $aresult[1] ); |
| 1033 |
$this->setVersion( $aversion[0] ); |
| 1034 |
} |
| 1035 |
} else { |
| 1036 |
$aversion = explode( ' ', stristr( $resultant, 'opera' ) ); |
| 1037 |
$this->setVersion( isset( $aversion[1] ) ? $aversion[1] : '' ); |
| 1038 |
} |
| 1039 |
if ( stripos( $this->_agent, 'Opera Mobi' ) !== false ) { |
| 1040 |
$this->setMobile( true ); |
| 1041 |
} |
| 1042 |
$this->_browser_name = self::BROWSER_OPERA; |
| 1043 |
return true; |
| 1044 |
} elseif ( stripos( $this->_agent, 'OPR' ) !== false ) { |
| 1045 |
$resultant = stristr( $this->_agent, 'OPR' ); |
| 1046 |
if ( preg_match( '/\//', $resultant ) ) { |
| 1047 |
$aresult = explode( '/', str_replace( '(', ' ', $resultant ) ); |
| 1048 |
if ( isset( $aresult[1] ) ) { |
| 1049 |
$aversion = explode( ' ', $aresult[1] ); |
| 1050 |
$this->setVersion( $aversion[0] ); |
| 1051 |
} |
| 1052 |
} |
| 1053 |
if ( stripos( $this->_agent, 'Mobile' ) !== false ) { |
| 1054 |
$this->setMobile( true ); |
| 1055 |
} |
| 1056 |
$this->_browser_name = self::BROWSER_OPERA; |
| 1057 |
return true; |
| 1058 |
} |
| 1059 |
return false; |
| 1060 |
} |
| 1061 |
|
| 1062 |
/** |
| 1063 |
* Determine if the browser is Chrome or not (last updated 1.7) |
| 1064 |
* |
| 1065 |
* @return boolean True if the browser is Chrome otherwise false |
| 1066 |
*/ |
| 1067 |
protected function checkBrowserChrome() { |
| 1068 |
if ( stripos( $this->_agent, 'Chrome' ) !== false ) { |
| 1069 |
$aresult = preg_split( '/[\/;]+/', stristr( $this->_agent, 'Chrome' ) ); |
| 1070 |
if ( isset( $aresult[1] ) ) { |
| 1071 |
$aversion = explode( ' ', $aresult[1] ); |
| 1072 |
$this->setVersion( $aversion[0] ); |
| 1073 |
$this->setBrowser( self::BROWSER_CHROME ); |
| 1074 |
// Chrome on Android |
| 1075 |
if ( stripos( $this->_agent, 'Android' ) !== false ) { |
| 1076 |
if ( stripos( $this->_agent, 'Mobile' ) !== false ) { |
| 1077 |
$this->setMobile( true ); |
| 1078 |
} else { |
| 1079 |
$this->setTablet( true ); |
| 1080 |
} |
| 1081 |
} |
| 1082 |
return true; |
| 1083 |
} |
| 1084 |
} |
| 1085 |
return false; |
| 1086 |
} |
| 1087 |
|
| 1088 |
|
| 1089 |
/** |
| 1090 |
* Determine if the browser is WebTv or not (last updated 1.7) |
| 1091 |
* |
| 1092 |
* @return boolean True if the browser is WebTv otherwise false |
| 1093 |
*/ |
| 1094 |
protected function checkBrowserWebTv() { |
| 1095 |
if ( stripos( $this->_agent, 'webtv' ) !== false ) { |
| 1096 |
$aresult = explode( '/', stristr( $this->_agent, 'webtv' ) ); |
| 1097 |
if ( isset( $aresult[1] ) ) { |
| 1098 |
$aversion = explode( ' ', $aresult[1] ); |
| 1099 |
$this->setVersion( $aversion[0] ); |
| 1100 |
$this->setBrowser( self::BROWSER_WEBTV ); |
| 1101 |
return true; |
| 1102 |
} |
| 1103 |
} |
| 1104 |
return false; |
| 1105 |
} |
| 1106 |
|
| 1107 |
/** |
| 1108 |
* Determine if the browser is NetPositive or not (last updated 1.7) |
| 1109 |
* |
| 1110 |
* @return boolean True if the browser is NetPositive otherwise false |
| 1111 |
*/ |
| 1112 |
protected function checkBrowserNetPositive() { |
| 1113 |
if ( stripos( $this->_agent, 'NetPositive' ) !== false ) { |
| 1114 |
$aresult = explode( '/', stristr( $this->_agent, 'NetPositive' ) ); |
| 1115 |
if ( isset( $aresult[1] ) ) { |
| 1116 |
$aversion = explode( ' ', $aresult[1] ); |
| 1117 |
$this->setVersion( str_replace( array( '(', ')', ';' ), '', $aversion[0] ) ); |
| 1118 |
$this->setBrowser( self::BROWSER_NETPOSITIVE ); |
| 1119 |
return true; |
| 1120 |
} |
| 1121 |
} |
| 1122 |
return false; |
| 1123 |
} |
| 1124 |
|
| 1125 |
/** |
| 1126 |
* Determine if the browser is Galeon or not (last updated 1.7) |
| 1127 |
* |
| 1128 |
* @return boolean True if the browser is Galeon otherwise false |
| 1129 |
*/ |
| 1130 |
protected function checkBrowserGaleon() { |
| 1131 |
if ( stripos( $this->_agent, 'galeon' ) !== false ) { |
| 1132 |
$aresult = explode( ' ', stristr( $this->_agent, 'galeon' ) ); |
| 1133 |
$aversion = explode( '/', $aresult[0] ); |
| 1134 |
if ( isset( $aversion[1] ) ) { |
| 1135 |
$this->setVersion( $aversion[1] ); |
| 1136 |
$this->setBrowser( self::BROWSER_GALEON ); |
| 1137 |
return true; |
| 1138 |
} |
| 1139 |
} |
| 1140 |
return false; |
| 1141 |
} |
| 1142 |
|
| 1143 |
/** |
| 1144 |
* Determine if the browser is Konqueror or not (last updated 1.7) |
| 1145 |
* |
| 1146 |
* @return boolean True if the browser is Konqueror otherwise false |
| 1147 |
*/ |
| 1148 |
protected function checkBrowserKonqueror() { |
| 1149 |
if ( stripos( $this->_agent, 'Konqueror' ) !== false ) { |
| 1150 |
$aresult = explode( ' ', stristr( $this->_agent, 'Konqueror' ) ); |
| 1151 |
$aversion = explode( '/', $aresult[0] ); |
| 1152 |
if ( isset( $aversion[1] ) ) { |
| 1153 |
$this->setVersion( $aversion[1] ); |
| 1154 |
$this->setBrowser( self::BROWSER_KONQUEROR ); |
| 1155 |
return true; |
| 1156 |
} |
| 1157 |
} |
| 1158 |
return false; |
| 1159 |
} |
| 1160 |
|
| 1161 |
/** |
| 1162 |
* Determine if the browser is iCab or not (last updated 1.7) |
| 1163 |
* |
| 1164 |
* @return boolean True if the browser is iCab otherwise false |
| 1165 |
*/ |
| 1166 |
protected function checkBrowserIcab() { |
| 1167 |
if ( stripos( $this->_agent, 'icab' ) !== false ) { |
| 1168 |
$aversion = explode( ' ', stristr( str_replace( '/', ' ', $this->_agent ), 'icab' ) ); |
| 1169 |
if ( isset( $aversion[1] ) ) { |
| 1170 |
$this->setVersion( $aversion[1] ); |
| 1171 |
$this->setBrowser( self::BROWSER_ICAB ); |
| 1172 |
return true; |
| 1173 |
} |
| 1174 |
} |
| 1175 |
return false; |
| 1176 |
} |
| 1177 |
|
| 1178 |
/** |
| 1179 |
* Determine if the browser is OmniWeb or not (last updated 1.7) |
| 1180 |
* |
| 1181 |
* @return boolean True if the browser is OmniWeb otherwise false |
| 1182 |
*/ |
| 1183 |
protected function checkBrowserOmniWeb() { |
| 1184 |
if ( stripos( $this->_agent, 'omniweb' ) !== false ) { |
| 1185 |
$aresult = explode( '/', stristr( $this->_agent, 'omniweb' ) ); |
| 1186 |
$aversion = explode( ' ', isset( $aresult[1] ) ? $aresult[1] : '' ); |
| 1187 |
$this->setVersion( $aversion[0] ); |
| 1188 |
$this->setBrowser( self::BROWSER_OMNIWEB ); |
| 1189 |
return true; |
| 1190 |
} |
| 1191 |
return false; |
| 1192 |
} |
| 1193 |
|
| 1194 |
/** |
| 1195 |
* Determine if the browser is Phoenix or not (last updated 1.7) |
| 1196 |
* |
| 1197 |
* @return boolean True if the browser is Phoenix otherwise false |
| 1198 |
*/ |
| 1199 |
protected function checkBrowserPhoenix() { |
| 1200 |
if ( stripos( $this->_agent, 'Phoenix' ) !== false ) { |
| 1201 |
$aversion = explode( '/', stristr( $this->_agent, 'Phoenix' ) ); |
| 1202 |
if ( isset( $aversion[1] ) ) { |
| 1203 |
$this->setVersion( $aversion[1] ); |
| 1204 |
$this->setBrowser( self::BROWSER_PHOENIX ); |
| 1205 |
return true; |
| 1206 |
} |
| 1207 |
} |
| 1208 |
return false; |
| 1209 |
} |
| 1210 |
|
| 1211 |
/** |
| 1212 |
* Determine if the browser is Firebird or not (last updated 1.7) |
| 1213 |
* |
| 1214 |
* @return boolean True if the browser is Firebird otherwise false |
| 1215 |
*/ |
| 1216 |
protected function checkBrowserFirebird() { |
| 1217 |
if ( stripos( $this->_agent, 'Firebird' ) !== false ) { |
| 1218 |
$aversion = explode( '/', stristr( $this->_agent, 'Firebird' ) ); |
| 1219 |
if ( isset( $aversion[1] ) ) { |
| 1220 |
$this->setVersion( $aversion[1] ); |
| 1221 |
$this->setBrowser( self::BROWSER_FIREBIRD ); |
| 1222 |
return true; |
| 1223 |
} |
| 1224 |
} |
| 1225 |
return false; |
| 1226 |
} |
| 1227 |
|
| 1228 |
/** |
| 1229 |
* Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) |
| 1230 |
* NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008) |
| 1231 |
* |
| 1232 |
* @return boolean True if the browser is Netscape Navigator 9+ otherwise false |
| 1233 |
*/ |
| 1234 |
protected function checkBrowserNetscapeNavigator9Plus() { |
| 1235 |
if ( stripos( $this->_agent, 'Firefox' ) !== false && preg_match( '/Navigator\/([^ ]*)/i', $this->_agent, $matches ) ) { |
| 1236 |
$this->setVersion( $matches[1] ); |
| 1237 |
$this->setBrowser( self::BROWSER_NETSCAPE_NAVIGATOR ); |
| 1238 |
return true; |
| 1239 |
} elseif ( stripos( $this->_agent, 'Firefox' ) === false && preg_match( '/Netscape6?\/([^ ]*)/i', $this->_agent, $matches ) ) { |
| 1240 |
$this->setVersion( $matches[1] ); |
| 1241 |
$this->setBrowser( self::BROWSER_NETSCAPE_NAVIGATOR ); |
| 1242 |
return true; |
| 1243 |
} |
| 1244 |
return false; |
| 1245 |
} |
| 1246 |
|
| 1247 |
/** |
| 1248 |
* Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7) |
| 1249 |
* |
| 1250 |
* @return boolean True if the browser is Shiretoko otherwise false |
| 1251 |
*/ |
| 1252 |
protected function checkBrowserShiretoko() { |
| 1253 |
if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/Shiretoko\/([^ ]*)/i', $this->_agent, $matches ) ) { |
| 1254 |
$this->setVersion( $matches[1] ); |
| 1255 |
$this->setBrowser( self::BROWSER_SHIRETOKO ); |
| 1256 |
return true; |
| 1257 |
} |
| 1258 |
return false; |
| 1259 |
} |
| 1260 |
|
| 1261 |
/** |
| 1262 |
* Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7) |
| 1263 |
* |
| 1264 |
* @return boolean True if the browser is Ice Cat otherwise false |
| 1265 |
*/ |
| 1266 |
protected function checkBrowserIceCat() { |
| 1267 |
if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/IceCat\/([^ ]*)/i', $this->_agent, $matches ) ) { |
| 1268 |
$this->setVersion( $matches[1] ); |
| 1269 |
$this->setBrowser( self::BROWSER_ICECAT ); |
| 1270 |
return true; |
| 1271 |
} |
| 1272 |
return false; |
| 1273 |
} |
| 1274 |
|
| 1275 |
/** |
| 1276 |
* Determine if the browser is Nokia or not (last updated 1.7) |
| 1277 |
* |
| 1278 |
* @return boolean True if the browser is Nokia otherwise false |
| 1279 |
*/ |
| 1280 |
protected function checkBrowserNokia() { |
| 1281 |
if ( preg_match( '/Nokia([^\/]+)\/([^ SP]+)/i', $this->_agent, $matches ) ) { |
| 1282 |
$this->setVersion( $matches[2] ); |
| 1283 |
if ( stripos( $this->_agent, 'Series60' ) !== false || strpos( $this->_agent, 'S60' ) !== false ) { |
| 1284 |
$this->setBrowser( self::BROWSER_NOKIA_S60 ); |
| 1285 |
} else { |
| 1286 |
$this->setBrowser( self::BROWSER_NOKIA ); |
| 1287 |
} |
| 1288 |
$this->setMobile( true ); |
| 1289 |
return true; |
| 1290 |
} |
| 1291 |
return false; |
| 1292 |
} |
| 1293 |
|
| 1294 |
/** |
| 1295 |
* Determine if the browser is Palemoon or not |
| 1296 |
* |
| 1297 |
* @return boolean True if the browser is Palemoon otherwise false |
| 1298 |
*/ |
| 1299 |
protected function checkBrowserPalemoon() { |
| 1300 |
if ( stripos( $this->_agent, 'safari' ) === false ) { |
| 1301 |
if ( preg_match( '/Palemoon[\/ \(]([^ ;\)]+)/i', $this->_agent, $matches ) ) { |
| 1302 |
$this->setVersion( $matches[1] ); |
| 1303 |
$this->setBrowser( self::BROWSER_PALEMOON ); |
| 1304 |
return true; |
| 1305 |
} elseif ( preg_match( '/Palemoon([0-9a-zA-Z\.]+)/i', $this->_agent, $matches ) ) { |
| 1306 |
$this->setVersion( $matches[1] ); |
| 1307 |
$this->setBrowser( self::BROWSER_PALEMOON ); |
| 1308 |
return true; |
| 1309 |
} elseif ( preg_match( '/Palemoon/i', $this->_agent, $matches ) ) { |
| 1310 |
$this->setVersion( '' ); |
| 1311 |
$this->setBrowser( self::BROWSER_PALEMOON ); |
| 1312 |
return true; |
| 1313 |
} |
| 1314 |
} |
| 1315 |
return false; |
| 1316 |
} |
| 1317 |
|
| 1318 |
/** |
| 1319 |
* Determine if the browser is UCBrowser or not |
| 1320 |
* |
| 1321 |
* @return boolean True if the browser is UCBrowser otherwise false |
| 1322 |
*/ |
| 1323 |
protected function checkBrowserUCBrowser() { |
| 1324 |
if ( preg_match( '/UC ?Browser\/?([\d\.]+)/', $this->_agent, $matches ) ) { |
| 1325 |
if ( isset( $matches[1] ) ) { |
| 1326 |
$this->setVersion( $matches[1] ); |
| 1327 |
} |
| 1328 |
if ( stripos( $this->_agent, 'Mobile' ) !== false ) { |
| 1329 |
$this->setMobile( true ); |
| 1330 |
} else { |
| 1331 |
$this->setTablet( true ); |
| 1332 |
} |
| 1333 |
$this->setBrowser( self::BROWSER_UCBROWSER ); |
| 1334 |
return true; |
| 1335 |
} |
| 1336 |
return false; |
| 1337 |
} |
| 1338 |
|
| 1339 |
/** |
| 1340 |
* Determine if the browser is Firefox or not |
| 1341 |
* |
| 1342 |
* @return boolean True if the browser is Firefox otherwise false |
| 1343 |
*/ |
| 1344 |
protected function checkBrowserFirefox() { |
| 1345 |
if ( stripos( $this->_agent, 'safari' ) === false ) { |
| 1346 |
if ( preg_match( '/Firefox[\/ \(]([^ ;\)]+)/i', $this->_agent, $matches ) ) { |
| 1347 |
$this->setVersion( $matches[1] ); |
| 1348 |
$this->setBrowser( self::BROWSER_FIREFOX ); |
| 1349 |
// Firefox on Android |
| 1350 |
if ( stripos( $this->_agent, 'Android' ) !== false || stripos( $this->_agent, 'iPhone' ) !== false ) { |
| 1351 |
if ( stripos( $this->_agent, 'Mobile' ) !== false || stripos( $this->_agent, 'Tablet' ) !== false ) { |
| 1352 |
$this->setMobile( true ); |
| 1353 |
} else { |
| 1354 |
$this->setTablet( true ); |
| 1355 |
} |
| 1356 |
} |
| 1357 |
return true; |
| 1358 |
} elseif ( preg_match( '/Firefox([0-9a-zA-Z\.]+)/i', $this->_agent, $matches ) ) { |
| 1359 |
$this->setVersion( $matches[1] ); |
| 1360 |
$this->setBrowser( self::BROWSER_FIREFOX ); |
| 1361 |
return true; |
| 1362 |
} elseif ( preg_match( '/Firefox$/i', $this->_agent, $matches ) ) { |
| 1363 |
$this->setVersion( '' ); |
| 1364 |
$this->setBrowser( self::BROWSER_FIREFOX ); |
| 1365 |
return true; |
| 1366 |
} |
| 1367 |
} elseif ( preg_match( '/FxiOS[\/ \(]([^ ;\)]+)/i', $this->_agent, $matches ) ) { |
| 1368 |
$this->setVersion( $matches[1] ); |
| 1369 |
$this->setBrowser( self::BROWSER_FIREFOX ); |
| 1370 |
// Firefox on Android |
| 1371 |
if ( stripos( $this->_agent, 'Android' ) !== false || stripos( $this->_agent, 'iPhone' ) !== false ) { |
| 1372 |
if ( stripos( $this->_agent, 'Mobile' ) !== false || stripos( $this->_agent, 'Tablet' ) !== false ) { |
| 1373 |
$this->setMobile( true ); |
| 1374 |
} else { |
| 1375 |
$this->setTablet( true ); |
| 1376 |
} |
| 1377 |
} |
| 1378 |
return true; |
| 1379 |
} |
| 1380 |
return false; |
| 1381 |
} |
| 1382 |
|
| 1383 |
/** |
| 1384 |
* Determine if the browser is Firefox or not (last updated 1.7) |
| 1385 |
* |
| 1386 |
* @return boolean True if the browser is Firefox otherwise false |
| 1387 |
*/ |
| 1388 |
protected function checkBrowserIceweasel() { |
| 1389 |
if ( stripos( $this->_agent, 'Iceweasel' ) !== false ) { |
| 1390 |
$aresult = explode( '/', stristr( $this->_agent, 'Iceweasel' ) ); |
| 1391 |
if ( isset( $aresult[1] ) ) { |
| 1392 |
$aversion = explode( ' ', $aresult[1] ); |
| 1393 |
$this->setVersion( $aversion[0] ); |
| 1394 |
$this->setBrowser( self::BROWSER_ICEWEASEL ); |
| 1395 |
return true; |
| 1396 |
} |
| 1397 |
} |
| 1398 |
return false; |
| 1399 |
} |
| 1400 |
|
| 1401 |
/** |
| 1402 |
* Determine if the browser is Mozilla or not (last updated 1.7) |
| 1403 |
* |
| 1404 |
* @return boolean True if the browser is Mozilla otherwise false |
| 1405 |
*/ |
| 1406 |
protected function checkBrowserMozilla() { |
| 1407 |
if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) { |
| 1408 |
$aversion = explode( ' ', stristr( $this->_agent, 'rv:' ) ); |
| 1409 |
preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion ); |
| 1410 |
$this->setVersion( str_replace( 'rv:', '', $aversion[0] ) ); |
| 1411 |
$this->setBrowser( self::BROWSER_MOZILLA ); |
| 1412 |
return true; |
| 1413 |
} elseif ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9]\.[0-9]/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) { |
| 1414 |
$aversion = explode( '', stristr( $this->_agent, 'rv:' ) ); |
| 1415 |
$this->setVersion( str_replace( 'rv:', '', $aversion[0] ) ); |
| 1416 |
$this->setBrowser( self::BROWSER_MOZILLA ); |
| 1417 |
return true; |
| 1418 |
} elseif ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/mozilla\/([^ ]*)/i', $this->_agent, $matches ) && stripos( $this->_agent, 'netscape' ) === false ) { |
| 1419 |
$this->setVersion( $matches[1] ); |
| 1420 |
$this->setBrowser( self::BROWSER_MOZILLA ); |
| 1421 |
return true; |
| 1422 |
} |
| 1423 |
return false; |
| 1424 |
} |
| 1425 |
|
| 1426 |
/** |
| 1427 |
* Determine if the browser is Lynx or not (last updated 1.7) |
| 1428 |
* |
| 1429 |
* @return boolean True if the browser is Lynx otherwise false |
| 1430 |
*/ |
| 1431 |
protected function checkBrowserLynx() { |
| 1432 |
if ( stripos( $this->_agent, 'lynx' ) !== false ) { |
| 1433 |
$aresult = explode( '/', stristr( $this->_agent, 'Lynx' ) ); |
| 1434 |
$aversion = explode( ' ', ( isset( $aresult[1] ) ? $aresult[1] : '' ) ); |
| 1435 |
$this->setVersion( $aversion[0] ); |
| 1436 |
$this->setBrowser( self::BROWSER_LYNX ); |
| 1437 |
return true; |
| 1438 |
} |
| 1439 |
return false; |
| 1440 |
} |
| 1441 |
|
| 1442 |
/** |
| 1443 |
* Determine if the browser is Amaya or not (last updated 1.7) |
| 1444 |
* |
| 1445 |
* @return boolean True if the browser is Amaya otherwise false |
| 1446 |
*/ |
| 1447 |
protected function checkBrowserAmaya() { |
| 1448 |
if ( stripos( $this->_agent, 'amaya' ) !== false ) { |
| 1449 |
$aresult = explode( '/', stristr( $this->_agent, 'Amaya' ) ); |
| 1450 |
if ( isset( $aresult[1] ) ) { |
| 1451 |
$aversion = explode( ' ', $aresult[1] ); |
| 1452 |
$this->setVersion( $aversion[0] ); |
| 1453 |
$this->setBrowser( self::BROWSER_AMAYA ); |
| 1454 |
return true; |
| 1455 |
} |
| 1456 |
} |
| 1457 |
return false; |
| 1458 |
} |
| 1459 |
|
| 1460 |
/** |
| 1461 |
* Determine if the browser is Safari or not (last updated 1.7) |
| 1462 |
* |
| 1463 |
* @return boolean True if the browser is Safari otherwise false |
| 1464 |
*/ |
| 1465 |
protected function checkBrowserSafari() { |
| 1466 |
if ( |
| 1467 |
stripos( $this->_agent, 'Safari' ) !== false |
| 1468 |
&& stripos( $this->_agent, 'iPhone' ) === false |
| 1469 |
&& stripos( $this->_agent, 'iPod' ) === false |
| 1470 |
) { |
| 1471 |
|
| 1472 |
$aresult = explode( '/', stristr( $this->_agent, 'Version' ) ); |
| 1473 |
if ( isset( $aresult[1] ) ) { |
| 1474 |
$aversion = explode( ' ', $aresult[1] ); |
| 1475 |
$this->setVersion( $aversion[0] ); |
| 1476 |
} else { |
| 1477 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1478 |
} |
| 1479 |
$this->setBrowser( self::BROWSER_SAFARI ); |
| 1480 |
return true; |
| 1481 |
} |
| 1482 |
return false; |
| 1483 |
} |
| 1484 |
|
| 1485 |
protected function checkBrowserSamsung() { |
| 1486 |
if ( stripos( $this->_agent, 'SamsungBrowser' ) !== false ) { |
| 1487 |
|
| 1488 |
$aresult = explode( '/', stristr( $this->_agent, 'SamsungBrowser' ) ); |
| 1489 |
if ( isset( $aresult[1] ) ) { |
| 1490 |
$aversion = explode( ' ', $aresult[1] ); |
| 1491 |
$this->setVersion( $aversion[0] ); |
| 1492 |
} else { |
| 1493 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1494 |
} |
| 1495 |
$this->setBrowser( self::BROWSER_SAMSUNG ); |
| 1496 |
return true; |
| 1497 |
} |
| 1498 |
return false; |
| 1499 |
} |
| 1500 |
|
| 1501 |
protected function checkBrowserSilk() { |
| 1502 |
if ( stripos( $this->_agent, 'Silk' ) !== false ) { |
| 1503 |
$aresult = explode( '/', stristr( $this->_agent, 'Silk' ) ); |
| 1504 |
if ( isset( $aresult[1] ) ) { |
| 1505 |
$aversion = explode( ' ', $aresult[1] ); |
| 1506 |
$this->setVersion( $aversion[0] ); |
| 1507 |
} else { |
| 1508 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1509 |
} |
| 1510 |
$this->setBrowser( self::BROWSER_SILK ); |
| 1511 |
return true; |
| 1512 |
} |
| 1513 |
return false; |
| 1514 |
} |
| 1515 |
|
| 1516 |
protected function checkBrowserIframely() { |
| 1517 |
if ( stripos( $this->_agent, 'Iframely' ) !== false ) { |
| 1518 |
$aresult = explode( '/', stristr( $this->_agent, 'Iframely' ) ); |
| 1519 |
if ( isset( $aresult[1] ) ) { |
| 1520 |
$aversion = explode( ' ', $aresult[1] ); |
| 1521 |
$this->setVersion( $aversion[0] ); |
| 1522 |
} else { |
| 1523 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1524 |
} |
| 1525 |
$this->setBrowser( self::BROWSER_I_FRAME ); |
| 1526 |
return true; |
| 1527 |
} |
| 1528 |
return false; |
| 1529 |
} |
| 1530 |
|
| 1531 |
protected function checkBrowserCocoa() { |
| 1532 |
if ( stripos( $this->_agent, 'CocoaRestClient' ) !== false ) { |
| 1533 |
$aresult = explode( '/', stristr( $this->_agent, 'CocoaRestClient' ) ); |
| 1534 |
if ( isset( $aresult[1] ) ) { |
| 1535 |
$aversion = explode( ' ', $aresult[1] ); |
| 1536 |
$this->setVersion( $aversion[0] ); |
| 1537 |
} else { |
| 1538 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1539 |
} |
| 1540 |
$this->setBrowser( self::BROWSER_COCOA ); |
| 1541 |
return true; |
| 1542 |
} |
| 1543 |
return false; |
| 1544 |
} |
| 1545 |
|
| 1546 |
/** |
| 1547 |
* Detect if URL is loaded from FacebookExternalHit |
| 1548 |
* |
| 1549 |
* @return boolean True if it detects FacebookExternalHit otherwise false |
| 1550 |
*/ |
| 1551 |
protected function checkFacebookExternalHit() { |
| 1552 |
if ( stristr( $this->_agent, 'FacebookExternalHit' ) ) { |
| 1553 |
$this->setRobot( true ); |
| 1554 |
$this->setFacebook( true ); |
| 1555 |
return true; |
| 1556 |
} |
| 1557 |
return false; |
| 1558 |
} |
| 1559 |
|
| 1560 |
/** |
| 1561 |
* Detect if URL is being loaded from internal Facebook browser |
| 1562 |
* |
| 1563 |
* @return boolean True if it detects internal Facebook browser otherwise false |
| 1564 |
*/ |
| 1565 |
protected function checkForFacebookIos() { |
| 1566 |
if ( stristr( $this->_agent, 'FBIOS' ) ) { |
| 1567 |
$this->setFacebook( true ); |
| 1568 |
return true; |
| 1569 |
} |
| 1570 |
return false; |
| 1571 |
} |
| 1572 |
|
| 1573 |
/** |
| 1574 |
* Detect Version for the Safari browser on iOS devices |
| 1575 |
* |
| 1576 |
* @return boolean True if it detects the version correctly otherwise false |
| 1577 |
*/ |
| 1578 |
protected function getSafariVersionOnIos() { |
| 1579 |
$aresult = explode( '/', stristr( $this->_agent, 'Version' ) ); |
| 1580 |
if ( isset( $aresult[1] ) ) { |
| 1581 |
$aversion = explode( ' ', $aresult[1] ); |
| 1582 |
$this->setVersion( $aversion[0] ); |
| 1583 |
return true; |
| 1584 |
} |
| 1585 |
return false; |
| 1586 |
} |
| 1587 |
|
| 1588 |
/** |
| 1589 |
* Detect Version for the Chrome browser on iOS devices |
| 1590 |
* |
| 1591 |
* @return boolean True if it detects the version correctly otherwise false |
| 1592 |
*/ |
| 1593 |
protected function getChromeVersionOnIos() { |
| 1594 |
$aresult = explode( '/', stristr( $this->_agent, 'CriOS' ) ); |
| 1595 |
if ( isset( $aresult[1] ) ) { |
| 1596 |
$aversion = explode( ' ', $aresult[1] ); |
| 1597 |
$this->setVersion( $aversion[0] ); |
| 1598 |
$this->setBrowser( self::BROWSER_CHROME ); |
| 1599 |
return true; |
| 1600 |
} |
| 1601 |
return false; |
| 1602 |
} |
| 1603 |
|
| 1604 |
/** |
| 1605 |
* Determine if the browser is iPhone or not (last updated 1.7) |
| 1606 |
* |
| 1607 |
* @return boolean True if the browser is iPhone otherwise false |
| 1608 |
*/ |
| 1609 |
protected function checkBrowseriPhone() { |
| 1610 |
if ( stripos( $this->_agent, 'iPhone' ) !== false ) { |
| 1611 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1612 |
$this->setBrowser( self::BROWSER_IPHONE ); |
| 1613 |
$this->getSafariVersionOnIos(); |
| 1614 |
$this->getChromeVersionOnIos(); |
| 1615 |
$this->checkForFacebookIos(); |
| 1616 |
$this->setMobile( true ); |
| 1617 |
return true; |
| 1618 |
} |
| 1619 |
return false; |
| 1620 |
} |
| 1621 |
|
| 1622 |
/** |
| 1623 |
* Determine if the browser is iPad or not (last updated 1.7) |
| 1624 |
* |
| 1625 |
* @return boolean True if the browser is iPad otherwise false |
| 1626 |
*/ |
| 1627 |
protected function checkBrowseriPad() { |
| 1628 |
if ( stripos( $this->_agent, 'iPad' ) !== false ) { |
| 1629 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1630 |
$this->setBrowser( self::BROWSER_IPAD ); |
| 1631 |
$this->getSafariVersionOnIos(); |
| 1632 |
$this->getChromeVersionOnIos(); |
| 1633 |
$this->checkForFacebookIos(); |
| 1634 |
$this->setTablet( true ); |
| 1635 |
return true; |
| 1636 |
} |
| 1637 |
return false; |
| 1638 |
} |
| 1639 |
|
| 1640 |
/** |
| 1641 |
* Determine if the browser is iPod or not (last updated 1.7) |
| 1642 |
* |
| 1643 |
* @return boolean True if the browser is iPod otherwise false |
| 1644 |
*/ |
| 1645 |
protected function checkBrowseriPod() { |
| 1646 |
if ( stripos( $this->_agent, 'iPod' ) !== false ) { |
| 1647 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1648 |
$this->setBrowser( self::BROWSER_IPOD ); |
| 1649 |
$this->getSafariVersionOnIos(); |
| 1650 |
$this->getChromeVersionOnIos(); |
| 1651 |
$this->checkForFacebookIos(); |
| 1652 |
$this->setMobile( true ); |
| 1653 |
return true; |
| 1654 |
} |
| 1655 |
return false; |
| 1656 |
} |
| 1657 |
|
| 1658 |
/** |
| 1659 |
* Determine if the browser is Android or not (last updated 1.7) |
| 1660 |
* |
| 1661 |
* @return boolean True if the browser is Android otherwise false |
| 1662 |
*/ |
| 1663 |
protected function checkBrowserAndroid() { |
| 1664 |
if ( stripos( $this->_agent, 'Android' ) !== false ) { |
| 1665 |
$aresult = explode( ' ', stristr( $this->_agent, 'Android' ) ); |
| 1666 |
if ( isset( $aresult[1] ) ) { |
| 1667 |
$aversion = explode( ' ', $aresult[1] ); |
| 1668 |
$this->setVersion( $aversion[0] ); |
| 1669 |
} else { |
| 1670 |
$this->setVersion( self::VERSION_UNKNOWN ); |
| 1671 |
} |
| 1672 |
if ( stripos( $this->_agent, 'Mobile' ) !== false ) { |
| 1673 |
$this->setMobile( true ); |
| 1674 |
} else { |
| 1675 |
$this->setTablet( true ); |
| 1676 |
} |
| 1677 |
$this->setBrowser( self::BROWSER_ANDROID ); |
| 1678 |
return true; |
| 1679 |
} |
| 1680 |
return false; |
| 1681 |
} |
| 1682 |
|
| 1683 |
/** |
| 1684 |
* Determine if the browser is Vivaldi |
| 1685 |
* |
| 1686 |
* @return boolean True if the browser is Vivaldi otherwise false |
| 1687 |
*/ |
| 1688 |
protected function checkBrowserVivaldi() { |
| 1689 |
if ( stripos( $this->_agent, 'Vivaldi' ) !== false ) { |
| 1690 |
$aresult = explode( '/', stristr( $this->_agent, 'Vivaldi' ) ); |
| 1691 |
if ( isset( $aresult[1] ) ) { |
| 1692 |
$aversion = explode( ' ', $aresult[1] ); |
| 1693 |
$this->setVersion( $aversion[0] ); |
| 1694 |
$this->setBrowser( self::BROWSER_VIVALDI ); |
| 1695 |
return true; |
| 1696 |
} |
| 1697 |
} |
| 1698 |
return false; |
| 1699 |
} |
| 1700 |
|
| 1701 |
/** |
| 1702 |
* Determine if the browser is Yandex |
| 1703 |
* |
| 1704 |
* @return boolean True if the browser is Yandex otherwise false |
| 1705 |
*/ |
| 1706 |
protected function checkBrowserYandex() { |
| 1707 |
if ( stripos( $this->_agent, 'YaBrowser' ) !== false ) { |
| 1708 |
$aresult = explode( '/', stristr( $this->_agent, 'YaBrowser' ) ); |
| 1709 |
if ( isset( $aresult[1] ) ) { |
| 1710 |
$aversion = explode( ' ', $aresult[1] ); |
| 1711 |
$this->setVersion( $aversion[0] ); |
| 1712 |
$this->setBrowser( self::BROWSER_YANDEX ); |
| 1713 |
|
| 1714 |
if ( stripos( $this->_agent, 'iPad' ) !== false ) { |
| 1715 |
$this->setTablet( true ); |
| 1716 |
} elseif ( stripos( $this->_agent, 'Mobile' ) !== false ) { |
| 1717 |
$this->setMobile( true ); |
| 1718 |
} elseif ( stripos( $this->_agent, 'Android' ) !== false ) { |
| 1719 |
$this->setTablet( true ); |
| 1720 |
} |
| 1721 |
|
| 1722 |
return true; |
| 1723 |
} |
| 1724 |
} |
| 1725 |
|
| 1726 |
return false; |
| 1727 |
} |
| 1728 |
|
| 1729 |
/** |
| 1730 |
* Determine if the browser is a PlayStation |
| 1731 |
* |
| 1732 |
* @return boolean True if the browser is PlayStation otherwise false |
| 1733 |
*/ |
| 1734 |
protected function checkBrowserPlayStation() { |
| 1735 |
if ( stripos( $this->_agent, 'PlayStation ' ) !== false ) { |
| 1736 |
$aresult = explode( ' ', stristr( $this->_agent, 'PlayStation ' ) ); |
| 1737 |
$this->setBrowser( self::BROWSER_PLAYSTATION ); |
| 1738 |
if ( isset( $aresult[0] ) ) { |
| 1739 |
$aversion = explode( ')', $aresult[2] ); |
| 1740 |
$this->setVersion( $aversion[0] ); |
| 1741 |
if ( stripos( $this->_agent, 'Portable)' ) !== false || stripos( $this->_agent, 'Vita' ) !== false ) { |
| 1742 |
$this->setMobile( true ); |
| 1743 |
} |
| 1744 |
return true; |
| 1745 |
} |
| 1746 |
} |
| 1747 |
return false; |
| 1748 |
} |
| 1749 |
|
| 1750 |
/** |
| 1751 |
* Determine if the browser is Wget or not (last updated 1.7) |
| 1752 |
* |
| 1753 |
* @return boolean True if the browser is Wget otherwise false |
| 1754 |
*/ |
| 1755 |
protected function checkBrowserWget() { |
| 1756 |
if ( preg_match( '!^Wget/([^ ]+)!i', $this->_agent, $aresult ) ) { |
| 1757 |
$this->setVersion( $aresult[1] ); |
| 1758 |
$this->setBrowser( self::BROWSER_WGET ); |
| 1759 |
return true; |
| 1760 |
} |
| 1761 |
return false; |
| 1762 |
} |
| 1763 |
/** |
| 1764 |
* Determine if the browser is cURL or not (last updated 1.7) |
| 1765 |
* |
| 1766 |
* @return boolean True if the browser is cURL otherwise false |
| 1767 |
*/ |
| 1768 |
protected function checkBrowserCurl() { |
| 1769 |
if ( strpos( $this->_agent, 'curl' ) === 0 ) { |
| 1770 |
$aresult = explode( '/', stristr( $this->_agent, 'curl' ) ); |
| 1771 |
if ( isset( $aresult[1] ) ) { |
| 1772 |
$aversion = explode( ' ', $aresult[1] ); |
| 1773 |
$this->setVersion( $aversion[0] ); |
| 1774 |
$this->setBrowser( self::BROWSER_CURL ); |
| 1775 |
return true; |
| 1776 |
} |
| 1777 |
} |
| 1778 |
return false; |
| 1779 |
} |
| 1780 |
|
| 1781 |
/** |
| 1782 |
* Determine the user's platform (last updated 2.0) |
| 1783 |
*/ |
| 1784 |
protected function checkPlatform() { |
| 1785 |
if ( stripos( $this->_agent, 'windows' ) !== false ) { |
| 1786 |
$this->_platform = self::PLATFORM_WINDOWS; |
| 1787 |
} elseif ( stripos( $this->_agent, 'iPad' ) !== false ) { |
| 1788 |
$this->_platform = self::PLATFORM_IPAD; |
| 1789 |
} elseif ( stripos( $this->_agent, 'iPod' ) !== false ) { |
| 1790 |
$this->_platform = self::PLATFORM_IPOD; |
| 1791 |
} elseif ( stripos( $this->_agent, 'iPhone' ) !== false ) { |
| 1792 |
$this->_platform = self::PLATFORM_IPHONE; |
| 1793 |
} elseif ( stripos( $this->_agent, 'mac' ) !== false ) { |
| 1794 |
$this->_platform = self::PLATFORM_APPLE; |
| 1795 |
} elseif ( stripos( $this->_agent, 'android' ) !== false ) { |
| 1796 |
$this->_platform = self::PLATFORM_ANDROID; |
| 1797 |
} elseif ( stripos( $this->_agent, 'Silk' ) !== false ) { |
| 1798 |
$this->_platform = self::PLATFORM_FIRE_OS; |
| 1799 |
} elseif ( stripos( $this->_agent, 'linux' ) !== false && stripos( $this->_agent, 'SMART-TV' ) !== false ) { |
| 1800 |
$this->_platform = self::PLATFORM_LINUX . '/' . self::PLATFORM_SMART_TV; |
| 1801 |
} elseif ( stripos( $this->_agent, 'linux' ) !== false ) { |
| 1802 |
$this->_platform = self::PLATFORM_LINUX; |
| 1803 |
} elseif ( stripos( $this->_agent, 'Nokia' ) !== false ) { |
| 1804 |
$this->_platform = self::PLATFORM_NOKIA; |
| 1805 |
} elseif ( stripos( $this->_agent, 'BlackBerry' ) !== false ) { |
| 1806 |
$this->_platform = self::PLATFORM_BLACKBERRY; |
| 1807 |
} elseif ( stripos( $this->_agent, 'FreeBSD' ) !== false ) { |
| 1808 |
$this->_platform = self::PLATFORM_FREEBSD; |
| 1809 |
} elseif ( stripos( $this->_agent, 'OpenBSD' ) !== false ) { |
| 1810 |
$this->_platform = self::PLATFORM_OPENBSD; |
| 1811 |
} elseif ( stripos( $this->_agent, 'NetBSD' ) !== false ) { |
| 1812 |
$this->_platform = self::PLATFORM_NETBSD; |
| 1813 |
} elseif ( stripos( $this->_agent, 'OpenSolaris' ) !== false ) { |
| 1814 |
$this->_platform = self::PLATFORM_OPENSOLARIS; |
| 1815 |
} elseif ( stripos( $this->_agent, 'SunOS' ) !== false ) { |
| 1816 |
$this->_platform = self::PLATFORM_SUNOS; |
| 1817 |
} elseif ( stripos( $this->_agent, 'OS\/2' ) !== false ) { |
| 1818 |
$this->_platform = self::PLATFORM_OS2; |
| 1819 |
} elseif ( stripos( $this->_agent, 'BeOS' ) !== false ) { |
| 1820 |
$this->_platform = self::PLATFORM_BEOS; |
| 1821 |
} elseif ( stripos( $this->_agent, 'win' ) !== false ) { |
| 1822 |
$this->_platform = self::PLATFORM_WINDOWS; |
| 1823 |
} elseif ( stripos( $this->_agent, 'Playstation' ) !== false ) { |
| 1824 |
$this->_platform = self::PLATFORM_PLAYSTATION; |
| 1825 |
} elseif ( stripos( $this->_agent, 'Roku' ) !== false ) { |
| 1826 |
$this->_platform = self::PLATFORM_ROKU; |
| 1827 |
} elseif ( stripos( $this->_agent, 'iOS' ) !== false ) { |
| 1828 |
$this->_platform = self::PLATFORM_IPHONE . '/' . self::PLATFORM_IPAD; |
| 1829 |
} elseif ( stripos( $this->_agent, 'tvOS' ) !== false ) { |
| 1830 |
$this->_platform = self::PLATFORM_APPLE_TV; |
| 1831 |
} elseif ( stripos( $this->_agent, 'curl' ) !== false ) { |
| 1832 |
$this->_platform = self::PLATFORM_TERMINAL; |
| 1833 |
} elseif ( stripos( $this->_agent, 'CrOS' ) !== false ) { |
| 1834 |
$this->_platform = self::PLATFORM_CHROME_OS; |
| 1835 |
} elseif ( stripos( $this->_agent, 'okhttp' ) !== false ) { |
| 1836 |
$this->_platform = self::PLATFORM_JAVA_ANDROID; |
| 1837 |
} elseif ( stripos( $this->_agent, 'PostmanRuntime' ) !== false ) { |
| 1838 |
$this->_platform = self::PLATFORM_POSTMAN; |
| 1839 |
} elseif ( stripos( $this->_agent, 'Iframely' ) !== false ) { |
| 1840 |
$this->_platform = self::PLATFORM_I_FRAME; |
| 1841 |
} |
| 1842 |
} |
| 1843 |
} |
| 1844 |
// @codingStandardsIgnoreEnd |