diff options
Diffstat (limited to 'plugins/wordpress-mobile-pack/frontend/class-detect.php')
-rwxr-xr-x | plugins/wordpress-mobile-pack/frontend/class-detect.php | 58 |
1 files changed, 6 insertions, 52 deletions
diff --git a/plugins/wordpress-mobile-pack/frontend/class-detect.php b/plugins/wordpress-mobile-pack/frontend/class-detect.php index b015c652..4e5d26f5 100755 --- a/plugins/wordpress-mobile-pack/frontend/class-detect.php +++ b/plugins/wordpress-mobile-pack/frontend/class-detect.php @@ -58,28 +58,6 @@ if (!class_exists('WMobilePack_Detect')) { } - /** - * Detect IE tablet - * - * @return bool - */ - protected function is_IE_tablet(){ - - // Check user agent only for not detected devices (should exclude Windows phones) - if (isset($_SERVER['HTTP_USER_AGENT'])){ - - // Check if user agent is IE v>10 ex: Trident/6.0 or Trident/7.0 (for IE11) with Touch - preg_match("@Trident/([0-9]{1,}[\.0-9]{0,}); Touch@", $_SERVER['HTTP_USER_AGENT'], $matches); - - // if IE version is equal or more than 10 - if (isset($matches[1]) && $matches[1] >= 6) - return true; - } - - return false; - } - - /** * @@ -105,28 +83,17 @@ if (!class_exists('WMobilePack_Detect')) { if ($detect->isMobile() || $detect->isTablet()) $is_supported_device = 1; - if ($detect->isTablet()) + if ($detect->isTablet()) { $is_tablet = 1; + } - if ($detect->is('iOS') || $detect->is('AndroidOS') || $detect->is('WindowsPhoneOS') || $detect->is('WindowsMobileOS')) { + if ($detect->is('iOS') || $detect->is('AndroidOS')) { $is_supported_os = 1; - } else { - - // Assume we have FirefoxOS, but this part should be replaced with a proper detection - if ($detect->isMobile() && $detect->is('Firefox') && stripos(strtolower($_SERVER['HTTP_USER_AGENT']), 'android') === false) - $is_supported_os = 1; } - if ($detect->is('WebKit') || $detect->is('Firefox') || ($detect->is('IE') && intval($detect->version('IE')) >= 10)) + if ($detect->is('WebKit')) { $is_supported_browser = 1; - - // Assume the device is not Windows 8 / IE - $is_IE_tablet = false; - - // Check user agent only for not detected devices (should exclude Windows phones) - if ($is_supported_device == 0){ - $is_IE_tablet = $this->is_IE_tablet(); - } + } // set load app variable $load_app = false; @@ -137,9 +104,6 @@ if (!class_exists('WMobilePack_Detect')) { $load_app = true; } - } elseif ($is_IE_tablet && $is_allowed_tablets == 1) { - - $load_app = true; } // set load app cookie @@ -159,23 +123,13 @@ if (!class_exists('WMobilePack_Detect')) { public function is_tablet() { $is_tablet = false; - $is_IE_tablet = false; if (!class_exists('WMP_Mobile_Detect')) { require_once (WMP_PLUGIN_PATH.'libs/Mobile-Detect-2.8.25/Mobile_Detect.php'); } $detect = new WMP_Mobile_Detect(); - - if ($detect->isTablet()) - $is_tablet = true; - - // Check user agent only for not detected devices (should exclude Windows phones) - if (!$detect->is('WindowsPhoneOS') && !$detect->is('WindowsMobileOS')){ - $is_IE_tablet = $this->is_IE_tablet(); - } - - return ($is_tablet || $is_IE_tablet); + return $detect->isTablet(); } |