r86185 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86184‎ | r86185 | r86186 >
Date:08:05, 16 April 2011
Author:ialex
Status:deferred
Tags:
Comment:
Use a dedicated file defined in $wgExtensionMessagesFiles to define magic word instead of using the LanguageGetMagic hook
Modified paths:
  • /trunk/extensions/BookManager/BookManager.body.php (modified) (history)
  • /trunk/extensions/BookManager/BookManager.i18n.magic.php (added) (history)
  • /trunk/extensions/BookManager/BookManager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BookManager/BookManager.body.php
@@ -173,27 +173,7 @@
174174 $aCustomVariableIds[] = 'chapternamee';
175175 return true;
176176 }
177 - # Function to declare magicwords
178 - static function LanguageGetMagic( &$magicWords, $langCode = "en" ) {
179 - # PREVPAGENAME
180 - $magicWords['prevpagename'] = array ( 0, 'PREVPAGENAME' );
181 - # PREVPAGENAME
182 - $magicWords['prevpagenamee'] = array ( 0, 'PREVPAGENAMEE' );
183 - # NEXTPAGENAME
184 - $magicWords['nextpagename'] = array ( 0, 'NEXTPAGENAME' );
185 - # NEXTPAGENAMEE
186 - $magicWords['nextpagenamee'] = array ( 0, 'NEXTPAGENAMEE' );
187 - # ROOTPAGENAME
188 - $magicWords['rootpagename'] = array ( 0, 'ROOTPAGENAME' , 'BOOKNAME' );
189 - # ROOTPAGENAMEE
190 - $magicWords['rootpagenamee'] = array ( 0, 'ROOTPAGENAMEE' , 'BOOKNAMEE' );
191 - # CHAPTERNAME
192 - $magicWords['chaptername'] = array ( 0, 'CHAPTERNAME' );
193 - # CHAPTERNAMEE
194 - $magicWords['chapternamee'] = array ( 0, 'CHAPTERNAMEE' );
195177
196 - return true;
197 - }
198178 # Values functions
199179 static function prevpagename( &$parser, $text = null ) {
200180 $t = self::pageText( $parser, $text, - 1 );
Index: trunk/extensions/BookManager/BookManager.i18n.magic.php
@@ -0,0 +1,17 @@
 2+<?php
 3+
 4+$magicWords = array();
 5+
 6+/**
 7+ * English
 8+ */
 9+$magicWords['en'] = array(
 10+ 'prevpagename' => array( 0, 'PREVPAGENAME' ),
 11+ 'prevpagenamee' => array( 0, 'PREVPAGENAMEE' ),
 12+ 'nextpagename' => array( 0, 'NEXTPAGENAME' ),
 13+ 'nextpagenamee' => array( 0, 'NEXTPAGENAMEE' ),
 14+ 'rootpagename' => array( 0, 'ROOTPAGENAME', 'BOOKNAME' ),
 15+ 'rootpagenamee' => array( 0, 'ROOTPAGENAMEE', 'BOOKNAMEE' ),
 16+ 'chaptername' => array( 0, 'CHAPTERNAME' ),
 17+ 'chapternamee' => array( 0, 'CHAPTERNAMEE' ),
 18+);
Property changes on: trunk/extensions/BookManager/BookManager.i18n.magic.php
___________________________________________________________________
Added: svn:eol-style
119 + native
Index: trunk/extensions/BookManager/BookManager.php
@@ -42,6 +42,7 @@
4343 $wgAutoloadClasses['BookManagerNavBar'] = $dir . '/BookManager.body.php';
4444 $wgAutoloadClasses['PrintVersion'] = $dir . '/BookManager.body.php';
4545 $wgExtensionMessagesFiles['BookManager'] = $dir . '/BookManager.i18n.php';
 46+$wgExtensionMessagesFiles['BookManagerMagic'] = $dir . '/BookManager.i18n.magic.php';
4647 $wgExtensionAliasesFiles['BookManager'] = $dir . '/BookManager.alias.php';
4748 $wgSpecialPages['PrintVersion'] = 'PrintVersion';
4849 $wgSpecialPageGroups['PrintVersion'] = 'other';
@@ -78,8 +79,6 @@
7980
8081 $wgHooks['ParserFirstCallInit'][] = 'BookManagerVariables::register';
8182
82 -$wgHooks['LanguageGetMagic'][] = 'BookManagerVariables::LanguageGetMagic';
83 -
8483 $wgHooks['MagicWordwgVariableIDs'][] = 'BookManagerVariables::DeclareVarIds';
8584
8685 $wgHooks['ParserGetVariableValueSwitch'][] = 'BookManagerVariables::AssignAValue';

Status & tagging log