/** * md文件解析 */ public function md() { $file = $this->get('file'); $p = $this->get('p'); // 目录 $directory = MD_FILE_ROOT_PATH . $p . '/'; // 如果不存在自动创建 filesystem::mkdir($directory); // 遍历文件夹所有内容 $path = array(); $dir = filesystem::ls($directory); usort($dir, 'compare'); foreach ($dir as $d) { $path[] = trim($d); } // 解析mk文件 $file = $directory . $file; if (is_file($file)) { $md = new markdown($file); $html = $md->parse(); view::assign('html', $html); } view::assign('path', $path); view::assign('p', $p); view::assign('file', str_replace($directory, '', $file)); }
?> <a href="<?php echo url::backend('addons', ['subpage' => 'overview']); ?> " class="btn btn-sm btn-default"><?php echo lang::get('back'); ?> </a> </div> <div class="clearfix"></div> </div> <div class="panel-body"> <?php $file = dir::addon($addon, 'README.md'); if (file_exists($file)) { echo markdown::parse(file_get_contents($file)); } else { echo lang::get('addon_no_readme'); } ?> </div> </div> </div> </div> <?php } else { $table = table::factory(); $table->addCollsLayout('20,*,215'); $table->addRow()->addCell('')->addCell(lang::get('name'))->addCell(lang::get('actions')); $table->addSection('tbody'); $addons = scandir(dir::backend('addons' . DIRECTORY_SEPARATOR));