function mobile_tools_menu_switch_site in Mobile Tools 6.2
Same name and namespace in other branches
- 6.3 mobile_tools.module \mobile_tools_menu_switch_site()
Redirect the user to the right path.
1 string reference to 'mobile_tools_menu_switch_site'
- mobile_tools_menu in ./
mobile_tools.module - Implementation of hook_menu().
File
- ./
mobile_tools.module, line 109 - Primarily Drupal hooks.
Code
function mobile_tools_menu_switch_site() {
$args = arg();
array_shift($args);
$site = array_shift($args);
$path = implode('/', $args);
// In case of redirect, we already redirect to the target url
if (variable_get('mobile_tools_redirect', FALSE)) {
if ($site == 'desktop') {
$url = variable_get('mobile_tools_desktop_url', '') . '/' . $path;
}
else {
$url = variable_get('mobile_tools_mobile_url', '') . '/' . $path;
}
}
else {
$url = $path;
}
$querystring = drupal_query_string_encode(array_merge($_GET, array(
'device' => $site,
)), array(
'q',
));
drupal_goto($url, $querystring);
}