X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fgallery%2FImageGalleryBase.php;h=09e40a2821a05e78c815d13ef9ab18efeeec814f;hb=631e8695b15412ec16c31623cbd6e5aa3d6efb1e;hp=80fd22ebaacbede81867a337147f3a73eebda1ce;hpb=bd83a8ca88447ab9dcb2e2a1c8be2cf2ec64157f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php index 80fd22ebaa..09e40a2821 100644 --- a/includes/gallery/ImageGalleryBase.php +++ b/includes/gallery/ImageGalleryBase.php @@ -58,6 +58,15 @@ abstract class ImageGalleryBase extends ContextSource { */ protected $mCaption = false; + /** + * Length to truncate filename to in caption when using "showfilename". + * A value of 'true' will truncate the filename to one line using CSS + * and will be the behaviour after deprecation. + * + * @var bool|int + */ + protected $mCaptionLength = true; + /** * @var bool Hide blacklisted images? */ @@ -113,12 +122,12 @@ abstract class ImageGalleryBase extends ContextSource { private static function loadModes() { if ( self::$modeMapping === false ) { self::$modeMapping = [ - 'traditional' => 'TraditionalImageGallery', - 'nolines' => 'NolinesImageGallery', - 'packed' => 'PackedImageGallery', - 'packed-hover' => 'PackedHoverImageGallery', - 'packed-overlay' => 'PackedOverlayImageGallery', - 'slideshow' => 'SlideshowImageGallery', + 'traditional' => TraditionalImageGallery::class, + 'nolines' => NolinesImageGallery::class, + 'packed' => PackedImageGallery::class, + 'packed-hover' => PackedHoverImageGallery::class, + 'packed-overlay' => PackedOverlayImageGallery::class, + 'slideshow' => SlideshowImageGallery::class, ]; // Allow extensions to make a new gallery format. Hooks::run( 'GalleryGetModes', [ &self::$modeMapping ] ); @@ -207,22 +216,26 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set how wide each image will be, in pixels. * - * @param int $num Integer > 0; invalid numbers will be ignored + * @param string $num Number. Unit other than 'px is invalid. Invalid numbers + * and those below 0 are ignored. */ public function setWidths( $num ) { - if ( $num > 0 ) { - $this->mWidths = (int)$num; + $parsed = Parser::parseWidthParam( $num, false ); + if ( isset( $parsed['width'] ) && $parsed['width'] > 0 ) { + $this->mWidths = $parsed['width']; } } /** * Set how high each image will be, in pixels. * - * @param int $num Integer > 0; invalid numbers will be ignored + * @param string $num Number. Unit other than 'px is invalid. Invalid numbers + * and those below 0 are ignored. */ public function setHeights( $num ) { - if ( $num > 0 ) { - $this->mHeights = (int)$num; + $parsed = Parser::parseWidthParam( $num, false ); + if ( isset( $parsed['width'] ) && $parsed['width'] > 0 ) { + $this->mHeights = $parsed['width']; } }