From: Alexandre Emsenhuber Date: Fri, 5 Aug 2011 14:58:37 +0000 (+0000) Subject: * Use local context instead of global variables X-Git-Tag: 1.31.0-rc.0~28412 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=dcd5c027b1239d2e8a9d5ab841f02c774f6b375d;p=lhc%2Fweb%2Fwiklou.git * Use local context instead of global variables * Call Linker methods statically --- diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index 977c65e7eb..67f8a2dcb1 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -62,19 +62,16 @@ class FileDuplicateSearchPage extends QueryPage { * @param $dupes Array of File objects */ function showList( $dupes ) { - global $wgOut; - $skin = $this->getSkin(); - $html = array(); $html[] = $this->openList( 0 ); foreach ( $dupes as $dupe ) { - $line = $this->formatResult( $skin, $dupe ); + $line = $this->formatResult( null, $dupe ); $html[] = "
  • " . $line . "
  • "; } $html[] = $this->closeList(); - $wgOut->addHtml( implode( "\n", $html ) ); + $this->getOutput()->addHtml( implode( "\n", $html ) ); } function getQueryInfo() { @@ -91,12 +88,12 @@ class FileDuplicateSearchPage extends QueryPage { } function execute( $par ) { - global $wgRequest, $wgOut, $wgLang, $wgScript; + global $wgScript; $this->setHeaders(); $this->outputHeader(); - $this->filename = isset( $par ) ? $par : $wgRequest->getText( 'filename' ); + $this->filename = isset( $par ) ? $par : $this->getRequest()->getText( 'filename' ); $this->file = null; $this->hash = ''; $title = Title::newFromText( $this->filename, NS_FILE ); @@ -104,8 +101,10 @@ class FileDuplicateSearchPage extends QueryPage { $this->file = wfFindFile( $title ); } + $out = $this->getOutput(); + # Create the input form - $wgOut->addHTML( + $out->addHTML( Xml::openElement( 'form', array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript ) ) . Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) . Xml::openElement( 'fieldset' ) . @@ -119,7 +118,7 @@ class FileDuplicateSearchPage extends QueryPage { if( $this->file ) { $this->hash = $this->file->getSha1(); } elseif( $this->filename !== '' ) { - $wgOut->wrapWikiMsg( + $out->wrapWikiMsg( "

    \n$1\n

    ", array( 'fileduplicatesearch-noresults', wfEscapeWikiText( $this->filename ) ) ); @@ -131,12 +130,12 @@ class FileDuplicateSearchPage extends QueryPage { if ( $img ) { $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) ); if( $thumb ) { - $wgOut->addHTML( '
    ' . + $out->addHTML( '
    ' . $thumb->toHtml( array( 'desc-link' => false ) ) . '
    ' . wfMsgExt( 'fileduplicatesearch-info', array( 'parse' ), - $wgLang->formatNum( $img->getWidth() ), - $wgLang->formatNum( $img->getHeight() ), - $wgLang->formatSize( $img->getSize() ), + $this->getLang()->formatNum( $img->getWidth() ), + $this->getLang()->formatNum( $img->getHeight() ), + $this->getLang()->formatSize( $img->getSize() ), $img->getMimeType() ) . '
    ' ); @@ -148,15 +147,15 @@ class FileDuplicateSearchPage extends QueryPage { # Show a short summary if( $numRows == 1 ) { - $wgOut->wrapWikiMsg( + $out->wrapWikiMsg( "

    \n$1\n

    ", array( 'fileduplicatesearch-result-1', wfEscapeWikiText( $this->filename ) ) ); } elseif ( $numRows ) { - $wgOut->wrapWikiMsg( + $out->wrapWikiMsg( "

    \n$1\n

    ", array( 'fileduplicatesearch-result-n', wfEscapeWikiText( $this->filename ), - $wgLang->formatNum( $numRows - 1 ) ) + $this->getLang()->formatNum( $numRows - 1 ) ) ); } @@ -171,18 +170,18 @@ class FileDuplicateSearchPage extends QueryPage { * @return string */ function formatResult( $skin, $result ) { - global $wgContLang, $wgLang; + global $wgContLang; $nt = $result->getTitle(); $text = $wgContLang->convert( $nt->getText() ); - $plink = $skin->link( + $plink = Linker::link( Title::newFromText( $nt->getPrefixedText() ), $text ); $userText = $result->getUser( 'text' ); - $user = $skin->link( Title::makeTitle( NS_USER, $userText ), $userText ); - $time = $wgLang->timeanddate( $result->getTimestamp() ); + $user = Linker::link( Title::makeTitle( NS_USER, $userText ), $userText ); + $time = $this->getLang()->timeanddate( $result->getTimestamp() ); return "$plink . . $user . . $time"; }