forked from extern/egroupware
Added mobile browser detection function
This commit is contained in:
parent
6c1e8e0d06
commit
a4730b3511
@ -1523,5 +1523,29 @@ class html
|
||||
}
|
||||
return $html2ret;
|
||||
}
|
||||
|
||||
|
||||
static private $mobileBrowser = null;
|
||||
|
||||
/**
|
||||
* Returns whether this is a mobile browser
|
||||
*/
|
||||
static public function is_mobile()
|
||||
{
|
||||
$agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
if (self::$mobileBrowser == null) {
|
||||
|
||||
self::$mobileBrowser = false;
|
||||
|
||||
foreach(array('iPhone','iPad','Android','SymbianOS') as $pattern)
|
||||
{
|
||||
self::$mobileBrowser |= (stripos($agent,$pattern) !== false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
//return self::$mobileBrowser;
|
||||
}
|
||||
}
|
||||
html::_init_static();
|
||||
|
Loading…
Reference in New Issue
Block a user