Skip to content

Commit 6ae84ff

Browse files
authored
add fallback for the new media setting and fix some phpcs (#34778)
1 parent e154f58 commit 6ae84ff

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

libraries/src/Helper/MediaHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public function canUpload($file, $component = 'com_media', $allowedExecutables =
207207

208208
$filetype = array_pop($filetypes);
209209

210-
$allowable = array_map('trim', explode(',', $params->get('restrict_uploads_extensions')));
210+
$allowable = array_map('trim', explode(',', $params->get('restrict_uploads_extensions', 'bmp,gif,jpg,jpeg,png,webp,ico,mp3,m4a,mp4a,ogg,mp4,mp4v,mpeg,mov,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv')));
211211
$ignored = array_map('trim', explode(',', $params->get('ignore_extensions')));
212212

213213
if ($filetype == '' || $filetype == false || (!\in_array($filetype, $allowable) && !\in_array($filetype, $ignored)))
@@ -228,7 +228,7 @@ public function canUpload($file, $component = 'com_media', $allowedExecutables =
228228

229229
if ($params->get('restrict_uploads', 1))
230230
{
231-
$allowedExtensions = array_map('trim', explode(',', $params->get('restrict_uploads_extensions')));
231+
$allowedExtensions = array_map('trim', explode(',', $params->get('restrict_uploads_extensions', 'bmp,gif,jpg,jpeg,png,webp,ico,mp3,m4a,mp4a,ogg,mp4,mp4v,mpeg,mov,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv')));
232232

233233
if (\in_array($filetype, $allowedExtensions))
234234
{

plugins/editors-xtd/image/image.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public function onDisplay($name, $asset, $author)
4949
$extension = $app->input->get('option');
5050

5151
// For categories we check the extension (ex: component.section)
52-
if ($extension === 'com_categories') {
52+
if ($extension === 'com_categories')
53+
{
5354
$parts = explode('.', $app->input->get('extension', 'com_content'));
5455
$extension = $parts[0];
5556
}
@@ -63,7 +64,8 @@ public function onDisplay($name, $asset, $author)
6364
|| ($user->authorise('core.edit.own', $asset) && $author === $user->id)
6465
|| (count($user->getAuthorisedCategories($extension, 'core.edit')) > 0)
6566
|| (count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author === $user->id)
66-
) {
67+
)
68+
{
6769
$doc->getWebAssetManager()
6870
->useScript('webcomponent.media-select')
6971
->useScript('webcomponent.field-media')
@@ -73,7 +75,8 @@ public function onDisplay($name, $asset, $author)
7375
$name . '_ImageModal',
7476
]);
7577

76-
if (count($doc->getScriptOptions('media-picker')) === 0) {
78+
if (count($doc->getScriptOptions('media-picker')) === 0)
79+
{
7780
$imagesExt = array_map(
7881
'trim',
7982
explode(

0 commit comments

Comments
 (0)