mirror of
https://github.com/suk-ws/ph-Bookshelf.git
synced 2024-12-05 01:16:53 +08:00
添加了站点和当前页面数据管理的静态对象,添加了基础的(真·)页头页脚(HTML限定款)模板
This commit is contained in:
parent
dfa9e3f8a9
commit
fa218dc2b0
20
src/Data/PageMeta.php
Normal file
20
src/Data/PageMeta.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once "./src/Element/BookContent/BookContented.php";
|
||||
require_once "./src/Element/BookContent/Page.php";
|
||||
|
||||
class PageMeta {
|
||||
|
||||
public static BookContented $book;
|
||||
public static Page $page;
|
||||
public static bool $isMainPage;
|
||||
|
||||
public static function getPageTitle (): string {
|
||||
return self::$page->getName()." - ".self::$book->getName();
|
||||
}
|
||||
|
||||
public static function getDescription (): string {
|
||||
return ""; // todo wip description
|
||||
}
|
||||
|
||||
}
|
46
src/Data/SiteMeta.php
Normal file
46
src/Data/SiteMeta.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once "./src/Element/Bookshelf.php";
|
||||
|
||||
class SiteMeta {
|
||||
|
||||
private static Bookshelf $BOOKSHELF;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function load () {
|
||||
self::$BOOKSHELF = Bookshelf::parseString(file_get_contents("./data/bookshelf.xml"));
|
||||
}
|
||||
|
||||
public static function getBookshelf(): Bookshelf {
|
||||
return self::$BOOKSHELF;
|
||||
}
|
||||
|
||||
public static function getGlobalIcon (): string {
|
||||
return "/favicon.ico"; // TODO ICON
|
||||
}
|
||||
|
||||
public static function getGitbookStylesheetsList (): array {
|
||||
return array(
|
||||
"gitbook/style.css",
|
||||
"gitbook/gitbook-plugin-highlight/website.css",
|
||||
"gitbook/gitbook-plugin-search/search.css",
|
||||
"gitbook/gitbook-plugin-fontsettings/website.css"
|
||||
);
|
||||
}
|
||||
|
||||
public static function getGitbookJavascriptList (): array {
|
||||
return array(
|
||||
"gitbook/gitbook.js",
|
||||
"gitbook/theme.js",
|
||||
"gitbook/gitbook-plugin-search/search-engine.js",
|
||||
"gitbook/gitbook-plugin-search/search.js",
|
||||
"gitbook/gitbook-plugin-lunr/lunr.min.js",
|
||||
"gitbook/gitbook-plugin-lunr/search-lunr.js",
|
||||
"gitbook/gitbook-plugin-sharing/buttons.js",
|
||||
"gitbook/gitbook-plugin-fontsettings/fontsettings.js"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
16
template/footer.php
Normal file
16
template/footer.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php require_once "./src/Data/SiteMeta.php" ?>
|
||||
</div>
|
||||
|
||||
<!-- Page data -->
|
||||
<?php // TODO Get Page data ?>
|
||||
|
||||
<!-- Gitbook Assets(js) -->
|
||||
<?php
|
||||
foreach (SiteMeta::getGitbookJavascriptList() as $item) {
|
||||
echo "<script src=\"$item\"></script>";
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
30
template/header.php
Normal file
30
template/header.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php require_once "./constant.php" ?>
|
||||
<?php require_once "./src/Data/SiteMeta.php" ?>
|
||||
<?php require_once "./src/Data/PageMeta.php" ?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="<?= "" // TODO Page language ?>">
|
||||
<head>
|
||||
<!-- Gitbook Meta -->
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="HandheldFriendly" content="true" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<!-- Page Meta -->
|
||||
<link rel="shortcut icon" href="<?= SiteMeta::getGlobalIcon() ?>" type="image/x-icon">
|
||||
<!-- Unused: <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> -->
|
||||
<title><?= PageMeta::getPageTitle() ?></title>
|
||||
<meta name="description" content="<?= PageMeta::getDescription() ?>">
|
||||
<meta name="generator" content="<?= get_frontpage_generate_version() ?>">
|
||||
<!-- Gitbook Assets(css) -->
|
||||
<?php
|
||||
foreach (SiteMeta::getGitbookStylesheetsList() as $item) {
|
||||
echo "<link rel=\"stylesheet\" href=\"$item\">";
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<div class="book">
|
||||
|
Loading…
Reference in New Issue
Block a user