r111038 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111037‎ | r111038 | r111039 >
Date:14:50, 9 February 2012
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Fixup hooks documentation and few minor stylize changes
Modified paths:
  • /trunk/extensions/Narayam/Narayam.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/Narayam.hooks.php
@@ -7,10 +7,15 @@
88
99 class NarayamHooks {
1010
11 - /// Hook: BeforePageDisplay
 11+ /**
 12+ * Hook: BeforePageDisplay
 13+ * @param $out OutputPage
 14+ * @param $skin
 15+ * @return bool
 16+ */
1217 public static function addModules( $out, $skin ) {
1318 if ( $out->getUser()->getOption( 'narayamEnable' ) ) {
14 - $schemes = array_values( self::getSchemes () );
 19+ $schemes = array_values( self::getSchemes() );
1520 if ( count( $schemes ) ) {
1621 $out->addModules( $schemes );
1722 $out->addModules( 'ext.narayam' );
@@ -35,7 +40,11 @@
3641 return true;
3742 }
3843
39 - /// Hook: ResourceLoaderGetConfigVars
 44+ /**
 45+ * Hook: ResourceLoaderGetConfigVars
 46+ * @param $vars Array
 47+ * @return bool
 48+ */
4049 public static function addConfig( &$vars ) {
4150 global $wgNarayamRecentItemsLength, $wgNarayamEnabledByDefault;
4251 $vars['wgNarayamEnabledByDefault'] = $wgNarayamEnabledByDefault;
@@ -44,9 +53,13 @@
4554 return true;
4655 }
4756
48 - /// Hook: MakeGlobalVariablesScript
 57+ /**
 58+ * Hook: MakeGlobalVariablesScript
 59+ * @param $vars Array
 60+ * @return bool
 61+ */
4962 public static function addVariables( &$vars ) {
50 - global $wgUser, $wgNarayamSchemes, $wgNarayamUseBetaMapping;
 63+ global $wgNarayamSchemes, $wgNarayamUseBetaMapping;
5164
5265 $vars['wgNarayamAvailableSchemes'] = self::getSchemes(); // Note: scheme names must be keys, not values
5366 $allSchemes = $wgNarayamSchemes;
@@ -72,7 +85,7 @@
7386
7487 /**
7588 * 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 )
7790 */
7891 protected static function getSchemes() {
7992 global $wgLanguageCode, $wgLang, $wgNarayamSchemes, $wgTitle, $wgNarayamUseBetaMapping;
@@ -92,19 +105,22 @@
93106 if ( $version === "beta" ) {
94107 if ( !$wgNarayamUseBetaMapping ) {
95108 unset( $schemes[$i] );
96 - }
97 - else {
 109+ } else {
98110 $schemes[$i] = $scheme[0];
99111 }
100 - }
101 - else {
 112+ } else {
102113 $schemes[$i] = $scheme;
103114 }
104115 }
105116 return $schemes;
106117 }
107118
108 - /// Hook: GetPreferences
 119+ /**
 120+ * Hook: GetPreferences
 121+ * @param $user User
 122+ * @param $preferences Array
 123+ * @return bool
 124+ */
109125 public static function addPreference( $user, &$preferences ) {
110126 // A checkbox in preferences to disable Narayam
111127 $preferences['narayamEnable'] = array(
@@ -116,6 +132,7 @@
117133
118134 return true;
119135 }
 136+
120137 /**
121138 * UserGetDefaultOptions hook handler.
122139 * @param $defaultOptions array

Comments

#Comment by Nikerabbit (talk | contribs)   07:45, 10 February 2012

Sigh why do we need these? All the information about hooks are in central place at docs/hooks.txt.

Status & tagging log