r114074 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114073‎ | r114074 | r114075 >
Date:21:40, 17 March 2012
Author:van-de-bugger
Status:new
Tags:
Comment:
Genderize: Configure after inclusion (foolow-up to r112924).
Modified paths:
  • /trunk/extensions/Genderize/Genderize.class.php (modified) (history)
  • /trunk/extensions/Genderize/Genderize.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Genderize/Genderize.php
@@ -25,6 +25,9 @@
2626 global $wgAutoloadClasses;
2727 $wgAutoloadClasses[ 'Genderize' ] = __DIR__ . '/Genderize.class.php';
2828
 29+global $wgExtensionFunctions;
 30+$wgExtensionFunctions[] = array( 'Genderize', 'onInitExtension' );
 31+
2932 global $wgHooks;
3033 $wgHooks[ 'LinkBegin' ][] = 'Genderize::onLinkBegin';
3134 $wgHooks[ 'SkinTemplateNavigation' ][] = 'Genderize::onSkinTemplateNavigation';
@@ -33,21 +36,18 @@
3437 $wgExtensionMessagesFiles[ 'Genderize' ] = __DIR__ . '/Genderize.i18n.php';
3538
3639 global $egGenderize;
37 -foreach ( array( 'male', 'female', 'unknown' ) as $gender ) {
38 - if ( ! isset( $egGenderize[ $gender ] ) ) {
39 - $egGenderize[ $gender ] = 'User';
40 - }; // if
41 -}; // foreach
 40+$egGenderize = array(
 41+ 'male' => 'User',
 42+ 'female' => 'User',
 43+ 'unknown' => 'User',
 44+);
4245
43 -global $wgExtraGenderNamespaces;
44 -$wgExtraGenderNamespaces[ NS_USER ] = $egGenderize;
45 -
4646 global $wgExtensionCredits;
4747 $wgExtensionCredits[ 'other' ][] = array(
4848 'path' => __FILE__,
4949 'name' => 'Genderize',
5050 'license' => 'AGPLv3',
51 - 'version' => '0.0.1',
 51+ 'version' => '0.0.1+',
5252 'author' => array( '[https://www.mediawiki.org/wiki/User:Van_de_Bugger Van de Bugger]' ),
5353 'url' => 'https://www.mediawiki.org/wiki/Extension:Genderize',
5454 'descriptionmsg' => 'genderize-desc',
Index: trunk/extensions/Genderize/Genderize.class.php
@@ -26,6 +26,15 @@
2727 class Genderize {
2828
2929
 30+ static public function onInitExtension() {
 31+
 32+ global $egGenderize, $wgExtraGenderNamespaces;
 33+
 34+ $wgExtraGenderNamespaces[ NS_USER ] = $egGenderize;
 35+
 36+ } // function onInitExtension
 37+
 38+
3039 static public function onLinkBegin( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) {
3140 if ( $target->getNamespace() == NS_USER ) {
3241 if ( ! isset( $text ) || Title::newFromText( $text )->getPrefixedText() == $target->getPrefixedText() ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112924Initial revision of Genderize extension.van-de-bugger22:33, 2 March 2012

Status & tagging log