X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderImage.php;h=072ae7944b177af4842c3a29a8135e1c0639a774;hb=75e3edb416aea15e4be2dfb0a4b66beef81f45f1;hp=6a6a3c24d5e265aaf6a19aedaaf69a5f68bd14c5;hpb=386c6ae9c5a5e9fe133a333b653b4d080dff1718;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderImage.php b/includes/resourceloader/ResourceLoaderImage.php index 6a6a3c24d5..072ae7944b 100644 --- a/includes/resourceloader/ResourceLoaderImage.php +++ b/includes/resourceloader/ResourceLoaderImage.php @@ -67,23 +67,27 @@ class ResourceLoaderImage { } } } + // Remove 'deprecated' key + if ( is_array( $this->descriptor ) ) { + unset( $this->descriptor[ 'deprecated' ] ); + } // Ensure that all files have common extension. $extensions = []; - $descriptor = (array)$descriptor; + $descriptor = (array)$this->descriptor; array_walk_recursive( $descriptor, function ( $path ) use ( &$extensions ) { $extensions[] = pathinfo( $path, PATHINFO_EXTENSION ); } ); $extensions = array_unique( $extensions ); if ( count( $extensions ) !== 1 ) { throw new InvalidArgumentException( - "File type for different image files of '$name' not the same" + "File type for different image files of '$name' not the same in module '$module'" ); } $ext = $extensions[0]; if ( !isset( self::$fileTypes[$ext] ) ) { throw new InvalidArgumentException( - "Invalid file type for image files of '$name' (valid: svg, png, gif, jpg)" + "Invalid file type for image files of '$name' (valid: svg, png, gif, jpg) in module '$module'" ); } $this->extension = $ext; @@ -144,9 +148,8 @@ class ResourceLoaderImage { public function getExtension( $format = 'original' ) { if ( $format === 'rasterized' && $this->extension === 'svg' ) { return 'png'; - } else { - return $this->extension; } + return $this->extension; } /**