From: Tim Düsterhus Date: Thu, 23 Jul 2020 08:48:52 +0000 (+0200) Subject: DRY up upload list list definitions in StyleAddForm X-Git-Tag: 5.3.0_Alpha_1~100^2~14 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6b8a30ec1ff4a1973da6a8cb369bb3254ba84a4c;p=GitHub%2FWoltLab%2FWCF.git DRY up upload list list definitions in StyleAddForm --- diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index 9c1c23de0d..0ae2284856 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -234,8 +234,8 @@ class StyleAddForm extends AbstractForm { } } - protected function rebuildUploadFields() { - $fields = [ + protected function getUploadFields() { + return [ 'image' => [ ], 'image2x' => [ ], 'pageLogo' => [ 'allowSvgImage' => true ], @@ -243,9 +243,11 @@ class StyleAddForm extends AbstractForm { 'coverPhoto' => [ ], 'favicon' => [ ], ]; - + } + + protected function rebuildUploadFields() { $handler = UploadHandler::getInstance(); - foreach ($fields as $name => $options) { + foreach ($this->getUploadFields() as $name => $options) { if ($handler->isRegisteredFieldId($name)) { $handler->unregisterUploadField($name); } @@ -322,7 +324,7 @@ class StyleAddForm extends AbstractForm { if (isset($_POST['scrollOffsets']) && is_array($_POST['scrollOffsets'])) $this->scrollOffsets = ArrayUtil::toIntegerArray($_POST['scrollOffsets']); $this->uploads = []; - foreach (['image', 'image2x', 'pageLogo', 'pageLogoMobile', 'coverPhoto', 'favicon'] as $field) { + foreach (array_keys($this->getUploadFields()) as $field) { $removedFiles = UploadHandler::getInstance()->getRemovedFiledByFieldId($field); if (!empty($removedFiles)) { $this->uploads[$field] = null;