--- a/common.inc.php +++ b/common.inc.php @@ -1,16 +1,23 @@ = 5) - || (preg_match('/symbian/i', $user_agent) - && preg_match('/platform/i', $user_agent) - && $browser['majorver'] >= 3) - || (preg_match('/blackberry/i', $user_agent) - && $browser['majorver'] >= 5) - || (preg_match('/opera mobile/i', $user_agent) - && $browser['majorver'] >= 10) - || (preg_match('/opera mini/i', $user_agent) - && $browser['majorver'] >= 5); + // http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 + $user_agent = $_SERVER['HTTP_USER_AGENT']; + return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); } function isFastDevice() { @@ -143,6 +131,7 @@ } return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); } + function endsWith($haystack, $needle, $case = true) { if ($case) {