http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89566
Revision: 89566
Author: reedy
Date: 2011-06-06 14:56:47 +0000 (Mon, 06 Jun 2011)
Log Message:
-----------
Followup r89564
Strip out the ?feed= functionality, update urls to point at the API!
Modified Paths:
--------------
trunk/phase3/includes/specials/SpecialContributions.php
Modified: trunk/phase3/includes/specials/SpecialContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialContributions.php 2011-06-06
14:53:32 UTC (rev 89565)
+++ trunk/phase3/includes/specials/SpecialContributions.php 2011-06-06
14:56:47 UTC (rev 89566)
@@ -116,10 +116,14 @@
}
// Add RSS/atom links
- $this->setSyndicated();
- $feedType = $wgRequest->getVal( 'feed' );
- if( $feedType ) {
- return $this->feed( $feedType );
+ global $wgFeedClasses;
+ $apiParams = array( 'action' => 'feedcontributions', 'user' =>
$wgUser->getName() );
+ $feedTemplate = wfScript( 'api' ) . '?';
+
+ foreach( $wgFeedClasses as $format => $class ) {
+ $theseParams = $apiParams + array( 'feedformat' =>
$format );
+ $url = $feedTemplate . wfArrayToCGI( $theseParams );
+ $wgOut->addFeedLink( $format, $url );
}
if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array(
$id ) ) ) {
@@ -150,7 +154,6 @@
}
$wgOut->preventClickjacking(
$pager->getPreventClickjacking() );
-
# Show the appropriate "footer" message - WHOIS tools,
etc.
if( $target != 'newbies' ) {
$message = 'sp-contributions-footer';
@@ -173,12 +176,6 @@
}
}
- protected function setSyndicated() {
- global $wgOut;
- $wgOut->setSyndicated( true );
- $wgOut->setFeedAppendQuery( wfArrayToCGI( $this->opts ) );
- }
-
/**
* Generates the subheading with links
* @param $nt Title object for the target
@@ -411,103 +408,6 @@
Xml::closeElement( 'form' );
return $f;
}
-
- /**
- * Output a subscription feed listing recent edits to this page.
- * @param $type String
- */
- protected function feed( $type ) {
- global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgOut;
-
- if( !$wgFeed ) {
- $wgOut->addWikiMsg( 'feed-unavailable' );
- return;
- }
-
- if( !isset( $wgFeedClasses[$type] ) ) {
- $wgOut->addWikiMsg( 'feed-invalid' );
- return;
- }
-
- $feed = new $wgFeedClasses[$type](
- $this->feedTitle(),
- wfMsgExt( 'tagline', 'parsemag' ),
- $this->getTitle()->getFullUrl() . "/" .
urlencode($this->opts['target'])
- );
-
- // Already valid title
- $nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] );
- $target = $this->opts['target'] == 'newbies' ? 'newbies' :
$nt->getText();
-
- $pager = new ContribsPager( array(
- 'target' => $target,
- 'namespace' => $this->opts['namespace'],
- 'year' => $this->opts['year'],
- 'month' => $this->opts['month'],
- 'tagFilter' => $this->opts['tagFilter'],
- 'deletedOnly' => $this->opts['deletedOnly'],
- 'topOnly' => $this->opts['topOnly'],
- 'showSizeDiff' => $this->opts['showSizeDiff'],
- ) );
-
- $pager->mLimit = min( $this->opts['limit'], $wgFeedLimit );
-
- $feed->outHeader();
- if( $pager->getNumRows() > 0 ) {
- foreach ( $pager->mResult as $row ) {
- $feed->outItem( $this->feedItem( $row ) );
- }
- }
- $feed->outFooter();
- }
-
- protected function feedTitle() {
- global $wgLanguageCode, $wgSitename;
- $desc = $this->getDescription();
- return "$wgSitename - $desc [$wgLanguageCode]";
- }
-
- protected function feedItem( $row ) {
- $title = Title::MakeTitle( intval( $row->page_namespace ),
$row->page_title );
- if( $title ) {
- $date = $row->rev_timestamp;
- $comments = $title->getTalkPage()->getFullURL();
- $revision = Revision::newFromTitle( $title,
$row->rev_id );
-
- return new FeedItem(
- $title->getPrefixedText(),
- $this->feedItemDesc( $revision ),
- $title->getFullURL(),
- $date,
- $this->feedItemAuthor( $revision ),
- $comments
- );
- } else {
- return null;
- }
- }
-
- /**
- * @param $revision Revision
- * @return string
- */
- protected function feedItemAuthor( $revision ) {
- return $revision->getUserText();
- }
-
- /**
- * @param $revision Revision
- * @return string
- */
- protected function feedItemDesc( $revision ) {
- if( $revision ) {
- return '<p>' . htmlspecialchars(
$revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
- htmlspecialchars( FeedItem::stripComment(
$revision->getComment() ) ) .
- "</p>\n<hr />\n<div>" .
- nl2br( htmlspecialchars( $revision->getText() )
) . "</div>";
- }
- return '';
- }
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs