From b6300314489e399370ae30cf5389ff37a1a5428b Mon Sep 17 00:00:00 2001 From: gabriel-glo Date: Mon, 22 Jul 2024 21:44:57 +0200 Subject: [PATCH] PHPCS fixes --- safe-svg.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/safe-svg.php b/safe-svg.php index 24eeb65f..33a497c4 100644 --- a/safe-svg.php +++ b/safe-svg.php @@ -395,7 +395,7 @@ public function fix_admin_preview( $response, $attachment, $meta ) { */ public function one_pixel_fix( $image, $attachment_id, $size, $icon ) { if ( get_post_mime_type( $attachment_id ) === 'image/svg+xml' ) { - $dimensions = $this->set_svg_dimensions( $size, $attachment_id ); + $dimensions = $this->set_svg_dimensions( $attachment_id, $size ); if ( $dimensions && $dimensions['height'] && $dimensions['width'] ) { $image[1] = $dimensions['width']; @@ -451,7 +451,7 @@ public function load_custom_admin_style() { public function get_image_tag_override( $html, $id, $alt, $title, $align, $size ) { $mime = get_post_mime_type( $id ); if ( 'image/svg+xml' === $mime ) { - $dimensions = $this->set_svg_dimensions( $size, $id ); + $dimensions = $this->set_svg_dimensions( $id, $size ); if ( $dimensions['height'] && $dimensions['width'] ) { $html = str_replace( 'width="1" ', sprintf( 'width="%s" ', $dimensions['width'] ), $html ); @@ -720,14 +720,13 @@ protected function str_ends_with( $haystack, $needle ) { /** * Set custom width or height of the SVG image. * - * @param string $dimension Dimension quality of the image. Either 'width' or 'height'. - * @param string|array $size Size of image. Image size or array of width and height values + * @param int $id Image attachment ID. + * @param string|array $size Size of image. Image size or array of width and height values * (in that order). Default 'thumbnail'. - * @param int $id Image attachment ID. * * @return int|false Width or height of the SVG image, or false if not found. */ - protected function set_svg_dimensions( $size, $id ) { + protected function set_svg_dimensions( $id, $size ) { $dimensions = $this->svg_dimensions( $id ); if ( is_array( $size ) ) {