* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Image gallery
*
*/
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?
*/
* @throws MWException
*/
static function factory( $mode = false, IContextSource $context = null ) {
- global $wgContLang;
self::loadModes();
if ( !$context ) {
$context = RequestContext::getMainAndWarn( __METHOD__ );
$mode = $galleryOptions['mode'];
}
- $mode = $wgContLang->lc( $mode );
+ $mode = MediaWikiServices::getInstance()->getContentLanguage()->lc( $mode );
if ( isset( self::$modeMapping[$mode] ) ) {
$class = self::$modeMapping[$mode];
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 ] );