function globalredirect_request_path in Global Redirect 7
globalredirect_request_path() is borrowed from request_uri(), but it only ltrim's..
1 call to globalredirect_request_path()
- globalredirect_init in ./
globalredirect.module - Implements hook_init().
File
- ./
globalredirect.module, line 436 - The Global Redirect module redirects for all paths which have aliases but are not using the aliases which reduces the risk of duplicate content.
Code
function globalredirect_request_path() {
if (request_uri()) {
if (isset($_REQUEST['q'])) {
$path = $_REQUEST['q'];
}
else {
// This is a request using a clean URL. Extract the path from REQUEST_URI.
$request_path = strtok(request_uri(), '?');
$base_path_len = drupal_strlen(rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/'));
// Unescape and strip $base_path prefix, leaving q without a leading slash.
$path = drupal_substr(urldecode($request_path), $base_path_len + 1);
}
}
else {
// This is the front page.
$path = '';
}
// Under certain conditions Apache's RewriteRule directive prepends the value
// assigned to $_GET['q'] with a slash. Moreover we can always have a trailing
// slash in place, hence we need to normalize $_GET['q'].
$path = ltrim($path, '/');
return $path;
}