Index: branches/Gadgets-work/Gadgets_body.php |
— | — | @@ -126,8 +126,7 @@ |
127 | 127 | $pages = array(); |
128 | 128 | |
129 | 129 | foreach ( $gadgets as $gadget ) { |
130 | | - $tname = 'gadget-' . $gadget->getName(); |
131 | | - if ( $wgUser->getOption( $tname ) ) { |
| 130 | + if ( $gadget->isEnabled() ) { |
132 | 131 | if ( $gadget->hasModule() ) { |
133 | 132 | $out->addModules( $gadget->getModuleName() ); |
134 | 133 | } |
— | — | @@ -234,6 +233,14 @@ |
235 | 234 | } |
236 | 235 | |
237 | 236 | /** |
| 237 | + * @return Boolean: Whether this gadget is enabled for current user |
| 238 | + */ |
| 239 | + public function isEnabled() { |
| 240 | + global $wgUser; |
| 241 | + return (bool)$wgUser->getOption( "gadget-{$this->name}" ); |
| 242 | + } |
| 243 | + |
| 244 | + /** |
238 | 245 | * @return Boolean: Whether all of this gadget's JS components support ResourceLoader |
239 | 246 | */ |
240 | 247 | public function supportsResourceLoader() { |