r95803 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95802‎ | r95803 | r95804 >
Date:18:37, 30 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/SpecialMIMEsearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialMIMEsearch.php
@@ -59,12 +59,11 @@
6060 }
6161
6262 function execute( $par ) {
63 - global $wgRequest, $wgOut;
64 - $mime = $par ? $par : $wgRequest->getText( 'mime' );
 63+ $mime = $par ? $par : $this->getRequest()->getText( 'mime' );
6564
6665 $this->setHeaders();
6766 $this->outputHeader();
68 - $wgOut->addHTML(
 67+ $this->getOutput()->addHTML(
6968 Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor( 'MIMEsearch' )->getLocalUrl() ) ) .
7069 Xml::openElement( 'fieldset' ) .
7170 Html::hidden( 'title', SpecialPage::getTitleFor( 'MIMEsearch' )->getPrefixedText() ) .
@@ -85,24 +84,25 @@
8685
8786
8887 function formatResult( $skin, $result ) {
89 - global $wgContLang, $wgLang;
 88+ global $wgContLang;
9089
9190 $nt = Title::makeTitle( $result->namespace, $result->title );
9291 $text = $wgContLang->convert( $nt->getText() );
93 - $plink = $skin->link(
 92+ $plink = Linker::link(
9493 Title::newFromText( $nt->getPrefixedText() ),
9594 htmlspecialchars( $text )
9695 );
9796
98 - $download = $skin->makeMediaLinkObj( $nt, wfMsgHtml( 'download' ) );
 97+ $download = Linker::makeMediaLinkObj( $nt, wfMsgHtml( 'download' ) );
 98+ $lang = $this->getLang();
9999 $bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
100 - $wgLang->formatNum( $result->img_size ) );
 100+ $lang->formatNum( $result->img_size ) );
101101 $dimensions = htmlspecialchars( wfMsg( 'widthheight',
102 - $wgLang->formatNum( $result->img_width ),
103 - $wgLang->formatNum( $result->img_height )
 102+ $lang->formatNum( $result->img_width ),
 103+ $lang->formatNum( $result->img_height )
104104 ) );
105 - $user = $skin->link( Title::makeTitle( NS_USER, $result->img_user_text ), htmlspecialchars( $result->img_user_text ) );
106 - $time = htmlspecialchars( $wgLang->timeanddate( $result->img_timestamp ) );
 105+ $user = Linker::link( Title::makeTitle( NS_USER, $result->img_user_text ), htmlspecialchars( $result->img_user_text ) );
 106+ $time = htmlspecialchars( $lang->timeanddate( $result->img_timestamp ) );
107107
108108 return "($download) $plink . . $dimensions . . $bytes . . $user . . $time";
109109 }

Status & tagging log