r113089 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113088‎ | r113089 | r113090 >
Date:21:33, 5 March 2012
Author:ialex
Status:ok
Tags:
Comment:
* Use local context to get messages
* Use Language::userTime() and Language::userDate() instead of Language::time() and Language::date() to display dates with user's preferences
Modified paths:
  • /trunk/phase3/includes/specials/SpecialListusers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialListusers.php
@@ -151,23 +151,23 @@
152152
153153 global $wgEdititis;
154154 if ( $wgEdititis ) {
155 - $editCount = $lang->formatNum( $row->edits );
156 - $edits = ' [' . wfMsgExt( 'usereditcount', array( 'parsemag', 'escape' ), $editCount ) . ']';
 155+ $edits = ' [' . $this->msg( 'usereditcount' )->numParams( $row->edits )->escaped() . ']';
157156 } else {
158157 $edits = '';
159158 }
160159
161160 $userTalkPage = $userPage->getTalkPage();
162 - $talk = Linker::link( $userTalkPage, wfMessage( 'talkpagelinktext' )->escaped() );
163 - $talk = ' ' . wfMessage( 'parentheses' )->rawParams( $talk )->escaped();
 161+ $talk = Linker::link( $userTalkPage, $this->msg( 'talkpagelinktext' )->escaped() );
 162+ $talk = ' ' . $this->msg( 'parentheses' )->rawParams( $talk )->escaped();
164163
165164 $created = '';
166165 # Some rows may be NULL
167166 if( $row->creation ) {
168 - $d = $lang->date( wfTimestamp( TS_MW, $row->creation ), true );
169 - $t = $lang->time( wfTimestamp( TS_MW, $row->creation ), true );
170 - $created = wfMsgExt( 'usercreated', array( 'parsemag', 'escape' ), $d, $t, $row->user_name );
171 - $created = ' ' . wfMessage( 'parentheses' )->rawParams( $created )->escaped();
 167+ $user = $this->getUser();
 168+ $d = $lang->userDate( $row->creation, $user );
 169+ $t = $lang->userTime( $row->creation, $user );
 170+ $created = $this->msg( 'usercreated', $d, $t, $row->user_name )->escaped();
 171+ $created = ' ' . $this->msg( 'parentheses' )->rawParams( $created )->escaped();
172172 }
173173
174174 wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
@@ -195,30 +195,30 @@
196196
197197 # Form tag
198198 $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listusers-form' ) ) .
199 - Xml::fieldset( wfMsg( 'listusers' ) ) .
 199+ Xml::fieldset( $this->msg( 'listusers' )->text() ) .
200200 Html::hidden( 'title', $self );
201201
202202 # Username field
203 - $out .= Xml::label( wfMsg( 'listusersfrom' ), 'offset' ) . ' ' .
 203+ $out .= Xml::label( $this->msg( 'listusersfrom' )->text(), 'offset' ) . ' ' .
204204 Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' ';
205205
206206 # Group drop-down list
207 - $out .= Xml::label( wfMsg( 'group' ), 'group' ) . ' ' .
 207+ $out .= Xml::label( $this->msg( 'group' )->text(), 'group' ) . ' ' .
208208 Xml::openElement('select', array( 'name' => 'group', 'id' => 'group' ) ) .
209 - Xml::option( wfMsg( 'group-all' ), '' );
 209+ Xml::option( $this->msg( 'group-all' )->text(), '' );
210210 foreach( $this->getAllGroups() as $group => $groupText )
211211 $out .= Xml::option( $groupText, $group, $group == $this->requestedGroup );
212212 $out .= Xml::closeElement( 'select' ) . '<br />';
213 - $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly );
 213+ $out .= Xml::checkLabel( $this->msg( 'listusers-editsonly' )->text(), 'editsOnly', 'editsOnly', $this->editsOnly );
214214 $out .= '&#160;';
215 - $out .= Xml::checkLabel( wfMsg('listusers-creationsort'), 'creationSort', 'creationSort', $this->creationSort );
 215+ $out .= Xml::checkLabel( $this->msg( 'listusers-creationsort' )->text(), 'creationSort', 'creationSort', $this->creationSort );
216216 $out .= '<br />';
217217
218218 wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
219219
220220 # Submit button and form bottom
221221 $out .= Html::hidden( 'limit', $this->mLimit );
222 - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
 222+ $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() );
223223 wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) );
224224 $out .= Xml::closeElement( 'fieldset' ) .
225225 Xml::closeElement( 'form' );
@@ -309,7 +309,7 @@
310310 $s .= Html::rawElement( 'ul', array(), $usersbody );
311311 $s .= $up->getNavigationBar();
312312 } else {
313 - $s .= wfMessage( 'listusers-noresult' )->parseAsBlock();
 313+ $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
314314 }
315315
316316 $this->getOutput()->addHTML( $s );

Status & tagging log