Index: trunk/extensions/Narayam/Narayam.hooks.php |
— | — | @@ -7,10 +7,15 @@ |
8 | 8 | |
9 | 9 | class NarayamHooks { |
10 | 10 | |
11 | | - /// Hook: BeforePageDisplay |
| 11 | + /** |
| 12 | + * Hook: BeforePageDisplay |
| 13 | + * @param $out OutputPage |
| 14 | + * @param $skin |
| 15 | + * @return bool |
| 16 | + */ |
12 | 17 | public static function addModules( $out, $skin ) { |
13 | 18 | if ( $out->getUser()->getOption( 'narayamEnable' ) ) { |
14 | | - $schemes = array_values( self::getSchemes () ); |
| 19 | + $schemes = array_values( self::getSchemes() ); |
15 | 20 | if ( count( $schemes ) ) { |
16 | 21 | $out->addModules( $schemes ); |
17 | 22 | $out->addModules( 'ext.narayam' ); |
— | — | @@ -35,7 +40,11 @@ |
36 | 41 | return true; |
37 | 42 | } |
38 | 43 | |
39 | | - /// Hook: ResourceLoaderGetConfigVars |
| 44 | + /** |
| 45 | + * Hook: ResourceLoaderGetConfigVars |
| 46 | + * @param $vars Array |
| 47 | + * @return bool |
| 48 | + */ |
40 | 49 | public static function addConfig( &$vars ) { |
41 | 50 | global $wgNarayamRecentItemsLength, $wgNarayamEnabledByDefault; |
42 | 51 | $vars['wgNarayamEnabledByDefault'] = $wgNarayamEnabledByDefault; |
— | — | @@ -44,9 +53,13 @@ |
45 | 54 | return true; |
46 | 55 | } |
47 | 56 | |
48 | | - /// Hook: MakeGlobalVariablesScript |
| 57 | + /** |
| 58 | + * Hook: MakeGlobalVariablesScript |
| 59 | + * @param $vars Array |
| 60 | + * @return bool |
| 61 | + */ |
49 | 62 | public static function addVariables( &$vars ) { |
50 | | - global $wgUser, $wgNarayamSchemes, $wgNarayamUseBetaMapping; |
| 63 | + global $wgNarayamSchemes, $wgNarayamUseBetaMapping; |
51 | 64 | |
52 | 65 | $vars['wgNarayamAvailableSchemes'] = self::getSchemes(); // Note: scheme names must be keys, not values |
53 | 66 | $allSchemes = $wgNarayamSchemes; |
— | — | @@ -72,7 +85,7 @@ |
73 | 86 | |
74 | 87 | /** |
75 | 88 | * Get the available schemes for the user and content language |
76 | | - * @return array( scheme name => module name ) |
| 89 | + * @return array array( scheme name => module name ) |
77 | 90 | */ |
78 | 91 | protected static function getSchemes() { |
79 | 92 | global $wgLanguageCode, $wgLang, $wgNarayamSchemes, $wgTitle, $wgNarayamUseBetaMapping; |
— | — | @@ -92,19 +105,22 @@ |
93 | 106 | if ( $version === "beta" ) { |
94 | 107 | if ( !$wgNarayamUseBetaMapping ) { |
95 | 108 | unset( $schemes[$i] ); |
96 | | - } |
97 | | - else { |
| 109 | + } else { |
98 | 110 | $schemes[$i] = $scheme[0]; |
99 | 111 | } |
100 | | - } |
101 | | - else { |
| 112 | + } else { |
102 | 113 | $schemes[$i] = $scheme; |
103 | 114 | } |
104 | 115 | } |
105 | 116 | return $schemes; |
106 | 117 | } |
107 | 118 | |
108 | | - /// Hook: GetPreferences |
| 119 | + /** |
| 120 | + * Hook: GetPreferences |
| 121 | + * @param $user User |
| 122 | + * @param $preferences Array |
| 123 | + * @return bool |
| 124 | + */ |
109 | 125 | public static function addPreference( $user, &$preferences ) { |
110 | 126 | // A checkbox in preferences to disable Narayam |
111 | 127 | $preferences['narayamEnable'] = array( |
— | — | @@ -116,6 +132,7 @@ |
117 | 133 | |
118 | 134 | return true; |
119 | 135 | } |
| 136 | + |
120 | 137 | /** |
121 | 138 | * UserGetDefaultOptions hook handler. |
122 | 139 | * @param $defaultOptions array |