Index: trunk/extensions/Gadgets/Gadgets.php |
— | — | @@ -48,7 +48,9 @@ |
49 | 49 | function wfLoadGadgets() { |
50 | 50 | static $gadgets = null; |
51 | 51 | |
52 | | - if ( $gadgets !== null ) return $gadgets; |
| 52 | + if ( $gadgets !== null ) { |
| 53 | + return $gadgets; |
| 54 | + } |
53 | 55 | |
54 | 56 | $struct = wfLoadGadgetsStructured(); |
55 | 57 | if ( !$struct ) { |
— | — | @@ -57,7 +59,7 @@ |
58 | 60 | } |
59 | 61 | |
60 | 62 | $gadgets = array(); |
61 | | - foreach ( $struct as $section => $entries ) { |
| 63 | + foreach ( $struct as $entries ) { |
62 | 64 | $gadgets = array_merge( $gadgets, $entries ); |
63 | 65 | } |
64 | 66 | |
— | — | @@ -68,7 +70,9 @@ |
69 | 71 | global $wgMemc; |
70 | 72 | |
71 | 73 | static $gadgets = null; |
72 | | - if ( $gadgets !== null && $forceNewText === null ) return $gadgets; |
| 74 | + if ( $gadgets !== null && $forceNewText === null ) { |
| 75 | + return $gadgets; |
| 76 | + } |
73 | 77 | |
74 | 78 | $key = wfMemcKey( 'gadgets-definition' ); |
75 | 79 | |
— | — | @@ -120,7 +124,9 @@ |
121 | 125 | |
122 | 126 | function wfGadgetsGetPreferences( $user, &$preferences ) { |
123 | 127 | $gadgets = wfLoadGadgetsStructured(); |
124 | | - if (!$gadgets) return true; |
| 128 | + if (!$gadgets) { |
| 129 | + return true; |
| 130 | + } |
125 | 131 | |
126 | 132 | $options = array(); |
127 | 133 | foreach( $gadgets as $section => $thisSection ) { |
— | — | @@ -162,7 +168,9 @@ |
163 | 169 | |
164 | 170 | function wfGadgetsBeforePageDisplay( $out ) { |
165 | 171 | global $wgUser; |
166 | | - if ( !$wgUser->isLoggedIn() ) return true; |
| 172 | + if ( !$wgUser->isLoggedIn() ) { |
| 173 | + return true; |
| 174 | + } |
167 | 175 | |
168 | 176 | //disable all gadgets on critical special pages |
169 | 177 | //NOTE: $out->isUserJsAllowed() is tempting, but always fals if $wgAllowUserJs is false. |
— | — | @@ -177,7 +185,9 @@ |
178 | 186 | } |
179 | 187 | |
180 | 188 | $gadgets = wfLoadGadgets(); |
181 | | - if ( !$gadgets ) return true; |
| 189 | + if ( !$gadgets ) { |
| 190 | + return true; |
| 191 | + } |
182 | 192 | |
183 | 193 | $lb = new LinkBatch(); |
184 | 194 | $lb->setCaller( __METHOD__ ); |
— | — | @@ -197,7 +207,9 @@ |
198 | 208 | |
199 | 209 | $done = array(); |
200 | 210 | foreach ( $pages as $page ) { |
201 | | - if ( isset( $done[$page] ) ) continue; |
| 211 | + if ( isset( $done[$page] ) ) { |
| 212 | + continue; |
| 213 | + } |
202 | 214 | $done[$page] = true; |
203 | 215 | wfApplyGadgetCode( $page, $out ); |
204 | 216 | } |
— | — | @@ -212,7 +224,9 @@ |
213 | 225 | // but we'd want it to appear above explicit user stuff, so it can be overwritten. |
214 | 226 | |
215 | 227 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Gadget-$page" ); |
216 | | - if ( !$t ) continue; |
| 228 | + if ( !$t ) { |
| 229 | + return; |
| 230 | + } |
217 | 231 | |
218 | 232 | if ( preg_match( '/\.js/', $page ) ) { |
219 | 233 | $u = $t->getLocalURL( 'action=raw&ctype=' . $wgJsMimeType ); |