function mobile_tools_init in Mobile Tools 5
Same name and namespace in other branches
- 6.3 mobile_tools.module \mobile_tools_init()
- 6.2 mobile_tools.module \mobile_tools_init()
- 7.3 mobile_tools.module \mobile_tools_init()
- 7.2 mobile_tools.module \mobile_tools_init()
Implementation of hook_boot().
File
- ./
mobile_tools.module, line 101 - Mobile Tools provides a range of functionality assisting in creating a mobile drupal site . this functionality contains:
Code
function mobile_tools_init() {
cache_clear_all(NULL, 'cache_page', TRUE);
global $conf;
global $user;
global $base_url;
// Invoke the hook_is_mobile_device() and hook_is_mobile_site()
$device_detection = variable_get('mobile-tools-device-detection', 'mobile_tools');
if ($device_detection != 'mobile_tools') {
drupal_load('module', $device_detection);
}
$site_detection = variable_get('mobile-tools-site-type-detection', 'mobile_tools');
if ($site_detection != 'mobile_tools') {
drupal_load('module', $site_detection);
}
$_SESSION['mobile-tools-mobile-device'] = module_invoke($device_detection, 'is_mobile_device');
$_SESSION['mobile-tools-site-type'] = module_invoke($site_detection, 'is_mobile_site');
if (variable_get('mobile_tools_enable_redirect', 0) == 1 && variable_get('mobile_tools_mobile_url', mobile_tools_create_mobile_url($base_url)) != variable_get('mobile_tools_desktop_url', $base_url)) {
mobile_tools_detection_boot();
// do the device detection, redirect or generate a notification
}
if (variable_get('mobile_tools_enable_theme', 0)) {
mobile_tools_themes_init();
// changes the theme
}
if (variable_get('mobile_tools_enable_roles', 0)) {
mobile_tools_roles_init();
// assigns the user the mobile role
}
if ($_SESSION['mobile-tools-site-type'] == 'mobile' || variable_get('mobile_tools_handling', '') == 'theme-switch' && $_SESSION['mobile-tools-mobile-device']['type'] == 'mobile') {
variable_set('default_main_nodes', variable_get('default_nodes_main_mobile', 5));
}
else {
variable_set('default_main_nodes', variable_get('default_nodes_main_original', 10));
}
}