mt_browscap.module in Mobile Tools 5
Same filename and directory in other branches
Implements mobile_tools module hooks to integrate with the browsercap module
File
contrib/mt_browscap/mt_browscap.moduleView source
<?php
/**
* @file
* Implements mobile_tools module hooks to integrate with the browsercap module
*/
/**
* Implementation of hook_is_mobile_device() provide by Mobile Tools module
*
*/
function mt_browscap_is_mobile_device() {
$info = browscap_get_browser();
// detect device type
if ($info['ismobiledevice']) {
$type = 'mobile';
}
else {
$type = 'desktop';
}
$groups = mt_browscap_device_groups();
$group = '';
if (in_array($info['browser'], $groups)) {
$group = $info['browser'];
}
return array(
'type' => $type,
'group' => $group,
);
}
/**
* Implementation of hook_device_groups() as provided by Mobile Tools module
*/
function mt_browscap_device_groups() {
return array(
'iPhone',
'iPod',
'Android',
'Opera Mini',
'BlackBerry',
);
}
Functions
Name | Description |
---|---|
mt_browscap_device_groups | Implementation of hook_device_groups() as provided by Mobile Tools module |
mt_browscap_is_mobile_device | Implementation of hook_is_mobile_device() provide by Mobile Tools module |