From 6fc2070a22cda40d174db205847dca4c214eeea6 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 14 Jan 2004 22:30:09 +0000 Subject: Patch 5114 by Kjartan: - Adds drupal_set_header() and drupal_get_headers(). - Cache now stores custom headers. - Replace theme_head() with drupal_get_html_head(), added drupal_set_html_head(). - Added RSS autodiscover links to node, blog and taxonomy pages. --- includes/common.inc | 70 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 10 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 55f3e6520..26e0d1681 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -87,6 +87,36 @@ function drupal_get_breadcrumb() { } /* @} */ +/** + * @name HTML head contents + * @ingroup common + * + * Set and get output that should be in the \ tag. + * @{ + */ + +function drupal_set_html_head($data = NULL) { + static $stored_head; + + if (!is_null($data)) { + $stored_head .= "$data\n"; + } + return $stored_head; +} + +function drupal_get_html_head() { + global $base_url; + + $output = ""; + $output .= "\n"; + $output .= "\n"; + + return $output . drupal_set_html_head(); +} +/* @} */ + /** * @name URL path * @ingroup common @@ -123,6 +153,28 @@ function drupal_rebuild_path_map() { * @{ */ +/** + * @name HTTP headers + * @ingroup common + * + * Functions to get and set the HTTP headers of the current page. + * @{ + */ +function drupal_set_header($header = NULL) { + static $stored_headers; + + if (!is_null($header)) { + header($header); + $stored_headers .= "$header\n"; + } + return $stored_headers; +} + +function drupal_get_headers() { + return drupal_set_header(); +} +/* @} */ + /** * HTTP redirects. Makes sure the redirected url is formatted correctly and * includes the session ID. @@ -915,8 +967,6 @@ function drupal_get_normal_path($path) { } function url($url = NULL, $query = NULL, $fragment = NULL) { - global $base_url; - static $script; if (empty($script)) { @@ -939,36 +989,36 @@ function url($url = NULL, $query = NULL, $fragment = NULL) { if (variable_get("clean_url", "0") == "0") { if (isset($url)) { if (isset($query)) { - return "$base_url/$script?q=$url&$query$fragment"; + return "$script?q=$url&$query$fragment"; } else { - return "$base_url/$script?q=$url$fragment"; + return "$script?q=$url$fragment"; } } else { if (isset($query)) { - return "$base_url/$script?$query$fragment"; + return "$script?$query$fragment"; } else { - return "$base_url/$fragment"; + return "$fragment"; } } } else { if (isset($url)) { if (isset($query)) { - return "$base_url/$url?$query$fragment"; + return "$url?$query$fragment"; } else { - return "$base_url/$url$fragment"; + return "$url$fragment"; } } else { if (isset($query)) { - return "$base_url/$script?$query$fragment"; + return "$script?$query$fragment"; } else { - return "$base_url/$fragment"; + return "$fragment"; } } } -- cgit v1.2.3