Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -116,10 +116,14 @@ |
117 | 117 | } |
118 | 118 | |
119 | 119 | // Add RSS/atom links |
120 | | - $this->setSyndicated(); |
121 | | - $feedType = $wgRequest->getVal( 'feed' ); |
122 | | - if( $feedType ) { |
123 | | - return $this->feed( $feedType ); |
| 120 | + global $wgFeedClasses; |
| 121 | + $apiParams = array( 'action' => 'feedcontributions', 'user' => $wgUser->getName() ); |
| 122 | + $feedTemplate = wfScript( 'api' ) . '?'; |
| 123 | + |
| 124 | + foreach( $wgFeedClasses as $format => $class ) { |
| 125 | + $theseParams = $apiParams + array( 'feedformat' => $format ); |
| 126 | + $url = $feedTemplate . wfArrayToCGI( $theseParams ); |
| 127 | + $wgOut->addFeedLink( $format, $url ); |
124 | 128 | } |
125 | 129 | |
126 | 130 | if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) { |
— | — | @@ -150,7 +154,6 @@ |
151 | 155 | } |
152 | 156 | $wgOut->preventClickjacking( $pager->getPreventClickjacking() ); |
153 | 157 | |
154 | | - |
155 | 158 | # Show the appropriate "footer" message - WHOIS tools, etc. |
156 | 159 | if( $target != 'newbies' ) { |
157 | 160 | $message = 'sp-contributions-footer'; |
— | — | @@ -173,12 +176,6 @@ |
174 | 177 | } |
175 | 178 | } |
176 | 179 | |
177 | | - protected function setSyndicated() { |
178 | | - global $wgOut; |
179 | | - $wgOut->setSyndicated( true ); |
180 | | - $wgOut->setFeedAppendQuery( wfArrayToCGI( $this->opts ) ); |
181 | | - } |
182 | | - |
183 | 180 | /** |
184 | 181 | * Generates the subheading with links |
185 | 182 | * @param $nt Title object for the target |
— | — | @@ -411,103 +408,6 @@ |
412 | 409 | Xml::closeElement( 'form' ); |
413 | 410 | return $f; |
414 | 411 | } |
415 | | - |
416 | | - /** |
417 | | - * Output a subscription feed listing recent edits to this page. |
418 | | - * @param $type String |
419 | | - */ |
420 | | - protected function feed( $type ) { |
421 | | - global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgOut; |
422 | | - |
423 | | - if( !$wgFeed ) { |
424 | | - $wgOut->addWikiMsg( 'feed-unavailable' ); |
425 | | - return; |
426 | | - } |
427 | | - |
428 | | - if( !isset( $wgFeedClasses[$type] ) ) { |
429 | | - $wgOut->addWikiMsg( 'feed-invalid' ); |
430 | | - return; |
431 | | - } |
432 | | - |
433 | | - $feed = new $wgFeedClasses[$type]( |
434 | | - $this->feedTitle(), |
435 | | - wfMsgExt( 'tagline', 'parsemag' ), |
436 | | - $this->getTitle()->getFullUrl() . "/" . urlencode($this->opts['target']) |
437 | | - ); |
438 | | - |
439 | | - // Already valid title |
440 | | - $nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] ); |
441 | | - $target = $this->opts['target'] == 'newbies' ? 'newbies' : $nt->getText(); |
442 | | - |
443 | | - $pager = new ContribsPager( array( |
444 | | - 'target' => $target, |
445 | | - 'namespace' => $this->opts['namespace'], |
446 | | - 'year' => $this->opts['year'], |
447 | | - 'month' => $this->opts['month'], |
448 | | - 'tagFilter' => $this->opts['tagFilter'], |
449 | | - 'deletedOnly' => $this->opts['deletedOnly'], |
450 | | - 'topOnly' => $this->opts['topOnly'], |
451 | | - 'showSizeDiff' => $this->opts['showSizeDiff'], |
452 | | - ) ); |
453 | | - |
454 | | - $pager->mLimit = min( $this->opts['limit'], $wgFeedLimit ); |
455 | | - |
456 | | - $feed->outHeader(); |
457 | | - if( $pager->getNumRows() > 0 ) { |
458 | | - foreach ( $pager->mResult as $row ) { |
459 | | - $feed->outItem( $this->feedItem( $row ) ); |
460 | | - } |
461 | | - } |
462 | | - $feed->outFooter(); |
463 | | - } |
464 | | - |
465 | | - protected function feedTitle() { |
466 | | - global $wgLanguageCode, $wgSitename; |
467 | | - $desc = $this->getDescription(); |
468 | | - return "$wgSitename - $desc [$wgLanguageCode]"; |
469 | | - } |
470 | | - |
471 | | - protected function feedItem( $row ) { |
472 | | - $title = Title::MakeTitle( intval( $row->page_namespace ), $row->page_title ); |
473 | | - if( $title ) { |
474 | | - $date = $row->rev_timestamp; |
475 | | - $comments = $title->getTalkPage()->getFullURL(); |
476 | | - $revision = Revision::newFromTitle( $title, $row->rev_id ); |
477 | | - |
478 | | - return new FeedItem( |
479 | | - $title->getPrefixedText(), |
480 | | - $this->feedItemDesc( $revision ), |
481 | | - $title->getFullURL(), |
482 | | - $date, |
483 | | - $this->feedItemAuthor( $revision ), |
484 | | - $comments |
485 | | - ); |
486 | | - } else { |
487 | | - return null; |
488 | | - } |
489 | | - } |
490 | | - |
491 | | - /** |
492 | | - * @param $revision Revision |
493 | | - * @return string |
494 | | - */ |
495 | | - protected function feedItemAuthor( $revision ) { |
496 | | - return $revision->getUserText(); |
497 | | - } |
498 | | - |
499 | | - /** |
500 | | - * @param $revision Revision |
501 | | - * @return string |
502 | | - */ |
503 | | - protected function feedItemDesc( $revision ) { |
504 | | - if( $revision ) { |
505 | | - return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) . |
506 | | - htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . |
507 | | - "</p>\n<hr />\n<div>" . |
508 | | - nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>"; |
509 | | - } |
510 | | - return ''; |
511 | | - } |
512 | 412 | } |
513 | 413 | |
514 | 414 | /** |