r86389 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86388‎ | r86389 | r86390 >
Date:11:03, 19 April 2011
Author:reedy
Status:ok
Tags:
Comment:
Documentation, braces, and one update of the User email sanitisation call
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -36,9 +36,15 @@
3737 'searchlimit' => array( 'Preferences', 'filterIntval' ),
3838 );
3939
 40+ /**
 41+ * @throws MWException
 42+ * @param $user User
 43+ * @return array|null
 44+ */
4045 static function getPreferences( $user ) {
41 - if ( self::$defaultPreferences )
 46+ if ( self::$defaultPreferences ) {
4247 return self::$defaultPreferences;
 48+ }
4349
4450 $defaultPreferences = array();
4551
@@ -91,7 +97,14 @@
9298 return $defaultPreferences;
9399 }
94100
95 - // Pull option from a user account. Handles stuff like array-type preferences.
 101+ /**
 102+ * Pull option from a user account. Handles stuff like array-type preferences.
 103+ *
 104+ * @param $name
 105+ * @param $info
 106+ * @param $user User
 107+ * @return array|String
 108+ */
96109 static function getOptionFromUser( $name, $info, $user ) {
97110 $val = $user->getOption( $name );
98111
@@ -112,6 +125,11 @@
113126 return $val;
114127 }
115128
 129+ /**
 130+ * @param $user User
 131+ * @param $defaultPreferences
 132+ * @return void
 133+ */
116134 static function profilePreferences( $user, &$defaultPreferences ) {
117135 global $wgLang, $wgUser;
118136 ## User info #####################################
@@ -295,7 +313,7 @@
296314 global $wgMaxSigChars, $wgOut, $wgParser;
297315
298316 // show a preview of the old signature first
299 - $oldsigWikiText = $wgParser->preSaveTransform( "~~~", new Title , $user, new ParserOptions );
 317+ $oldsigWikiText = $wgParser->preSaveTransform( "~~~", new Title, $user, new ParserOptions );
300318 $oldsigHTML = $wgOut->parseInline( $oldsigWikiText );
301319 $defaultPreferences['oldsig'] = array(
302320 'type' => 'info',
@@ -444,6 +462,11 @@
445463 }
446464 }
447465
 466+ /**
 467+ * @param $user User
 468+ * @param $defaultPreferences
 469+ * @return void
 470+ */
448471 static function skinPreferences( $user, &$defaultPreferences ) {
449472 ## Skin #####################################
450473 global $wgLang, $wgAllowUserCss, $wgAllowUserJs;
@@ -510,6 +533,11 @@
511534 );
512535 }
513536
 537+ /**
 538+ * @param $user User
 539+ * @param $defaultPreferences
 540+ * @return void
 541+ */
514542 static function datetimePreferences( $user, &$defaultPreferences ) {
515543 global $wgLang;
516544
@@ -794,6 +822,11 @@
795823 }
796824 }
797825
 826+ /**
 827+ * @param $user User
 828+ * @param $defaultPreferences
 829+ * @return void
 830+ */
798831 static function watchlistPreferences( $user, &$defaultPreferences ) {
799832 global $wgUseRCPatrol, $wgEnableAPI;
800833
@@ -988,7 +1021,7 @@
9891022 }
9901023
9911024 /**
992 - * @param $user The User object
 1025+ * @param $user User The User object
9931026 * @return Array: text/links to display as key; $skinkey as value
9941027 */
9951028 static function generateSkinOptions( $user ) {
@@ -1130,7 +1163,7 @@
11311164 }
11321165
11331166 static function validateEmail( $email, $alldata ) {
1134 - if ( $email && !User::isValidEmailAddr( $email ) ) {
 1167+ if ( $email && !Sanitizer::validateEmail( $email ) ) {
11351168 return wfMsgExt( 'invalidemailaddress', 'parseinline' );
11361169 }
11371170
@@ -1343,6 +1376,10 @@
13441377 return Status::newGood();
13451378 }
13461379
 1380+ /**
 1381+ * @param $user User
 1382+ * @return array
 1383+ */
13471384 public static function loadOldSearchNs( $user ) {
13481385 $searchableNamespaces = SearchEngine::searchableNamespaces();
13491386 // Back compat with old format

Status & tagging log