Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -36,9 +36,15 @@ |
37 | 37 | 'searchlimit' => array( 'Preferences', 'filterIntval' ), |
38 | 38 | ); |
39 | 39 | |
| 40 | + /** |
| 41 | + * @throws MWException |
| 42 | + * @param $user User |
| 43 | + * @return array|null |
| 44 | + */ |
40 | 45 | static function getPreferences( $user ) { |
41 | | - if ( self::$defaultPreferences ) |
| 46 | + if ( self::$defaultPreferences ) { |
42 | 47 | return self::$defaultPreferences; |
| 48 | + } |
43 | 49 | |
44 | 50 | $defaultPreferences = array(); |
45 | 51 | |
— | — | @@ -91,7 +97,14 @@ |
92 | 98 | return $defaultPreferences; |
93 | 99 | } |
94 | 100 | |
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 | + */ |
96 | 109 | static function getOptionFromUser( $name, $info, $user ) { |
97 | 110 | $val = $user->getOption( $name ); |
98 | 111 | |
— | — | @@ -112,6 +125,11 @@ |
113 | 126 | return $val; |
114 | 127 | } |
115 | 128 | |
| 129 | + /** |
| 130 | + * @param $user User |
| 131 | + * @param $defaultPreferences |
| 132 | + * @return void |
| 133 | + */ |
116 | 134 | static function profilePreferences( $user, &$defaultPreferences ) { |
117 | 135 | global $wgLang, $wgUser; |
118 | 136 | ## User info ##################################### |
— | — | @@ -295,7 +313,7 @@ |
296 | 314 | global $wgMaxSigChars, $wgOut, $wgParser; |
297 | 315 | |
298 | 316 | // 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 ); |
300 | 318 | $oldsigHTML = $wgOut->parseInline( $oldsigWikiText ); |
301 | 319 | $defaultPreferences['oldsig'] = array( |
302 | 320 | 'type' => 'info', |
— | — | @@ -444,6 +462,11 @@ |
445 | 463 | } |
446 | 464 | } |
447 | 465 | |
| 466 | + /** |
| 467 | + * @param $user User |
| 468 | + * @param $defaultPreferences |
| 469 | + * @return void |
| 470 | + */ |
448 | 471 | static function skinPreferences( $user, &$defaultPreferences ) { |
449 | 472 | ## Skin ##################################### |
450 | 473 | global $wgLang, $wgAllowUserCss, $wgAllowUserJs; |
— | — | @@ -510,6 +533,11 @@ |
511 | 534 | ); |
512 | 535 | } |
513 | 536 | |
| 537 | + /** |
| 538 | + * @param $user User |
| 539 | + * @param $defaultPreferences |
| 540 | + * @return void |
| 541 | + */ |
514 | 542 | static function datetimePreferences( $user, &$defaultPreferences ) { |
515 | 543 | global $wgLang; |
516 | 544 | |
— | — | @@ -794,6 +822,11 @@ |
795 | 823 | } |
796 | 824 | } |
797 | 825 | |
| 826 | + /** |
| 827 | + * @param $user User |
| 828 | + * @param $defaultPreferences |
| 829 | + * @return void |
| 830 | + */ |
798 | 831 | static function watchlistPreferences( $user, &$defaultPreferences ) { |
799 | 832 | global $wgUseRCPatrol, $wgEnableAPI; |
800 | 833 | |
— | — | @@ -988,7 +1021,7 @@ |
989 | 1022 | } |
990 | 1023 | |
991 | 1024 | /** |
992 | | - * @param $user The User object |
| 1025 | + * @param $user User The User object |
993 | 1026 | * @return Array: text/links to display as key; $skinkey as value |
994 | 1027 | */ |
995 | 1028 | static function generateSkinOptions( $user ) { |
— | — | @@ -1130,7 +1163,7 @@ |
1131 | 1164 | } |
1132 | 1165 | |
1133 | 1166 | static function validateEmail( $email, $alldata ) { |
1134 | | - if ( $email && !User::isValidEmailAddr( $email ) ) { |
| 1167 | + if ( $email && !Sanitizer::validateEmail( $email ) ) { |
1135 | 1168 | return wfMsgExt( 'invalidemailaddress', 'parseinline' ); |
1136 | 1169 | } |
1137 | 1170 | |
— | — | @@ -1343,6 +1376,10 @@ |
1344 | 1377 | return Status::newGood(); |
1345 | 1378 | } |
1346 | 1379 | |
| 1380 | + /** |
| 1381 | + * @param $user User |
| 1382 | + * @return array |
| 1383 | + */ |
1347 | 1384 | public static function loadOldSearchNs( $user ) { |
1348 | 1385 | $searchableNamespaces = SearchEngine::searchableNamespaces(); |
1349 | 1386 | // Back compat with old format |