Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -326,4 +326,4 @@ |
327 | 327 | } |
328 | 328 | |
329 | 329 | ResourceLoader::register( include( "$IP/resources/Resources.php" ) ); |
330 | | -wfRunHook( 'ResourceLoaderRegisterModules' ); |
\ No newline at end of file |
| 330 | +wfRunHooks( 'ResourceLoaderRegisterModules' ); |
\ No newline at end of file |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -405,4 +405,4 @@ |
406 | 406 | 'mediawiki.legacy.wikiprintable' => new ResourceLoaderFileModule( array( |
407 | 407 | 'styles' => array( 'skins/common/wikiprintable.css' => array( 'media' => 'print' ) ), |
408 | 408 | ) ), |
409 | | -) ); |
\ No newline at end of file |
| 409 | +); |
\ No newline at end of file |
Index: trunk/extensions/Vector/Vector.hooks.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | 'vector-collapsiblenav-more', |
22 | 22 | ), |
23 | 23 | 'dependencies' => array( 'jquery.client' ), |
24 | | - ) |
| 24 | + ), |
25 | 25 | 'preferences' => array( |
26 | 26 | 'key' => 'vector-collapsiblenav', |
27 | 27 | 'ui' => array( |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | 'name' => 'vector.collapsibleTabs', |
40 | 40 | 'resources' => array( |
41 | 41 | 'scripts' => 'extensions/Vector/modules/vector.collapsibleTabs.js', |
42 | | - ) |
| 42 | + ), |
43 | 43 | ), |
44 | 44 | 'editwarning' => array( |
45 | 45 | 'name' => 'vector.editWarning', |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | 'dependencies' => array( 'jquery.client' ), |
68 | 68 | ), |
69 | 69 | 'preferences' => array( |
70 | | - 'requirements' = array( 'vector-simplesearch' => true ), |
| 70 | + 'requirements' => array( 'vector-simplesearch' => true ), |
71 | 71 | ), |
72 | 72 | ), |
73 | 73 | 'footercleanup' => array( |
— | — | @@ -86,14 +86,14 @@ |
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | 'preferences' => array( |
90 | | - 'requirements' = array( 'vector-simplesearch' => true, 'disablesuggest' => false ), |
| 90 | + 'requirements' => array( 'vector-simplesearch' => true, 'disablesuggest' => false ), |
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |
94 | 94 | |
95 | 95 | /* Protected Static Methods */ |
96 | 96 | |
97 | | - protected static isEnabled( $module ) { |
| 97 | + protected static function isEnabled( $module ) { |
98 | 98 | global $wgVectorModules, $wgUser; |
99 | 99 | |
100 | 100 | $enabled = |
— | — | @@ -101,15 +101,17 @@ |
102 | 102 | ( |
103 | 103 | $wgVectorModules[$module]['user'] && |
104 | 104 | isset( self::$modules[$module]['preferences']['key'] ) && |
105 | | - $wgUser->getOption( self::$modules[$module]['preferences']['key'] |
| 105 | + $wgUser->getOption( self::$modules[$module]['preferences']['key'] ) |
106 | 106 | ); |
107 | 107 | if ( !$enabled ) { |
108 | 108 | return false; |
109 | 109 | } |
110 | | - foreach ( self::$modules[$module]['preferences']['requirements'] as $requirement => $value ) { |
111 | | - // Important! We really do want fuzzy evaluation here |
112 | | - if ( $wgUser->getOption( $requirement ) != $value ) { |
113 | | - return false; |
| 110 | + if ( isset( self::$modules[$module]['preferences']['requirements'] ) ) { |
| 111 | + foreach ( self::$modules[$module]['preferences']['requirements'] as $requirement => $value ) { |
| 112 | + // Important! We really do want fuzzy evaluation here |
| 113 | + if ( $wgUser->getOption( $requirement ) != $value ) { |
| 114 | + return false; |
| 115 | + } |
114 | 116 | } |
115 | 117 | } |
116 | 118 | return true; |
— | — | @@ -139,6 +141,7 @@ |
140 | 142 | $out->addModules( self::$modules[$module]['name'] ); |
141 | 143 | } |
142 | 144 | } |
| 145 | + return true; |
143 | 146 | } |
144 | 147 | |
145 | 148 | /** |
— | — | @@ -153,7 +156,7 @@ |
154 | 157 | global $wgVectorModules; |
155 | 158 | |
156 | 159 | foreach ( $wgVectorModules as $module => $enable ) { |
157 | | - if ( $enable['user'] ) && isset( self::$modules['preferences'][$module]['ui'] ) ) { |
| 160 | + if ( $enable['user'] && isset( self::$modules['preferences'][$module]['ui'] ) ) { |
158 | 161 | $defaultPreferences[self::$modules['preferences'][$module]['key']] = |
159 | 162 | self::$modules['preferences'][$module]['ui']; |
160 | 163 | } |
— | — | @@ -166,6 +169,8 @@ |
167 | 170 | * Adds enabled/disabled switches for Vector modules |
168 | 171 | */ |
169 | 172 | public static function makeGlobalVariablesScript( &$vars ) { |
| 173 | + global $wgVectorModules; |
| 174 | + |
170 | 175 | $configurations = array(); |
171 | 176 | foreach ( $wgVectorModules as $module => $enable ) { |
172 | 177 | if ( |
— | — | @@ -191,7 +196,8 @@ |
192 | 197 | */ |
193 | 198 | public static function resourceLoaderRegisterModules() { |
194 | 199 | foreach ( self::$modules as $module ) { |
195 | | - ResourceLoader::register( $module['name'], $module['resources'] ); |
| 200 | + ResourceLoader::register( $module['name'], new ResourceLoaderFileModule( $module['resources'] ) ); |
196 | 201 | } |
| 202 | + return true; |
197 | 203 | } |
198 | 204 | } |
\ No newline at end of file |