diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-27 19:57:36 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-27 19:57:36 +0000 |
commit | d40bb1e98df3e347b12e56a8f0134255086f0464 (patch) | |
tree | 4193de3afe4a4e8cfadd56bb92490ca08c24a5f4 /includes | |
parent | ba7399847faad5edc216d600ba6203011389081e (diff) | |
download | brdo-d40bb1e98df3e347b12e56a8f0134255086f0464.tar.gz brdo-d40bb1e98df3e347b12e56a8f0134255086f0464.tar.bz2 |
#207330 by c960657: allow custom URL rewriter to work on base_url and fix urlencoding of front page URL with a path prefix
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 26 |
1 files changed, 13 insertions, 13 deletions
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 '<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']) { |