Index: trunk/extensions/Genderize/Genderize.php |
— | — | @@ -25,6 +25,9 @@ |
26 | 26 | global $wgAutoloadClasses; |
27 | 27 | $wgAutoloadClasses[ 'Genderize' ] = __DIR__ . '/Genderize.class.php'; |
28 | 28 | |
| 29 | +global $wgExtensionFunctions; |
| 30 | +$wgExtensionFunctions[] = array( 'Genderize', 'onInitExtension' ); |
| 31 | + |
29 | 32 | global $wgHooks; |
30 | 33 | $wgHooks[ 'LinkBegin' ][] = 'Genderize::onLinkBegin'; |
31 | 34 | $wgHooks[ 'SkinTemplateNavigation' ][] = 'Genderize::onSkinTemplateNavigation'; |
— | — | @@ -33,21 +36,18 @@ |
34 | 37 | $wgExtensionMessagesFiles[ 'Genderize' ] = __DIR__ . '/Genderize.i18n.php'; |
35 | 38 | |
36 | 39 | 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 | +); |
42 | 45 | |
43 | | -global $wgExtraGenderNamespaces; |
44 | | -$wgExtraGenderNamespaces[ NS_USER ] = $egGenderize; |
45 | | - |
46 | 46 | global $wgExtensionCredits; |
47 | 47 | $wgExtensionCredits[ 'other' ][] = array( |
48 | 48 | 'path' => __FILE__, |
49 | 49 | 'name' => 'Genderize', |
50 | 50 | 'license' => 'AGPLv3', |
51 | | - 'version' => '0.0.1', |
| 51 | + 'version' => '0.0.1+', |
52 | 52 | 'author' => array( '[https://www.mediawiki.org/wiki/User:Van_de_Bugger Van de Bugger]' ), |
53 | 53 | 'url' => 'https://www.mediawiki.org/wiki/Extension:Genderize', |
54 | 54 | 'descriptionmsg' => 'genderize-desc', |
Index: trunk/extensions/Genderize/Genderize.class.php |
— | — | @@ -26,6 +26,15 @@ |
27 | 27 | class Genderize { |
28 | 28 | |
29 | 29 | |
| 30 | + static public function onInitExtension() { |
| 31 | + |
| 32 | + global $egGenderize, $wgExtraGenderNamespaces; |
| 33 | + |
| 34 | + $wgExtraGenderNamespaces[ NS_USER ] = $egGenderize; |
| 35 | + |
| 36 | + } // function onInitExtension |
| 37 | + |
| 38 | + |
30 | 39 | static public function onLinkBegin( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) { |
31 | 40 | if ( $target->getNamespace() == NS_USER ) { |
32 | 41 | if ( ! isset( $text ) || Title::newFromText( $text )->getPrefixedText() == $target->getPrefixedText() ) { |