r55499 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55498‎ | r55499 | r55500 >
Date:20:12, 22 August 2009
Author:brion
Status:deferred
Tags:
Comment:
More inline <script> cleanup: move wgNotice / wgNoticeLocal initializations to global JS vars definition to drop another unnecessary <script>let
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -119,6 +119,7 @@
120120 if( $wgCentralNoticeLoader ) {
121121 $wgHooks['BeforePageDisplay'][] = 'efCentralNoticeLoader';
122122 $wgHooks['SiteNoticeAfter'][] = 'efCentralNoticeDisplay';
 123+ $wgHooks['MakeGlobalVariablesScript'][] = 'efCentralNoticeDefaults';
123124 }
124125
125126 $wgAutoloadClasses['NoticePage'] = $dir . 'NoticePage.php';
@@ -171,12 +172,19 @@
172173 */
173174
174175 // Load the notice text from <head>
175 - $wgOut->addInlineScript( "var wgNotice='';var wgNoticeLocal='';" );
176176 $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$encCentralLoader?$wgStyleVersion\"></script>\n" );
177177
178178 return true;
179179 }
180180
 181+function efCentralNoticeDefaults( &$vars ) {
 182+ // Initialize these variables to empty, so if the notice script fails
 183+ // we don't have any surprises.
 184+ $vars['wgNotice'] = '';
 185+ $vars['wgNoticeLocal'] = '';
 186+ return true;
 187+}
 188+
181189 function efCentralNoticeDisplay( &$notice ) {
182190 // Slip in load of the data...
183191 $notice =

Status & tagging log