https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113508
Revision: 113508 Author: wikinaut Date: 2012-03-09 19:43:44 +0000 (Fri, 09 Mar 2012) Log Message: ----------- 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 trunk/extensions/RSS/RSS.php trunk/extensions/RSS/RSSParser.php Modified: trunk/extensions/RSS/RSS.i18n.php =================================================================== --- trunk/extensions/RSS/RSS.i18n.php 2012-03-09 19:42:01 UTC (rev 113507) +++ trunk/extensions/RSS/RSS.i18n.php 2012-03-09 19:43:44 UTC (rev 113508) @@ -14,6 +14,7 @@ $messages['en'] = array( 'rss-desc' => 'Displays RSS feeds on MediaWiki pages in a standard or in user-definable formats using template pages', + 'rss-tracking-category' => 'RSS', 'rss-error' => 'Failed to load RSS feed from $1: $2', 'rss-empty' => 'Failed to load RSS feed from $1!', 'rss-fetch-nourl' => 'Fetch called without a URL!', @@ -35,6 +36,7 @@ */ $messages['qqq'] = array( 'rss-invalid-url' => '$1 is the invalid URL for the RSS feed', + '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.', 'rss-feed' => "; $1 : ''not to be localised'' : 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. Modified: trunk/extensions/RSS/RSS.php =================================================================== --- trunk/extensions/RSS/RSS.php 2012-03-09 19:42:01 UTC (rev 113507) +++ trunk/extensions/RSS/RSS.php 2012-03-09 19:43:44 UTC (rev 113508) @@ -4,7 +4,7 @@ * * @file * @ingroup Extensions - * @version 2.12 + * @version 2.14 * @author mutante, Daniel Kinzler, Rdb, Mafs, Thomas Gries, Alxndr, Chris Reigrut, K001 * @author Kellan Elliott-McCrea <kel...@protest.net> -- author of MagpieRSS * @author Jeroen De Dauw @@ -14,7 +14,7 @@ * @link http://www.mediawiki.org/wiki/Extension:RSS Documentation */ -define( "EXTENSION_RSS_VERSION", "2.12 20120307" ); +define( "EXTENSION_RSS_VERSION", "2.14 20120309" ); if ( !defined( 'MEDIAWIKI' ) ) { die( "This is not a valid entry point.\n" ); @@ -102,3 +102,16 @@ // If you want to see images in feed items, then you need to globally allow // image tags in your wiki by using the MediaWiki parameter; default: false // $wgAllowImageTag = true; + +// Parameter to enable the automatic tracking category +// for all pages using this parser extension +// +// Category name [[MediaWiki:Rss-tracking-category]] (default) +// $wgRSSTrackingCategory = true; +// +// you can assign a specific category name [[MediaWiki:Rss-mycategory]] +// $wgRSSTrackingCategory = 'rss-mycategory'; +// +// you can disable the use of a tracking category +// $wgRSSTrackingCategory = false; +$wgRSSTrackingCategory = true; Modified: trunk/extensions/RSS/RSSParser.php =================================================================== --- trunk/extensions/RSS/RSSParser.php 2012-03-09 19:42:01 UTC (rev 113507) +++ trunk/extensions/RSS/RSSParser.php 2012-03-09 19:43:44 UTC (rev 113508) @@ -75,7 +75,7 @@ # Get a maximal length for item texts if ( isset( $args['item-max-length'] ) ) { $this->ItemMaxLength = $args['item-max-length']; - } elseif ( isset( $wgRSSItemMaxLength ) && is_numeric( $wgRSSItemMaxLength ) ) { + } elseif ( is_numeric( $wgRSSItemMaxLength ) ) { $this->ItemMaxLength = $wgRSSItemMaxLength; } @@ -328,6 +328,7 @@ * @param $frame the frame param to pass to recursiveTagParse() */ function renderFeed( $parser, $frame ) { + global $wgRSSTrackingCategory; $renderedFeed = ''; @@ -352,6 +353,11 @@ $renderedFeed = $this->sandboxParse( $renderedFeed ); } + if ( $wgRSSTrackingCategory === true ) { + $parser->addTrackingCategory( 'rss-tracking-category' ); + } elseif ( is_string( $wgRSSTrackingCategory ) ) { + $parser->addTrackingCategory( $wgRSSTrackingCategory ); + } return $renderedFeed; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs