r106930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106929‎ | r106930 | r106931 >
Date:08:10, 21 December 2011
Author:maxsem
Status:ok
Tags:
Comment:
Renamed parameter 'channel' into 'feed' for clarity
Modified paths:
  • /trunk/extensions/FeaturedFeeds/ApiFeaturedFeeds.php (modified) (history)
  • /trunk/extensions/FeaturedFeeds/FeaturedFeeds.body.php (modified) (history)
  • /trunk/extensions/FeaturedFeeds/FeaturedFeedsWMF.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FeaturedFeeds/ApiFeaturedFeeds.php
@@ -28,10 +28,10 @@
2929 $this->dieUsage( 'Invalid language code', 'language-invalid' );
3030 }
3131 $feeds = FeaturedFeeds::getFeeds( $language );
32 - $ourFeed = $feeds[$params['channel']];
 32+ $ourFeed = $feeds[$params['feed']];
3333
3434 $feedClass = new $wgFeedClasses[$params['feedformat']] (
35 - $ourFeed['name'],
 35+ $ourFeed['title'],
3636 $ourFeed['description'],
3737 FeaturedFeeds::getFeedURL( $ourFeed, $params['feedformat'] )
3838 );
@@ -49,7 +49,7 @@
5050 ApiBase::PARAM_DFLT => 'rss',
5151 ApiBase::PARAM_TYPE => $feedFormatNames
5252 ),
53 - 'channel' => array(
 53+ 'feed' => array(
5454 ApiBase::PARAM_TYPE => $availableFeeds,
5555 ApiBase::PARAM_REQUIRED => true,
5656 ),
@@ -62,7 +62,7 @@
6363 public function getParamDescription() {
6464 return array(
6565 'feedformat' => 'The format of the feed',
66 - 'channel' => 'Feed channel',
 66+ 'feed' => 'Feed name',
6767 'language' => 'Feed language code. Ignored by some feeds.'
6868 );
6969 }
@@ -80,22 +80,22 @@
8181
8282 public function getExamples() {
8383 global $wgVersion;
84 - // attempt to find a valid channel name
 84+ // attempt to find a valid feed name
8585 // if none available, just use an example value
8686 $availableFeeds = array_keys( FeaturedFeeds::getFeeds( false ) );
87 - $channel = reset( $availableFeeds );
88 - if ( !$channel ) {
89 - $channel = 'featured';
 87+ $feed = reset( $availableFeeds );
 88+ if ( !$feed ) {
 89+ $feed = 'featured';
9090 }
9191
9292 if ( version_compare( $wgVersion, '1.19alpha', '>=' ) ) {
9393 return array(
94 - "api.php?action=featuredfeed&channel=$channel" => "Retrieve feed for channel `$channel'",
 94+ "api.php?action=featuredfeed&feed=$feed" => "Retrieve feed `$feed'",
9595 );
9696 } else {
9797 return array(
98 - "Retrieve feed for channel `$channel'",
99 - " api.php?action=featuredfeed&channel=$channel",
 98+ "Retrieve feed `$feed'",
 99+ " api.php?action=featuredfeed&feed=$feed",
100100 );
101101 }
102102 }
Index: trunk/extensions/FeaturedFeeds/FeaturedFeedsWMF.php
@@ -15,13 +15,13 @@
1616 $media = array(
1717 'potd' => array( // Picture Of The Day
1818 'page' => 'ffeed-potd-page',
19 - 'feedName' => 'ffeed-potd-title',
 19+ 'title' => 'ffeed-potd-title',
2020 'description' => 'ffeed-potd-desc',
2121 'entryName' => 'ffeed-potd-entry',
2222 ),
2323 'motd' => array( // Media Of The Day
2424 'page' => 'ffeed-motd-page',
25 - 'feedName' => 'ffeed-motd-title',
 25+ 'title' => 'ffeed-motd-title',
2626 'description' => 'ffeed-motd-desc',
2727 'entryName' => 'ffeed-motd-entry',
2828 ),
@@ -31,13 +31,13 @@
3232 $feeds += array(
3333 'featured' => array(
3434 'page' => 'ffeed-fa-page',
35 - 'feedName' => 'ffeed-fa-title',
 35+ 'title' => 'ffeed-fa-title',
3636 'description' => 'ffeed-fa-desc',
3737 'entryName' => 'ffeed-fa-entry',
3838 ),
3939 'onthisday' => array(
4040 'page' => 'ffeed-onthisday-page',
41 - 'feedName' => 'ffeed-onthisday-title',
 41+ 'title' => 'ffeed-onthisday-title',
4242 'description' => 'ffeed-onthisday-desc',
4343 'entryName' => 'ffeed-onthisday-entry',
4444 ),
Index: trunk/extensions/FeaturedFeeds/FeaturedFeeds.body.php
@@ -46,7 +46,7 @@
4747 $out->addLink( array(
4848 'rel' => 'alternate',
4949 'type' => "application/$type+xml",
50 - 'title' => $feed['name'],
 50+ 'title' => $feed['title'],
5151 'href' => self::getFeedURL( $feed, $type ),
5252 ) );
5353 }
@@ -76,7 +76,7 @@
7777 $requestedLang = Language::factory( $langCode );
7878 $parser = new Parser();
7979 foreach ( $feedDefs as $name => $opts ) {
80 - $feed = array( 'channel' => $name );
 80+ $feed = array( 'name' => $name );
8181
8282 $pageMsg = wfMessage( $opts['page'] )->inContentLanguage();
8383 if ( $pageMsg->isDisabled() ) {
@@ -87,7 +87,7 @@
8888 $feed['inUserLanguage'] = $opts['inUserLanguage'];
8989 $lang = $opts['inUserLanguage'] ? $requestedLang : $wgContLang;
9090 $feed['language'] = $lang->getCode();
91 - $feed['name'] = wfMessage( $opts['feedName'] )->inLanguage( $lang )->text();
 91+ $feed['title'] = wfMessage( $opts['title'] )->inLanguage( $lang )->text();
9292 $feed['description'] = wfMessage( $opts['description'] )->inLanguage( $lang )->text();
9393 $entryName = wfMessage( $opts['entryName'] )->inLanguage( $lang )->plain();
9494 $feed['entries'] = array();
@@ -158,7 +158,7 @@
159159
160160 $options = array(
161161 'action' => 'featuredfeed',
162 - 'channel' => $feed['channel'],
 162+ 'feed' => $feed['name'],
163163 'feedformat' => $format,
164164 );
165165 if ( $feed['inUserLanguage'] && $feed['language'] != $wgContLang->getCode() ) {

Status & tagging log