Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -38,10 +38,10 @@ |
39 | 39 | /** |
40 | 40 | * @throws MWException |
41 | 41 | * @param $user User |
42 | | - * @param $context IContextSource |
| 42 | + * @param $context ContextSource |
43 | 43 | * @return array|null |
44 | 44 | */ |
45 | | - static function getPreferences( $user, IContextSource $context ) { |
| 45 | + public static function getPreferences( $user, ContextSource $context ) { |
46 | 46 | if ( self::$defaultPreferences ) { |
47 | 47 | return self::$defaultPreferences; |
48 | 48 | } |
— | — | @@ -127,11 +127,11 @@ |
128 | 128 | |
129 | 129 | /** |
130 | 130 | * @param $user User |
131 | | - * @param $context IContextSource |
| 131 | + * @param $context ContextSource |
132 | 132 | * @param $defaultPreferences |
133 | 133 | * @return void |
134 | 134 | */ |
135 | | - static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 135 | + static function profilePreferences( $user, ContextSource $context, &$defaultPreferences ) { |
136 | 136 | global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode, |
137 | 137 | $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars, |
138 | 138 | $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication, |
— | — | @@ -454,11 +454,11 @@ |
455 | 455 | |
456 | 456 | /** |
457 | 457 | * @param $user User |
458 | | - * @param $context IContextSource |
| 458 | + * @param $context ContextSource |
459 | 459 | * @param $defaultPreferences |
460 | 460 | * @return void |
461 | 461 | */ |
462 | | - static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 462 | + static function skinPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
463 | 463 | ## Skin ##################################### |
464 | 464 | global $wgAllowUserCss, $wgAllowUserJs; |
465 | 465 | |
— | — | @@ -603,10 +603,10 @@ |
604 | 604 | |
605 | 605 | /** |
606 | 606 | * @param $user User |
607 | | - * @param $context IContextSource |
| 607 | + * @param $context ContextSource |
608 | 608 | * @param $defaultPreferences Array |
609 | 609 | */ |
610 | | - static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 610 | + static function renderingPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
611 | 611 | ## Page Rendering ############################## |
612 | 612 | global $wgAllowUserCssPrefs; |
613 | 613 | if ( $wgAllowUserCssPrefs ) { |
— | — | @@ -681,10 +681,10 @@ |
682 | 682 | |
683 | 683 | /** |
684 | 684 | * @param $user User |
685 | | - * @param $context IContextSource |
| 685 | + * @param $context ContextSource |
686 | 686 | * @param $defaultPreferences Array |
687 | 687 | */ |
688 | | - static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 688 | + static function editingPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
689 | 689 | global $wgUseExternalEditor, $wgAllowUserCssPrefs; |
690 | 690 | |
691 | 691 | ## Editing ##################################### |
— | — | @@ -781,10 +781,10 @@ |
782 | 782 | |
783 | 783 | /** |
784 | 784 | * @param $user User |
785 | | - * @param $context IContextSource |
| 785 | + * @param $context ContextSource |
786 | 786 | * @param $defaultPreferences Array |
787 | 787 | */ |
788 | | - static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 788 | + static function rcPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
789 | 789 | global $wgRCMaxAge, $wgRCShowWatchingUsers; |
790 | 790 | |
791 | 791 | ## RecentChanges ##################################### |
— | — | @@ -838,10 +838,10 @@ |
839 | 839 | |
840 | 840 | /** |
841 | 841 | * @param $user User |
842 | | - * @param $context IContextSource |
| 842 | + * @param $context ContextSource |
843 | 843 | * @param $defaultPreferences |
844 | 844 | */ |
845 | | - static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 845 | + static function watchlistPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
846 | 846 | global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge; |
847 | 847 | |
848 | 848 | $watchlistdaysMax = ceil( $wgRCMaxAge / ( 3600 * 24 ) ); |
— | — | @@ -939,10 +939,10 @@ |
940 | 940 | |
941 | 941 | /** |
942 | 942 | * @param $user User |
943 | | - * @param $context IContextSource |
| 943 | + * @param $context ContextSource |
944 | 944 | * @param $defaultPreferences Array |
945 | 945 | */ |
946 | | - static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 946 | + static function searchPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
947 | 947 | global $wgContLang, $wgEnableMWSuggest, $wgVectorUseSimpleSearch; |
948 | 948 | |
949 | 949 | ## Search ##################################### |
— | — | @@ -1003,10 +1003,10 @@ |
1004 | 1004 | |
1005 | 1005 | /** |
1006 | 1006 | * @param $user User |
1007 | | - * @param $context IContextSource |
| 1007 | + * @param $context ContextSource |
1008 | 1008 | * @param $defaultPreferences Array |
1009 | 1009 | */ |
1010 | | - static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) { |
| 1010 | + static function miscPreferences( $user, ContextSource $context, &$defaultPreferences ) { |
1011 | 1011 | global $wgContLang; |
1012 | 1012 | |
1013 | 1013 | ## Misc ##################################### |
— | — | @@ -1035,10 +1035,10 @@ |
1036 | 1036 | |
1037 | 1037 | /** |
1038 | 1038 | * @param $user User The User object |
1039 | | - * @param $context IContextSource |
| 1039 | + * @param $context ContextSource |
1040 | 1040 | * @return Array: text/links to display as key; $skinkey as value |
1041 | 1041 | */ |
1042 | | - static function generateSkinOptions( $user, IContextSource $context ) { |
| 1042 | + static function generateSkinOptions( $user, ContextSource $context ) { |
1043 | 1043 | global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs; |
1044 | 1044 | $ret = array(); |
1045 | 1045 | |
— | — | @@ -1090,10 +1090,10 @@ |
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | /** |
1094 | | - * @param $context IContextSource |
| 1094 | + * @param $context ContextSource |
1095 | 1095 | * @return array |
1096 | 1096 | */ |
1097 | | - static function getDateOptions( IContextSource $context ) { |
| 1097 | + static function getDateOptions( ContextSource $context ) { |
1098 | 1098 | $lang = $context->getLanguage(); |
1099 | 1099 | $dateopts = $lang->getDatePreferences(); |
1100 | 1100 | |
— | — | @@ -1125,10 +1125,10 @@ |
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | /** |
1129 | | - * @param $context IContextSource |
| 1129 | + * @param $context ContextSource |
1130 | 1130 | * @return array |
1131 | 1131 | */ |
1132 | | - static function getImageSizes( IContextSource $context ) { |
| 1132 | + static function getImageSizes( ContextSource $context ) { |
1133 | 1133 | global $wgImageLimits; |
1134 | 1134 | |
1135 | 1135 | $ret = array(); |
— | — | @@ -1143,10 +1143,10 @@ |
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | /** |
1147 | | - * @param $context IContextSource |
| 1147 | + * @param $context ContextSource |
1148 | 1148 | * @return array |
1149 | 1149 | */ |
1150 | | - static function getThumbSizes( IContextSource $context ) { |
| 1150 | + static function getThumbSizes( ContextSource $context ) { |
1151 | 1151 | global $wgThumbLimits; |
1152 | 1152 | |
1153 | 1153 | $ret = array(); |
— | — | @@ -1200,17 +1200,21 @@ |
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * @param $user User |
1204 | | - * @param $context IContextSource |
| 1204 | + * @param $context ContextSource |
1205 | 1205 | * @param $formClass string |
1206 | 1206 | * @param $remove Array: array of items to remove |
1207 | 1207 | * @return HtmlForm |
1208 | 1208 | */ |
1209 | | - static function getFormObject( $user, IContextSource $context, $formClass = 'PreferencesForm', array $remove = array() ) { |
| 1209 | + static function getFormObject( $user, ContextSource $context, $formClass = 'PreferencesForm', array $remove = array() ) { |
1210 | 1210 | $formDescriptor = Preferences::getPreferences( $user, $context ); |
1211 | 1211 | if ( count( $remove ) ) { |
1212 | 1212 | $removeKeys = array_flip( $remove ); |
1213 | 1213 | $formDescriptor = array_diff_key( $formDescriptor, $removeKeys ); |
1214 | 1214 | } |
| 1215 | + |
| 1216 | + /** |
| 1217 | + * @var $htmlForm PreferencesForm |
| 1218 | + */ |
1215 | 1219 | $htmlForm = new $formClass( $formDescriptor, $context, 'prefs' ); |
1216 | 1220 | |
1217 | 1221 | $htmlForm->setModifiedUser( $user ); |
— | — | @@ -1225,9 +1229,10 @@ |
1226 | 1230 | } |
1227 | 1231 | |
1228 | 1232 | /** |
| 1233 | + * @param $context ContextSource |
1229 | 1234 | * @return array |
1230 | 1235 | */ |
1231 | | - static function getTimezoneOptions( IContextSource $context ) { |
| 1236 | + static function getTimezoneOptions( ContextSource $context ) { |
1232 | 1237 | $opt = array(); |
1233 | 1238 | |
1234 | 1239 | global $wgLocalTZoffset, $wgLocaltimezone; |
— | — | @@ -1330,7 +1335,7 @@ |
1331 | 1336 | |
1332 | 1337 | /** |
1333 | 1338 | * @param $formData |
1334 | | - * @param $form HTMLForm |
| 1339 | + * @param $form PreferencesForm |
1335 | 1340 | * @param $entryPoint string |
1336 | 1341 | * @return bool|Status|string |
1337 | 1342 | */ |
— | — | @@ -1389,6 +1394,7 @@ |
1390 | 1395 | |
1391 | 1396 | /** |
1392 | 1397 | * @param $formData |
| 1398 | + * @param $form PreferencesForm |
1393 | 1399 | * @return Status |
1394 | 1400 | */ |
1395 | 1401 | public static function tryUISubmit( $formData, $form ) { |
— | — | @@ -1476,10 +1482,16 @@ |
1477 | 1483 | |
1478 | 1484 | private $modifiedUser; |
1479 | 1485 | |
| 1486 | + /** |
| 1487 | + * @param $user User |
| 1488 | + */ |
1480 | 1489 | public function setModifiedUser( $user ) { |
1481 | 1490 | $this->modifiedUser = $user; |
1482 | 1491 | } |
1483 | 1492 | |
| 1493 | + /** |
| 1494 | + * @return User |
| 1495 | + */ |
1484 | 1496 | public function getModifiedUser() { |
1485 | 1497 | if ( $this->modifiedUser === null ) { |
1486 | 1498 | return $this->getUser(); |
— | — | @@ -1546,8 +1558,10 @@ |
1547 | 1559 | |
1548 | 1560 | return $data; |
1549 | 1561 | } |
| 1562 | + |
1550 | 1563 | /** |
1551 | 1564 | * Get the whole body of the form. |
| 1565 | + * @return string |
1552 | 1566 | */ |
1553 | 1567 | function getBody() { |
1554 | 1568 | return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' ); |
— | — | @@ -1556,6 +1570,8 @@ |
1557 | 1571 | /** |
1558 | 1572 | * Get the <legend> for a given section key. Normally this is the |
1559 | 1573 | * prefs-$key message but we'll allow extensions to override it. |
| 1574 | + * @param $key string |
| 1575 | + * @return string |
1560 | 1576 | */ |
1561 | 1577 | function getLegend( $key ) { |
1562 | 1578 | $legend = parent::getLegend( $key ); |