From a6a47a32572c3b71d0c6cf1a2918c0f9d6f8213b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 9 Nov 2002 16:24:46 +0000 Subject: - Applied Moshe's "theme head" patch: "This patch to theme.inc adds the ability for modules to insert HTML into the section of all web pages. The additional modules in this directory [ed: blog.module] demonstate possible uses for the new _head() hook." --- includes/theme.inc | 9 ++++++++- modules/blog.module | 44 ++++++++++++++++++-------------------------- modules/blog/blog.module | 44 ++++++++++++++++++-------------------------- themes/goofy/goofy.theme | 1 + themes/marvin/marvin.theme | 1 + themes/unconed/unconed.theme | 1 + 6 files changed, 47 insertions(+), 53 deletions(-) diff --git a/includes/theme.inc b/includes/theme.inc index e153258af..a8659ab5e 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -20,7 +20,9 @@ class BaseTheme { function header($title = "") { $output = "\n"; - $output .= "". variable_get(site_name, "drupal") ."background\" text=\"$this->foreground\">"; + $output .= "". variable_get(site_name, "drupal") .""; + $output .= theme_head($main); + $output .= "background\" text=\"$this->foreground\">"; $output .= "
"; print $output; @@ -122,6 +124,11 @@ function theme_list() { return $list; } +function theme_head($main = 0) { + $head = module_invoke_all("head", $main); + return "\n". implode($head, "\n"). "\n"; +} + function theme_init() { global $user; diff --git a/modules/blog.module b/modules/blog.module index b603884fc..865bdbe87 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -6,7 +6,6 @@ function blog_system($field){ return $system[$field]; } - function blog_conf_options() { $output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 55, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.")); $words = t("words"); @@ -45,6 +44,16 @@ function blog_access($op, $node) { } +function blog_head($main = 0) { + global $id, $mod; + + if ($mod && $id) { + $account = user_load(array("uid" => $id)); + $output[] = "name. "'s blog\" href=\"". path_uri(). "module.php?mod=blog&op=view&id=$id\" />"; + } + return $output ? $output : array(); +} + function blog_user($type, &$edit, &$user) { switch ($type) { case "view_public": @@ -92,7 +101,6 @@ function blog_save($op, $node) { } - function blog_help() { ?>

Drupal's blog module allows registered users to maintain an online blog, often referred to as an online journal or diary. They can be filled with daily thoughts, poetry, boneless blabber, spiritual theories, intimate details, valuable experiences, cynical rants, semi-coherent comments, writing experiments, artistic babblings, critics on current facts, fresh insights, diverse dreams, chronicles and mumbling madness available for public consumption. It is made up of individual entries that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen, or agree/disagree with. A typical example of a long term blog can be seen at http://www.scripting.com/.

@@ -117,37 +125,21 @@ function blog_feed_user($uid = 0, $date = 0) { } $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.created > '". ($date - 2592000) ."' ORDER BY n.nid DESC LIMIT 15"); - while ($blog = db_fetch_object($result)) { - $items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser); - } - $output .= "\n"; - // $output .= "\n"; - $output .= "\n"; - $output .= format_rss_channel("$account->name's blog", path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => $account->uid), "module"), "$account->name's blog", $items); - $output .= "\n"; - - header("Content-Type: text/xml"); - - print $output; + $channel["title"] = $account->name. "'s blog"; + $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view", "id" => $uid), "module"); + $channel["description"] = $term->description; + node_feed($result, $channel); } function blog_feed_last() { $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 15"); - while ($blog = db_fetch_object($result)) { - $items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser); - } - - $output .= "\n"; - $output .= "\n"; - $output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() . drupal_url(array("mod" => "blog"), "module"), "Recently updated blogs.", $items); - $output .= "\n"; - - header("Content-Type: text/xml"); - - print $output; + $channel["title"] = variable_get("site_name", "drupal"). "blogs"; + $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view"), "module"); + $channel["description"] = $term->description; + node_feed($result, $channel); } diff --git a/modules/blog/blog.module b/modules/blog/blog.module index b603884fc..865bdbe87 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -6,7 +6,6 @@ function blog_system($field){ return $system[$field]; } - function blog_conf_options() { $output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 55, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.")); $words = t("words"); @@ -45,6 +44,16 @@ function blog_access($op, $node) { } +function blog_head($main = 0) { + global $id, $mod; + + if ($mod && $id) { + $account = user_load(array("uid" => $id)); + $output[] = "name. "'s blog\" href=\"". path_uri(). "module.php?mod=blog&op=view&id=$id\" />"; + } + return $output ? $output : array(); +} + function blog_user($type, &$edit, &$user) { switch ($type) { case "view_public": @@ -92,7 +101,6 @@ function blog_save($op, $node) { } - function blog_help() { ?>

Drupal's blog module allows registered users to maintain an online blog, often referred to as an online journal or diary. They can be filled with daily thoughts, poetry, boneless blabber, spiritual theories, intimate details, valuable experiences, cynical rants, semi-coherent comments, writing experiments, artistic babblings, critics on current facts, fresh insights, diverse dreams, chronicles and mumbling madness available for public consumption. It is made up of individual entries that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen, or agree/disagree with. A typical example of a long term blog can be seen at http://www.scripting.com/.

@@ -117,37 +125,21 @@ function blog_feed_user($uid = 0, $date = 0) { } $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.created > '". ($date - 2592000) ."' ORDER BY n.nid DESC LIMIT 15"); - while ($blog = db_fetch_object($result)) { - $items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser); - } - $output .= "\n"; - // $output .= "\n"; - $output .= "\n"; - $output .= format_rss_channel("$account->name's blog", path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => $account->uid), "module"), "$account->name's blog", $items); - $output .= "\n"; - - header("Content-Type: text/xml"); - - print $output; + $channel["title"] = $account->name. "'s blog"; + $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view", "id" => $uid), "module"); + $channel["description"] = $term->description; + node_feed($result, $channel); } function blog_feed_last() { $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 15"); - while ($blog = db_fetch_object($result)) { - $items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser); - } - - $output .= "\n"; - $output .= "\n"; - $output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() . drupal_url(array("mod" => "blog"), "module"), "Recently updated blogs.", $items); - $output .= "\n"; - - header("Content-Type: text/xml"); - - print $output; + $channel["title"] = variable_get("site_name", "drupal"). "blogs"; + $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view"), "module"); + $channel["description"] = $term->description; + node_feed($result, $channel); } diff --git a/themes/goofy/goofy.theme b/themes/goofy/goofy.theme index 3c938f96c..8dd71630c 100644 --- a/themes/goofy/goofy.theme +++ b/themes/goofy/goofy.theme @@ -30,6 +30,7 @@ + <?php echo ($title ? ($title . " - ") : "") . variable_get(site_name, "drupal"); ?>