r101493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101492‎ | r101493 | r101494 >
Date:16:19, 1 November 2011
Author:ialex
Status:ok
Tags:
Comment:
* Use local context to get messages
* Parse 'activeusers-noresult' and 'activeusers-intro' messages
Modified paths:
  • /trunk/phase3/includes/specials/SpecialActiveusers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialActiveusers.php
@@ -131,13 +131,9 @@
132132 $groups = $lang->commaList( $list );
133133
134134 $item = $lang->specialList( $ulinks, $groups );
135 - $count = wfMsgExt( 'activeusers-count',
136 - array( 'parsemag' ),
137 - $lang->formatNum( $row->recentedits ),
138 - $userName,
139 - $lang->formatNum( $this->RCMaxAge )
140 - );
141 - $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : '';
 135+ $count = $this->msg( 'activeusers-count' )->numParams( $row->recentedits )
 136+ ->params( $userName )->numParams( $this->RCMaxAge )->escaped();
 137+ $blocked = $row->blocked ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : '';
142138
143139 return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" );
144140 }
@@ -149,16 +145,19 @@
150146 $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : '';
151147
152148 $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag
153 - $out .= Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n";
 149+ $out .= Xml::fieldset( $this->msg( 'activeusers' )->text() ) . "\n";
154150 $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n";
155151
156 - $out .= Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . '<br />';# Username field
 152+ $out .= Xml::inputLabel( $this->msg( 'activeusers-from' )->text(),
 153+ 'username', 'offset', 20, $this->requestedUser ) . '<br />';# Username field
157154
158 - $out .= Xml::checkLabel( wfMsg('activeusers-hidebots'), 'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ) );
 155+ $out .= Xml::checkLabel( $this->msg( 'activeusers-hidebots' )->text(),
 156+ 'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ) );
159157
160 - $out .= Xml::checkLabel( wfMsg('activeusers-hidesysops'), 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ) ) . '<br />';
 158+ $out .= Xml::checkLabel( $this->msg( 'activeusers-hidesysops' )->text(),
 159+ 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ) ) . '<br />';
161160
162 - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n";# Submit button and form bottom
 161+ $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n";# Submit button and form bottom
163162 $out .= Xml::closeElement( 'fieldset' );
164163 $out .= Xml::closeElement( 'form' );
165164
@@ -189,25 +188,25 @@
190189 $this->setHeaders();
191190 $this->outputHeader();
192191
 192+ $out = $this->getOutput();
 193+ $out->wrapWikiMsg( "<div class='mw-activeusers-intro'>\n$1\n</div>",
 194+ array( 'activeusers-intro', $this->getLang()->formatNum( $wgActiveUserDays ) ) );
 195+
193196 $up = new ActiveUsersPager( $this->getContext() );
194197
195198 # getBody() first to check, if empty
196199 $usersbody = $up->getBody();
197200
198 - $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ),
199 - wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $wgActiveUserDays ) )
200 - );
201 -
202 - $s .= $up->getPageHeader();
203 - if( $usersbody ) {
204 - $s .= $up->getNavigationBar();
205 - $s .= Html::rawElement( 'ul', array(), $usersbody );
206 - $s .= $up->getNavigationBar();
 201+ $out->addHTML( $up->getPageHeader() );
 202+ if ( $usersbody ) {
 203+ $out->addHTML(
 204+ $up->getNavigationBar() .
 205+ Html::rawElement( 'ul', array(), $usersbody ) .
 206+ $up->getNavigationBar()
 207+ );
207208 } else {
208 - $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) );
 209+ $out->addWikiMsg( 'activeusers-noresult' );
209210 }
210 -
211 - $this->getOutput()->addHTML( $s );
212211 }
213212
214213 }

Status & tagging log