Browse Source

fix warning

master
filesite 4 months ago
parent
commit
3ae90b42e0
  1. 8
      themes/beauty/controller/ListController.php
  2. 8
      themes/beauty/controller/SiteController.php

8
themes/beauty/controller/ListController.php

@ -108,12 +108,12 @@ Class ListController extends Controller { @@ -108,12 +108,12 @@ Class ListController extends Controller {
if ($showType == 'image' && !empty($scanResults[$cateId]['files'])) {
$scanResults[$cateId]['files'] = array_filter($scanResults[$cateId]['files'], function($item) {
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif');
return in_array($item['extension'], $imgExts);
return !empty($item['extension']) && in_array($item['extension'], $imgExts);
});
}else if ($showType == 'video' && !empty($scanResults[$cateId]['files'])) {
$scanResults[$cateId]['files'] = array_filter($scanResults[$cateId]['files'], function($item) {
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8');
return in_array($item['extension'], $videoExts);
return !empty($item['extension']) && in_array($item['extension'], $videoExts);
});
}
@ -166,7 +166,7 @@ Class ListController extends Controller { @@ -166,7 +166,7 @@ Class ListController extends Controller {
break;
}
if (in_array($item['extension'], $imgExts)) {
if (!empty($item['extension']) && in_array($item['extension'], $imgExts)) {
array_push($imgs, $item);
$index ++;
}
@ -186,7 +186,7 @@ Class ListController extends Controller { @@ -186,7 +186,7 @@ Class ListController extends Controller {
break;
}
if (in_array($item['extension'], $videoExts)) {
if (!empty($item['extension']) && in_array($item['extension'], $videoExts)) {
array_push($videos, $item);
$index ++;
}

8
themes/beauty/controller/SiteController.php

@ -145,12 +145,12 @@ Class SiteController extends Controller { @@ -145,12 +145,12 @@ Class SiteController extends Controller {
if ($showType == 'image') {
$scanResults = array_filter($scanResults, function($item) {
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif');
return in_array($item['extension'], $imgExts);
return !empty($item['extension']) && in_array($item['extension'], $imgExts);
});
}else if ($showType == 'video') {
$scanResults = array_filter($scanResults, function($item) {
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8');
return in_array($item['extension'], $videoExts);
return !empty($item['extension']) && in_array($item['extension'], $videoExts);
});
}
@ -170,7 +170,7 @@ Class SiteController extends Controller { @@ -170,7 +170,7 @@ Class SiteController extends Controller {
break;
}
if (in_array($item['extension'], $imgExts)) {
if (!empty($item['extension']) && in_array($item['extension'], $imgExts)) {
array_push($imgs, $item);
$index ++;
}
@ -189,7 +189,7 @@ Class SiteController extends Controller { @@ -189,7 +189,7 @@ Class SiteController extends Controller {
break;
}
if (in_array($item['extension'], $videoExts)) {
if (!empty($item['extension']) && in_array($item['extension'], $videoExts)) {
array_push($videos, $item);
$index ++;
}

Loading…
Cancel
Save