|
|
|
@ -19,27 +19,37 @@ Class ListController extends Controller {
@@ -19,27 +19,37 @@ Class ListController extends Controller {
|
|
|
|
|
$cateId = $this->get('id', $menus[0]['id']); |
|
|
|
|
|
|
|
|
|
$titles = []; |
|
|
|
|
$html = ''; |
|
|
|
|
$htmlReadme = ''; |
|
|
|
|
$readmeFile = $scanner->getDefaultReadme(); |
|
|
|
|
if (!empty($readmeFile)) { |
|
|
|
|
$titles = $scanner->getMDTitles($readmeFile['id']); |
|
|
|
|
|
|
|
|
|
$Parsedown = new Parsedown(); |
|
|
|
|
$content = file_get_contents($readmeFile['realpath']); |
|
|
|
|
$html = $Parsedown->text($content); |
|
|
|
|
$html = $scanner->fixMDUrls($readmeFile['realpath'], $html); |
|
|
|
|
$htmlReadme = $Parsedown->text($content); |
|
|
|
|
$htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取目录面包屑 |
|
|
|
|
$subcate = $scanResults[$cateId]; |
|
|
|
|
$breadcrumbs = $this->getBreadcrumbs($menus, $subcate); |
|
|
|
|
|
|
|
|
|
//获取当前目录下的readme |
|
|
|
|
$htmlCateReadme = ''; |
|
|
|
|
$cateReadmeFile = $scanner->getDefaultReadme($cateId); |
|
|
|
|
if (!empty($cateReadmeFile)) { |
|
|
|
|
$Parsedown = new Parsedown(); |
|
|
|
|
$content = file_get_contents($cateReadmeFile['realpath']); |
|
|
|
|
$htmlCateReadme = $Parsedown->text($content); |
|
|
|
|
$htmlCateReadme = $scanner->fixMDUrls($cateReadmeFile['realpath'], $htmlCateReadme); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$pageTitle = !empty($titles) ? $titles[0]['name'] : "FileSite.io - 无数据库、基于文件和目录的Markdown文档、网址导航、图书、图片、视频网站PHP开源系统"; |
|
|
|
|
if (!empty($subcate)) { |
|
|
|
|
$pageTitle = "{$subcate['directory']}的照片,来自{$pageTitle}"; |
|
|
|
|
} |
|
|
|
|
$viewName = '//site/index'; //共享视图 |
|
|
|
|
$params = compact('cateId', 'dirTree', 'scanResults', 'menus', 'html', 'breadcrumbs'); |
|
|
|
|
$params = compact('cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme'); |
|
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|