You are here

function mobile_tools_boot in Mobile Tools 6.2

Same name and namespace in other branches
  1. 6.3 mobile_tools.module \mobile_tools_boot()
  2. 6 mobile_tools.module \mobile_tools_boot()

Implementation of hook_boot().

File

./mobile_tools.module, line 175
Primarily Drupal hooks.

Code

function mobile_tools_boot() {
  global $mobile_tools_device, $conf;

  // Skip everything in case drush is used
  if (php_sapi_name() == 'cli') {
    return;
  }

  // Get the device object
  $mobile_tools_device = mobile_tools_get_device();

  // First call the redirect function. This will redirect the user if needed
  if (variable_get('mobile_tools_redirect', FALSE)) {
    $redirected = mobile_tools_device_redirect($mobile_tools_device);
  }
  if ($mobile_tools_device['type'] == 'mobile' && mobile_tools_site_type() == 'mobile') {
    $conf['site_frontpage'] = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
  }

  // Switch theme if needed
  $theme_switched = mobile_tools_switch_theme($mobile_tools_device);
}