#207330 by c960657: allow custom URL rewriter to work on base_url and fix urlencoding of front page URL with a path prefix

6.x
Gábor Hojtsy 2008-01-27 19:57:36 +00:00
parent ba7399847f
commit d40bb1e98d
1 changed files with 13 additions and 13 deletions

View File

@ -1314,26 +1314,26 @@ function url($path = NULL, $options = array()) {
// The base_url might be rewritten from the language rewrite in domain mode. // The base_url might be rewritten from the language rewrite in domain mode.
$options['base_url'] = $base_url; $options['base_url'] = $base_url;
} }
$base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
// Preserve the original path before aliasing. // Preserve the original path before aliasing.
$original_path = $path; $original_path = $path;
// The special path '<front>' links to the default front page. // The special path '<front>' links to the default front page.
if (!empty($path) && $path != '<front>') { if ($path == '<front>') {
if (!$options['alias']) { $path = '';
}
elseif (!empty($path) && !$options['alias']) {
$path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : ''); $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
} }
if (function_exists('custom_url_rewrite_outbound')) { if (function_exists('custom_url_rewrite_outbound')) {
// Modules may alter outbound links by reference. // Modules may alter outbound links by reference.
custom_url_rewrite_outbound($path, $options, $original_path); custom_url_rewrite_outbound($path, $options, $original_path);
} }
$path = drupal_urlencode($options['prefix'] . $path);
} $base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
else { $prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
// Will be empty if there is no language prefix. $path = drupal_urlencode($prefix . $path);
$path = trim($options['prefix'], '/');
}
if ($clean_url) { if ($clean_url) {
// With Clean URLs. // With Clean URLs.