function mobile_tools_create_mobile_url in Mobile Tools 7.2
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 mobile_tools.module \mobile_tools_create_mobile_url()
- 6.2 mobile_tools.module \mobile_tools_create_mobile_url()
Helper function to assist in making a mobile url (m.*) from a given url
Parameters
$url: orginal url
Return value
the mobile url
1 call 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
File
- ./
mobile_tools.admin.inc, line 387 - Adminstrative pages for Mobile Tools
Code
function mobile_tools_create_mobile_url($url) {
// @todo replace with a PURL provider definition
$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';
}
}