r93848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93847‎ | r93848 | r93849 >
Date:19:42, 3 August 2011
Author:ialex
Status:ok
Tags:
Comment:
* Use local context instead of global variables
* Call Linker methods statically
Modified paths:
  • /trunk/phase3/includes/specials/SpecialTags.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialTags.php
@@ -36,11 +36,10 @@
3737 }
3838
3939 function execute( $par ) {
40 - global $wgOut;
 40+ $out = $this->getOutput();
 41+ $out->setPageTitle( wfMsg( 'tags-title' ) );
 42+ $out->wrapWikiMsg( "<div class='mw-tags-intro'>\n$1\n</div>", 'tags-intro' );
4143
42 - $wgOut->setPageTitle( wfMsg( 'tags-title' ) );
43 - $wgOut->wrapWikiMsg( "<div class='mw-tags-intro'>\n$1\n</div>", 'tags-intro' );
44 -
4544 // Write the headers
4645 $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, wfMsgExt( 'tags-tag', 'parseinline' ) ) .
4746 Xml::tags( 'th', null, wfMsgExt( 'tags-display-header', 'parseinline' ) ) .
@@ -59,35 +58,30 @@
6059 $html .= $this->doTagRow( $tag, 0 );
6160 }
6261
63 - $wgOut->addHTML( Xml::tags( 'table', array( 'class' => 'wikitable mw-tags-table' ), $html ) );
 62+ $out->addHTML( Xml::tags( 'table', array( 'class' => 'wikitable mw-tags-table' ), $html ) );
6463 }
6564
6665 function doTagRow( $tag, $hitcount ) {
67 - static $sk = null, $doneTags = array();
68 - if ( !$sk ) {
69 - $sk = $this->getSkin();
70 - }
 66+ static $doneTags = array();
7167
7268 if ( in_array( $tag, $doneTags ) ) {
7369 return '';
7470 }
7571
76 - global $wgLang;
77 -
7872 $newRow = '';
7973 $newRow .= Xml::tags( 'td', null, Xml::element( 'tt', null, $tag ) );
8074
8175 $disp = ChangeTags::tagDescription( $tag );
82 - $disp .= ' (' . $sk->link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ) . ')';
 76+ $disp .= ' (' . Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ) . ')';
8377 $newRow .= Xml::tags( 'td', null, $disp );
8478
8579 $msg = wfMessage( "tag-$tag-description" );
8680 $desc = !$msg->exists() ? '' : $msg->parse();
87 - $desc .= ' (' . $sk->link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ) . ')';
 81+ $desc .= ' (' . Linker::link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ) . ')';
8882 $newRow .= Xml::tags( 'td', null, $desc );
8983
90 - $hitcount = wfMsgExt( 'tags-hitcount', array( 'parsemag' ), $wgLang->formatNum( $hitcount ) );
91 - $hitcount = $sk->link( SpecialPage::getTitleFor( 'Recentchanges' ), $hitcount, array(), array( 'tagfilter' => $tag ) );
 84+ $hitcount = wfMsgExt( 'tags-hitcount', array( 'parsemag' ), $this->getLang()->formatNum( $hitcount ) );
 85+ $hitcount = Linker::link( SpecialPage::getTitleFor( 'Recentchanges' ), $hitcount, array(), array( 'tagfilter' => $tag ) );
9286 $newRow .= Xml::tags( 'td', null, $hitcount );
9387
9488 $doneTags[] = $tag;

Status & tagging log