X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FImageHandler.php;h=c2870c25ea6271518f5041b4bb699dbc8b55ac1d;hb=ee56f00ddf0609082f8ae9a4dc3e6e1b6f54ddfd;hp=787f21e4430019b9d8794faf93b9311a3d8f9c13;hpb=bd5fd843d672e35dde630d6be5d76437e8f5205a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/ImageHandler.php b/includes/media/ImageHandler.php index 787f21e443..a0a160321c 100644 --- a/includes/media/ImageHandler.php +++ b/includes/media/ImageHandler.php @@ -31,16 +31,16 @@ abstract class ImageHandler extends MediaHandler { * @param File $file * @return bool */ - function canRender( $file ) { + public function canRender( $file ) { return ( $file->getWidth() && $file->getHeight() ); } - function getParamMap() { - return array( 'img_width' => 'width' ); + public function getParamMap() { + return [ 'img_width' => 'width' ]; } - function validateParam( $name, $value ) { - if ( in_array( $name, array( 'width', 'height' ) ) ) { + public function validateParam( $name, $value ) { + if ( in_array( $name, [ 'width', 'height' ] ) ) { if ( $value <= 0 ) { return false; } else { @@ -51,7 +51,7 @@ abstract class ImageHandler extends MediaHandler { } } - function makeParamString( $params ) { + public function makeParamString( $params ) { if ( isset( $params['physicalWidth'] ) ) { $width = $params['physicalWidth']; } elseif ( isset( $params['width'] ) ) { @@ -61,26 +61,26 @@ abstract class ImageHandler extends MediaHandler { } # Removed for ProofreadPage - #$width = intval( $width ); + # $width = intval( $width ); return "{$width}px"; } - function parseParamString( $str ) { + public function parseParamString( $str ) { $m = false; if ( preg_match( '/^(\d+)px$/', $str, $m ) ) { - return array( 'width' => $m[1] ); + return [ 'width' => $m[1] ]; } else { return false; } } function getScriptParams( $params ) { - return array( 'width' => $params['width'] ); + return [ 'width' => $params['width'] ]; } /** * @param File $image - * @param array $params + * @param array &$params * @return bool */ function normaliseParams( $image, &$params ) { @@ -152,8 +152,8 @@ abstract class ImageHandler extends MediaHandler { /** * Validate thumbnail parameters and fill in the correct height * - * @param int $width Specified width (input/output) - * @param int $height Height (output only) + * @param int &$width Specified width (input/output) + * @param int &$height Height (output only) * @param int $srcWidth Width of the source image * @param int $srcHeight Height of the source image * @param string $mimeType Unused @@ -201,9 +201,9 @@ abstract class ImageHandler extends MediaHandler { } function getImageSize( $image, $path ) { - wfSuppressWarnings(); + Wikimedia\suppressWarnings(); $gis = getimagesize( $path ); - wfRestoreWarnings(); + Wikimedia\restoreWarnings(); return $gis; } @@ -245,11 +245,11 @@ abstract class ImageHandler extends MediaHandler { if ( $pages === false || $pages <= 1 ) { $msg = wfMessage( 'file-info-size' )->numParams( $file->getWidth(), $file->getHeight() )->params( $size, - $file->getMimeType() )->parse(); + '' . $file->getMimeType() . '' )->parse(); } else { $msg = wfMessage( 'file-info-size-pages' )->numParams( $file->getWidth(), $file->getHeight() )->params( $size, - $file->getMimeType() )->numParams( $pages )->parse(); + '' . $file->getMimeType() . '' )->numParams( $pages )->parse(); } return $msg;