Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -119,6 +119,7 @@ |
120 | 120 | if( $wgCentralNoticeLoader ) { |
121 | 121 | $wgHooks['BeforePageDisplay'][] = 'efCentralNoticeLoader'; |
122 | 122 | $wgHooks['SiteNoticeAfter'][] = 'efCentralNoticeDisplay'; |
| 123 | + $wgHooks['MakeGlobalVariablesScript'][] = 'efCentralNoticeDefaults'; |
123 | 124 | } |
124 | 125 | |
125 | 126 | $wgAutoloadClasses['NoticePage'] = $dir . 'NoticePage.php'; |
— | — | @@ -171,12 +172,19 @@ |
172 | 173 | */ |
173 | 174 | |
174 | 175 | // Load the notice text from <head> |
175 | | - $wgOut->addInlineScript( "var wgNotice='';var wgNoticeLocal='';" ); |
176 | 176 | $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$encCentralLoader?$wgStyleVersion\"></script>\n" ); |
177 | 177 | |
178 | 178 | return true; |
179 | 179 | } |
180 | 180 | |
| 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 | + |
181 | 189 | function efCentralNoticeDisplay( &$notice ) { |
182 | 190 | // Slip in load of the data... |
183 | 191 | $notice = |