function detectAppleMobile($query = '') { $container = $_SERVER['HTTP_USER_AGENT']; // The below prints out the user agent array. Uncomment to see it shown on the page. // print_r($container); $this->applemobile = false; $useragents = bnc_wptouch_get_user_agents(); $exclude_agents = bnc_wptouch_get_exclude_user_agents(); $devfile = compat_get_plugin_dir('wptouch') . '/include/developer.mode'; foreach ($useragents as $useragent) { if (preg_match("#{$useragent}#i", $container) || file_exists($devfile)) { $this->applemobile = true; break; } } if ($this->applemobile && !file_exists($devfile)) { foreach ($exclude_agents as $agent) { if (preg_match("#{$agent}#i", $container)) { $this->applemobile = false; break; } } } }
function detectAppleMobile($query = '') { $container = $_SERVER['HTTP_USER_AGENT']; // The below prints out the user agent array. Uncomment to see it shown on the page. // print_r($container); $this->applemobile = false; $useragents = bnc_wptouch_get_user_agents(); $exclude_agents = bnc_wptouch_get_exclude_user_agents(); foreach ($useragents as $useragent) { if (preg_match("#{$useragent}#i", $container)) { $this->applemobile = true; break; } } if ($this->applemobile) { foreach ($exclude_agents as $agent) { if (preg_match("#{$agent}#i", $container)) { $this->applemobile = false; break; } } } }
function wp_super_cache_wptouch_browsers($browsers) { global $cache_wptouch, $wptouch_exclude_ua, $wp_cache_config_file; if (false == function_exists('bnc_wptouch_get_exclude_user_agents') || false == function_exists('bnc_wptouch_get_user_agents')) { return $browsers; } $browsers = implode(',', bnc_wptouch_get_exclude_user_agents()); // hack, support exclude agents too if ($browsers != $wptouch_exclude_ua) { wp_cache_replace_line('^ *\\$wptouch_exclude_ua', "\$wptouch_exclude_ua = '{$browsers}';", $wp_cache_config_file); $wptouch_exclude_ua = $browsers; } return bnc_wptouch_get_user_agents(); }