2021-03-23 00:51:45 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once "./src/Element/Bookshelf.php";
|
2021-05-10 12:09:29 +08:00
|
|
|
require_once "./constant.php";
|
2021-03-23 00:51:45 +08:00
|
|
|
|
|
|
|
class SiteMeta {
|
|
|
|
|
|
|
|
private static Bookshelf $BOOKSHELF;
|
2021-09-30 19:34:16 +08:00
|
|
|
|
2021-05-10 12:09:29 +08:00
|
|
|
static function get_frontpage_generate_version (): string {
|
2021-09-30 19:34:16 +08:00
|
|
|
return APP_NAME." ".VERSION;
|
2021-05-10 12:09:29 +08:00
|
|
|
}
|
2021-03-23 00:51:45 +08:00
|
|
|
|
2021-11-22 16:08:50 +08:00
|
|
|
public static function getProgramVersion(): string {
|
|
|
|
return sprintf("%s @%s/%s", VERSION, CHANNEL, BRANCH);
|
|
|
|
}
|
|
|
|
|
2021-03-23 00:51:45 +08:00
|
|
|
/**
|
|
|
|
* @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(
|
2021-09-30 19:34:16 +08:00
|
|
|
// "/assets/gitbook/style.css",
|
|
|
|
// "/assets/gitbook/gitbook-plugin-fontsettings/website.css",
|
|
|
|
// "/assets/gitbook-fix.css",
|
|
|
|
// "/assets/ref.css",
|
|
|
|
"/assets/main.css",
|
2021-03-23 00:51:45 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getGitbookJavascriptList (): array {
|
|
|
|
return array(
|
2021-09-30 19:34:16 +08:00
|
|
|
// "/assets/gitbook/gitbook.js",
|
|
|
|
// "/assets/gitbook-fix.js",
|
|
|
|
// "https://cdn.jsdelivr.net/npm/marked/marked.min.js",
|
|
|
|
// "/assets/ref.js",
|
|
|
|
"/assets/main.js",
|
2021-03-23 00:51:45 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-05-05 13:42:29 +08:00
|
|
|
public static function getCustomCssContent (string $id): string {
|
|
|
|
return file_get_contents("./data/$id.css");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getCustomScriptContent (string $id): string {
|
|
|
|
return file_get_contents("./data/$id.js");
|
|
|
|
}
|
|
|
|
|
2021-05-27 16:22:48 +08:00
|
|
|
public static function getUserThemes (): string {
|
|
|
|
$fontSize = $_COOKIE['font-size'] ?? 2;
|
|
|
|
$fontFamily = $_COOKIE['font-family'] ?? 1;
|
|
|
|
$colorTheme = $_COOKIE['color-theme'] ?? 0;
|
|
|
|
return "font-size-$fontSize font-family-$fontFamily color-theme-$colorTheme";
|
|
|
|
}
|
|
|
|
|
2021-03-23 00:51:45 +08:00
|
|
|
}
|