Index: trunk/extensions/Gadgets/Gadgets_body.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * ArticleSaveComplete hook handler. |
20 | | - * |
| 20 | + * |
21 | 21 | * @param $article Article |
22 | 22 | * @param $user User |
23 | 23 | * @param $text String: New page text |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | public static function getPreferences( $user, &$preferences ) { |
58 | 58 | $gadgets = Gadget::loadStructuredList(); |
59 | 59 | if (!$gadgets) return true; |
60 | | - |
| 60 | + |
61 | 61 | $options = array(); |
62 | 62 | $default = array(); |
63 | 63 | foreach( $gadgets as $section => $thisSection ) { |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | $options = array_merge( $options, $available ); |
81 | 81 | } |
82 | 82 | } |
83 | | - |
| 83 | + |
84 | 84 | $preferences['gadgets-intro'] = |
85 | 85 | array( |
86 | 86 | 'type' => 'info', |
— | — | @@ -91,8 +91,8 @@ |
92 | 92 | 'raw' => 1, |
93 | 93 | 'rawrow' => 1, |
94 | 94 | ); |
95 | | - |
96 | | - $preferences['gadgets'] = |
| 95 | + |
| 96 | + $preferences['gadgets'] = |
97 | 97 | array( |
98 | 98 | 'type' => 'multiselect', |
99 | 99 | 'options' => $options, |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | 'prefix' => 'gadget-', |
103 | 103 | 'default' => $default, |
104 | 104 | ); |
105 | | - |
| 105 | + |
106 | 106 | return true; |
107 | 107 | } |
108 | 108 | |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | */ |
131 | 131 | public static function beforePageDisplay( $out ) { |
132 | 132 | global $wgUser; |
133 | | - |
| 133 | + |
134 | 134 | wfProfileIn( __METHOD__ ); |
135 | 135 | |
136 | 136 | $gadgets = Gadget::loadList(); |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Adds one legacy script to output. |
173 | | - * |
| 173 | + * |
174 | 174 | * @param $page String: Unprefixed page title |
175 | 175 | * @param $out OutputPage |
176 | 176 | */ |
— | — | @@ -354,8 +354,8 @@ |
355 | 355 | * @return Boolean: Whether this gadget has resources that can be loaded via ResourceLoader |
356 | 356 | */ |
357 | 357 | public function hasModule() { |
358 | | - return count( $this->styles ) |
359 | | - + ( $this->supportsResourceLoader() ? count( $this->scripts ) : 0 ) |
| 358 | + return count( $this->styles ) |
| 359 | + + ( $this->supportsResourceLoader() ? count( $this->scripts ) : 0 ) |
360 | 360 | > 0; |
361 | 361 | } |
362 | 362 | |
— | — | @@ -506,12 +506,13 @@ |
507 | 507 | return $gadgets; |
508 | 508 | } |
509 | 509 | |
510 | | - $g = wfMsgForContentNoTrans( "gadgets-definition" ); |
511 | | - if ( wfEmptyMsg( "gadgets-definition", $g ) ) { |
| 510 | + $g = wfMessage( "gadgets-definition" )->inContentLanguage(); |
| 511 | + if ( !$g->exists() ) { |
512 | 512 | $gadgets = false; |
513 | 513 | wfProfileOut( __METHOD__ ); |
514 | 514 | return $gadgets; |
515 | 515 | } |
| 516 | + $g = $g->plain(); |
516 | 517 | } else { |
517 | 518 | $g = $forceNewText; |
518 | 519 | } |