https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113516
Revision: 113516 Author: wikinaut Date: 2012-03-09 20:01: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:Etherpadlite-tracking-category name (= Etherpad). 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/EtherpadLite/EtherpadLite.i18n.php trunk/extensions/EtherpadLite/EtherpadLite.php trunk/extensions/EtherpadLite/EtherpadLite_body.php Modified: trunk/extensions/EtherpadLite/EtherpadLite.i18n.php =================================================================== --- trunk/extensions/EtherpadLite/EtherpadLite.i18n.php 2012-03-09 19:56:27 UTC (rev 113515) +++ trunk/extensions/EtherpadLite/EtherpadLite.i18n.php 2012-03-09 20:01:44 UTC (rev 113516) @@ -13,6 +13,7 @@ */ $messages['en'] = array( 'etherpadlite-desc' => 'Adds <eplite> parser tag to embed one or many Etherpad Lite pads (which are hosted on local or external Etherpad Lite server/s) on pages', + 'etherpadlite-tracking-category' => 'Etherpad', 'etherpadlite-invalid-pad-url' => '"$1" is not a valid Etherpad Lite URL or pad name.', 'etherpadlite-url-is-not-whitelisted' => '"$1" is not in the whitelist of allowed Etherpad Lite servers. {{PLURAL:$3|$2 is the only allowed server|The allowed servers are as follows: $2}}.', 'etherpadlite-empty-whitelist' => '"$1" is not in the whitelist of allowed Etherpad Lite servers. There are no allowed servers in the whitelist.', @@ -32,6 +33,7 @@ * $1 is a URL not in the whitelist for Etherpad Lite servers.', 'etherpadlite-pad-used-more-than-once' => 'Error if users try to show multiple frames of the very same pad. Each pad must be unique on a wiki page. Parameters: * $1 is a full pad URL (server/padid).', + 'etherpadlite-tracking-category' => 'The name of a category for all pages which use the <eplite> parser extension tag. The category is automatically added unless the feature is disabled.', ); /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) Modified: trunk/extensions/EtherpadLite/EtherpadLite.php =================================================================== --- trunk/extensions/EtherpadLite/EtherpadLite.php 2012-03-09 19:56:27 UTC (rev 113515) +++ trunk/extensions/EtherpadLite/EtherpadLite.php 2012-03-09 20:01:44 UTC (rev 113516) @@ -64,7 +64,7 @@ 'path' => __FILE__, 'name' => 'EtherpadLite', 'author' => array( 'Thomas Gries' ), - 'version' => '1.11 20120219', + 'version' => '1.12 20120309', 'url' => 'https://www.mediawiki.org/wiki/Extension:EtherpadLite', 'descriptionmsg' => 'etherpadlite-desc', ); @@ -104,3 +104,20 @@ # include "*" if you expressly want to allow all urls (you should not do this) # $wgEtherpadLiteUrlWhitelist = array( "*" ); + +// 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:etherpadlite-tracking-category]] (default) +// $wgEtherpadLiteTrackingCategory = true; +// +// you can assign a specific category name [[MediaWiki:Etherpadlite-mycategory]] +// $wgEtherpadLiteTrackingCategory = 'etherpadlite-mycategory'; +// +// you can disable the use of a tracking category +// $wgEtherpadLiteTrackingCategory = false; +$wgEtherpadLiteTrackingCategory = true; Modified: trunk/extensions/EtherpadLite/EtherpadLite_body.php =================================================================== --- trunk/extensions/EtherpadLite/EtherpadLite_body.php 2012-03-09 19:56:27 UTC (rev 113515) +++ trunk/extensions/EtherpadLite/EtherpadLite_body.php 2012-03-09 20:01:44 UTC (rev 113516) @@ -39,7 +39,7 @@ global $wgEtherpadLiteDefaultPadUrl, $wgEtherpadLiteDefaultWidth, $wgEtherpadLiteDefaultHeight, $wgEtherpadLiteMonospacedFont, $wgEtherpadLiteShowControls, $wgEtherpadLiteShowLineNumbers, $wgEtherpadLiteShowChat, $wgEtherpadLiteShowAuthorColors, $wgEtherpadLiteUrlWhitelist, - $wgEtherpadLitePadsOnThisPage; + $wgEtherpadLitePadsOnThisPage, $wgEtherpadLiteTrackingCategory; # check the user input @@ -168,24 +168,30 @@ wfDebug( "EtherpadLite::EtherpadLiteRender $output\n" ); + if ( $wgEtherpadLiteTrackingCategory === true ) { + $parser->addTrackingCategory( 'etherpadlite-tracking-category' ); + } elseif ( is_string( $wgEtherpadLiteTrackingCategory ) ) { + $parser->addTrackingCategory( $wgEtherpadLiteTrackingCategory ); + } + return $output; } /** * Output an error message, all wraped up nicely. - * @param String $errorName The system message that this error is + * @param String $errorMessageName The system message that this error is * @param String|Array $param Error parameter (or parameters) * @return String Html that is the error. */ - private static function EtherpadLiteError( $errorName, $param ) { + private static function EtherpadLiteError( $errorMessageName, $param ) { // Anything from a parser tag should use Content lang for message, // since the cache doesn't vary by user language: do not use wfMsgForContent but wfMsgForContent // The ->parse() part makes everything safe from an escaping standpoint. return Html::rawElement( 'span', array( 'class' => 'error' ), - wfMessage( $errorName )->inContentLanguage()->params( $param )->parse() + "Extension:EtherpadLite: -- Error: " . wfMessage( $errorMessageName )->inContentLanguage()->params( $param )->parse() ); } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs