|
|
|
@ -137,10 +137,27 @@ Class SiteController extends Controller {
@@ -137,10 +137,27 @@ Class SiteController extends Controller {
|
|
|
|
|
$copyright = $readmeFile['copyright']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//图片、视频类型筛选支持 |
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
|
|
|
|
|
|
$showType = $this->get('show', 'all'); |
|
|
|
|
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); |
|
|
|
|
}); |
|
|
|
|
}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); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dataType支持:[image, video] |
|
|
|
|
$dataType = $this->get('dataType', 'html'); |
|
|
|
|
if ($dataType == 'image') { |
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
$imgs = array(); |
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
$index = 0; |
|
|
|
@ -160,7 +177,6 @@ Class SiteController extends Controller {
@@ -160,7 +177,6 @@ Class SiteController extends Controller {
|
|
|
|
|
} |
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'imgs')); |
|
|
|
|
}else if ($dataType == 'video') { |
|
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
|
$videos = array(); |
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
$index = 0; |
|
|
|
@ -184,7 +200,7 @@ Class SiteController extends Controller {
@@ -184,7 +200,7 @@ Class SiteController extends Controller {
|
|
|
|
|
|
|
|
|
|
$viewName = 'index'; |
|
|
|
|
$params = compact( |
|
|
|
|
'page', 'pageSize', 'cacheDataId', |
|
|
|
|
'page', 'pageSize', 'cacheDataId', 'showType', |
|
|
|
|
'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'mp3File', 'copyright' |
|
|
|
|
); |
|
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
|