X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FImageHistoryList.php;h=e488b6c1f78da0d90f68e36ff7079d3f65331d87;hb=3fa40cd0bd1b330fac7602bab3ce17de0e18e03d;hp=bb8ed2420b2e29990b0524b02930330545a5fadb;hpb=61898ad28ed69c5b391eb43e0db9386279b9612c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/ImageHistoryList.php b/includes/page/ImageHistoryList.php index bb8ed2420b..e488b6c1f7 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 * @@ -52,13 +54,14 @@ class ImageHistoryList extends ContextSource { * @param ImagePage $imagePage */ public function __construct( $imagePage ) { - global $wgShowArchiveThumbnails; + $context = $imagePage->getContext(); $this->current = $imagePage->getPage()->getFile(); $this->img = $imagePage->getDisplayedFile(); $this->title = $imagePage->getTitle(); $this->imagePage = $imagePage; - $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender(); - $this->setContext( $imagePage->getContext() ); + $this->showThumb = $context->getConfig()->get( 'ShowArchiveThumbnails' ) && + $this->img->canRender(); + $this->setContext( $context ); } /** @@ -111,8 +114,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() ); @@ -193,16 +194,18 @@ class ImageHistoryList extends ContextSource { $row .= ""; if ( !$file->userCan( File::DELETED_FILE, $user ) ) { # Don't link to unviewable files - $row .= '' - . $lang->userTimeAndDate( $timestamp, $user ) . ''; + $row .= Html::element( 'span', [ 'class' => 'history-deleted' ], + $lang->userTimeAndDate( $timestamp, $user ) + ); } elseif ( $file->isDeleted( File::DELETED_FILE ) ) { + $timeAndDate = htmlspecialchars( $lang->userTimeAndDate( $timestamp, $user ) ); if ( $local ) { $this->preventClickjacking(); $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); # Make a link to review the image $url = Linker::linkKnown( $revdel, - $lang->userTimeAndDate( $timestamp, $user ), + $timeAndDate, [], [ 'target' => $this->title->getPrefixedText(), @@ -211,12 +214,13 @@ class ImageHistoryList extends ContextSource { ] ); } else { - $url = $lang->userTimeAndDate( $timestamp, $user ); + $url = $timeAndDate; } $row .= '' . $url . ''; } elseif ( !$file->exists() ) { - $row .= '' - . $lang->userTimeAndDate( $timestamp, $user ) . ''; + $row .= Html::element( 'span', [ 'class' => 'mw-file-missing' ], + $lang->userTimeAndDate( $timestamp, $user ) + ); } else { $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img ); $row .= Xml::element( @@ -264,8 +268,12 @@ class ImageHistoryList extends ContextSource { $row .= '' . $this->msg( 'rev-deleted-comment' )->escaped() . ''; } else { - $row .= '' . - Linker::formatComment( $description, $this->title ) . ''; + $contLang = MediaWikiServices::getInstance()->getContentLanguage(); + $row .= Html::rawElement( + 'td', + [ 'dir' => $contLang->getDir() ], + Linker::formatComment( $description, $this->title ) + ); } $rowClass = null;