Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -28,8 +28,9 @@ |
29 | 29 | var $mContainsOldMagic = 0, $mContainsNewMagic = 0; |
30 | 30 | var $mIsArticleRelated = true; |
31 | 31 | protected $mParserOptions = null; // lazy initialised, use parserOptions() |
32 | | - var $mShowFeedLinks = false; |
33 | | - var $mFeedLinksAppendQuery = false; |
| 32 | + |
| 33 | + var $mFeedLinks = array(); |
| 34 | + |
34 | 35 | var $mEnableClientCache = true; |
35 | 36 | var $mArticleBodyOnly = false; |
36 | 37 | |
— | — | @@ -575,14 +576,30 @@ |
576 | 577 | public function isArticle() { return $this->mIsarticle; } |
577 | 578 | public function setPrintable() { $this->mPrintable = true; } |
578 | 579 | public function isPrintable() { return $this->mPrintable; } |
579 | | - public function setSyndicated( $show = true ) { $this->mShowFeedLinks = $show; } |
580 | | - public function isSyndicated() { return $this->mShowFeedLinks; } |
581 | | - public function setFeedAppendQuery( $val ) { $this->mFeedLinksAppendQuery = $val; } |
582 | 580 | public function getFeedAppendQuery() { return $this->mFeedLinksAppendQuery; } |
583 | 581 | public function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; } |
584 | 582 | public function getOnloadHandler() { return $this->mOnloadHandler; } |
585 | 583 | public function disable() { $this->mDoNothing = true; } |
586 | 584 | public function isDisabled() { return $this->mDoNothing; } |
| 585 | + |
| 586 | + public function setSyndicated( $show = true ) { $this->mShowFeedLinks = $show; } |
| 587 | + |
| 588 | + public function setFeedAppendQuery( $val ) { |
| 589 | + global $wgFeedClasses; |
| 590 | + |
| 591 | + $this->mFeedLinks = array(); |
| 592 | + |
| 593 | + foreach( $wgFeedClasses as $type => $class ) { |
| 594 | + $query = "feed=$type&".$val; |
| 595 | + $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query ); |
| 596 | + } |
| 597 | + } |
| 598 | + |
| 599 | + public function addFeedLink( $format, $href ) { |
| 600 | + $this->mFeedLinks[$format] = $href; |
| 601 | + } |
| 602 | + |
| 603 | + public function isSyndicated() { return count($this->mFeedLinks); } |
587 | 604 | |
588 | 605 | public function setArticleRelated( $v ) { |
589 | 606 | $this->mIsArticleRelated = $v; |
— | — | @@ -1916,22 +1933,8 @@ |
1917 | 1934 | * Return URLs for each supported syndication format for this page. |
1918 | 1935 | * @return array associating format keys with URLs |
1919 | 1936 | */ |
1920 | | - public function getSyndicationLinks() { |
1921 | | - global $wgFeedClasses; |
1922 | | - $links = array(); |
1923 | | - |
1924 | | - if( $this->isSyndicated() ) { |
1925 | | - if( is_string( $this->getFeedAppendQuery() ) ) { |
1926 | | - $appendQuery = "&" . $this->getFeedAppendQuery(); |
1927 | | - } else { |
1928 | | - $appendQuery = ""; |
1929 | | - } |
1930 | | - |
1931 | | - foreach( $wgFeedClasses as $format => $class ) { |
1932 | | - $links[$format] = $this->getTitle()->getLocalUrl( "feed=$format{$appendQuery}" ); |
1933 | | - } |
1934 | | - } |
1935 | | - return $links; |
| 1937 | + public function getSyndicationLinks() { |
| 1938 | + return $this->mFeedLinks; |
1936 | 1939 | } |
1937 | 1940 | |
1938 | 1941 | /** |
Index: trunk/phase3/includes/specials/SpecialWatchlist.php |
— | — | @@ -13,6 +13,21 @@ |
14 | 14 | global $wgUser, $wgOut, $wgLang, $wgRequest; |
15 | 15 | global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker; |
16 | 16 | global $wgEnotifWatchlist; |
| 17 | + |
| 18 | + // Add feed links |
| 19 | + $wlToken = $wgUser->getOption( 'watchlisttoken' ); |
| 20 | + if ($wlToken) { |
| 21 | + global $wgServer, $wgScriptPath, $wgFeedClasses; |
| 22 | + $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev', |
| 23 | + 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken ); |
| 24 | + $feedTemplate = $wgServer . '/' . $wgScriptPath . '/api.php?'; |
| 25 | + |
| 26 | + foreach( $wgFeedClasses as $format => $class ) { |
| 27 | + $theseParams = $apiParams + array( 'feedformat' => $format ); |
| 28 | + $url = $feedTemplate . wfArrayToCGI( $theseParams ); |
| 29 | + $wgOut->addFeedLink( $format, $url ); |
| 30 | + } |
| 31 | + } |
17 | 32 | |
18 | 33 | $skin = $wgUser->getSkin(); |
19 | 34 | $specialTitle = SpecialPage::getTitleFor( 'Watchlist' ); |