Created
May 16, 2016 21:26
-
-
Save brs14ku/b5ba23761d9ac12791d7c4810c505d97 to your computer and use it in GitHub Desktop.
mobile detect batcache variant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mysite_is_mobile() | |
{ | |
$isMobile = preg_match("#(ipod|iphone|android|opera mini|blackberry|pre/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)#i", $_SERVER['HTTP_USER_AGENT'] ); | |
return $isMobile == 1 ? true : false; | |
} | |
$batcache->unique['mobile'] = mysite_is_mobile(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment