Skip to content

Commit

Permalink
Use empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
richard67 committed May 5, 2023
1 parent f7a3fe8 commit b374ddd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public static function canUpload($file, $err = '')

$format = strtolower(File::getExt($file['name']));

$imageTypes = explode(',', $params->get('image_formats') ?? 'gif,bmp,jpg,jpeg,png,webp');
$sourceTypes = explode(',', $params->get('source_formats') ?? 'txt,less,ini,xml,js,php,css,scss,sass,json');
$fontTypes = explode(',', $params->get('font_formats') ?? 'woff,woff2,ttf,otf');
$archiveTypes = explode(',', $params->get('compressed_formats') ?? 'zip');
$imageTypes = explode(',', $params->get('image_formats') ?? '');
$sourceTypes = explode(',', $params->get('source_formats') ?? '');
$fontTypes = explode(',', $params->get('font_formats') ?? '');
$archiveTypes = explode(',', $params->get('compressed_formats') ?? '');

$allowable = array_merge($imageTypes, $sourceTypes, $fontTypes, $archiveTypes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1774,10 +1774,10 @@ protected function checkFormat($ext)
{
if (!isset($this->allowedFormats)) {
$params = ComponentHelper::getParams('com_templates');
$imageTypes = explode(',', $params->get('image_formats') ?? 'gif,bmp,jpg,jpeg,png,webp');
$sourceTypes = explode(',', $params->get('source_formats') ?? 'txt,less,ini,xml,js,php,css,scss,sass,json');
$fontTypes = explode(',', $params->get('font_formats') ?? 'woff,woff2,ttf,otf');
$archiveTypes = explode(',', $params->get('compressed_formats') ?? 'zip');
$imageTypes = explode(',', $params->get('image_formats') ?? '');
$sourceTypes = explode(',', $params->get('source_formats') ?? '');
$fontTypes = explode(',', $params->get('font_formats') ?? '');
$archiveTypes = explode(',', $params->get('compressed_formats') ?? '');

$this->allowedFormats = array_merge($imageTypes, $sourceTypes, $fontTypes, $archiveTypes);
$this->allowedFormats = array_map('strtolower', $this->allowedFormats);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ public function display($tpl = null)
$this->stylesHTML = '';

$params = ComponentHelper::getParams('com_templates');
$imageTypes = explode(',', $params->get('image_formats') ?? 'gif,bmp,jpg,jpeg,png,webp');
$sourceTypes = explode(',', $params->get('source_formats') ?? 'txt,less,ini,xml,js,php,css,scss,sass,json');
$fontTypes = explode(',', $params->get('font_formats') ?? 'woff,woff2,ttf,otf');
$archiveTypes = explode(',', $params->get('compressed_formats') ?? 'zip');
$imageTypes = explode(',', $params->get('image_formats') ?? '');
$sourceTypes = explode(',', $params->get('source_formats') ?? '');
$fontTypes = explode(',', $params->get('font_formats') ?? '');
$archiveTypes = explode(',', $params->get('compressed_formats') ?? '');

if (in_array($ext, $sourceTypes)) {
$this->form = $this->get('Form');
Expand Down

0 comments on commit b374ddd

Please sign in to comment.