r89044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89043‎ | r89044 | r89045 >
Date:16:32, 28 May 2011
Author:reedy
Status:deferred
Tags:
Comment:
And even mooore
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/includes/RequestContext.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RequestContext.php
@@ -10,14 +10,38 @@
1111 */
1212
1313 class RequestContext {
14 - private $mRequest; // / WebRequest object
15 - private $mTitle; // / Title object
16 - private $mOutput; // / OutputPage object
17 - private $mUser; // / User object
18 - private $mLang; // / Language object
19 - private $mSkin; // / Skin object
2014
2115 /**
 16+ * @var WebRequest
 17+ */
 18+ private $mRequest;
 19+
 20+ /**
 21+ * @var Title
 22+ */
 23+ private $mTitle;
 24+
 25+ /**
 26+ * @var OutputPage
 27+ */
 28+ private $mOutput;
 29+
 30+ /**
 31+ * @var User
 32+ */
 33+ private $mUser;
 34+
 35+ /**
 36+ * @var Language
 37+ */
 38+ private $mLang;
 39+
 40+ /**
 41+ * @var Skin
 42+ */
 43+ private $mSkin;
 44+
 45+ /**
2246 * Set the WebRequest object
2347 *
2448 * @param $r WebRequest object
@@ -189,6 +213,10 @@
190214 * Make these C#-style accessors, so you can do $context->user->getName() which is
191215 * internally mapped to $context->__get('user')->getName() which is mapped to
192216 * $context->getUser()->getName()
 217+ *
 218+ * @param $name string
 219+ *
 220+ * @return string
193221 */
194222 public function __get( $name ) {
195223 if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) {
@@ -198,6 +226,11 @@
199227 trigger_error( "Undefined property {$name}", E_NOTICE );
200228 }
201229
 230+ /**
 231+ * @param $name string
 232+ * @param $value
 233+ * @return string
 234+ */
202235 public function __set( $name, $value ) {
203236 if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) {
204237 $fname = 'set' . ucfirst( $name );
Index: trunk/phase3/includes/Preferences.php
@@ -517,6 +517,10 @@
518518 }
519519 }
520520
 521+ /**
 522+ * @param $user User
 523+ * @param $defaultPreferences Array
 524+ */
521525 static function filesPreferences( $user, &$defaultPreferences ) {
522526 ## Files #####################################
523527 $defaultPreferences['imagesize'] = array(
@@ -595,6 +599,10 @@
596600 );
597601 }
598602
 603+ /**
 604+ * @param $user User
 605+ * @param $defaultPreferences Array
 606+ */
599607 static function renderingPreferences( $user, &$defaultPreferences ) {
600608 ## Page Rendering ##############################
601609 global $wgAllowUserCssPrefs;
@@ -668,6 +676,10 @@
669677 );
670678 }
671679
 680+ /**
 681+ * @param $user User
 682+ * @param $defaultPreferences Array
 683+ */
672684 static function editingPreferences( $user, &$defaultPreferences ) {
673685 global $wgUseExternalEditor, $wgAllowUserCssPrefs;
674686
@@ -766,6 +778,10 @@
767779 );
768780 }
769781
 782+ /**
 783+ * @param $user User
 784+ * @param $defaultPreferences Array
 785+ */
770786 static function rcPreferences( $user, &$defaultPreferences ) {
771787 global $wgRCMaxAge, $wgUseRCPatrol, $wgLang;
772788
@@ -825,7 +841,6 @@
826842 /**
827843 * @param $user User
828844 * @param $defaultPreferences
829 - * @return void
830845 */
831846 static function watchlistPreferences( $user, &$defaultPreferences ) {
832847 global $wgUseRCPatrol, $wgEnableAPI;
@@ -920,6 +935,10 @@
921936 }
922937 }
923938
 939+ /**
 940+ * @param $user User
 941+ * @param $defaultPreferences Array
 942+ */
924943 static function searchPreferences( $user, &$defaultPreferences ) {
925944 global $wgContLang;
926945
@@ -981,6 +1000,10 @@
9821001 );
9831002 }
9841003
 1004+ /**
 1005+ * @param $user User
 1006+ * @param $defaultPreferences Array
 1007+ */
9851008 static function miscPreferences( $user, &$defaultPreferences ) {
9861009 ## Misc #####################################
9871010 $defaultPreferences['diffonly'] = array(
@@ -1064,6 +1087,9 @@
10651088 return $ret;
10661089 }
10671090
 1091+ /**
 1092+ * @return array
 1093+ */
10681094 static function getDateOptions() {
10691095 global $wgLang;
10701096 $dateopts = $wgLang->getDatePreferences();
@@ -1095,6 +1121,9 @@
10961122 return $ret;
10971123 }
10981124
 1125+ /**
 1126+ * @return array
 1127+ */
10991128 static function getImageSizes() {
11001129 global $wgImageLimits;
11011130
@@ -1108,6 +1137,9 @@
11091138 return $ret;
11101139 }
11111140
 1141+ /**
 1142+ * @return array
 1143+ */
11121144 static function getThumbSizes() {
11131145 global $wgThumbLimits;
11141146
@@ -1121,6 +1153,11 @@
11221154 return $ret;
11231155 }
11241156
 1157+ /**
 1158+ * @param $signature
 1159+ * @param $alldata
 1160+ * @return bool|string
 1161+ */
11251162 static function validateSignature( $signature, $alldata ) {
11261163 global $wgParser, $wgMaxSigChars, $wgLang;
11271164 if ( mb_strlen( $signature ) > $wgMaxSigChars ) {
@@ -1138,6 +1175,11 @@
11391176 }
11401177 }
11411178
 1179+ /**
 1180+ * @param $signature
 1181+ * @param $alldata
 1182+ * @return
 1183+ */
11421184 static function cleanSignature( $signature, $alldata ) {
11431185 global $wgParser;
11441186 if ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] ) {
@@ -1150,6 +1192,11 @@
11511193 return $signature;
11521194 }
11531195
 1196+ /**
 1197+ * @param $email
 1198+ * @param $alldata
 1199+ * @return bool|String
 1200+ */
11541201 static function validateEmail( $email, $alldata ) {
11551202 if ( $email && !Sanitizer::validateEmail( $email ) ) {
11561203 return wfMsgExt( 'invalidemailaddress', 'parseinline' );
@@ -1162,6 +1209,11 @@
11631210 return true;
11641211 }
11651212
 1213+ /**
 1214+ * @param $user User
 1215+ * @param $formClass string
 1216+ * @return HtmlForm
 1217+ */
11661218 static function getFormObject( $user, $formClass = 'PreferencesForm' ) {
11671219 $formDescriptor = Preferences::getPreferences( $user );
11681220 $htmlForm = new $formClass( $formDescriptor, 'prefs' );
@@ -1177,6 +1229,9 @@
11781230 return $htmlForm;
11791231 }
11801232
 1233+ /**
 1234+ * @return array
 1235+ */
11811236 static function getTimezoneOptions() {
11821237 $opt = array();
11831238
@@ -1239,10 +1294,20 @@
12401295 return $opt;
12411296 }
12421297
 1298+ /**
 1299+ * @param $value
 1300+ * @param $alldata
 1301+ * @return int
 1302+ */
12431303 static function filterIntval( $value, $alldata ){
12441304 return intval( $value );
12451305 }
12461306
 1307+ /**
 1308+ * @param $tz
 1309+ * @param $alldata
 1310+ * @return string
 1311+ */
12471312 static function filterTimezoneInput( $tz, $alldata ) {
12481313 $data = explode( '|', $tz, 3 );
12491314 switch ( $data[0] ) {
@@ -1268,6 +1333,11 @@
12691334 }
12701335 }
12711336
 1337+ /**
 1338+ * @param $formData
 1339+ * @param $entryPoint string
 1340+ * @return bool|Status|string
 1341+ */
12721342 static function tryFormSubmit( $formData, $entryPoint = 'internal' ) {
12731343 global $wgUser, $wgEmailAuthentication, $wgEnableEmail;
12741344
@@ -1349,6 +1419,10 @@
13501420 return $result;
13511421 }
13521422
 1423+ /**
 1424+ * @param $formData
 1425+ * @return Status
 1426+ */
13531427 public static function tryUISubmit( $formData ) {
13541428 $res = self::tryFormSubmit( $formData, 'ui' );
13551429
@@ -1391,12 +1465,20 @@
13921466
13931467 /** Some tweaks to allow js prefs to work */
13941468 class PreferencesForm extends HTMLForm {
 1469+
 1470+ /**
 1471+ * @param $html string
 1472+ * @return String
 1473+ */
13951474 function wrapForm( $html ) {
13961475 $html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html );
13971476
13981477 return parent::wrapForm( $html );
13991478 }
14001479
 1480+ /**
 1481+ * @return String
 1482+ */
14011483 function getButtons() {
14021484 $html = parent::getButtons();
14031485
@@ -1412,6 +1494,10 @@
14131495 return $html;
14141496 }
14151497
 1498+ /**
 1499+ * @param $data array
 1500+ * @return array
 1501+ */
14161502 function filterDataForSubmit( $data ) {
14171503 // Support for separating MultiSelect preferences into multiple preferences
14181504 // Due to lack of array support.

Status & tagging log