You are here

function mobile_tools_browscap_activate in Mobile Tools 7.3

Device group activation callback.

Parameters

object $device_group: Device group to consider for activation

Return value

boolean Return TRUE if the redirect should occur, FALSE otherwise.

2 string references to 'mobile_tools_browscap_activate'
mobile_tools_browscap_mobile_tools_device_detector_info in mobile_tools_browscap/mobile_tools_browscap.module
Implements hook_mobile_tools_device_detector_info().
mobile_tools_default_mobile_tools_device_groups in ./mobile_tools.default_mobile_tools_device_group.inc
Implements hook_default_mobile_tools_device_groups().

File

mobile_tools_browscap/mobile_tools_browscap.module, line 19
Integrate the device detection in Browscap with Mobile Tools

Code

function mobile_tools_browscap_activate($device_group) {
  $browser = browscap_get_browser();
  $redirect = FALSE;

  // Get the redirect state
  // Check for a match on the parent
  $redirect = _mobile_tools_browscap_match_parent($browser, $device_group);

  // If no match, try the user agent specifically
  if (FALSE === $redirect) {
    $redirect = _mobile_tools_browscap_match_useragent($browser, $device_group);
  }

  // @todo continue cascade of any matchable items
  return $redirect;
}