From a58d877108f6b7ff6712c6261815c6092c7f6949 Mon Sep 17 00:00:00 2001 From: Neil Drumm <drumm@3064.no-reply.drupal.org> Date: Wed, 23 Aug 2006 05:55:38 +0000 Subject: [PATCH] #66569 by m3avrck. Put all the feed icons in the same place. --- includes/common.inc | 28 +++++++++++++++++++ includes/theme.inc | 1 + modules/aggregator/aggregator.module | 5 ++-- modules/blog/blog.module | 6 ++-- modules/forum/forum.module | 2 +- modules/node/node.module | 4 ++- modules/taxonomy/taxonomy.module | 2 +- themes/bluemarine/page.tpl.php | 1 + themes/chameleon/chameleon.theme | 1 + themes/engines/phptemplate/phptemplate.engine | 1 + themes/pushbutton/page.tpl.php | 3 +- 11 files changed, 44 insertions(+), 10 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 79bf69b0ea76..c9de3a4344ac 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -148,6 +148,34 @@ function drupal_get_headers() { return drupal_set_header(); } +/* + * Add a feed URL for the current page. + * + * @param $url + * The url for the feed + * @param $theme_function + * The name of the theming function to use to style the feed icon, defaults to theme_feed_icon() + */ +function drupal_add_feed($url = NULL, $theme_function = 'feed_icon') { + static $stored_feed_links = array(); + + if (!is_null($url)) { + $stored_feed_links[$url] = theme($theme_function, $url); + } + return $stored_feed_links; +} + +/** + * Get the feed URLs for the current page. + * + * @param $delimiter + * The delimiter to split feeds by + */ +function drupal_get_feeds($delimiter = "\n") { + $feeds = drupal_add_feed(); + return implode($feeds, $delimiter); +} + /** * @name HTTP handling * @{ diff --git a/includes/theme.inc b/includes/theme.inc index 2635c4e14486..124f187d7db9 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -387,6 +387,7 @@ function theme_page($content) { $output .= "\n<!-- begin content -->\n"; $output .= $content; + $output .= drupal_get_feeds(); $output .= "\n<!-- end content -->\n"; $output .= '</td></tr></table>'; diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index bcd08b8ef80a..e32f95c993b4 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -1085,11 +1085,12 @@ function aggregator_page_list($sql, $header, $categorize) { // arg(1) is undefined if we are at the top aggregator URL // is there a better way to do this? if (!arg(1)) { - $form['feed_icon'] = array('#value' => theme('feed_icon', url('aggregator/rss'))); + drupal_add_feed(url('aggregator/rss')); } elseif (arg(1) == 'categories' && arg(2) && !arg(3)) { - $form['feed_icon'] = array('#value' => theme('feed_icon', url('aggregator/rss/' . arg(2)))); + drupal_add_feed(url('aggregator/rss/'. arg(2))); } + return $form; } diff --git a/modules/blog/blog.module b/modules/blog/blog.module index b4892e738dd9..b0227e66d8cc 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -163,7 +163,7 @@ function blog_page_user($uid) { $output .= node_view(node_load($node->nid), 1); } $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); - $output .= theme('feed_icon', url("blog/$account->uid/feed")); + drupal_add_feed(url('blog/'. $account->uid .'/feed')); drupal_add_link(array('rel' => 'alternate', 'type' => 'application/rss+xml', @@ -190,7 +190,7 @@ function blog_page_last() { $output .= node_view(node_load($node->nid), 1); } $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); - $output .= theme('feed_icon', url('blog/feed')); + drupal_add_feed(url('blog/feed')); drupal_add_link(array('rel' => 'alternate', 'type' => 'application/rss+xml', @@ -310,5 +310,3 @@ function blog_block($op = 'list', $delta = 0) { } } } - - diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 71cf6c960a84..32dc7ebe17cb 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -936,7 +936,7 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p 'href' => url('taxonomy/term/'. $tid .'/0/feed'))); $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page); - $output .= theme('feed_icon', url("taxonomy/term/$tid/0/feed")); + drupal_add_feed(url('taxonomy/term/'. $tid .'/0/feed')); } $output .= '</div>'; } diff --git a/modules/node/node.module b/modules/node/node.module index b8ed3c4e2adb..237354ab8b9f 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -2256,10 +2256,12 @@ function node_page_default() { $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10)); if (db_num_rows($result)) { + $feed_url = url('rss.xml', NULL, NULL, TRUE); + drupal_add_feed($feed_url); drupal_add_link(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => t('RSS'), - 'href' => url('rss.xml', NULL, NULL, TRUE))); + 'href' => $feed_url)); $output = ''; while ($node = db_fetch_object($result)) { diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 6d93a43fce94..18ba091b3126 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -1257,7 +1257,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { 'href' => url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'))); $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE)); - $output .= theme('feed_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed')); + drupal_add_feed(url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed')); return $output; break; diff --git a/themes/bluemarine/page.tpl.php b/themes/bluemarine/page.tpl.php index 385df6fa9dbe..88b255398926 100644 --- a/themes/bluemarine/page.tpl.php +++ b/themes/bluemarine/page.tpl.php @@ -43,6 +43,7 @@ <?php print $help ?> <?php print $messages ?> <?php print $content; ?> + <?php print $feed_icons; ?> </div> </td> <?php if ($sidebar_right) { ?><td id="sidebar-right"> diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme index 056ffdf4c55e..9ffa50ef0228 100644 --- a/themes/chameleon/chameleon.theme +++ b/themes/chameleon/chameleon.theme @@ -92,6 +92,7 @@ function chameleon_page($content) { $output .= "\n<!-- begin content -->\n"; $output .= $content; + $output .= drupal_get_feeds(); $output .= "\n<!-- end content -->\n"; if ($footer = variable_get('site_footer', '')) { diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine index 7533888fccb7..744563ad9b98 100644 --- a/themes/engines/phptemplate/phptemplate.engine +++ b/themes/engines/phptemplate/phptemplate.engine @@ -196,6 +196,7 @@ function phptemplate_page($content) { 'breadcrumb' => theme('breadcrumb', drupal_get_breadcrumb()), 'closure' => theme('closure'), 'content' => '<!-- begin content -->' . $content . '<!-- end content -->', + 'feed_icons' => drupal_get_feeds(), 'footer_message' => filter_xss_admin(variable_get('site_footer', FALSE)) . "\n" . theme('blocks', 'footer'), 'head' => drupal_get_html_head(), 'head_title' => implode(' | ', $head_title), diff --git a/themes/pushbutton/page.tpl.php b/themes/pushbutton/page.tpl.php index 3b8219556d14..cdfe447716ca 100644 --- a/themes/pushbutton/page.tpl.php +++ b/themes/pushbutton/page.tpl.php @@ -81,7 +81,8 @@ <?php endif; ?> <!-- start main content --> - <?php print($content) ?> + <?php print $content; ?> + <?php print $feed_icons; ?> <!-- end main content --> </div><!-- main --> -- GitLab