Commit 2d059380 authored by Dries's avatar Dries

- Patch #66569 by m3avrck: Consolidate the drupal_add_link() calls.

parent 055844e7
......@@ -153,14 +153,19 @@ function drupal_get_headers() {
*
* @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()
* @param $title
* The title of the feed
*/
function drupal_add_feed($url = NULL, $theme_function = 'feed_icon') {
function drupal_add_feed($url = NULL, $title = '') {
static $stored_feed_links = array();
if (!is_null($url)) {
$stored_feed_links[$url] = theme($theme_function, $url);
$stored_feed_links[$url] = theme('feed_icon', $url);
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => $title,
'href' => $url));
}
return $stored_feed_links;
}
......
......@@ -163,12 +163,8 @@ function blog_page_user($uid) {
$output .= node_view(node_load($node->nid), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
drupal_add_feed(url('blog/'. $account->uid .'/feed'));
drupal_add_feed(url('blog/'. $account->uid .'/feed'), t('RSS - !title', array('!title' => $title));
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => t('RSS - !title', array('!title' => $title)),
'href' => url("blog/$account->uid/feed")));
return $output;
}
else {
......@@ -190,12 +186,8 @@ function blog_page_last() {
$output .= node_view(node_load($node->nid), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
drupal_add_feed(url('blog/feed'));
drupal_add_feed(url('blog/feed'), t('RSS - blogs'));
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => t('RSS - blogs'),
'href' => url("blog/feed")));
return $output;
}
......
......@@ -930,13 +930,8 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p
$output .= theme('forum_list', $forums, $parents, $tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => 'RSS - '. $title,
'href' => url('taxonomy/term/'. $tid .'/0/feed')));
$output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
drupal_add_feed(url('taxonomy/term/'. $tid .'/0/feed'));
drupal_add_feed(url('taxonomy/term/'. $tid .'/0/feed'), 'RSS - '. $title);
}
$output .= '</div>';
}
......
......@@ -2257,11 +2257,7 @@ function node_page_default() {
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' => $feed_url));
drupal_add_feed($feed_url, t('RSS'));
$output = '';
while ($node = db_fetch_object($result)) {
......
......@@ -1251,13 +1251,8 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
$breadcrumbs = array_reverse($breadcrumbs);
menu_set_location($breadcrumbs);
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => 'RSS - '. $title,
'href' => url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed')));
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE));
drupal_add_feed(url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'));
drupal_add_feed(url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'), 'RSS - '. $title);
return $output;
break;
......
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