diff options
| author | BigCoke233 <hi@guhub.cn> | 2020-07-11 10:45:32 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2020-07-11 10:45:32 +0800 |
| commit | 646be60afa95355fee8652f4c7328a83ff38a94c (patch) | |
| tree | a0355c5d1a77f3ef7346cae51bf1cb69bed6129d | |
| parent | 12d7a70545d1ec4eed63d6e9e8f823c08646c7ee (diff) | |
🎨 Add: 添加高级设置、可自定义字体 CDN
| -rw-r--r-- | functions.php | 1 | ||||
| -rw-r--r-- | includes/head.php | 18 | ||||
| -rw-r--r-- | themeConfig.php | 13 |
3 files changed, 27 insertions, 5 deletions
diff --git a/functions.php b/functions.php index b3cbe10..796a4f2 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,6 @@ <?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?> <?php +require_once("themeConfig.php"); require_once("libs/Utils.php"); require_once("libs/Contents.php"); require_once("libs/Comments.php"); diff --git a/includes/head.php b/includes/head.php index bfc2bb8..3a6aa92 100644 --- a/includes/head.php +++ b/includes/head.php @@ -49,9 +49,17 @@ Utils::addRequires($css_files,"css",$this->options->CDN,$custom); ?> <!-- icon font --> - <link rel="stylesheet" href="//at.alicdn.com/t/font_1165190_1djdjjwge4m.css" /> - <!-- Google Fonts --> - <link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:300|Noto+Serif+SC&display=swap" rel="stylesheet"> - <style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat}<?php $this->options->cssEcho(); ?></style> + <link rel="stylesheet" href="//at.alicdn.com/t/font_1165190_1djdjjwge4m.css" /><?php + if($GLOBALS['miraclesFontCDN']['if']=='on'): + if($GLOBALS['miraclesFontCDN']['cdn']=='google_font'): + $theme_font_url = "https://fonts.googleapis.com/css?family=Noto+Sans+SC:300|Noto+Serif+SC&display=swap"; + elseif($GLOBALS['miraclesFontCDN']['cdn']=='font_lolinet'): + $theme_font_url = "https://fonts.loli.net/css?family=Noto+Sans+SC:300|Noto+Serif+SC&display=swap"; + else: + $theme_font_url = $GLOBALS['miraclesFontCDN']['cdn']; + endif; ?> + <!-- Font CDN --> + <link href="<?php echo $theme_font_url; ?>" rel="stylesheet"> + <?php endif; ?><style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat}<?php $this->options->cssEcho(); ?></style> </head> - <body class="<?php if($this->options->bodyFonts && $this->options->bodyFonts=1): ?>body-serif<?php endif; ?>"> + <body class="<?php if($this->options->bodyFonts && $this->options->bodyFonts=1): ?>body-serif<?php endif; ?>">
\ No newline at end of file diff --git a/themeConfig.php b/themeConfig.php new file mode 100644 index 0000000..3b9199d --- /dev/null +++ b/themeConfig.php @@ -0,0 +1,13 @@ +<?php +/** + * ThemeConfig.php + * 主题高级设置 + * + * Notice: 这些都是普通用户不常用的设置项,故单独放在这里 + */ + +//主题字体 CDN +$GLOBALS['miraclesFontCDN'] = array( + 'if' => 'on', //是否开启字体 CDN(使用思源宋体/黑体) + 'cdn' => 'google_font' //默认 Google Font,可选项:google_font / font_lolinet,或者直接输入字体文件 url +);
\ No newline at end of file |
