X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FImageHistoryList.php;h=607357fcd14b98a4d9ceec01e1f66b0ac14decd4;hb=6f3d5a5204770b7e9076ec0c956631c32a9e1114;hp=4c3672979497781a4ea5ba1486061ec43a401f68;hpb=554ca56fd5e76b0216c09543d447dbecd5773202;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/ImageHistoryList.php b/includes/page/ImageHistoryList.php index 4c36729794..0a07c6884f 100644 --- a/includes/page/ImageHistoryList.php +++ b/includes/page/ImageHistoryList.php @@ -18,6 +18,8 @@ * @file */ +use MediaWiki\MediaWikiServices; + /** * Builds the image revision log shown on image pages * @@ -80,12 +82,12 @@ class ImageHistoryList extends ContextSource { * @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" . "
\n" . $this->msg( 'filehist-help' )->parseAsBlock() . $navLinks . "\n" - . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n" + . Xml::openElement( 'table', [ 'class' => 'wikitable filehistory' ] ) . "\n" . '' . ( $this->current->isLocal() && ( $this->getUser()->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '' : '' ) @@ -111,8 +113,6 @@ class ImageHistoryList extends ContextSource { * @return string */ public function imageHistoryLine( $iscur, $file ) { - global $wgContLang; - $user = $this->getUser(); $lang = $this->getLanguage(); $timestamp = wfTimestamp( TS_MW, $file->getTimestamp() ); @@ -129,14 +129,14 @@ class ImageHistoryList extends ContextSource { $row .= ''; # 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. @@ -150,11 +150,11 @@ class ImageHistoryList extends ContextSource { $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 ); } @@ -176,12 +176,11 @@ class ImageHistoryList extends ContextSource { $row .= Linker::linkKnown( $this->title, $this->msg( 'filehist-revert' )->escaped(), - array(), - array( + [], + [ 'action' => 'revert', 'oldimage' => $img, - 'wpEditToken' => $user->getEditToken( $img ) - ) + ] ); } } @@ -204,12 +203,12 @@ class ImageHistoryList extends ContextSource { $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 ); @@ -222,7 +221,7 @@ class ImageHistoryList extends ContextSource { $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img ); $row .= Xml::element( 'a', - array( 'href' => $url ), + [ 'href' => $url ], $lang->userTimeAndDate( $timestamp, $user ) ); } @@ -265,12 +264,13 @@ class ImageHistoryList extends ContextSource { $row .= '' . $this->msg( 'rev-deleted-comment' )->escaped() . ''; } else { - $row .= '' . - Linker::formatComment( $description, $this->title ) . ''; + $row .= + '' . Linker::formatComment( $description, $this->title ) . ''; } $rowClass = null; - Hooks::run( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) ); + Hooks::run( 'ImagePageFileHistoryLine', [ $this, $file, &$row, &$rowClass ] ); $classAttr = $rowClass ? " class='$rowClass'" : ''; return "{$row}\n"; @@ -286,20 +286,20 @@ class ImageHistoryList extends ContextSource { 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();