r84242 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84241‎ | r84242 | r84243 >
Date:13:56, 18 March 2011
Author:ialex
Status:ok
Tags:
Comment:
And I forgot to commit these ones in r84240
Modified paths:
  • /trunk/extensions/GraphViz/GraphViz.php (modified) (history)
  • /trunk/extensions/HeaderTabs/HeaderTabs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GraphViz/GraphViz.php
@@ -128,12 +128,7 @@
129129 * Media Wiki Plugin Stuff
130130 */
131131
132 -// Check if the Wiki supports the new extension syntax
133 -if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
134 - $wgHooks['ParserFirstCallInit'][] = 'wfGraphVizExtension';
135 -} else { // Otherwise do things the old fashioned way
136 - $wgExtensionFunctions[] = 'wfGraphVizExtension';
137 -}
 132+$wgHooks['ParserFirstCallInit'][] = 'wfGraphVizSetHook';
138133
139134 // Information about the people did this Parserhook
140135 $wgExtensionCredits['parserhook'][] = array(
@@ -154,10 +149,9 @@
155150 /*
156151 * Information about the hooks used
157152 */
158 - function wfGraphVizExtension() {
159 - global $wgParser;
160 - $wgParser->setHook( 'graphviz', 'renderGraphviz' );
161 - $wgParser->setHook( 'mscgen', 'renderMscGen' );
 153+ function wfGraphVizSetHook( $parser ) {
 154+ $parser->setHook( 'graphviz', 'renderGraphviz' );
 155+ $parser->setHook( 'mscgen', 'renderMscGen' );
162156 return true;
163157 }
164158
Index: trunk/extensions/HeaderTabs/HeaderTabs.php
@@ -21,7 +21,6 @@
2222 $wgAutoloadClasses['HeaderTabs'] = "$dir/HeaderTabs_body.yui.php";
2323 }
2424
25 -$wgExtensionFunctions[] = 'htSetupExtension';
2625 $wgExtensionCredits['parserhook'][] = array(
2726 'name' => 'Header Tabs',
2827 'description' => 'Adds tabs to the page separating top-level sections.',
@@ -32,26 +31,18 @@
3332
3433 $htUseHistory = true;
3534
36 -function htSetupExtension() {
37 - global $wgHooks;
38 - global $wgParser;
 35+$wgHooks['ParserFirstCallInit'][] = 'headerTabsParserFunctions';
 36+$wgHooks['LanguageGetMagic'][] = 'headerTabsLanguageGetMagic';
 37+$wgHooks['BeforePageDisplay'][] = 'HeaderTabs::addHTMLHeader';
 38+$wgHooks['ParserAfterTidy'][] = 'HeaderTabs::replaceFirstLevelHeaders';
3939
40 - $wgHooks['BeforePageDisplay'][] = 'HeaderTabs::addHTMLHeader';
41 - $wgHooks['ParserAfterTidy'][] = 'HeaderTabs::replaceFirstLevelHeaders';
42 - $wgParser->setHook( 'headertabs', array( 'HeaderTabs', 'tag' ) );
43 -
 40+# Parser function to insert a link changing a tab:
 41+function headerTabsParserFunctions( $parser ) {
 42+ $parser->setHook( 'headertabs', array( 'HeaderTabs', 'tag' ) );
 43+ $parser->setFunctionHook( 'switchtablink', array( 'HeaderTabs', 'renderSwitchTabLink' ) );
4444 return true;
4545 }
4646
47 -# Parser function to insert a link changing a tab:
48 -$wgExtensionFunctions[] = 'headerTabsParserFunctions';
49 -$wgHooks['LanguageGetMagic'][] = 'headerTabsLanguageGetMagic';
50 -
51 -function headerTabsParserFunctions() {
52 - global $wgParser;
53 - $wgParser->setFunctionHook( 'switchtablink', array( 'HeaderTabs', 'renderSwitchTabLink' ) );
54 -}
55 -
5647 function headerTabsLanguageGetMagic( &$magicWords, $langCode = "en" ) {
5748 switch ( $langCode ) {
5849 default:

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84240extension function -> ParserFirstCallInit hook to register parser hooks and f...ialex13:54, 18 March 2011

Status & tagging log