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;" .
}
$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;
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
*