* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Builds the image revision log shown on image pages
*
*/
public function __construct( $imagePage ) {
global $wgShowArchiveThumbnails;
- $this->current = $imagePage->getFile();
+ $this->current = $imagePage->getPage()->getFile();
$this->img = $imagePage->getDisplayedFile();
$this->title = $imagePage->getTitle();
$this->imagePage = $imagePage;
* @return string
*/
public function beginImageHistoryList( $navLinks = '' ) {
- return Xml::element( 'h2', array( 'id' => 'filehistory' ), $this->msg( 'filehist' )->text() )
+ return Xml::element( 'h2', [ 'id' => 'filehistory' ], $this->msg( 'filehist' )->text() )
. "\n"
. "<div id=\"mw-imagepage-section-filehistory\">\n"
. $this->msg( 'filehist-help' )->parseAsBlock()
. $navLinks . "\n"
- . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
+ . Xml::openElement( 'table', [ 'class' => 'wikitable filehistory' ] ) . "\n"
. '<tr><th></th>'
. ( $this->current->isLocal()
&& ( $this->getUser()->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '<th></th>' : '' )
* @return string
*/
public function imageHistoryLine( $iscur, $file ) {
- global $wgContLang;
-
$user = $this->getUser();
$lang = $this->getLanguage();
$timestamp = wfTimestamp( TS_MW, $file->getTimestamp() );
$row .= '<td>';
# Link to remove from history
if ( $user->isAllowed( 'delete' ) ) {
- $q = array( 'action' => 'delete' );
+ $q = [ 'action' => 'delete' ];
if ( !$iscur ) {
$q['oldimage'] = $img;
}
$row .= Linker::linkKnown(
$this->title,
$this->msg( $iscur ? 'filehist-deleteall' : 'filehist-deleteone' )->escaped(),
- array(), $q
+ [], $q
);
}
# Link to hide content. Don't show useless link to people who cannot hide revisions.
$del = Linker::revDeleteLinkDisabled( $canHide );
} else {
list( $ts, ) = explode( '!', $img, 2 );
- $query = array(
+ $query = [
'type' => 'oldimage',
'target' => $this->title->getPrefixedText(),
'ids' => $ts,
- );
+ ];
$del = Linker::revDeleteLink( $query,
$file->isDeleted( File::DELETED_RESTRICTED ), $canHide );
}
$row .= Linker::linkKnown(
$this->title,
$this->msg( 'filehist-revert' )->escaped(),
- array(),
- array(
+ [],
+ [
'action' => 'revert',
'oldimage' => $img,
- 'wpEditToken' => $user->getEditToken( $img )
- )
+ ]
);
}
}
$url = Linker::linkKnown(
$revdel,
$lang->userTimeAndDate( $timestamp, $user ),
- array(),
- array(
+ [],
+ [
'target' => $this->title->getPrefixedText(),
'file' => $img,
'token' => $user->getEditToken( $img )
- )
+ ]
);
} else {
$url = $lang->userTimeAndDate( $timestamp, $user );
$url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
$row .= Xml::element(
'a',
- array( 'href' => $url ),
+ [ 'href' => $url ],
$lang->userTimeAndDate( $timestamp, $user )
);
}
$row .= '<td><span class="history-deleted">' .
$this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>';
} else {
- $row .= '<td dir="' . $wgContLang->getDir() . '">' .
- Linker::formatComment( $description, $this->title ) . '</td>';
+ $row .=
+ '<td dir="' . MediaWikiServices::getInstance()->getContentLanguage()->getDir() .
+ '">' . Linker::formatComment( $description, $this->title ) . '</td>';
}
$rowClass = null;
- Hooks::run( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) );
+ Hooks::run( 'ImagePageFileHistoryLine', [ $this, $file, &$row, &$rowClass ] );
$classAttr = $rowClass ? " class='$rowClass'" : '';
return "<tr{$classAttr}>{$row}</tr>\n";
if ( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE, $user )
&& !$file->isDeleted( File::DELETED_FILE )
) {
- $params = array(
+ $params = [
'width' => '120',
'height' => '120',
- );
+ ];
$timestamp = wfTimestamp( TS_MW, $file->getTimestamp() );
$thumbnail = $file->transform( $params );
- $options = array(
+ $options = [
'alt' => $this->msg( 'filehist-thumbtext',
$lang->userTimeAndDate( $timestamp, $user ),
$lang->userDate( $timestamp, $user ),
$lang->userTime( $timestamp, $user ) )->text(),
'file-link' => true,
- );
+ ];
if ( !$thumbnail ) {
return $this->msg( 'filehist-nothumb' )->escaped();