Index: trunk/extensions/Narayam/Narayam.hooks.php |
— | — | @@ -6,6 +6,8 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | class NarayamHooks { |
| 10 | + |
| 11 | + /// Hook: BeforePageDisplay |
10 | 12 | public static function addModules( $out, $skin ) { |
11 | 13 | global $wgUser; |
12 | 14 | |
— | — | @@ -24,9 +26,11 @@ |
25 | 27 | return true; |
26 | 28 | } |
27 | 29 | |
| 30 | + /// Hook: ResourceLoaderGetConfigVars |
28 | 31 | public static function addConfig( &$vars ) { |
29 | 32 | global $wgNarayamEnabledByDefault, $wgNarayamRecentItemsLength, $wgUser; |
30 | 33 | |
| 34 | + // FIXME: this hook cannot depend on any state! |
31 | 35 | if ( $wgUser->getOption( 'narayamDisable' ) ) { |
32 | 36 | // User disabled Narayam |
33 | 37 | return true; |
— | — | @@ -34,10 +38,11 @@ |
35 | 39 | |
36 | 40 | $vars['wgNarayamEnabledByDefault'] = $wgNarayamEnabledByDefault; |
37 | 41 | $vars['wgNarayamRecentItemsLength'] = $wgNarayamRecentItemsLength; |
38 | | - |
| 42 | + |
39 | 43 | return true; |
40 | 44 | } |
41 | 45 | |
| 46 | + /// Hook: MakeGlobalVariablesScript |
42 | 47 | public static function addVariables( &$vars ) { |
43 | 48 | global $wgUser, $wgNarayamSchemes; |
44 | 49 | |
— | — | @@ -64,12 +69,13 @@ |
65 | 70 | $wgNarayamSchemes[$wgLanguageCode] : array(); |
66 | 71 | $userlangSchemes = isset( $wgNarayamSchemes[$userlangCode] ) ? |
67 | 72 | $wgNarayamSchemes[$userlangCode] : array(); |
68 | | - |
| 73 | + |
69 | 74 | $schemes = $userlangSchemes + $contlangSchemes; |
70 | 75 | |
71 | 76 | return $schemes; |
72 | 77 | } |
73 | 78 | |
| 79 | + /// Hook: GetPreferences |
74 | 80 | public static function addPreference( $user, &$preferences ) { |
75 | 81 | // A checkbox in preferences to diable Narayam |
76 | 82 | $preferences['narayamDisable'] = array( |