r112112 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112111‎ | r112112 | r112113 >
Date:15:53, 22 February 2012
Author:ialex
Status:ok
Tags:
Comment:
Use local context to get messages
Modified paths:
  • /trunk/phase3/includes/specials/SpecialStatistics.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialStatistics.php
@@ -97,7 +97,7 @@
9898 $text .= Xml::closeElement( 'table' );
9999
100100 # Customizable footer
101 - $footer = wfMessage( 'statistics-footer' );
 101+ $footer = $this->msg( 'statistics-footer' );
102102 if ( !$footer->isBlank() ) {
103103 $text .= "\n" . $footer->parse();
104104 }
@@ -116,7 +116,7 @@
117117 */
118118 private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) {
119119 if( $descMsg ) {
120 - $msg = wfMessage( $descMsg, $descMsgParam );
 120+ $msg = $this->msg( $descMsg, $descMsgParam );
121121 if ( $msg->exists() ) {
122122 $descriptionText = $msg->parse();
123123 $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
@@ -136,29 +136,29 @@
137137 */
138138 private function getPageStats() {
139139 return Xml::openElement( 'tr' ) .
140 - Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-pages', array( 'parseinline' ) ) ) .
 140+ Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-pages' )->parse() ) .
141141 Xml::closeElement( 'tr' ) .
142142 $this->formatRow( Linker::linkKnown( SpecialPage::getTitleFor( 'Allpages' ),
143 - wfMsgExt( 'statistics-articles', array( 'parseinline' ) ) ),
 143+ $this->msg( 'statistics-articles' )->parse() ),
144144 $this->getLanguage()->formatNum( $this->good ),
145145 array( 'class' => 'mw-statistics-articles' ) ) .
146 - $this->formatRow( wfMsgExt( 'statistics-pages', array( 'parseinline' ) ),
 146+ $this->formatRow( $this->msg( 'statistics-pages' )->parse(),
147147 $this->getLanguage()->formatNum( $this->total ),
148148 array( 'class' => 'mw-statistics-pages' ),
149149 'statistics-pages-desc' ) .
150150 $this->formatRow( Linker::linkKnown( SpecialPage::getTitleFor( 'Listfiles' ),
151 - wfMsgExt( 'statistics-files', array( 'parseinline' ) ) ),
 151+ $this->msg( 'statistics-files' )->parse() ),
152152 $this->getLanguage()->formatNum( $this->images ),
153153 array( 'class' => 'mw-statistics-files' ) );
154154 }
155155 private function getEditStats() {
156156 return Xml::openElement( 'tr' ) .
157 - Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-edits', array( 'parseinline' ) ) ) .
 157+ Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-edits' )->parse() ) .
158158 Xml::closeElement( 'tr' ) .
159 - $this->formatRow( wfMsgExt( 'statistics-edits', array( 'parseinline' ) ),
 159+ $this->formatRow( $this->msg( 'statistics-edits' )->parse(),
160160 $this->getLanguage()->formatNum( $this->edits ),
161161 array( 'class' => 'mw-statistics-edits' ) ) .
162 - $this->formatRow( wfMsgExt( 'statistics-edits-average', array( 'parseinline' ) ),
 162+ $this->formatRow( $this->msg( 'statistics-edits-average' )->parse(),
163163 $this->getLanguage()->formatNum( sprintf( '%.2f', $this->total ? $this->edits / $this->total : 0 ) ),
164164 array( 'class' => 'mw-statistics-edits-average' ) );
165165 }
@@ -166,15 +166,15 @@
167167 private function getUserStats() {
168168 global $wgActiveUserDays;
169169 return Xml::openElement( 'tr' ) .
170 - Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) .
 170+ Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-users' )->parse() ) .
171171 Xml::closeElement( 'tr' ) .
172 - $this->formatRow( wfMsgExt( 'statistics-users', array( 'parseinline' ) ),
 172+ $this->formatRow( $this->msg( 'statistics-users' )->parse(),
173173 $this->getLanguage()->formatNum( $this->users ),
174174 array( 'class' => 'mw-statistics-users' ) ) .
175 - $this->formatRow( wfMsgExt( 'statistics-users-active', array( 'parseinline' ) ) . ' ' .
 175+ $this->formatRow( $this->msg( 'statistics-users-active' )->parse() . ' ' .
176176 Linker::linkKnown(
177177 SpecialPage::getTitleFor( 'Activeusers' ),
178 - wfMsgHtml( 'listgrouprights-members' )
 178+ $this->msg( 'listgrouprights-members' )->escaped()
179179 ),
180180 $this->getLanguage()->formatNum( $this->activeUsers ),
181181 array( 'class' => 'mw-statistics-users-active' ),
@@ -191,13 +191,13 @@
192192 continue;
193193 }
194194 $groupname = htmlspecialchars( $group );
195 - $msg = wfMessage( 'group-' . $groupname );
 195+ $msg = $this->msg( 'group-' . $groupname );
196196 if ( $msg->isBlank() ) {
197197 $groupnameLocalized = $groupname;
198198 } else {
199199 $groupnameLocalized = $msg->text();
200200 }
201 - $msg = wfMessage( 'grouppage-' . $groupname )->inContentLanguage();
 201+ $msg = $this->msg( 'grouppage-' . $groupname )->inContentLanguage();
202202 if ( $msg->isBlank() ) {
203203 $grouppageLocalized = MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname;
204204 } else {
@@ -210,7 +210,7 @@
211211 );
212212 $grouplink = Linker::linkKnown(
213213 SpecialPage::getTitleFor( 'Listusers' ),
214 - wfMsgHtml( 'listgrouprights-members' ),
 214+ $this->msg( 'listgrouprights-members' )->escaped(),
215215 array(),
216216 array( 'group' => $group )
217217 );
@@ -229,12 +229,12 @@
230230
231231 private function getViewsStats() {
232232 return Xml::openElement( 'tr' ) .
233 - Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-views', array( 'parseinline' ) ) ) .
 233+ Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-views' )->parse() ) .
234234 Xml::closeElement( 'tr' ) .
235 - $this->formatRow( wfMsgExt( 'statistics-views-total', array( 'parseinline' ) ),
 235+ $this->formatRow( $this->msg( 'statistics-views-total' )->parse(),
236236 $this->getLanguage()->formatNum( $this->views ),
237237 array ( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) .
238 - $this->formatRow( wfMsgExt( 'statistics-views-peredit', array( 'parseinline' ) ),
 238+ $this->formatRow( $this->msg( 'statistics-views-peredit' )->parse(),
239239 $this->getLanguage()->formatNum( sprintf( '%.2f', $this->edits ?
240240 $this->views / $this->edits : 0 ) ),
241241 array ( 'class' => 'mw-statistics-views-peredit' ) );
@@ -262,7 +262,7 @@
263263 );
264264 if( $res->numRows() > 0 ) {
265265 $text .= Xml::openElement( 'tr' );
266 - $text .= Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-mostpopular', array( 'parseinline' ) ) );
 266+ $text .= Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-mostpopular' )->parse() );
267267 $text .= Xml::closeElement( 'tr' );
268268 foreach ( $res as $row ) {
269269 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
@@ -282,7 +282,7 @@
283283 return '';
284284
285285 $return = Xml::openElement( 'tr' ) .
286 - Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) .
 286+ Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-hooks' )->parse() ) .
287287 Xml::closeElement( 'tr' );
288288
289289 foreach( $stats as $name => $number ) {

Status & tagging log