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'; ?>