r85882 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85881‎ | r85882 | r85883 >
Date:15:46, 12 April 2011
Author:ashley
Status:ok
Tags:
Comment:
follow-up to r85876: fix some coding style issues (some of which were not introduced in r85876) + tweak docs (we don't usually mark author(s)/copyright holder(s) on individual functions, only on whole files)
Modified paths:
  • /trunk/phase3/includes/specials/SpecialEmailuser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialEmailuser.php
@@ -29,11 +29,11 @@
3030 class SpecialEmailUser extends UnlistedSpecialPage {
3131 protected $mTarget;
3232
33 - public function __construct(){
 33+ public function __construct() {
3434 parent::__construct( 'Emailuser' );
3535 }
3636
37 - protected function getFormFields(){
 37+ protected function getFormFields() {
3838 global $wgUser;
3939 return array(
4040 'From' => array(
@@ -119,12 +119,12 @@
120120 }
121121 // Got a valid target user name? Else ask for one.
122122 $ret = self::getTarget( $this->mTarget );
123 - if( ! $ret instanceof User ){
 123+ if( !$ret instanceof User ) {
124124 if( $this->mTarget != '' ) {
125 - $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' ) ;
126 - $wgOut->addHtml ( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' );
 125+ $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' );
 126+ $wgOut->addHTML( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' );
127127 }
128 - $wgOut->addHtml (self::userForm( $this->mTarget ) );
 128+ $wgOut->addHTML( self::userForm( $this->mTarget ) );
129129 return false;
130130 }
131131
@@ -138,15 +138,15 @@
139139 $form->setWrapperLegend( wfMsgExt( 'email-legend', 'parsemag' ) );
140140 $form->loadData();
141141
142 - if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ){
 142+ if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) {
143143 return false;
144144 }
145145
146 - $wgOut->setPagetitle( wfMsg( 'emailpage' ) );
 146+ $wgOut->setPageTitle( wfMsg( 'emailpage' ) );
147147 $result = $form->show();
148148
149 - if( $result === true || ( $result instanceof Status && $result->isGood() ) ){
150 - $wgOut->setPagetitle( wfMsg( 'emailsent' ) );
 149+ if( $result === true || ( $result instanceof Status && $result->isGood() ) ) {
 150+ $wgOut->setPageTitle( wfMsg( 'emailsent' ) );
151151 $wgOut->addWikiMsg( 'emailsenttext' );
152152 $wgOut->returnToMain( false, $this->mTargetObj->getUserPage() );
153153 }
@@ -168,10 +168,10 @@
169169 if( !$nu instanceof User || !$nu->getId() ) {
170170 wfDebug( "Target is invalid user.\n" );
171171 return 'notarget';
172 - } else if ( !$nu->isEmailConfirmed() ) {
 172+ } elseif ( !$nu->isEmailConfirmed() ) {
173173 wfDebug( "User has no valid email.\n" );
174174 return 'noemail';
175 - } else if ( !$nu->canReceiveEmail() ) {
 175+ } elseif ( !$nu->canReceiveEmail() ) {
176176 wfDebug( "User does not allow user emails.\n" );
177177 return 'nowikiemail';
178178 }
@@ -188,7 +188,7 @@
189189 */
190190 public static function getPermissionsError( $user, $editToken ) {
191191 global $wgEnableEmail, $wgEnableUserEmail;
192 - if( !$wgEnableEmail || !$wgEnableUserEmail ){
 192+ if( !$wgEnableEmail || !$wgEnableUserEmail ) {
193193 return 'usermaildisabled';
194194 }
195195
@@ -196,7 +196,7 @@
197197 return 'badaccess';
198198 }
199199
200 - if( !$user->isEmailConfirmed() ){
 200+ if( !$user->isEmailConfirmed() ) {
201201 return 'mailnologin';
202202 }
203203
@@ -219,19 +219,19 @@
220220
221221 return null;
222222 }
223 -
 223+
224224 /**
225225 * Form to ask for target user name.
226 - * @author purodha
227 - * @param $name string User name submitted.
228 - * @return string form asking for user name.
 226+ *
 227+ * @param $name String: user name submitted.
 228+ * @return String: form asking for user name.
229229 */
230230 static function userForm( $name ) {
231 - $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => '', 'id' => 'askusername' ) ) .
 231+ $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => '', 'id' => 'askusername' ) ) .
232232 Xml::openElement( 'fieldset' ) .
233233 Html::rawElement( 'legend', null, wfMessage( 'emailtarget' )->parse() ) .
234 - Xml::inputLabel( wfMessage('emailusername')->text(), 'target', 'emailusertarget', 30, $name ) . ' ' .
235 - Xml::submitButton( wfMessage('emailusernamesubmit')->text() ) .
 234+ Xml::inputLabel( wfMessage( 'emailusername' )->text(), 'target', 'emailusertarget', 30, $name ) . ' ' .
 235+ Xml::submitButton( wfMessage( 'emailusernamesubmit' )->text() ) .
236236 Xml::closeElement( 'fieldset' ) .
237237 Xml::closeElement( 'form' ) . "\n";
238238 return $string;
@@ -249,7 +249,7 @@
250250 global $wgUser, $wgUserEmailUseReplyTo;
251251
252252 $target = self::getTarget( $data['Target'] );
253 - if( !$target instanceof User ){
 253+ if( !$target instanceof User ) {
254254 return wfMsgExt( $target . 'text', 'parse' );
255255 }
256256 $to = new MailAddress( $target );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85876(bug 13879) Special:Emailuser now asks for suitable target user if called wit...purodha12:49, 12 April 2011

Status & tagging log