From 608bff9df17b48bc8f516f4942c23fd4db8af0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Sat, 20 Mar 2021 09:18:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 4 ++-- public/config.php | 25 ++++++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/functions.php b/functions.php index ad497a0..74b2635 100644 --- a/functions.php +++ b/functions.php @@ -339,8 +339,8 @@ function themeConfig($form) NULL, '自定义网站字体(非必填)', '介绍:用于修改全站字体,填写则使用引入的字体,不填写使用默认字体
- 格式:字体URL链接
- 注意:由于体积文件较大,建议使用cdn链接方式进行引入' + 格式:字体URL链接(推荐使用woff格式的字体,网页专用字体格式)
+ 注意:字体文件一般有几兆,建议使用cdn链接' ); $JCustomFont->setAttribute('class', 'joe_content joe_global'); $form->addInput($JCustomFont); diff --git a/public/config.php b/public/config.php index 8d15a02..dd0c7fd 100644 --- a/public/config.php +++ b/public/config.php @@ -29,18 +29,12 @@ detectIE() && (alert('当前站点不支持IE浏览器或您开启了兼容模式,请使用其他浏览器访问或关闭兼容模式。'), (location.href = 'https://www.baidu.com')) options->JCustomFont, 'woff2') !== false) { - $format = 'woff2'; -} elseif (strpos($this->options->JCustomFont, 'woff') !== false) { - $format = 'woff'; -} elseif (strpos($this->options->JCustomFont, 'ttf') !== false) { - $format = 'truetype'; -} elseif (strpos($this->options->JCustomFont, 'eot') !== false) { - $format = 'embedded-opentype'; -} elseif (strpos($this->options->JCustomFont, 'svg') !== false) { - $format = 'svg'; -} +$fontUrl = $this->options->JCustomFont; +if (strpos($fontUrl, 'woff2') !== false) $fontFormat = 'woff2'; +elseif (strpos($fontUrl, 'woff') !== false) $fontFormat = 'woff'; +elseif (strpos($fontUrl, 'ttf') !== false) $fontFormat = 'truetype'; +elseif (strpos($fontUrl, 'eot') !== false) $fontFormat = 'embedded-opentype'; +elseif (strpos($fontUrl, 'svg') !== false) $fontFormat = 'svg'; ?>