Commit d40bb1e9 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#207330 by c960657: allow custom URL rewriter to work on base_url and fix...

#207330 by c960657: allow custom URL rewriter to work on base_url and fix urlencoding of front page URL with a path prefix
parent ba739984
......@@ -1314,27 +1314,27 @@ function url($path = NULL, $options = array()) {
// The base_url might be rewritten from the language rewrite in domain mode.
$options['base_url'] = $base_url;
}
$base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
// Preserve the original path before aliasing.
$original_path = $path;
// The special path '<front>' links to the default front page.
if (!empty($path) && $path != '<front>') {
if (!$options['alias']) {
$path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
}
if (function_exists('custom_url_rewrite_outbound')) {
// Modules may alter outbound links by reference.
custom_url_rewrite_outbound($path, $options, $original_path);
}
$path = drupal_urlencode($options['prefix'] . $path);
if ($path == '<front>') {
$path = '';
}
else {
// Will be empty if there is no language prefix.
$path = trim($options['prefix'], '/');
elseif (!empty($path) && !$options['alias']) {
$path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
}
if (function_exists('custom_url_rewrite_outbound')) {
// Modules may alter outbound links by reference.
custom_url_rewrite_outbound($path, $options, $original_path);
}
$base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
$prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
$path = drupal_urlencode($prefix . $path);
if ($clean_url) {
// With Clean URLs.
if ($options['query']) {
......
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