Remove use of deprecated LanguageGetMagic hook.

Update $wgExtensionCredits here and there, renamed descriptionmsg key for UKGeocodingForMaps.
Remove a few globals that were used for magic words.
Trim trailing whitespace and update indentation in a few places.
Updated examples.
This commit is contained in:
Siebrand Mazeland 2012-01-19 14:02:15 +00:00
parent 5127c15006
commit a7aea465ae
4 changed files with 14 additions and 20 deletions

View file

@ -13,6 +13,7 @@ $messages = array();
* @author David Pean <david.pean@gmail.com>
*/
$messages['en'] = array(
'voteny-desc' => 'JavaScript-based voting with the <tt>&lt;vote&gt;</tt> tag',
'vote-link' => 'Vote',
'vote-unvote-link' => 'unvote',
'vote-community-score' => 'community score: $1',

View file

@ -23,9 +23,9 @@ if ( !defined( 'MEDIAWIKI' ) ) {
// Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Vote',
'version' => '2.4',
'version' => '2.5',
'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ),
'description' => 'JavaScript-based voting with the <tt>&lt;vote&gt;</tt> tag',
'descriptionmsg' => 'voteny-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:VoteNY'
);
@ -43,6 +43,7 @@ require_once( 'Vote_AjaxFunctions.php' );
// Autoload classes and set up i18n
$dir = dirname( __FILE__ ) . '/';
$wgExtensionMessagesFiles['Vote'] = $dir . 'Vote.i18n.php';
$wgExtensionMessagesFiles['VoteNYMagic'] = $dir . 'VoteNY.i18n.magic.php';
$wgAutoloadClasses['Vote'] = $dir . 'VoteClass.php';
$wgAutoloadClasses['VoteStars'] = $dir . 'VoteClass.php';
@ -56,9 +57,6 @@ $wgAutoloadClasses['VoteHooks'] = $dir . 'VoteHooks.php';
$wgHooks['ParserFirstCallInit'][] = 'VoteHooks::registerParserHook';
$wgHooks['RenameUserSQL'][] = 'VoteHooks::onUserRename';
// Translations for {{NUMBEROFVOTES}}
//$wgExtensionMessagesFiles['NumberOfVotes'] = $dir . 'Vote.i18n.magic.php';
$wgHooks['LanguageGetMagic'][] = 'VoteHooks::setUpMagicWord';
$wgHooks['ParserGetVariableValueSwitch'][] = 'VoteHooks::assignValueToMagicWord';
$wgHooks['MagicWordwgVariableIDs'][] = 'VoteHooks::registerVariableId';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'VoteHooks::addTable';

View file

@ -81,21 +81,6 @@ class VoteHooks {
return true;
}
/**
* Set up the {{NUMBEROFVOTES}} magic word.
*
* @param $magicWords Array: array of magic words
* @param $langID
* @return Boolean: true
*/
public static function setUpMagicWord( &$magicWords, $langID ) {
// tell MediaWiki that {{NUMBEROFVOTES}} and all case variants found in
// wiki text should be mapped to magic ID 'NUMBEROFVOTES'
// (0 means case-insensitive)
$magicWords['NUMBEROFVOTES'] = array( 0, 'NUMBEROFVOTES' );
return true;
}
/**
* Assign a value to {{NUMBEROFVOTES}}. First we try memcached and if that
* fails, we fetch it directly from the database and cache it for 24 hours.

10
VoteNY.i18n.magic.php Normal file
View file

@ -0,0 +1,10 @@
<?php
/**
* Internationalization file for magic words.
*/
$magicWords = array();
$magicWords['en'] = array(
'NUMBEROFVOTES' => array( 0, 'NUMBEROFVOTES' ),
);