X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fgallery%2FTraditionalImageGallery.php;h=a87322d46d7084fec0cffb6323496f52fc8e9f7c;hb=d503ac7c9433a36358b1db27c6365167ea869832;hp=1cb7e6d24a478b42e8d0917fb13363138c694d8e;hpb=8f0b4332c5702d424322b2932afb30036b5e7d30;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php index 1cb7e6d24a..a87322d46d 100644 --- a/includes/gallery/TraditionalImageGallery.php +++ b/includes/gallery/TraditionalImageGallery.php @@ -35,7 +35,7 @@ class TraditionalImageGallery extends ImageGalleryBase { function toHTML() { if ( $this->mPerRow > 0 ) { $maxwidth = $this->mPerRow * ( $this->mWidths + $this->getAllPadding() ); - $oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : ''; + $oldStyle = $this->mAttribs['style'] ?? ''; # _width is ignored by any sane browser. IE6 doesn't know max-width # so it uses _width instead $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . @@ -191,19 +191,7 @@ class TraditionalImageGallery extends ImageGalleryBase { } $textlink = $this->mShowFilename ? - // Preloaded into LinkCache above - Linker::linkKnown( - $nt, - htmlspecialchars( - is_int( $this->getCaptionLength() ) ? - $lang->truncate( $nt->getText(), $this->getCaptionLength() ) : - $nt->getText() - ), - [ - 'class' => 'galleryfilename' . - ( $this->getCaptionLength() === true ? ' galleryfilename-truncate' : '' ) - ] - ) . "\n" : + $this->getCaptionHtml( $nt, $lang ) : ''; $galleryText = $textlink . $text . $meta; @@ -227,6 +215,27 @@ class TraditionalImageGallery extends ImageGalleryBase { return $output; } + /** + * @param Title $nt + * @param Language $lang + * @return string HTML + */ + protected function getCaptionHtml( Title $nt, Language $lang ) { + // Preloaded into LinkCache in toHTML + return Linker::linkKnown( + $nt, + htmlspecialchars( + is_int( $this->getCaptionLength() ) ? + $lang->truncate( $nt->getText(), $this->getCaptionLength() ) : + $nt->getText() + ), + [ + 'class' => 'galleryfilename' . + ( $this->getCaptionLength() === true ? ' galleryfilename-truncate' : '' ) + ] + ) . "\n"; + } + /** * Add the wrapper html around the thumb's caption *