http://www.mediawiki.org/wiki/Special:Code/MediaWiki/55016
Revision: 55016 Author: siebrand Date: 2009-08-14 13:20:59 +0000 (Fri, 14 Aug 2009) Log Message: ----------- * Autoincrement, OnlineStatus, and PSINoTocNum: new style magic words * Autoincrement: add extension description in i18n file, reindent * bump versions where applicable * add support for localisation to Translate extension (also for Maps magic words) Modified Paths: -------------- trunk/extensions/Autoincrement/Autoincrement.php trunk/extensions/OnlineStatus/OnlineStatus.php trunk/extensions/PSINoTocNum/PSINoTocNum.php trunk/extensions/Translate/groups/mediawiki-defines.txt Added Paths: ----------- trunk/extensions/Autoincrement/Autoincrement.i18n.magic.php trunk/extensions/Autoincrement/Autoincrement.i18n.php trunk/extensions/OnlineStatus/OnlineStatus.i18n.magic.php trunk/extensions/PSINoTocNum/PSINoTocNum.i18n.magic.php Added: trunk/extensions/Autoincrement/Autoincrement.i18n.magic.php =================================================================== --- trunk/extensions/Autoincrement/Autoincrement.i18n.magic.php (rev 0) +++ trunk/extensions/Autoincrement/Autoincrement.i18n.magic.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -0,0 +1,7 @@ +<?php + +$magicWords = array(); + +$magicWords['en'] = array( + 'autoincrement' => array( 0, 'AUTOINCREMENT' ), +); Property changes on: trunk/extensions/Autoincrement/Autoincrement.i18n.magic.php ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/extensions/Autoincrement/Autoincrement.i18n.php =================================================================== --- trunk/extensions/Autoincrement/Autoincrement.i18n.php (rev 0) +++ trunk/extensions/Autoincrement/Autoincrement.i18n.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -0,0 +1,7 @@ +<?php + +$messages = array(); + +$messages['en'] = array( + 'autoincrement-desc' => 'A variable hook that adds the autoincrementing variable <nowiki>{{AUTOINCREMENT}}</nowiki>', +); Property changes on: trunk/extensions/Autoincrement/Autoincrement.i18n.php ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: trunk/extensions/Autoincrement/Autoincrement.php =================================================================== --- trunk/extensions/Autoincrement/Autoincrement.php 2009-08-14 13:18:23 UTC (rev 55015) +++ trunk/extensions/Autoincrement/Autoincrement.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -14,40 +14,31 @@ $wgExtensionCredits['variable'][] = array( 'path' => __FILE__, 'name' => 'Autoincrement', - 'description' => 'a variable hook that adds an autoincrementing variable, <nowiki>{{AUTOINCREMENT}}</nowiki>', 'author' => 'Ævar Arnfjörð Bjarmason', + 'description' => 'A variable hook that adds an autoincrementing variable, <nowiki>{{AUTOINCREMENT}}</nowiki>', + 'description-desc' => 'autoincrement-desc', 'url' => 'http://www.mediawiki.org/wiki/Extension:Autoincrement', ); +$dir = dirname(__FILE__) . '/'; +$wgExtensionMessagesFiles['Autoincrement'] = $dir . 'Autoincrement.i18n.php'; +$wgExtensionMessagesFiles['AutoincrementMagic'] = $dir . 'Autoincrement.i18n.magic.php'; + class Autoincrement { var $mCount; - + function Autoincrement() { global $wgHooks; - + $this->mCount = 0; - - $wgHooks['MagicWordwgVariableIDs'][] = array( $this, 'wfAutoincrementHookVariables' ); - $wgHooks['LanguageGetMagic'][] = array( $this, 'wfAutoincrementHookRaw' ); + $wgHooks['ParserGetVariableValueSwitch'][] = array( $this, 'wfAutoincrementHookSwitch' ); } - - function wfAutoincrementHookVariables( &$wgVariableIDs ) { - $wgVariableIDs[] = 'autoincrement'; - return true; - } - - function wfAutoincrementHookRaw( &$raw ) { - $raw['autoincrement'] = array( 0, 'AUTOINCREMENT' ); - - return true; - } - function wfAutoincrementHookSwitch( &$parser, &$varCache, &$index, &$ret ) { if ( $index === 'autoincrement' ) $ret = ++$this->mCount; // No formatNum() just like url autonumbering - + return true; } } Added: trunk/extensions/OnlineStatus/OnlineStatus.i18n.magic.php =================================================================== --- trunk/extensions/OnlineStatus/OnlineStatus.i18n.magic.php (rev 0) +++ trunk/extensions/OnlineStatus/OnlineStatus.i18n.magic.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -0,0 +1,9 @@ +<?php + +$magicWords = array(); + +$magicWords['en'] = array( + 'onlinestatus_word' => array( 1, 'ONLINESTATUS' ), + 'onlinestatus_word_raw' => array( 1, 'RAWONLINESTATUS' ), + 'anyuseronlinestatus' => array( 0, 'anyuseronlinestatus' ), +); Property changes on: trunk/extensions/OnlineStatus/OnlineStatus.i18n.magic.php ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: trunk/extensions/OnlineStatus/OnlineStatus.php =================================================================== --- trunk/extensions/OnlineStatus/OnlineStatus.php 2009-08-14 13:18:23 UTC (rev 55015) +++ trunk/extensions/OnlineStatus/OnlineStatus.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -4,7 +4,7 @@ * Extension that adds a new toggle in user preferences to show if the user is * aviabled or not. See http://mediawiki.org/wiki/Extension:OnlineStatus for * more informations. - * Require MediaWiki 1.15 alpha r49790 or higher to work. + * Require MediaWiki 1.16 alpha r52503 or higher to work. * * @addtogroup Extensions * @author Alexandre Emsenhuber @@ -17,7 +17,7 @@ 'name' => 'OnlineStatus', 'author' => 'Alexandre Emsenhuber', 'url' => 'http://www.mediawiki.org/wiki/Extension:OnlineStatus', - 'version' => '2009-04-25', + 'version' => '2009-08-14', 'description' => 'Add a preference to show if the user is currently present or not on the wiki', 'descriptionmsg' => 'onlinestatus-desc', ); @@ -37,22 +37,20 @@ $wgDefaultUserOptions['onlineonlogin'] = 1; $wgDefaultUserOptions['offlineonlogout'] = 1; +// Add messages files +$wgExtensionMessagesFiles['OnlineStatus'] = dirname( __FILE__ ) . '/OnlineStatus.i18n.php'; +$wgExtensionMessagesFiles['OnlineStatusMagic'] = dirname( __FILE__ ) . '/OnlineStatus.i18n.magic.php'; // FIXME: Should be a separate class file class OnlineStatus { - + // FIXME: Can't this just be in the core bit instead of the class? The init() will not have to be called static function init(){ - global $wgExtensionMessagesFiles, $wgExtensionFunctions, $wgHooks, $wgAjaxExportList; + global $wgExtensionFunctions, $wgHooks, $wgAjaxExportList; - // Add messages file - $wgExtensionMessagesFiles['OnlineStatus'] = dirname( __FILE__ ) . '/OnlineStatus.i18n.php'; - // Hooks for the Parser $wgHooks['ParserFirstCallInit'][] = 'OnlineStatus::ParserFirstCallInit'; // Magic words hooks - $wgHooks['MagicWordwgVariableIDs'][] = 'OnlineStatus::MagicWordVariable'; - $wgHooks['LanguageGetMagic'][] = 'OnlineStatus::LanguageGetMagic'; $wgHooks['ParserGetVariableValueSwitch'][] = 'OnlineStatus::ParserGetVariable'; // Hooks for Special:Preferences @@ -169,26 +167,6 @@ } /** - * Hook function for MagicWordwgVariableIDs - */ - static function MagicWordVariable( &$magicWords ) { - $magicWords[] = 'onlinestatus_word'; - $magicWords[] = 'onlinestatus_word_raw'; - return true; - } - - /** - * Hook function for LanguageGetMagic - * @todo maybe allow localisation - */ - static function LanguageGetMagic( &$magicWords, $langCode ) { - $magicWords['onlinestatus_word'] = array( 1, 'ONLINESTATUS' ); - $magicWords['onlinestatus_word_raw'] = array( 1, 'RAWONLINESTATUS' ); - $magicWords['anyuseronlinestatus'] = array( 0, 'anyuseronlinestatus' ); - return true; - } - - /** * Hook function for ParserGetVariableValueSwitch */ static function ParserGetVariable( &$parser, &$varCache, &$index, &$ret ){ Added: trunk/extensions/PSINoTocNum/PSINoTocNum.i18n.magic.php =================================================================== --- trunk/extensions/PSINoTocNum/PSINoTocNum.i18n.magic.php (rev 0) +++ trunk/extensions/PSINoTocNum/PSINoTocNum.i18n.magic.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -0,0 +1,7 @@ +<?php + +$magicWords = array(); + +$magicWords['en'] = array( + 'MAG_NOTOCNUM' => array( 0, '__NOTOCNUM__' ), +); Property changes on: trunk/extensions/PSINoTocNum/PSINoTocNum.i18n.magic.php ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: trunk/extensions/PSINoTocNum/PSINoTocNum.php =================================================================== --- trunk/extensions/PSINoTocNum/PSINoTocNum.php 2009-08-14 13:18:23 UTC (rev 55015) +++ trunk/extensions/PSINoTocNum/PSINoTocNum.php 2009-08-14 13:20:59 UTC (rev 55016) @@ -34,7 +34,7 @@ * * Add "__NOTOCNUM__" to any article. * * @author Benedikt Meuthrath - * @version $Revision: 1.4 $ + * @version 1.5 */ if (!defined('MEDIAWIKI')) { @@ -44,40 +44,19 @@ $wgExtensionCredits['parserhook'][] = array( 'path' => __FILE__, 'name' => 'PSINoTocNum', - 'version' => '$Revision: 1.4 $', + 'version' => '1.5', 'author' => 'Benedikt Meuthrath', - 'url' => 'http://www.mediawiki.org/wiki/Extension:PSINoTocNum', - 'description' => 'New MagicWord "<nowiki>__NOTOCNUM__</nowiki>".', + 'url' => 'http://www.mediawiki.org/wiki/Extension:PSINoTocNum', + 'description' => 'New MagicWord "<nowiki>__NOTOCNUM__</nowiki>".', 'descriptionmsg' => 'psinotocnum-desc', ); $dir = dirname(__FILE__) . '/'; $wgExtensionMessagesFiles['PSINoTocNum'] = $dir . 'PSINoTocNum.i18n.php'; +$wgExtensionMessagesFiles['PSINoTocNumMagic'] = $dir . 'PSINoTocNum.i18n.magic.php'; - -$wgHooks['MagicWordMagicWords'][] = 'PSINoTocNumMagicWordMagicWords'; -$wgHooks['MagicWordwgVariableIDs'][] = 'PSINoTocNumMagicWordwgVariableIDs'; -$wgHooks['LanguageGetMagic'][] = 'PSINoTocNumLanguageGetMagic'; $wgHooks['ParserBeforeInternalParse'][] = 'PSINoTocNumParserBeforeInternalParse'; -function PSINoTocNumMagicWordMagicWords(&$magicWords) { - $magicWords[] = 'MAG_NOTOCNUM'; - - return true; -} - -function PSINoTocNumMagicWordwgVariableIDs(&$wgVariableIDs) { - $wgVariableIDs[] = MAG_NOTOCNUM; - - return true; -} - -function PSINoTocNumLanguageGetMagic(&$magicWords, $langCode) { - $magicWords[MAG_NOTOCNUM] = array( 0, "__NOTOCNUM__" ); - - return true; -} - function PSINoTocNumParserBeforeInternalParse($parser, $text, $stripState) { if (MagicWord::get( MAG_NOTOCNUM )->matchAndRemove( $text ) ) { global $wgOut; Modified: trunk/extensions/Translate/groups/mediawiki-defines.txt =================================================================== --- trunk/extensions/Translate/groups/mediawiki-defines.txt 2009-08-14 13:18:23 UTC (rev 55015) +++ trunk/extensions/Translate/groups/mediawiki-defines.txt 2009-08-14 13:20:59 UTC (rev 55016) @@ -45,6 +45,9 @@ Assert Edit descmsg = assert_edit_desc +Autoincrement +magicfile = Autoincrement/Autoincrement.i18n.magic.php + Author Protect Babel @@ -557,6 +560,7 @@ ignored = maintenance-stats Maps +magicfile = Maps/Maps.i18n.magic.php descmsg = maps_desc optional = maps_name @@ -661,6 +665,7 @@ descmsg = ogg-desc Online Status +magicfile = OnlineStatus/OnlineStatus.i18n.magic.php ignored = onlinestatus-levels OpenID @@ -736,6 +741,7 @@ descmsg = protectsection_desc PSI NoTocNum +magicfile = PSINoTocNum/PSINoTocNum.i18n.magic.php Purge _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs