From 82f90c703af2f4fab79f99ca4841b8d17ed78fc6 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 3 Jul 2014 13:01:09 -0400 Subject: [PATCH] updated mobileesp. --- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 8 +- vendor/composer/installed.json | 36 +- vendor/mobileesp/mdetect/mdetect.php | 624 ++++++++++++++++----------- 4 files changed, 394 insertions(+), 276 deletions(-) diff --git a/vendor/autoload.php b/vendor/autoload.php index 37f75b15a95..e1040318221 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit941ac0bb90f7fc4a150b2c34799e8826::getLoader(); +return ComposerAutoloaderInit10fa56f5866e8fd06c4858e28b252536::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 26763b8f5ae..dabcd65d86a 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit941ac0bb90f7fc4a150b2c34799e8826 +class ComposerAutoloaderInit10fa56f5866e8fd06c4858e28b252536 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit941ac0bb90f7fc4a150b2c34799e8826 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit941ac0bb90f7fc4a150b2c34799e8826', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit10fa56f5866e8fd06c4858e28b252536', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit941ac0bb90f7fc4a150b2c34799e8826', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit10fa56f5866e8fd06c4858e28b252536', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; array_push($includePaths, get_include_path()); @@ -48,7 +48,7 @@ class ComposerAutoloaderInit941ac0bb90f7fc4a150b2c34799e8826 } } -function composerRequire941ac0bb90f7fc4a150b2c34799e8826($file) +function composerRequire10fa56f5866e8fd06c4858e28b252536($file) { require $file; } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index e27fc8c5e4b..675ea822f03 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -17,24 +17,6 @@ ] } }, - { - "name": "mobileesp/mdetect", - "version": "dev-master", - "version_normalized": "9999999-dev", - "dist": { - "type": "file", - "url": "http://mobileesp.googlecode.com/svn/PHP/mdetect.php", - "reference": null, - "shasum": null - }, - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "/" - ] - } - }, { "name": "pear-pear.php.net/Console_Getopt", "version": "1.3.1", @@ -889,5 +871,23 @@ "php", "stylesheet" ] + }, + { + "name": "mobileesp/mdetect", + "version": "dev-master", + "version_normalized": "9999999-dev", + "dist": { + "type": "file", + "url": "http://mobileesp.googlecode.com/svn/PHP/mdetect.php", + "reference": null, + "shasum": null + }, + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "/" + ] + } } ] diff --git a/vendor/mobileesp/mdetect/mdetect.php b/vendor/mobileesp/mdetect/mdetect.php index acff58d2abb..c2a06d75de2 100644 --- a/vendor/mobileesp/mdetect/mdetect.php +++ b/vendor/mobileesp/mdetect/mdetect.php @@ -1,39 +1,31 @@ <?php /* ******************************************* -// Copyright 2010-2012, Anthony Hand +// Copyright 2010-2013, Anthony Hand // -// File version date: April 23, 2012 -// Update: -// - Updated DetectAmazonSilk(): Fixed an issue in the detection logic. +// File version 2013.10.27 (October 27, 2013) +// Updates: +// - Made minor update to the InitDeviceScan. Should check Tablet Tier first, then iPhone Tier, then Quick Mobile. // -// File version date: April 22, 2012 - Second update -// Update: To address additional Kindle issues... -// - Updated DetectRichCSS(): Excluded e-Ink Kindle devices. -// - Created DetectAmazonSilk(): Created to detect Kindle Fire devices in Silk mode. -// - Updated DetectMobileQuick(): Updated to include e-Ink Kindle devices and the Kindle Fire in Silk mode. +// File version 2013.08.01 (August 1, 2013) +// Updates: +// - Updated DetectMobileQuick(). Moved the 'Exclude Tablets' logic to the top of the method to fix a logic bug. // -// File version date: April 11, 2012 -// Update: -// - Added a new variable for the new BlackBerry Curve Touch (9380): deviceBBCurveTouch. -// - Updated DetectBlackBerryTouch() to support the new BlackBerry Curve Touch (9380). -// - Updated DetectKindle(): Added the missing 'this' class identifier for the DetectAndroid() call. -// -// File version date: January 21, 2012 -// Update: -// - Added the constructor method per new features in PHP 5.0: __construct(). -// - Moved Windows Phone 7 to the iPhone Tier. WP7.5's IE 9-based browser is good enough now. -// - Added a new variable for 2 versions of the new BlackBerry Bold Touch (9900 and 9930): deviceBBBoldTouch. -// - Updated DetectBlackBerryTouch() to support the 2 versions of the new BlackBerry Bold Touch (9900 and 9930). -// - Updated DetectKindle() to focus on eInk devices only. The Kindle Fire should be detected as a regular Android device. -// -// File version date: August 22, 2011 -// Update: -// - Updated DetectAndroidTablet() to fix a bug introduced in the last fix! The true/false returns were mixed up. -// -// File version date: August 16, 2011 -// Update: -// - Updated DetectAndroidTablet() to exclude Opera Mini, which was falsely reporting as running on a tablet device when on a phone. +// File version 2013.07.13 (July 13, 2013) +// Updates: +// - Added support for Tizen: variable and DetectTizen(). +// - Added support for Meego: variable and DetectMeego(). +// - Added support for Windows Phone 8: variable and DetectWindowsPhone8(). +// - Added a generic Windows Phone method: DetectWindowsPhone(). +// - Added support for BlackBerry 10 OS: variable and DetectBlackBerry10Phone(). +// - Added support for PlayStation Vita handheld: variable and DetectGamingHandheld(). +// - Updated DetectTierIphone(). Added Tizen; updated the Windows Phone, BB10, and PS Vita support. +// - Updated DetectWindowsMobile(). Uses generic DetectWindowsPhone() method rather than WP7. +// - Updated DetectSmartphone(). Uses the IsTierIphone variable. +// - Updated DetectSonyMylo() with more efficient code. +// - Removed DetectGarminNuvifone() from DetectTierIphone(). How many are left in market in 2013? It is detected as a RichCSS Tier device. +// - Removed the deviceXoom variable. It was unused. +// - Added detection support for the Obigo mobile browser to DetectMobileQuick(). // // // LICENSE INFORMATION @@ -80,16 +72,21 @@ class uagent_info var $true = 1; var $false = 0; - //Let's store values for quickly accessing the same info multiple times. - var $isIphone = 0; //Stores whether the device is an iPhone or iPod Touch. - var $isAndroidPhone = 0; //Stores whether the device is a (small-ish) Android phone or media player. - var $isTierTablet = 0; //Stores whether is the Tablet (HTML5-capable, larger screen) tier of devices. - var $isTierIphone = 0; //Stores whether is the iPhone tier of devices. - var $isTierRichCss = 0; //Stores whether the device can probably support Rich CSS, but JavaScript support is not assumed. (e.g., newer BlackBerry, Windows Mobile) - var $isTierGenericMobile = 0; //Stores whether it is another mobile device, which cannot be assumed to support CSS or JS (eg, older BlackBerry, RAZR) + //Let's store values for quickly accessing the same info multiple times. InitCompleted + var $initCompleted = 0; //Stores whether we're currently initializing the most popular functions. + var $isWebkit = 0; //Stores the result of DetectWebkit() + var $isMobilePhone = 0; //Stores the result of DetectMobileQuick() + var $isIphone = 0; //Stores the result of DetectIphone() + var $isAndroid = 0; //Stores the result of DetectAndroid() + var $isAndroidPhone = 0; //Stores the result of DetectAndroidPhone() + var $isTierTablet = 0; //Stores the result of DetectTierTablet() + var $isTierIphone = 0; //Stores the result of DetectTierIphone() + var $isTierRichCss = 0; //Stores the result of DetectTierRichCss() + var $isTierGenericMobile = 0; //Stores the result of DetectTierOtherPhones() //Initialize some initial smartphone string variables. var $engineWebKit = 'webkit'; + var $deviceIphone = 'iphone'; var $deviceIpod = 'ipod'; var $deviceIpad = 'ipad'; @@ -97,18 +94,10 @@ class uagent_info var $deviceAndroid = 'android'; var $deviceGoogleTV = 'googletv'; - var $deviceXoom = 'xoom'; //Motorola Xoom var $deviceHtcFlyer = 'htc_flyer'; //HTC Flyer - var $deviceNuvifone = 'nuvifone'; //Garmin Nuvifone - - var $deviceSymbian = 'symbian'; - var $deviceS60 = 'series60'; - var $deviceS70 = 'series70'; - var $deviceS80 = 'series80'; - var $deviceS90 = 'series90'; - var $deviceWinPhone7 = 'windows phone os 7'; + var $deviceWinPhone8 = 'windows phone 8'; var $deviceWinMob = 'windows ce'; var $deviceWindows = 'windows'; var $deviceIeMob = 'iemobile'; @@ -116,6 +105,7 @@ class uagent_info var $enginePie = 'wm5 pie'; //An old Windows Mobile var $deviceBB = 'blackberry'; + var $deviceBB10 = 'bb10'; //For the new BB 10 OS var $vndRIM = 'vnd.rim'; //Detectable when BB devices emulate IE or Firefox var $deviceBBStorm = 'blackberry95'; //Storm 1 and 2 var $deviceBBBold = 'blackberry97'; //Bold 97x0 (non-touch) @@ -126,15 +116,25 @@ class uagent_info var $deviceBBTorch = 'blackberry 98'; //Torch var $deviceBBPlaybook = 'playbook'; //PlayBook tablet + var $deviceSymbian = 'symbian'; + var $deviceS60 = 'series60'; + var $deviceS70 = 'series70'; + var $deviceS80 = 'series80'; + var $deviceS90 = 'series90'; + var $devicePalm = 'palm'; var $deviceWebOS = 'webos'; //For Palm's line of WebOS devices var $deviceWebOShp = 'hpwos'; //For HP's line of WebOS devices - var $engineBlazer = 'blazer'; //Old Palm browser var $engineXiino = 'xiino'; //Another old Palm + var $deviceNuvifone = 'nuvifone'; //Garmin Nuvifone + var $deviceBada = 'bada'; //Samsung's Bada OS + var $deviceTizen = 'tizen'; //Tizen OS + var $deviceMeego = 'meego'; //Meego OS + var $deviceKindle = 'kindle'; //Amazon Kindle, eInk one - var $engineSilk = 'silk'; //Amazon's accelerated Silk browser for Kindle Fire + var $engineSilk = 'silk-accelerated'; //Amazon's accelerated Silk browser for Kindle Fire //Initialize variables for mobile-specific content. var $vndwap = 'vnd.wap'; @@ -146,6 +146,7 @@ class uagent_info var $deviceDanger = 'danger'; var $deviceHiptop = 'hiptop'; var $devicePlaystation = 'playstation'; + var $devicePlaystationVita = 'vita'; var $deviceNintendoDs = 'nitro'; var $deviceNintendo = 'nintendo'; var $deviceWii = 'wii'; @@ -159,6 +160,7 @@ class uagent_info var $deviceMidp = 'midp'; //a mobile Java technology var $uplink = 'up.link'; var $engineTelecaQ = 'teleca q'; //a modern feature phone browser + var $engineObigo = 'obigo'; //W 10 is a modern feature phone browser var $devicePda = 'pda'; //some devices report themselves as PDAs var $mini = 'mini'; //Some mobile browsers put 'mini' in their names. @@ -176,7 +178,7 @@ class uagent_info var $manuericsson = "ericsson"; var $manuSamsung1 = "sec-sgh"; var $manuSony = "sony"; - var $manuHtc = "htc"; //Popular Android and WinMo manufacturer + var $manuHtc = "htc"; //In some UserAgents, the only clue is the operator. var $svcDocomo = "docomo"; @@ -191,7 +193,7 @@ class uagent_info //The constructor. Allows the latest PHP (5.0+) to locate a constructor object and initialize the object. function __construct() { - $this->uagent_info(); + $this->uagent_info(); } @@ -199,29 +201,36 @@ class uagent_info //The object initializer. Initializes several default variables. function uagent_info() { - $this->useragent = isset($_SERVER['HTTP_USER_AGENT'])?strtolower($_SERVER['HTTP_USER_AGENT']):''; - $this->httpaccept = isset($_SERVER['HTTP_ACCEPT'])?strtolower($_SERVER['HTTP_ACCEPT']):''; + $this->useragent = isset($_SERVER['HTTP_USER_AGENT'])?strtolower($_SERVER['HTTP_USER_AGENT']):''; + $this->httpaccept = isset($_SERVER['HTTP_ACCEPT'])?strtolower($_SERVER['HTTP_ACCEPT']):''; - //Let's initialize some values to save cycles later. - $this->InitDeviceScan(); + //Let's initialize some values to save cycles later. + $this->InitDeviceScan(); } //************************** // Initialize Key Stored Values. function InitDeviceScan() { - global $isIphone, $isAndroidPhone, $isTierTablet, $isTierIphone; - - //We'll use these 4 variables to speed other processing. They're super common. - $this->isIphone = $this->DetectIphoneOrIpod(); + //Save these properties to speed processing + global $isWebkit, $isIphone, $isAndroid, $isAndroidPhone; + $this->isWebkit = $this->DetectWebkit(); + $this->isIphone = $this->DetectIphone(); + $this->isAndroid = $this->DetectAndroid(); $this->isAndroidPhone = $this->DetectAndroidPhone(); - $this->isTierIphone = $this->DetectTierIphone(); - $this->isTierTablet = $this->DetectTierTablet(); - //Optional: Comment these out if you don't need them. + //These tiers are the most useful for web development + global $isMobilePhone, $isTierTablet, $isTierIphone; + $this->isTierTablet = $this->DetectTierTablet(); //Do first + $this->isTierIphone = $this->DetectTierIphone(); //Do second + $this->isMobilePhone = $this->DetectMobileQuick(); //Do third + + //Optional: Comment these out if you NEVER use them. global $isTierRichCss, $isTierGenericMobile; $this->isTierRichCss = $this->DetectTierRichCss(); $this->isTierGenericMobile = $this->DetectTierOtherPhones(); + + $this->initCompleted = $this->true; } //************************** @@ -243,6 +252,10 @@ class uagent_info // Detects if the current device is an iPhone. function DetectIphone() { + if ($this->initCompleted == $this->true || + $this->isIphone == $this->true) + return $this->isIphone; + if (stripos($this->useragent, $this->deviceIphone) > -1) { //The iPad and iPod Touch say they're an iPhone. So let's disambiguate. @@ -283,8 +296,8 @@ class uagent_info function DetectIphoneOrIpod() { //We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay. - if (stripos($this->useragent, $this->deviceIphone) > -1 || - stripos($this->useragent, $this->deviceIpod) > -1) + if ($this->DetectIphone() == $this->true || + $this->DetectIpod() == $this->true) return $this->true; else return $this->false; @@ -307,8 +320,12 @@ class uagent_info // Also detects Google TV. function DetectAndroid() { - if ((stripos($this->useragent, $this->deviceAndroid) > -1) || - ($this->DetectGoogleTV() == $this->true)) + if ($this->initCompleted == $this->true || + $this->isAndroid == $this->true) + return $this->isAndroid; + + if ((stripos($this->useragent, $this->deviceAndroid) > -1) + || ($this->DetectGoogleTV() == $this->true)) return $this->true; //Special check for the HTC Flyer 7" tablet if ((stripos($this->useragent, $this->deviceHtcFlyer) > -1)) @@ -324,15 +341,21 @@ class uagent_info // Ignores tablets (Honeycomb and later). function DetectAndroidPhone() { + if ($this->initCompleted == $this->true || + $this->isAndroidPhone == $this->true) + return $this->isAndroidPhone; + if (($this->DetectAndroid() == $this->true) && (stripos($this->useragent, $this->mobile) > -1)) - return $this->true; + return $this->true; + //Special check for Android phones with Opera Mobile. They should report here. if (($this->DetectOperaAndroidPhone() == $this->true)) return $this->true; //Special check for the HTC Flyer 7" tablet. It should report here. if ((stripos($this->useragent, $this->deviceHtcFlyer) > -1)) - return $this->true; + return $this->true; + else return $this->false; } @@ -386,6 +409,10 @@ class uagent_info // Detects if the current browser is based on WebKit. function DetectWebkit() { + if ($this->initCompleted == $this->true || + $this->isWebkit == $this->true) + return $this->isWebkit; + if (stripos($this->useragent, $this->engineWebKit) > -1) return $this->true; else @@ -394,46 +421,32 @@ class uagent_info //************************** - // Detects if the current browser is the Nokia S60 Open Source Browser. - function DetectS60OssBrowser() + // Detects if the current browser is EITHER a + // Windows Phone 7.x OR 8 device. + function DetectWindowsPhone() { - //First, test for WebKit, then make sure it's either Symbian or S60. - if ($this->DetectWebkit() == $this->true) - { - if (stripos($this->useragent, $this->deviceSymbian) > -1 || - stripos($this->useragent, $this->deviceS60) > -1) - { - return $this->true; - } - else - return $this->false; - } + if (($this->DetectWindowsPhone8() == $this->true) + || ($this->DetectWindowsPhone7() == $this->true)) + return $this->true; else return $this->false; } //************************** - // Detects if the current device is any Symbian OS-based device, - // including older S60, Series 70, Series 80, Series 90, and UIQ, - // or other browsers running on these devices. - function DetectSymbianOS() + // Detects a Windows Phone 7.x device (in mobile browsing mode). + function DetectWindowsPhone7() { - if (stripos($this->useragent, $this->deviceSymbian) > -1 || - stripos($this->useragent, $this->deviceS60) > -1 || - stripos($this->useragent, $this->deviceS70) > -1 || - stripos($this->useragent, $this->deviceS80) > -1 || - stripos($this->useragent, $this->deviceS90) > -1) + if (stripos($this->useragent, $this->deviceWinPhone7) > -1) return $this->true; else return $this->false; } - + //************************** - // Detects if the current browser is a - // Windows Phone 7 device. - function DetectWindowsPhone7() + // Detects a Windows Phone 8 device (in mobile browsing mode). + function DetectWindowsPhone8() { - if (stripos($this->useragent, $this->deviceWinPhone7) > -1) + if (stripos($this->useragent, $this->deviceWinPhone8) > -1) return $this->true; else return $this->false; @@ -441,12 +454,13 @@ class uagent_info //************************** // Detects if the current browser is a Windows Mobile device. - // Excludes Windows Phone 7 devices. + // Excludes Windows Phone 7 and later devices. // Focuses on Windows Mobile 6.xx and earlier. function DetectWindowsMobile() { - if ($this->DetectWindowsPhone7() == $this->true) - return $this->false; + if ($this->DetectWindowsPhone() == $this->true) + return $this->false; + //Most devices use 'Windows CE', but some report 'iemobile' // and some older ones report as 'PIE' for Pocket IE. if (stripos($this->useragent, $this->deviceWinMob) > -1 || @@ -470,11 +484,25 @@ class uagent_info //************************** // Detects if the current browser is any BlackBerry device. - // Includes the PlayBook. + // Includes BB10 OS, but excludes the PlayBook. function DetectBlackBerry() { if ((stripos($this->useragent, $this->deviceBB) > -1) || (stripos($this->httpaccept, $this->vndRIM) > -1)) + return $this->true; + if ($this->DetectBlackBerry10Phone() == $this->true) + return $this->true; + else + return $this->false; + } + + //************************** + // Detects if the current browser is a BlackBerry 10 OS phone. + // Excludes tablets. + function DetectBlackBerry10Phone() + { + if ((stripos($this->useragent, $this->deviceBB10) > -1) && + (stripos($this->useragent, $this->mobile) > -1)) return $this->true; else return $this->false; @@ -563,21 +591,56 @@ class uagent_info return $this->false; } + + //************************** + // Detects if the current browser is the Nokia S60 Open Source Browser. + function DetectS60OssBrowser() + { + //First, test for WebKit, then make sure it's either Symbian or S60. + if ($this->DetectWebkit() == $this->true) + { + if (stripos($this->useragent, $this->deviceSymbian) > -1 || + stripos($this->useragent, $this->deviceS60) > -1) + { + return $this->true; + } + else + return $this->false; + } + else + return $this->false; + } + + //************************** + // Detects if the current device is any Symbian OS-based device, + // including older S60, Series 70, Series 80, Series 90, and UIQ, + // or other browsers running on these devices. + function DetectSymbianOS() + { + if (stripos($this->useragent, $this->deviceSymbian) > -1 || + stripos($this->useragent, $this->deviceS60) > -1 || + stripos($this->useragent, $this->deviceS70) > -1 || + stripos($this->useragent, $this->deviceS80) > -1 || + stripos($this->useragent, $this->deviceS90) > -1) + return $this->true; + else + return $this->false; + } + + //************************** // Detects if the current browser is on a PalmOS device. function DetectPalmOS() { + //Make sure it's not WebOS first + if ($this->DetectPalmWebOS() == $this->true) + return $this->false; + //Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino. if (stripos($this->useragent, $this->devicePalm) > -1 || stripos($this->useragent, $this->engineBlazer) > -1 || stripos($this->useragent, $this->engineXiino) > -1) - { - //Make sure it's not WebOS first - if ($this->DetectPalmWebOS() == $this->true) - return $this->false; - else return $this->true; - } else return $this->false; } @@ -605,62 +668,7 @@ class uagent_info return $this->false; } - //************************** - // Detects if the current browser is a - // Garmin Nuvifone. - function DetectGarminNuvifone() - { - if (stripos($this->useragent, $this->deviceNuvifone) > -1) - return $this->true; - else - return $this->false; - } - - - //************************** - // Check to see whether the device is any device - // in the 'smartphone' category. - function DetectSmartphone() - { - global $isIphone, $isAndroidPhone, $isTierIphone; - - if (($this->isIphone == $this->true) - || ($this->isAndroidPhone == $this->true) - || ($this->isTierIphone == $this->true) - || ($this->DetectS60OssBrowser() == $this->true) - || ($this->DetectSymbianOS() == $this->true) - || ($this->DetectWindowsMobile() == $this->true) - || ($this->DetectWindowsPhone7() == $this->true) - || ($this->DetectBlackBerry() == $this->true) - || ($this->DetectPalmWebOS() == $this->true) - || ($this->DetectPalmOS() == $this->true) - || ($this->DetectGarminNuvifone() == $this->true)) - return $this->true; - else - return $this->false; - } - - - //************************** - // Detects whether the device is a Brew-powered device. - function DetectBrewDevice() - { - if (stripos($this->useragent, $this->deviceBrew) > -1) - return $this->true; - else - return $this->false; - } - //************************** - // Detects the Danger Hiptop device. - function DetectDangerHiptop() - { - if (stripos($this->useragent, $this->deviceDanger) > -1 || - stripos($this->useragent, $this->deviceHiptop) > -1) - return $this->true; - else - return $this->false; - } //************************** // Detects if the current browser is Opera Mobile or Mini. @@ -704,17 +712,6 @@ class uagent_info return $this->false; } - //************************** - // Detects whether the device supports WAP or WML. - function DetectWapWml() - { - if (stripos($this->httpaccept, $this->vndwap) > -1 || - stripos($this->httpaccept, $this->wml) > -1) - return $this->true; - else - return $this->false; - } - //************************** // Detects if the current device is an Amazon Kindle (eInk devices only). // Note: For the Kindle Fire, use the normal Android methods. @@ -728,7 +725,7 @@ class uagent_info } //************************** - // Detects if the current Amazon device is using the Silk Browser. + // Detects if the current Amazon device has turned on the Silk accelerated browsing feature. // Note: Typically used by the the Kindle Fire. function DetectAmazonSilk() { @@ -737,49 +734,105 @@ class uagent_info else return $this->false; } - + + //************************** + // Detects if a Garmin Nuvifone device. + function DetectGarminNuvifone() + { + if (stripos($this->useragent, $this->deviceNuvifone) > -1) + return $this->true; + else + return $this->false; + } //************************** - // The quick way to detect for a mobile device. - // Will probably detect most recent/current mid-tier Feature Phones - // as well as smartphone-class devices. Excludes Apple iPads and other modern tablets. - function DetectMobileQuick() + // Detects a device running the Bada smartphone OS from Samsung. + function DetectBada() { - //Let's exclude tablets - if ($this->isTierTablet == $this->true) - return $this->false; - - //Most mobile browsing is done on smartphones - if ($this->DetectSmartphone() == $this->true) - return $this->true; + if (stripos($this->useragent, $this->deviceBada) > -1) + return $this->true; + else + return $this->false; + } - if (($this->DetectWapWml() == $this->true) - || ($this->DetectBrewDevice() == $this->true) - || ($this->DetectOperaMobile() == $this->true)) - return $this->true; - - if ((stripos($this->useragent, $this->engineNetfront) > -1) - || (stripos($this->useragent, $this->engineUpBrowser) > -1) - || (stripos($this->useragent, $this->engineOpenWeb) > -1)) + //************************** + // Detects a device running the Tizen smartphone OS. + function DetectTizen() + { + if (stripos($this->useragent, $this->deviceTizen) > -1) return $this->true; - - if (($this->DetectDangerHiptop() == $this->true) - || ($this->DetectMidpCapable() == $this->true) - || ($this->DetectMaemoTablet() == $this->true) - || ($this->DetectArchos() == $this->true)) + else + return $this->false; + } + + //************************** + // Detects a device running the Meego OS. + function DetectMeego() + { + if (stripos($this->useragent, $this->deviceMeego) > -1) return $this->true; + else + return $this->false; + } + + //************************** + // Detects the Danger Hiptop device. + function DetectDangerHiptop() + { + if (stripos($this->useragent, $this->deviceDanger) > -1 || + stripos($this->useragent, $this->deviceHiptop) > -1) + return $this->true; + else + return $this->false; + } - if ((stripos($this->useragent, $this->devicePda) > -1) && - !(stripos($this->useragent, $this->disUpdate) > -1)) + //************************** + // Detects if the current browser is a Sony Mylo device. + function DetectSonyMylo() + { + if ((stripos($this->useragent, $this->manuSony) > -1) && + ((stripos($this->useragent, $this->qtembedded) > -1) || + (stripos($this->useragent, $this->mylocom2) > -1))) return $this->true; - if (stripos($this->useragent, $this->mobile) > -1) + else + return $this->false; + } + + //************************** + // Detects if the current device is on one of the Maemo-based Nokia Internet Tablets. + function DetectMaemoTablet() + { + if (stripos($this->useragent, $this->maemo) > -1) + return $this->true; + //For Nokia N810, must be Linux + Tablet, or else it could be something else. + if ((stripos($this->useragent, $this->linux) > -1) + && (stripos($this->useragent, $this->deviceTablet) > -1) + && ($this->DetectWebOSTablet() == $this->false) + && ($this->DetectAndroid() == $this->false)) return $this->true; + else + return $this->false; + } - //We also look for Kindle devices - if ($this->DetectKindle() == $this->true || - $this->DetectAmazonSilk() == $this->true) - return $this->true; + //************************** + // Detects if the current device is an Archos media player/Internet tablet. + function DetectArchos() + { + if (stripos($this->useragent, $this->deviceArchos) > -1) + return $this->true; + else + return $this->false; + } + //************************** + // Detects if the current device is an Internet-capable game console. + // Includes many handheld consoles. + function DetectGameConsole() + { + if (($this->DetectSonyPlaystation() == $this->true) || + ($this->DetectNintendo() == $this->true) || + ($this->DetectXbox() == $this->true)) + return $this->true; else return $this->false; } @@ -794,6 +847,18 @@ class uagent_info return $this->false; } + //************************** + // Detects if the current device is a handheld gaming device with + // a touchscreen and modern iPhone-class browser. Includes the Playstation Vita. + function DetectGamingHandheld() + { + if ((stripos($this->useragent, $this->devicePlaystation) > -1) && + (stripos($this->useragent, $this->devicePlaystationVita) > -1)) + return $this->true; + else + return $this->false; + } + //************************** // Detects if the current device is a Nintendo game device. function DetectNintendo() @@ -815,76 +880,112 @@ class uagent_info else return $this->false; } - + //************************** - // Detects if the current device is an Internet-capable game console. - function DetectGameConsole() + // Detects whether the device is a Brew-powered device. + function DetectBrewDevice() { - if ($this->DetectSonyPlaystation() == $this->true) - return $this->true; - else if ($this->DetectNintendo() == $this->true) - return $this->true; - else if ($this->DetectXbox() == $this->true) + if (stripos($this->useragent, $this->deviceBrew) > -1) return $this->true; else return $this->false; } //************************** - // Detects if the current device supports MIDP, a mobile Java technology. - function DetectMidpCapable() + // Detects whether the device supports WAP or WML. + function DetectWapWml() { - if (stripos($this->useragent, $this->deviceMidp) > -1 || - stripos($this->httpaccept, $this->deviceMidp) > -1) + if (stripos($this->httpaccept, $this->vndwap) > -1 || + stripos($this->httpaccept, $this->wml) > -1) return $this->true; else return $this->false; } //************************** - // Detects if the current device is on one of the Maemo-based Nokia Internet Tablets. - function DetectMaemoTablet() + // Detects if the current device supports MIDP, a mobile Java technology. + function DetectMidpCapable() { - if (stripos($this->useragent, $this->maemo) > -1) - return $this->true; - //For Nokia N810, must be Linux + Tablet, or else it could be something else. - if ((stripos($this->useragent, $this->linux) > -1) - && (stripos($this->useragent, $this->deviceTablet) > -1) - && ($this->DetectWebOSTablet() == $this->false) - && ($this->DetectAndroid() == $this->false)) + if (stripos($this->useragent, $this->deviceMidp) > -1 || + stripos($this->httpaccept, $this->deviceMidp) > -1) return $this->true; else return $this->false; } + + + //***************************** + // Device Classes + //***************************** + //************************** - // Detects if the current device is an Archos media player/Internet tablet. - function DetectArchos() + // Check to see whether the device is *any* 'smartphone'. + // Note: It's better to use DetectTierIphone() for modern touchscreen devices. + function DetectSmartphone() { - if (stripos($this->useragent, $this->deviceArchos) > -1) + //Exclude duplicates from TierIphone + if (($this->DetectTierIphone() == $this->true) + || ($this->DetectS60OssBrowser() == $this->true) + || ($this->DetectSymbianOS() == $this->true) + || ($this->DetectWindowsMobile() == $this->true) + || ($this->DetectBlackBerry() == $this->true) + || ($this->DetectPalmWebOS() == $this->true)) return $this->true; else return $this->false; } //************************** - // Detects if the current browser is a Sony Mylo device. - function DetectSonyMylo() + // The quick way to detect for a mobile device. + // Will probably detect most recent/current mid-tier Feature Phones + // as well as smartphone-class devices. Excludes Apple iPads and other modern tablets. + function DetectMobileQuick() { - if (stripos($this->useragent, $this->manuSony) > -1) - { - if ((stripos($this->useragent, $this->qtembedded) > -1) || - (stripos($this->useragent, $this->mylocom2) > -1)) - { - return $this->true; - } - else - return $this->false; - } + //Let's exclude tablets + if ($this->isTierTablet == $this->true) + return $this->false; + + if ($this->initCompleted == $this->true || + $this->isMobilePhone == $this->true) + return $this->isMobilePhone; + + //Most mobile browsing is done on smartphones + if ($this->DetectSmartphone() == $this->true) + return $this->true; + + if (stripos($this->useragent, $this->mobile) > -1) + return $this->true; + + if (($this->DetectWapWml() == $this->true) + || ($this->DetectBrewDevice() == $this->true) + || ($this->DetectOperaMobile() == $this->true)) + return $this->true; + + if ((stripos($this->useragent, $this->engineObigo) > -1) + || (stripos($this->useragent, $this->engineNetfront) > -1) + || (stripos($this->useragent, $this->engineUpBrowser) > -1) + || (stripos($this->useragent, $this->engineOpenWeb) > -1)) + return $this->true; + + if (($this->DetectDangerHiptop() == $this->true) + || ($this->DetectMidpCapable() == $this->true) + || ($this->DetectMaemoTablet() == $this->true) + || ($this->DetectArchos() == $this->true)) + return $this->true; + + if ((stripos($this->useragent, $this->devicePda) > -1) && + !(stripos($this->useragent, $this->disUpdate) > -1)) + return $this->true; + + //We also look for Kindle devices + if ($this->DetectKindle() == $this->true || + $this->DetectAmazonSilk() == $this->true) + return $this->true; + else return $this->false; } - //************************** // The longer and more thorough way to detect for a mobile device. @@ -909,9 +1010,9 @@ class uagent_info return $this->true; if (stripos($this->useragent, $this->manuericsson) > -1) return $this->true; - if (stripos($this->useragent, $this->manuSamsung1) > -1) return $this->true; + if (stripos($this->useragent, $this->svcDocomo) > -1) return $this->true; if (stripos($this->useragent, $this->svcKddi) > -1) @@ -924,7 +1025,6 @@ class uagent_info } - //***************************** // For Mobile Web Site Design //***************************** @@ -936,6 +1036,10 @@ class uagent_info // Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc. function DetectTierTablet() { + if ($this->initCompleted == $this->true || + $this->isTierTablet == $this->true) + return $this->isTierTablet; + if (($this->DetectIpad() == $this->true) || ($this->DetectAndroidTablet() == $this->true) || ($this->DetectBlackBerryTablet() == $this->true) @@ -950,22 +1054,28 @@ class uagent_info // The quick way to detect for a tier of devices. // This method detects for devices which can // display iPhone-optimized web content. - // Includes iPhone, iPod Touch, Android, Windows Phone 7, WebOS, etc. + // Includes iPhone, iPod Touch, Android, Windows Phone 7 and 8, BB10, WebOS, Playstation Vita, etc. function DetectTierIphone() { - if (($this->isIphone == $this->true) || - ($this->isAndroidPhone == $this->true)) + if ($this->initCompleted == $this->true || + $this->isTierIphone == $this->true) + return $this->isTierIphone; + + if (($this->DetectIphoneOrIpod() == $this->true) + || ($this->DetectAndroidPhone() == $this->true) + || ($this->DetectWindowsPhone() == $this->true) + || ($this->DetectBlackBerry10Phone() == $this->true) + || ($this->DetectPalmWebOS() == $this->true) + || ($this->DetectBada() == $this->true) + || ($this->DetectTizen() == $this->true) + || ($this->DetectGamingHandheld() == $this->true)) return $this->true; - + + //Note: BB10 phone is in the previous paragraph if (($this->DetectBlackBerryWebKit() == $this->true) && ($this->DetectBlackBerryTouch() == $this->true)) - return $this->true; - if ($this->DetectWindowsPhone7() == $this->true) - return $this->true; - if ($this->DetectPalmWebOS() == $this->true) - return $this->true; - if ($this->DetectGarminNuvifone() == $this->true) - return $this->true; + return $this->true; + else return $this->false; } @@ -978,6 +1088,10 @@ class uagent_info // Excludes all iPhone Tier devices. function DetectTierRichCss() { + if ($this->initCompleted == $this->true || + $this->isTierRichCss == $this->true) + return $this->isTierRichCss; + if ($this->DetectMobileQuick() == $this->true) { //Exclude iPhone Tier and e-Ink Kindle devices @@ -1015,6 +1129,10 @@ class uagent_info // but excludes the iPhone and RichCSS Tier devices. function DetectTierOtherPhones() { + if ($this->initCompleted == $this->true || + $this->isTierGenericMobile == $this->true) + return $this->isTierGenericMobile; + //Exclude devices in the other 2 categories if (($this->DetectMobileLong() == $this->true) && ($this->DetectTierIphone() == $this->false) -- GitLab