r103449 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103448‎ | r103449 | r103450 >
Date:10:06, 17 November 2011
Author:ialex
Status:ok
Tags:
Comment:
* Removed Preferences::validateEmail() to that e-mail address modification is in another special page, no callers
* Added $form parameter to Preferences::cleanSignature() and Preferences::validateSignature(), they are passed to the functions since r102879
* Use local context to get messages
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -1160,19 +1160,20 @@
11611161 }
11621162
11631163 /**
1164 - * @param $signature
1165 - * @param $alldata
 1164+ * @param $signature string
 1165+ * @param $alldata array
 1166+ * @param $form HTMLForm
11661167 * @return bool|string
11671168 */
1168 - static function validateSignature( $signature, $alldata ) {
 1169+ static function validateSignature( $signature, $alldata, $form ) {
11691170 global $wgParser, $wgMaxSigChars;
11701171 if ( mb_strlen( $signature ) > $wgMaxSigChars ) {
11711172 return Xml::element( 'span', array( 'class' => 'error' ),
1172 - wfMessage( 'badsiglength' )->numParams( $wgMaxSigChars )->text() );
 1173+ $form->msg( 'badsiglength' )->numParams( $wgMaxSigChars )->text() );
11731174 } elseif ( isset( $alldata['fancysig'] ) &&
11741175 $alldata['fancysig'] &&
11751176 false === $wgParser->validateSig( $signature ) ) {
1176 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) );
 1177+ return Xml::element( 'span', array( 'class' => 'error' ), $form->msg( 'badsig' )->text() );
11771178 } else {
11781179 return true;
11791180 }
@@ -1181,9 +1182,10 @@
11821183 /**
11831184 * @param $signature string
11841185 * @param $alldata array
 1186+ * @param $form HTMLForm
11851187 * @return string
11861188 */
1187 - static function cleanSignature( $signature, $alldata ) {
 1189+ static function cleanSignature( $signature, $alldata, $form ) {
11881190 global $wgParser;
11891191 if ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] ) {
11901192 $signature = $wgParser->cleanSig( $signature );
@@ -1196,23 +1198,6 @@
11971199 }
11981200
11991201 /**
1200 - * @param $email
1201 - * @param $alldata
1202 - * @return bool|String
1203 - */
1204 - static function validateEmail( $email, $alldata ) {
1205 - if ( $email && !Sanitizer::validateEmail( $email ) ) {
1206 - return wfMsgExt( 'invalidemailaddress', 'parseinline' );
1207 - }
1208 -
1209 - global $wgEmailConfirmToEdit;
1210 - if ( $wgEmailConfirmToEdit && !$email ) {
1211 - return wfMsgExt( 'noemailtitle', 'parseinline' );
1212 - }
1213 - return true;
1214 - }
1215 -
1216 - /**
12171202 * @param $user User
12181203 * @param $context IContextSource
12191204 * @param $formClass string
@@ -1229,7 +1214,7 @@
12301215
12311216 $htmlForm->setModifiedUser( $user );
12321217 $htmlForm->setId( 'mw-prefs-form' );
1233 - $htmlForm->setSubmitText( wfMsg( 'saveprefs' ) );
 1218+ $htmlForm->setSubmitText( $context->msg( 'saveprefs' )->text() );
12341219 # Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'
12351220 $htmlForm->setSubmitTooltip( 'preferences-save' );
12361221 $htmlForm->setSubmitID( 'prefsubmit' );
@@ -1532,7 +1517,7 @@
15331518
15341519 $t = SpecialPage::getTitleFor( 'Preferences', 'reset' );
15351520
1536 - $html .= "\n" . Linker::link( $t, wfMsgHtml( 'restoreprefs' ) );
 1521+ $html .= "\n" . Linker::link( $t, $this->msg( 'restoreprefs' )->escaped() );
15371522
15381523 $html = Xml::tags( 'div', array( 'class' => 'mw-prefs-buttons' ), $html );
15391524

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102879Removed usage of $wgUser in block and unblock processing:...ialex07:25, 13 November 2011

Status & tagging log