Commit a58d8771 authored by drumm's avatar drumm

#66569 by m3avrck. Put all the feed icons in the same place.

parent 32e22f1f
......@@ -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
* @{
......
......@@ -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>';
......
......@@ -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;
}
......
......@@ -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) {
}
}
}
......@@ -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>';
}
......
......@@ -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)) {
......
......@@ -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;
......
......@@ -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">
......
......@@ -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', '')) {
......
......@@ -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),
......
......@@ -81,7 +81,8 @@
<?php endif; ?>
<!-- start main content -->
<?php print($content) ?>
<?php print $content; ?>
<?php print $feed_icons; ?>
<!-- end main content -->
</div><!-- main -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment