You are here

function mt_browscap_is_mobile_device in Mobile Tools 6.3

Same name and namespace in other branches
  1. 5 contrib/mt_browscap/mt_browscap.module \mt_browscap_is_mobile_device()
  2. 6 contrib/mt_browscap/mt_browscap.module \mt_browscap_is_mobile_device()

Implementation of hook_is_mobile_device() provide by Mobile Tools module

File

contrib/mt_browscap/mt_browscap.module, line 8

Code

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 = array_search($info['browser'], $groups);
  }
  return array(
    'type' => $type,
    'group' => $group,
  );
}