From 6484f57cebdf204d038ff31a7c035b8098102467 Mon Sep 17 00:00:00 2001 From: Marco Ingraiti Date: Thu, 2 May 2024 10:10:31 +0200 Subject: [PATCH] refactor: moved mimetypes to constant declaration --- ps_imageslider.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ps_imageslider.php b/ps_imageslider.php index 26562ec..8dd8273 100644 --- a/ps_imageslider.php +++ b/ps_imageslider.php @@ -43,6 +43,7 @@ class Ps_ImageSlider extends Module implements WidgetInterface protected $default_pause_on_hover = 1; protected $default_wrap = 1; protected $templateFile; + const SUPPORTED_MIME_TYPES = ['jpg', 'gif', 'jpeg', 'png', 'avif', 'webp']; /** * @var string */ @@ -472,16 +473,9 @@ protected function _postProcess() !empty($imagesize) && in_array( Tools::strtolower(Tools::substr(strrchr($imagesize['mime'], '/'), 1)), - [ - 'jpg', - 'gif', - 'jpeg', - 'png', - 'avif', - 'webp', - ] + self::SUPPORTED_MIME_TYPES ) && - in_array($type, ['jpg', 'gif', 'jpeg', 'png', 'avif', 'webp']) + in_array($type, self::SUPPORTED_MIME_TYPES) ) { $temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS'); $salt = sha1(microtime());