Commit daaeef0e authored by Dries's avatar Dries

- Partial patch #4927: mass URL aliasing by Goba.
parent 3176e669
......@@ -801,10 +801,14 @@ function form_allowed_tags_text() {
* Given an old url, return the alias.
*/
function drupal_get_path_alias($path) {
$map = drupal_get_path_map();
if ($map) {
return array_search($path, $map);
if (($map = drupal_get_path_map()) && ($newpath = array_search($path, $map))) {
return $newpath;
}
elseif (function_exists("conf_url_rewrite")) {
return conf_url_rewrite($path, 'outgoing');
}
else {
return $path;
}
}
......@@ -812,9 +816,15 @@ function drupal_get_path_alias($path) {
* Given an alias, return the default url.
*/
function drupal_get_normal_path($path) {
$map = drupal_get_path_map();
return $map[$path] ? $map[$path] : $path;
if (($map = drupal_get_path_map()) && isset($map[$path])) {
return $map[$path];
}
elseif (function_exists("conf_url_rewrite")) {
return conf_url_rewrite($path, 'incoming');
}
else {
return $path;
}
}
function url($url = NULL, $query = NULL, $fragment = NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment