summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialFileDuplicateSearch.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialFileDuplicateSearch.php')
-rw-r--r--includes/specials/SpecialFileDuplicateSearch.php49
1 files changed, 23 insertions, 26 deletions
diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php
index a296fd95..18d19db8 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[] = "<li>" . $line . "</li>";
}
$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,14 +101,16 @@ 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' ) .
- Xml::element( 'legend', null, wfMsg( 'fileduplicatesearch-legend' ) ) .
- Xml::inputLabel( wfMsg( 'fileduplicatesearch-filename' ), 'filename', 'filename', 50, $this->filename ) . ' ' .
- Xml::submitButton( wfMsg( 'fileduplicatesearch-submit' ) ) .
+ Xml::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) .
+ Xml::inputLabel( $this->msg( 'fileduplicatesearch-filename' )->text(), 'filename', 'filename', 50, $this->filename ) . ' ' .
+ Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' )
);
@@ -119,7 +118,7 @@ class FileDuplicateSearchPage extends QueryPage {
if( $this->file ) {
$this->hash = $this->file->getSha1();
} elseif( $this->filename !== '' ) {
- $wgOut->wrapWikiMsg(
+ $out->wrapWikiMsg(
"<p class='mw-fileduplicatesearch-noresults'>\n$1\n</p>",
array( 'fileduplicatesearch-noresults', wfEscapeWikiText( $this->filename ) )
);
@@ -131,14 +130,12 @@ class FileDuplicateSearchPage extends QueryPage {
if ( $img ) {
$thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
if( $thumb ) {
- $wgOut->addHTML( '<div id="mw-fileduplicatesearch-icon">' .
+ $out->addHTML( '<div id="mw-fileduplicatesearch-icon">' .
$thumb->toHtml( array( 'desc-link' => false ) ) . '<br />' .
- wfMsgExt( 'fileduplicatesearch-info', array( 'parse' ),
- $wgLang->formatNum( $img->getWidth() ),
- $wgLang->formatNum( $img->getHeight() ),
- $wgLang->formatSize( $img->getSize() ),
- $img->getMimeType()
- ) .
+ $this->msg( 'fileduplicatesearch-info' )->numParams(
+ $img->getWidth(), $img->getHeight() )->params(
+ $this->getLanguage()->formatSize( $img->getSize() ),
+ $img->getMimeType() )->parseAsBlock() .
'</div>' );
}
}
@@ -148,15 +145,15 @@ class FileDuplicateSearchPage extends QueryPage {
# Show a short summary
if( $numRows == 1 ) {
- $wgOut->wrapWikiMsg(
+ $out->wrapWikiMsg(
"<p class='mw-fileduplicatesearch-result-1'>\n$1\n</p>",
array( 'fileduplicatesearch-result-1', wfEscapeWikiText( $this->filename ) )
);
} elseif ( $numRows ) {
- $wgOut->wrapWikiMsg(
+ $out->wrapWikiMsg(
"<p class='mw-fileduplicatesearch-result-n'>\n$1\n</p>",
array( 'fileduplicatesearch-result-n', wfEscapeWikiText( $this->filename ),
- $wgLang->formatNum( $numRows - 1 ) )
+ $this->getLanguage()->formatNum( $numRows - 1 ) )
);
}
@@ -171,18 +168,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->getLanguage()->userTimeAndDate( $result->getTimestamp(), $this->getUser() );
return "$plink . . $user . . $time";
}