summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-12-29 19:10:26 +0000
committerDries Buytaert <dries@buytaert.net>2003-12-29 19:10:26 +0000
commitbe2f4058189a54fb2bd1ad8309efa8d75d297b81 (patch)
tree650bb26d634fc8b78bc58881f2bdad575dbccc84 /includes/common.inc
parent286f6188780e17f65279e6ed063e7f51aff6d7e5 (diff)
downloadbrdo-be2f4058189a54fb2bd1ad8309efa8d75d297b81.tar.gz
brdo-be2f4058189a54fb2bd1ad8309efa8d75d297b81.tar.bz2
- Added $fragment identifier to url() and l(). Patch by Goba.
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc29
1 files changed, 18 insertions, 11 deletions
diff --git a/includes/common.inc b/includes/common.inc
index fb2851a0b..fc2c5f192 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -817,7 +817,7 @@ function drupal_get_normal_path($path) {
return $map[$path] ? $map[$path] : $path;
}
-function url($url = NULL, $query = NULL) {
+function url($url = NULL, $query = NULL, $fragment = NULL) {
global $base_url;
static $script;
@@ -835,39 +835,46 @@ function url($url = NULL, $query = NULL) {
$url = $alias;
}
+ if (isset($fragment)) {
+ $fragment = "#$fragment";
+ }
+ else {
+ $fragment = '';
+ }
+
if (variable_get("clean_url", "0") == "0") {
if (isset($url)) {
if (isset($query)) {
- return "$base_url/$script?q=$url&amp;$query";
+ return "$base_url/$script?q=$url&amp;$query$fragment";
}
else {
- return "$base_url/$script?q=$url";
+ return "$base_url/$script?q=$url$fragment";
}
}
else {
if (isset($query)) {
- return "$base_url/$script?$query";
+ return "$base_url/$script?$query$fragment";
}
else {
- return "$base_url/";
+ return "$base_url/$fragment";
}
}
}
else {
if (isset($url)) {
if (isset($query)) {
- return "$base_url/$url?$query";
+ return "$base_url/$url?$query$fragment";
}
else {
- return "$base_url/$url";
+ return "$base_url/$url$fragment";
}
}
else {
if (isset($query)) {
- return "$base_url/$script?$query";
+ return "$base_url/$script?$query$fragment";
}
else {
- return "$base_url/";
+ return "$base_url/$fragment";
}
}
}
@@ -883,8 +890,8 @@ function drupal_attributes($attributes = NULL) {
}
}
-function l($text, $url, $attributes = array(), $query = NULL) {
- return "<a href=\"". url($url, $query) ."\"". drupal_attributes($attributes) .">$text</a>";
+function l($text, $url, $attributes = array(), $query = NULL, $fragment = NULL) {
+ return "<a href=\"". url($url, $query, $fragment) ."\"". drupal_attributes($attributes) .">$text</a>";
}
function field_get($string, $name) {