r113508 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113507‎ | r113508 | r113509 >
Date:19:43, 9 March 2012
Author:wikinaut
Status:reverted (Comments)
Tags:gerritmigration 
Comment:
add tracking category feature (enabled by default). Each page using this extensions get automatically the tracking category with MediaWiki:Rss-tracking-category name (= RSS). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki.
Modified paths:
  • /trunk/extensions/RSS/RSS.i18n.php (modified) (history)
  • /trunk/extensions/RSS/RSS.php (modified) (history)
  • /trunk/extensions/RSS/RSSParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RSS/RSSParser.php
@@ -75,7 +75,7 @@
7676 # Get a maximal length for item texts
7777 if ( isset( $args['item-max-length'] ) ) {
7878 $this->ItemMaxLength = $args['item-max-length'];
79 - } elseif ( isset( $wgRSSItemMaxLength ) && is_numeric( $wgRSSItemMaxLength ) ) {
 79+ } elseif ( is_numeric( $wgRSSItemMaxLength ) ) {
8080 $this->ItemMaxLength = $wgRSSItemMaxLength;
8181 }
8282
@@ -328,6 +328,7 @@
329329 * @param $frame the frame param to pass to recursiveTagParse()
330330 */
331331 function renderFeed( $parser, $frame ) {
 332+ global $wgRSSTrackingCategory;
332333
333334 $renderedFeed = '';
334335
@@ -352,6 +353,11 @@
353354 $renderedFeed = $this->sandboxParse( $renderedFeed );
354355
355356 }
 357+ if ( $wgRSSTrackingCategory === true ) {
 358+ $parser->addTrackingCategory( 'rss-tracking-category' );
 359+ } elseif ( is_string( $wgRSSTrackingCategory ) ) {
 360+ $parser->addTrackingCategory( $wgRSSTrackingCategory );
 361+ }
356362
357363 return $renderedFeed;
358364 }
Index: trunk/extensions/RSS/RSS.i18n.php
@@ -14,6 +14,7 @@
1515
1616 $messages['en'] = array(
1717 'rss-desc' => 'Displays RSS feeds on MediaWiki pages in a standard or in user-definable formats using template pages',
 18+ 'rss-tracking-category' => 'RSS',
1819 'rss-error' => 'Failed to load RSS feed from $1: $2',
1920 'rss-empty' => 'Failed to load RSS feed from $1!',
2021 'rss-fetch-nourl' => 'Fetch called without a URL!',
@@ -35,6 +36,7 @@
3637 */
3738 $messages['qqq'] = array(
3839 'rss-invalid-url' => '$1 is the invalid URL for the RSS feed',
 40+ 'rss-tracking-category' => 'The name of a category for all pages which use the <rss> parser extension tag. The category is automatically added unless the feature is disabled.',
3941 'rss-feed' => "; $1
4042 : ''not to be localised''
4143 : The RSS extension substitutes this placeholder with the name of a template page. The content of this template page determines the final layout of the RSS feed on the rendered wiki page. The Extension:RSS currently uses 'MediaWiki:Rss-feed' as default for $1. This means that the content of [[MediaWiki:Rss-feed]] determines how RSS feed items are rendered.
Index: trunk/extensions/RSS/RSS.php
@@ -4,7 +4,7 @@
55 *
66 * @file
77 * @ingroup Extensions
8 - * @version 2.12
 8+ * @version 2.14
99 * @author mutante, Daniel Kinzler, Rdb, Mafs, Thomas Gries, Alxndr, Chris Reigrut, K001
1010 * @author Kellan Elliott-McCrea <kellan@protest.net> -- author of MagpieRSS
1111 * @author Jeroen De Dauw
@@ -14,7 +14,7 @@
1515 * @link http://www.mediawiki.org/wiki/Extension:RSS Documentation
1616 */
1717
18 -define( "EXTENSION_RSS_VERSION", "2.12 20120307" );
 18+define( "EXTENSION_RSS_VERSION", "2.14 20120309" );
1919
2020 if ( !defined( 'MEDIAWIKI' ) ) {
2121 die( "This is not a valid entry point.\n" );
@@ -102,3 +102,16 @@
103103 // If you want to see images in feed items, then you need to globally allow
104104 // image tags in your wiki by using the MediaWiki parameter; default: false
105105 // $wgAllowImageTag = true;
 106+
 107+// Parameter to enable the automatic tracking category
 108+// for all pages using this parser extension
 109+//
 110+// Category name [[MediaWiki:Rss-tracking-category]] (default)
 111+// $wgRSSTrackingCategory = true;
 112+//
 113+// you can assign a specific category name [[MediaWiki:Rss-mycategory]]
 114+// $wgRSSTrackingCategory = 'rss-mycategory';
 115+//
 116+// you can disable the use of a tracking category
 117+// $wgRSSTrackingCategory = false;
 118+$wgRSSTrackingCategory = true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r113510follow up r113508 : escaped html tag brackets to make translaters happywikinaut19:50, 9 March 2012
r114168removed the redundant code for handling tracking categories. By using '-' for...wikinaut18:56, 19 March 2012
r114390Revert r111347, r111348, r111350, r111351, r111515, r111816, r112243, r112251......catrope18:40, 21 March 2012

Comments

#Comment by 😂 (talk | contribs)   05:01, 21 March 2012

Rather than defaulting to true and having an extra comparison, wouldn't it be simpler to just default to the string?

#Comment by 😂 (talk | contribs)   05:04, 21 March 2012

Nevermind, got it in the followup r114168

#Comment by Wikinaut (talk | contribs)   06:55, 21 March 2012

Info: tracking category _parameter_ removed in r114168.

Status & tagging log