function mobile_tools_create_mobile_url in Mobile Tools 5
Same name and namespace in other branches
- 6.3 mobile_tools.module \mobile_tools_create_mobile_url()
- 6 mobile_tools.module \mobile_tools_create_mobile_url()
- 6.2 mobile_tools.module \mobile_tools_create_mobile_url()
- 7.2 mobile_tools.admin.inc \mobile_tools_create_mobile_url()
Helper function to assist in making a mobile url (m.*) from a given url
@parm $url orginal url
Return value
the mobile url
5 calls to mobile_tools_create_mobile_url()
- mobile_tools_detection_boot in ./
mobile_tools.module - Being called in the hook_init() implementation This function is in charge of device detection, redirection or displaying a notification
- mobile_tools_detection_configuration_form in ./
mobile_tools.module - Configuration form for the mobile device detection, redirection and notification
- mobile_tools_init in ./
mobile_tools.module - Implementation of hook_boot().
- mobile_tools_token_values in ./
mobile_tools.module - Implementation of the hook_token_values().
- _mobile_tools_site_detection in ./
mobile_tools.module
File
- ./
mobile_tools.module, line 985 - Mobile Tools provides a range of functionality assisting in creating a mobile drupal site . this functionality contains:
Code
function mobile_tools_create_mobile_url($url) {
$url_parsed = parse_url($url);
if (!array_key_exists('path', $url_parsed)) {
$url_parsed['path'] = "";
}
$url = $url_parsed['host'];
$url = explode('.', $url);
if (count($url) == 3) {
$url[0] = 'm';
return 'http://' . implode('.', $url) . $url_parsed['path'];
}
else {
if (count($url) == 2) {
return 'http://m.' . implode('.', $url) . $url_parsed['path'];
}
else {
return 'http://' . implode('.', $url) . $url_parsed['path'] . '/mobile';
}
}
}