更新
This commit is contained in:
parent
514662f407
commit
608bff9df1
@ -339,8 +339,8 @@ function themeConfig($form)
|
|||||||
NULL,
|
NULL,
|
||||||
'自定义网站字体(非必填)',
|
'自定义网站字体(非必填)',
|
||||||
'介绍:用于修改全站字体,填写则使用引入的字体,不填写使用默认字体 <br>
|
'介绍:用于修改全站字体,填写则使用引入的字体,不填写使用默认字体 <br>
|
||||||
格式:字体URL链接 <br>
|
格式:字体URL链接(推荐使用woff格式的字体,网页专用字体格式) <br>
|
||||||
注意:由于体积文件较大,建议使用cdn链接方式进行引入'
|
注意:字体文件一般有几兆,建议使用cdn链接'
|
||||||
);
|
);
|
||||||
$JCustomFont->setAttribute('class', 'joe_content joe_global');
|
$JCustomFont->setAttribute('class', 'joe_content joe_global');
|
||||||
$form->addInput($JCustomFont);
|
$form->addInput($JCustomFont);
|
||||||
|
@ -29,18 +29,12 @@
|
|||||||
detectIE() && (alert('当前站点不支持IE浏览器或您开启了兼容模式,请使用其他浏览器访问或关闭兼容模式。'), (location.href = 'https://www.baidu.com'))
|
detectIE() && (alert('当前站点不支持IE浏览器或您开启了兼容模式,请使用其他浏览器访问或关闭兼容模式。'), (location.href = 'https://www.baidu.com'))
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$format = null;
|
$fontUrl = $this->options->JCustomFont;
|
||||||
if (strpos($this->options->JCustomFont, 'woff2') !== false) {
|
if (strpos($fontUrl, 'woff2') !== false) $fontFormat = 'woff2';
|
||||||
$format = 'woff2';
|
elseif (strpos($fontUrl, 'woff') !== false) $fontFormat = 'woff';
|
||||||
} elseif (strpos($this->options->JCustomFont, 'woff') !== false) {
|
elseif (strpos($fontUrl, 'ttf') !== false) $fontFormat = 'truetype';
|
||||||
$format = 'woff';
|
elseif (strpos($fontUrl, 'eot') !== false) $fontFormat = 'embedded-opentype';
|
||||||
} elseif (strpos($this->options->JCustomFont, 'ttf') !== false) {
|
elseif (strpos($fontUrl, 'svg') !== false) $fontFormat = 'svg';
|
||||||
$format = 'truetype';
|
|
||||||
} elseif (strpos($this->options->JCustomFont, 'eot') !== false) {
|
|
||||||
$format = 'embedded-opentype';
|
|
||||||
} elseif (strpos($this->options->JCustomFont, 'svg') !== false) {
|
|
||||||
$format = 'svg';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
@font-face {
|
||||||
@ -48,12 +42,13 @@ if (strpos($this->options->JCustomFont, 'woff2') !== false) {
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
src: url('<?php $this->options->JCustomFont() ?>');
|
src: url('<?php echo $fontUrl ?>');
|
||||||
<?php if ($format) echo "src: url('{$this->options->JCustomFont}') fromat('{$format}');" ?>
|
<?php if ($fontFormat) : ?>src: url('<?php echo $fontUrl ?>') format('<?php echo $fontFormat ?>');
|
||||||
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
<?php if ($this->options->JCustomFont) : ?>font-family: 'Joe Font';
|
<?php if ($fontUrl) : ?>font-family: 'Joe Font';
|
||||||
<?php else : ?>font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
|
<?php else : ?>font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user