From d40bb1e98df3e347b12e56a8f0134255086f0464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Sun, 27 Jan 2008 19:57:36 +0000 Subject: #207330 by c960657: allow custom URL rewriter to work on base_url and fix urlencoding of front page URL with a path prefix --- includes/common.inc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 34758a397..b8900736e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -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 '' links to the default front page. - if (!empty($path) && $path != '') { - 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 == '') { + $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']) { -- cgit v1.2.3