From 8bbcf517c2a018441c1bbdf9cf83e46b986be533 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 28 May 2011 16:32:09 +0000 Subject: [PATCH] And even mooore --- includes/Preferences.php | 88 ++++++++++++++++++++++++++++++++++++- includes/RequestContext.php | 45 ++++++++++++++++--- 2 files changed, 126 insertions(+), 7 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index 2723f75010..b5a2894e0a 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -517,6 +517,10 @@ class Preferences { } } + /** + * @param $user User + * @param $defaultPreferences Array + */ static function filesPreferences( $user, &$defaultPreferences ) { ## Files ##################################### $defaultPreferences['imagesize'] = array( @@ -595,6 +599,10 @@ class Preferences { ); } + /** + * @param $user User + * @param $defaultPreferences Array + */ static function renderingPreferences( $user, &$defaultPreferences ) { ## Page Rendering ############################## global $wgAllowUserCssPrefs; @@ -668,6 +676,10 @@ class Preferences { ); } + /** + * @param $user User + * @param $defaultPreferences Array + */ static function editingPreferences( $user, &$defaultPreferences ) { global $wgUseExternalEditor, $wgAllowUserCssPrefs; @@ -766,6 +778,10 @@ class Preferences { ); } + /** + * @param $user User + * @param $defaultPreferences Array + */ static function rcPreferences( $user, &$defaultPreferences ) { global $wgRCMaxAge, $wgUseRCPatrol, $wgLang; @@ -825,7 +841,6 @@ class Preferences { /** * @param $user User * @param $defaultPreferences - * @return void */ static function watchlistPreferences( $user, &$defaultPreferences ) { global $wgUseRCPatrol, $wgEnableAPI; @@ -920,6 +935,10 @@ class Preferences { } } + /** + * @param $user User + * @param $defaultPreferences Array + */ static function searchPreferences( $user, &$defaultPreferences ) { global $wgContLang; @@ -981,6 +1000,10 @@ class Preferences { ); } + /** + * @param $user User + * @param $defaultPreferences Array + */ static function miscPreferences( $user, &$defaultPreferences ) { ## Misc ##################################### $defaultPreferences['diffonly'] = array( @@ -1064,6 +1087,9 @@ class Preferences { return $ret; } + /** + * @return array + */ static function getDateOptions() { global $wgLang; $dateopts = $wgLang->getDatePreferences(); @@ -1095,6 +1121,9 @@ class Preferences { return $ret; } + /** + * @return array + */ static function getImageSizes() { global $wgImageLimits; @@ -1108,6 +1137,9 @@ class Preferences { return $ret; } + /** + * @return array + */ static function getThumbSizes() { global $wgThumbLimits; @@ -1121,6 +1153,11 @@ class Preferences { return $ret; } + /** + * @param $signature + * @param $alldata + * @return bool|string + */ static function validateSignature( $signature, $alldata ) { global $wgParser, $wgMaxSigChars, $wgLang; if ( mb_strlen( $signature ) > $wgMaxSigChars ) { @@ -1138,6 +1175,11 @@ class Preferences { } } + /** + * @param $signature + * @param $alldata + * @return + */ static function cleanSignature( $signature, $alldata ) { global $wgParser; if ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] ) { @@ -1150,6 +1192,11 @@ class Preferences { return $signature; } + /** + * @param $email + * @param $alldata + * @return bool|String + */ static function validateEmail( $email, $alldata ) { if ( $email && !Sanitizer::validateEmail( $email ) ) { return wfMsgExt( 'invalidemailaddress', 'parseinline' ); @@ -1162,6 +1209,11 @@ class Preferences { return true; } + /** + * @param $user User + * @param $formClass string + * @return HtmlForm + */ static function getFormObject( $user, $formClass = 'PreferencesForm' ) { $formDescriptor = Preferences::getPreferences( $user ); $htmlForm = new $formClass( $formDescriptor, 'prefs' ); @@ -1177,6 +1229,9 @@ class Preferences { return $htmlForm; } + /** + * @return array + */ static function getTimezoneOptions() { $opt = array(); @@ -1239,10 +1294,20 @@ class Preferences { return $opt; } + /** + * @param $value + * @param $alldata + * @return int + */ static function filterIntval( $value, $alldata ){ return intval( $value ); } + /** + * @param $tz + * @param $alldata + * @return string + */ static function filterTimezoneInput( $tz, $alldata ) { $data = explode( '|', $tz, 3 ); switch ( $data[0] ) { @@ -1268,6 +1333,11 @@ class Preferences { } } + /** + * @param $formData + * @param $entryPoint string + * @return bool|Status|string + */ static function tryFormSubmit( $formData, $entryPoint = 'internal' ) { global $wgUser, $wgEmailAuthentication, $wgEnableEmail; @@ -1349,6 +1419,10 @@ class Preferences { return $result; } + /** + * @param $formData + * @return Status + */ public static function tryUISubmit( $formData ) { $res = self::tryFormSubmit( $formData, 'ui' ); @@ -1391,12 +1465,20 @@ class Preferences { /** Some tweaks to allow js prefs to work */ class PreferencesForm extends HTMLForm { + + /** + * @param $html string + * @return String + */ function wrapForm( $html ) { $html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html ); return parent::wrapForm( $html ); } + /** + * @return String + */ function getButtons() { $html = parent::getButtons(); @@ -1412,6 +1494,10 @@ class PreferencesForm extends HTMLForm { return $html; } + /** + * @param $data array + * @return array + */ function filterDataForSubmit( $data ) { // Support for separating MultiSelect preferences into multiple preferences // Due to lack of array support. diff --git a/includes/RequestContext.php b/includes/RequestContext.php index abbdd4e278..b06b021d9d 100644 --- a/includes/RequestContext.php +++ b/includes/RequestContext.php @@ -10,12 +10,36 @@ */ class RequestContext { - private $mRequest; // / WebRequest object - private $mTitle; // / Title object - private $mOutput; // / OutputPage object - private $mUser; // / User object - private $mLang; // / Language object - private $mSkin; // / Skin object + + /** + * @var WebRequest + */ + private $mRequest; + + /** + * @var Title + */ + private $mTitle; + + /** + * @var OutputPage + */ + private $mOutput; + + /** + * @var User + */ + private $mUser; + + /** + * @var Language + */ + private $mLang; + + /** + * @var Skin + */ + private $mSkin; /** * Set the WebRequest object @@ -189,6 +213,10 @@ class RequestContext { * Make these C#-style accessors, so you can do $context->user->getName() which is * internally mapped to $context->__get('user')->getName() which is mapped to * $context->getUser()->getName() + * + * @param $name string + * + * @return string */ public function __get( $name ) { if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) { @@ -198,6 +226,11 @@ class RequestContext { trigger_error( "Undefined property {$name}", E_NOTICE ); } + /** + * @param $name string + * @param $value + * @return string + */ public function __set( $name, $value ) { if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) { $fname = 'set' . ucfirst( $name ); -- 2.20.1