Skip to content

Commit d5fb6a2

Browse files
Simplify remove extensions on settings save
1 parent 9978263 commit d5fb6a2

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/admin-settings.cls.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,8 @@ public function save($raw_data)
119119
$v = Utility::sanitize_lines($v);
120120

121121
// Remove from MAPPING FILETYPE extensions for IMAGES, CSS, JS
122-
$remove_type = array('jpg', 'jpeg', 'png', 'gif', 'svg', 'webp', 'avif', 'css', 'js');
123-
$temp = array_filter($v, function ($i_v) use ($remove_type) {
124-
$leave_value = true;
125-
126-
foreach ($remove_type as $remove) {
127-
if (strpos($i_v, $remove) !== false) {
128-
$leave_value = false;
129-
break;
130-
}
131-
}
132-
133-
return $leave_value;
134-
});
135-
$v = array_values($temp);
122+
$remove_type = array('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp', '.avif', '.css', '.js');
123+
$v = array_diff($v, $remove_type);
136124
}
137125
if ($child == self::CDN_MAPPING_URL) {
138126
# If not a valid URL, turn off CDN

0 commit comments

Comments
 (0)