From dd53b4bdb8db05749c9be16a913a7efebfb1d546 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Mon, 24 Sep 2007 04:43:23 +0000 Subject: [PATCH] (bug 5412) Add feed links for the site (i.e., Recentchanges) to all pages. --- RELEASE-NOTES | 1 + includes/OutputPage.php | 23 +++++++++++++++++++++-- includes/SpecialRecentchanges.php | 2 -- languages/messages/MessagesEn.php | 4 ++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4445e08aab..2c5fe6a4b9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -27,6 +27,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 11136) If using Postgres, search path is explicitly set if wgDBmwschema is not set to 'mediawiki', allowing multiple mediawiki instances per user. * (bug 11151) Add descriptive to revision history page +* (bug 5412) Add feed links for the site to all pages === Bug fixes in 1.12 === diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 60cf395204..9fa2d409ad 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1277,12 +1277,31 @@ class OutputPage { } $ret .= " />\n"; } + + # Recent changes feed should appear on every page + global $wgSitename; + $rctitle = SpecialPage::getTitleFor( 'Recentchanges' ); + $link = $rctitle->escapeFullURL( 'feed=rss' ); + $title = wfMsg( 'site-rss-feed', $wgSitename ); + $ret .= "<link rel='alternate' type='application/rss+xml' title='$title' href='$link' />\n"; + $link = $rctitle->escapeFullURL( 'feed=atom' ); + $title = wfMsg( 'site-atom-feed', $wgSitename ); + $ret .= "<link rel='alternate' type='application/atom+xml' title='$title' href='$link' />\n"; + if( $this->isSyndicated() ) { # FIXME: centralize the mime-type and name information in Feed.php $link = $wgRequest->escapeAppendQuery( 'feed=rss' ); - $ret .= "<link rel='alternate' type='application/rss+xml' title='RSS 2.0' href='$link' />\n"; + # Use the page name for the title (accessed through $wgTitle since + # there's no other way). In principle, this could lead to issues + # with having the same name for different feeds corresponding to + # the same page, but we can't avoid that at this low a level. + global $wgTitle; + $pagetitle = $wgTitle->getPrefixedText(); + $title = wfMsg( 'page-rss-feed', $pagetitle ); + $ret .= "<link rel='alternate' type='application/rss+xml' title='$title' href='$link' />\n"; $link = $wgRequest->escapeAppendQuery( 'feed=atom' ); - $ret .= "<link rel='alternate' type='application/atom+xml' title='Atom 1.0' href='$link' />\n"; + $title = wfMsg( 'page-atom-feed', $pagetitle ); + $ret .= "<link rel='alternate' type='application/atom+xml' title='$title' href='$link' />\n"; } return $ret; diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index 2d70209d9c..2744cd8f55 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -220,8 +220,6 @@ function wfSpecialRecentchanges( $par, $specialPage ) { } // And now for the content - $wgOut->setSyndicated( true ); - $list = ChangesList::newFromUser( $wgUser ); if ( $wgAllowCategorizedRecentChanges ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 0d01970da4..bb35d61604 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -706,6 +706,10 @@ XHTML id names. 'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}', 'feedlinks' => 'Feed:', 'feed-invalid' => 'Invalid subscription feed type.', +'site-rss-feed' => '$1 RSS Feed', +'site-atom-feed' => '$1 Atom Feed', +'page-rss-feed' => '"$1" RSS Feed', +'page-atom-feed' => '"$1" Atom Feed', 'feed-atom' => 'Atom', # only translate this message to other languages if you have to change it 'feed-rss' => 'RSS', # only translate this message to other languages if you have to change it 'sitenotice' => '-', # the equivalent to wgSiteNotice; don't translate or duplicate this message to other languages -- 2.20.1