You are here

mt_browscap.module in Mobile Tools 6.3

File

contrib/mt_browscap/mt_browscap.module
View source
<?php

/**
 *  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 = array_search($info['browser'], $groups);
  }
  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' => 'iPhone',
    'ipod' => 'iPod',
    'android' => 'Android',
    'opera_mini' => 'Opera Mini',
    'blackberry' => 'BlackBerry',
  );
}

/** 
 *
 */

Functions

Namesort descending 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