<?php
function is_wptouch_user_agent() {
// This needs to match your WP Touch list!!
$useragents = array(
"iphone", // Apple iPhone
"ipod", // Apple iPod touch
"aspen", // iPhone simulator
"dream", // Pre 1.5 Android
"android", // 1.5+ Android
"cupcake", // 1.5+ Android
"blackberry9500", // Storm
"blackberry9530", // Storm
"opera mini", // Experimental
"webos", // Experimental
"incognito", // Other iPhone browser
"webmate" // Other iPhone browser
);
$browser_agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
$is_wptouch_ua = false;
foreach ( $useragents as $useragent ) {
if ( preg_match( "#$useragent#i", $browser_agent ) ) {
$is_wptouch_ua = true;
break;
}
}
return($is_wptouch_ua);
}
global $batcache;
$batcache->unique['wptouch'] = is_wptouch_user_agent();
echo $batcache;
preferences:
33.76 ms | 402 KiB | 5 Q