<?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 = "iphone";
$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 md5(serialize($batcache->unique));
preferences:
48.12 ms | 402 KiB | 5 Q