You are here

function mobile_tools_init in Mobile Tools 6.2

Same name and namespace in other branches
  1. 5 mobile_tools.module \mobile_tools_init()
  2. 6.3 mobile_tools.module \mobile_tools_init()
  3. 7.3 mobile_tools.module \mobile_tools_init()
  4. 7.2 mobile_tools.module \mobile_tools_init()

Implementation of hook_init().

File

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

Code

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

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

  // Some small extras
  if (mobile_tools_site_type() == 'mobile') {
    $conf['default_nodes_main'] = variable_get('default_nodes_main_mobile', variable_get('default_nodes_main', 10));
  }

  // Set the content
  if (module_exists('context')) {
    $plugin = context_get_plugin('condition', 'mobile');
    if (!empty($plugin) && is_object($plugin)) {
      $device = mobile_tools_get_device();
      $plugin
        ->execute($device['type']);
      $plugin
        ->execute($device['group']);
    }
  }

  // Initialize i18n variables so they are retrieved before non-translated variables.
  if (module_exists('i18n')) {
    i18n_variable_init();
  }
}