diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-11-09 16:24:46 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-11-09 16:24:46 +0000 |
commit | a6a47a32572c3b71d0c6cf1a2918c0f9d6f8213b (patch) | |
tree | f3951ae48b9bc2e56dad3f093373c8ccd97f8616 | |
parent | 562df8fe43f8794317c974dae463f5470cfdc497 (diff) | |
download | brdo-a6a47a32572c3b71d0c6cf1a2918c0f9d6f8213b.tar.gz brdo-a6a47a32572c3b71d0c6cf1a2918c0f9d6f8213b.tar.bz2 |
- Applied Moshe's "theme head" patch:
"This patch to theme.inc adds the ability for modules to insert HTML
into the <HEAD> section of all web pages. The additional modules in
this directory [ed: blog.module] demonstate possible uses for the
new _head() hook."
-rw-r--r-- | includes/theme.inc | 9 | ||||
-rw-r--r-- | modules/blog.module | 44 | ||||
-rw-r--r-- | modules/blog/blog.module | 44 | ||||
-rw-r--r-- | themes/goofy/goofy.theme | 1 | ||||
-rw-r--r-- | themes/marvin/marvin.theme | 1 | ||||
-rw-r--r-- | 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 = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"; - $output .= "<html><head><title>". variable_get(site_name, "drupal") ."</title></head><body bgcolor=\"$this->background\" text=\"$this->foreground\">"; + $output .= "<html><head><title>". variable_get(site_name, "drupal") ."</title>"; + $output .= theme_head($main); + $output .= "</head><body bgcolor=\"$this->background\" text=\"$this->foreground\">"; $output .= "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\"><tr><td valign=\"top\" width=\"170\">"; 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[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->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() { ?> <p>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 <a href="http://www.scripting.com/">http://www.scripting.com/</a>.</p> @@ -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 .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; - // $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n"; - $output .= "<rss version=\"0.91\">\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 .= "</rss>\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 .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; - $output .= "<rss version=\"0.91\">\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 .= "</rss>\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[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->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() { ?> <p>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 <a href="http://www.scripting.com/">http://www.scripting.com/</a>.</p> @@ -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 .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; - // $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n"; - $output .= "<rss version=\"0.91\">\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 .= "</rss>\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 .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; - $output .= "<rss version=\"0.91\">\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 .= "</rss>\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 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> + <?php print theme_head($main); ?> <title><?php echo ($title ? ($title . " - ") : "") . variable_get(site_name, "drupal"); ?></title> <style type="text/css"> <!-- diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index b169c6ef4..5343193af 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -32,6 +32,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> + <?php print theme_head($main); ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title> <?php diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index a1e6683eb..25249eb2e 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -50,6 +50,7 @@ ?> <HTML> <HEAD> + <?php print theme_head($main); ?> <TITLE><?php echo ($title ? ($title . " - ") : "") . variable_get(site_name, "drupal"); ?></TITLE> <STYLE type="text/css"> <!-- |