Add localisation of special pages for Asksql, BadImage, CategoryIntersection, ContributionScores, Contributors
This commit is contained in:
parent
8fcca8bea6
commit
2ce29213c2
2 changed files with 28 additions and 11 deletions
14
ContributionScores.alias.php
Normal file
14
ContributionScores.alias.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Aliases for special pages
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @ingroup Extensions
|
||||||
|
*/
|
||||||
|
|
||||||
|
$aliases = array();
|
||||||
|
|
||||||
|
/** English */
|
||||||
|
$aliases['en'] = array(
|
||||||
|
'ContributionScores'=> array( 'ContributionScores' ),
|
||||||
|
);
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/** \file
|
/** \file
|
||||||
* \brief Contains setup code for the Contribution Scores Extension.
|
* \brief Contains setup code for the Contribution Scores Extension.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# Not a valid entry point, skip unless MEDIAWIKI is defined
|
# Not a valid entry point, skip unless MEDIAWIKI is defined
|
||||||
|
@ -30,7 +30,10 @@ $wgAutoloadClasses['ContributionScores'] = CONTRIBUTIONSCORES_PATH . '/Contribut
|
||||||
$wgSpecialPages['ContributionScores'] = 'ContributionScores';
|
$wgSpecialPages['ContributionScores'] = 'ContributionScores';
|
||||||
$wgSpecialPageGroups['ContributionScores'] = 'wiki';
|
$wgSpecialPageGroups['ContributionScores'] = 'wiki';
|
||||||
|
|
||||||
if( version_compare( $wgVersion, '1.11', '>=' ) ) {
|
if( version_compare( $wgVersion, '1.13', '>=' ) ) {
|
||||||
|
$wgExtensionMessagesFiles['ContributionScores'] = CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php';
|
||||||
|
$wgExtensionAliasesFiles['ContributionScores'] = CONTRIBUTIONSCORES_PATH . '/ContributionScores.alias.php';
|
||||||
|
} else if( version_compare( $wgVersion, '1.11', '>=' ) ) {
|
||||||
$wgExtensionMessagesFiles['ContributionScores'] = CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php';
|
$wgExtensionMessagesFiles['ContributionScores'] = CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php';
|
||||||
} else {
|
} else {
|
||||||
$wgExtensionFunctions[] = 'efContributionScores_AddMessages';
|
$wgExtensionFunctions[] = 'efContributionScores_AddMessages';
|
||||||
|
@ -47,7 +50,7 @@ if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
|
||||||
///Message Cache population for versions that did not support $wgExtensionFunctions
|
///Message Cache population for versions that did not support $wgExtensionFunctions
|
||||||
function efContributionScores_AddMessages() {
|
function efContributionScores_AddMessages() {
|
||||||
global $wgMessageCache;
|
global $wgMessageCache;
|
||||||
|
|
||||||
#Add Messages
|
#Add Messages
|
||||||
require( CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php' );
|
require( CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php' );
|
||||||
foreach( $messages as $key => $value ) {
|
foreach( $messages as $key => $value ) {
|
||||||
|
@ -58,7 +61,7 @@ function efContributionScores_AddMessages() {
|
||||||
|
|
||||||
function efContributionScores_Setup() {
|
function efContributionScores_Setup() {
|
||||||
global $wgParser;
|
global $wgParser;
|
||||||
|
|
||||||
$wgParser->setFunctionHook( 'cscore', 'efContributionScores_Render' );
|
$wgParser->setFunctionHook( 'cscore', 'efContributionScores_Render' );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -73,16 +76,16 @@ function efContributionScores_Render(&$parser, $usertext, $metric='score') {
|
||||||
|
|
||||||
if( version_compare( $wgVersion, '1.11', '>=' ) )
|
if( version_compare( $wgVersion, '1.11', '>=' ) )
|
||||||
wfLoadExtensionMessages( 'ContributionScores' );
|
wfLoadExtensionMessages( 'ContributionScores' );
|
||||||
|
|
||||||
$output = "";
|
$output = "";
|
||||||
|
|
||||||
if ($wgContribScoreDisableCache) {
|
if ($wgContribScoreDisableCache) {
|
||||||
$parser->disableCache();
|
$parser->disableCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = User::newFromName($usertext);
|
$user = User::newFromName($usertext);
|
||||||
$dbr = wfGetDB( DB_SLAVE );
|
$dbr = wfGetDB( DB_SLAVE );
|
||||||
|
|
||||||
if ( $user instanceof User && $user->isLoggedIn() ) {
|
if ( $user instanceof User && $user->isLoggedIn() ) {
|
||||||
if ($metric=='score') {
|
if ($metric=='score') {
|
||||||
$res = $dbr->select('revision',
|
$res = $dbr->select('revision',
|
||||||
|
@ -96,7 +99,7 @@ function efContributionScores_Render(&$parser, $usertext, $metric='score') {
|
||||||
array('rev_user' => $user->getID()));
|
array('rev_user' => $user->getID()));
|
||||||
$row = $dbr->fetchObject($res);
|
$row = $dbr->fetchObject($res);
|
||||||
$output = $row->rev_count;
|
$output = $row->rev_count;
|
||||||
|
|
||||||
} elseif ($metric=='pages') {
|
} elseif ($metric=='pages') {
|
||||||
$res = $dbr->select('revision',
|
$res = $dbr->select('revision',
|
||||||
'COUNT(DISTINCT rev_page) AS page_count',
|
'COUNT(DISTINCT rev_page) AS page_count',
|
||||||
|
@ -109,6 +112,6 @@ function efContributionScores_Render(&$parser, $usertext, $metric='score') {
|
||||||
} else {
|
} else {
|
||||||
$output = wfMsg('contributionscores-invalidusername');
|
$output = wfMsg('contributionscores-invalidusername');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parser->insertStripItem($output, $parser->mStripState);
|
return $parser->insertStripItem($output, $parser->mStripState);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue