GitInfo: Don't try shelling out if it's disabled
[lhc/web/wiklou.git] / includes / gallery / TraditionalImageGallery.php
index 1cb7e6d..a87322d 100644 (file)
@@ -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
         *