Index: trunk/extensions/Gadgets/Gadgets.php |
— | — | @@ -48,9 +48,9 @@ |
49 | 49 | } |
50 | 50 | |
51 | 51 | function wfLoadGadgets() { |
52 | | - static $gadgets = NULL; |
| 52 | + static $gadgets = null; |
53 | 53 | |
54 | | - if ( $gadgets !== NULL ) return $gadgets; |
| 54 | + if ( $gadgets !== null ) return $gadgets; |
55 | 55 | |
56 | 56 | $struct = wfLoadGadgetsStructured(); |
57 | 57 | if ( !$struct ) { |
— | — | @@ -66,15 +66,15 @@ |
67 | 67 | return $gadgets; |
68 | 68 | } |
69 | 69 | |
70 | | -function wfLoadGadgetsStructured( $forceNewText = NULL ) { |
| 70 | +function wfLoadGadgetsStructured( $forceNewText = null ) { |
71 | 71 | global $wgMemc; |
72 | 72 | |
73 | | - static $gadgets = NULL; |
74 | | - if ( $gadgets !== NULL && $forceNewText === NULL ) return $gadgets; |
| 73 | + static $gadgets = null; |
| 74 | + if ( $gadgets !== null && $forceNewText === null ) return $gadgets; |
75 | 75 | |
76 | 76 | $key = wfMemcKey( 'gadgets-definition' ); |
77 | 77 | |
78 | | - if ( $forceNewText === NULL ) { |
| 78 | + if ( $forceNewText === null ) { |
79 | 79 | //cached? |
80 | 80 | $gadgets = $wgMemc->get( $key ); |
81 | 81 | if ( is_array($gadgets) ) return $gadgets; |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | |
116 | 116 | //cache for a while. gets purged automatically when MediaWiki:Gadgets-definition is edited |
117 | 117 | $wgMemc->set( $key, $gadgets, 60*60*24 ); |
118 | | - $source = $forceNewText !== NULL ? 'input text' : 'MediaWiki:Gadgets-definition'; |
| 118 | + $source = $forceNewText !== null ? 'input text' : 'MediaWiki:Gadgets-definition'; |
119 | 119 | wfDebug( __METHOD__ . ": $source parsed, cache entry $key updated\n"); |
120 | 120 | |
121 | 121 | return $gadgets; |
— | — | @@ -159,12 +159,12 @@ |
160 | 160 | } |
161 | 161 | |
162 | 162 | function wfGadgetsBeforePageDisplay( &$out ) { |
163 | | - global $wgUser, $wgTitle; |
| 163 | + global $wgUser; |
164 | 164 | if ( !$wgUser->isLoggedIn() ) return true; |
165 | 165 | |
166 | 166 | //disable all gadgets on Special:Preferences |
167 | | - if ( $wgTitle->getNamespace() == NS_SPECIAL ) { |
168 | | - $name = SpecialPage::resolveAlias( $wgTitle->getText() ); |
| 167 | + if ( $out->getTitle()->getNamespace() == NS_SPECIAL ) { |
| 168 | + $name = SpecialPage::resolveAlias( $out->getTitle()->getText() ); |
169 | 169 | if ( $name == "Preferences" ) return true; |
170 | 170 | } |
171 | 171 | |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | } |
186 | 186 | |
187 | 187 | function wfApplyGadgetCode( $code, &$out, &$done ) { |
188 | | - global $wgSkin, $wgJsMimeType; |
| 188 | + global $wgJsMimeType; |
189 | 189 | |
190 | 190 | //FIXME: stuff added via $out->addScript appears below usercss and userjs in the head tag. |
191 | 191 | // but we'd want it to appear above explicit user stuff, so it can be overwritten. |
— | — | @@ -211,9 +211,7 @@ |
212 | 212 | /** |
213 | 213 | * inject descriptions into system messages, so they show on Special:Allmessages |
214 | 214 | */ |
215 | | -function wfGadgetsInjectMessages() { |
216 | | - global $wgLang, $wgMessageCache; |
217 | | - |
| 215 | +function wfGadgetsInjectMessages( $msgCache ) { |
218 | 216 | $gadgets = wfLoadGadgetsStructured(); |
219 | 217 | if ( !$gadgets ) return true; |
220 | 218 | |
— | — | @@ -236,7 +234,7 @@ |
237 | 235 | } |
238 | 236 | } |
239 | 237 | |
240 | | - $wgMessageCache->addMessages( $messages ); |
| 238 | + $msgCache->addMessages( $messages ); |
241 | 239 | return true; |
242 | 240 | } |
243 | 241 | |