Skip to content

Commit

Permalink
[TASK] Clean-up code
Browse files Browse the repository at this point in the history
  • Loading branch information
ohader committed Oct 28, 2024
1 parent 41c3c66 commit db9bed4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
9 changes: 2 additions & 7 deletions Classes/ViewHelpers/File/IsAudioViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['SYS']['audiofile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === FileType::AUDIO->value
)
) {
return true;
}

return false;
);
}
}
9 changes: 2 additions & 7 deletions Classes/ViewHelpers/File/IsImageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === FileType::IMAGE->value
)
) {
return true;
}

return false;
);
}
}
9 changes: 2 additions & 7 deletions Classes/ViewHelpers/File/IsMediaViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ public function render()
$allowedFileExtensions = $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] ?? '';
$allowedFileExtensions = GeneralUtility::trimExplode(',', $allowedFileExtensions);

if (is_object($file)
return is_object($file)
&& ($file instanceof FileReference || $file instanceof File)
&& (
in_array($file->getExtension(), $allowedFileExtensions, true)
|| $file->getType() === FileType::VIDEO->value
)
) {
return true;
}

return false;
);
}
}

0 comments on commit db9bed4

Please sign in to comment.