function mobile_theme_init in Mobile Theme 6
Same name and namespace in other branches
- 5 mobile_theme.module \mobile_theme_init()
Check to see if the user is running on a mobile browser.
File
- ./
mobile_theme.module, line 6
Code
function mobile_theme_init() {
// Retrieve the detection method.
$method = variable_get('mobile_theme_detection', 'mobile_theme_detect_php');
// If the detection method cannot be found, revert to default
if (!function_exists($method)) {
$method = "mobile_theme_detect_php";
}
// Check if the mobile theme is to be used.
$mobile_device = $method();
if ($mobile_device) {
$theme = variable_get('mobile_theme_selection', 'default');
if ($theme != 'default') {
global $custom_theme;
$custom_theme = $theme;
}
}
}