function mobile_tools_create_mobile_url in Mobile Tools 6
Same name and namespace in other branches
- 5 mobile_tools.module \mobile_tools_create_mobile_url()
- 6.3 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
2 calls to mobile_tools_create_mobile_url()
- mobile_tools_configuration_form in ./
mobile_tools.admin.inc - Configuration form for the mobile device detection, redirection and notification
- _mobile_tools_site_detection in ./
mobile_tools.module
File
- ./
mobile_tools.module, line 533 - 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'];
}
elseif (count($url) == 2) {
return 'http://m.' . implode('.', $url) . $url_parsed['path'];
}
else {
return 'http://' . implode('.', $url) . $url_parsed['path'] . '/mobile';
}
}