r98783 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98782‎ | r98783 | r98784 >
Date:17:48, 3 October 2011
Author:ialex
Status:ok
Tags:
Comment:
Use local context instead of global variables
Modified paths:
  • /trunk/phase3/includes/specials/SpecialWhatlinkshere.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialWhatlinkshere.php
@@ -269,8 +269,7 @@
270270 }
271271
272272 protected function listItem( $row, $nt, $notClose = false ) {
273 - global $wgLang;
274 - $dirmark = $wgLang->getDirMark();
 273+ $dirmark = $this->getLang()->getDirMark();
275274
276275 # local message cache
277276 static $msgcache = null;
@@ -346,11 +345,9 @@
347346 }
348347
349348 function getPrevNext( $prevId, $nextId ) {
350 - global $wgLang;
351349 $currentLimit = $this->opts->getValue( 'limit' );
352 - $fmtLimit = $wgLang->formatNum( $currentLimit );
353 - $prev = wfMsgExt( 'whatlinkshere-prev', array( 'parsemag', 'escape' ), $fmtLimit );
354 - $next = wfMsgExt( 'whatlinkshere-next', array( 'parsemag', 'escape' ), $fmtLimit );
 350+ $prev = wfMessage( 'whatlinkshere-prev' )->numParams( $currentLimit )->escaped();
 351+ $next = wfMessage( 'whatlinkshere-next' )->numParams( $currentLimit )->escaped();
355352
356353 $changed = $this->opts->getChangedValues();
357354 unset($changed['target']); // Already in the request title
@@ -365,13 +362,14 @@
366363 }
367364
368365 $limitLinks = array();
 366+ $lang = $this->getLang();
369367 foreach ( $this->limits as $limit ) {
370 - $prettyLimit = $wgLang->formatNum( $limit );
 368+ $prettyLimit = htmlspecialchars( $lang->formatNum( $limit ) );
371369 $overrides = array( 'limit' => $limit );
372370 $limitLinks[] = $this->makeSelfLink( $prettyLimit, array_merge( $changed, $overrides ) );
373371 }
374372
375 - $nums = $wgLang->pipeList( $limitLinks );
 373+ $nums = $lang->pipeList( $limitLinks );
376374
377375 return wfMsgHtml( 'viewprevnext', $prev, $next, $nums );
378376 }
@@ -425,7 +423,6 @@
426424 * @return string HTML fieldset and filter panel with the show/hide links
427425 */
428426 function getFilterPanel() {
429 - global $wgLang;
430427 $show = wfMsgHtml( 'show' );
431428 $hide = wfMsgHtml( 'hide' );
432429
@@ -445,6 +442,6 @@
446443 $overrides = array( $type => !$chosen );
447444 $links[] = wfMsgHtml( "whatlinkshere-{$type}", $this->makeSelfLink( $msg, array_merge( $changed, $overrides ) ) );
448445 }
449 - return Xml::fieldset( wfMsg( 'whatlinkshere-filters' ), $wgLang->pipeList( $links ) );
 446+ return Xml::fieldset( wfMsg( 'whatlinkshere-filters' ), $this->getLang()->pipeList( $links ) );
450447 }
451448 }

Status & tagging log