summaryrefslogtreecommitdiffstats
path: root/functions.php
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2020-04-12 15:34:50 +0800
committerBigCoke233 <hi@guhub.cn>2020-04-12 15:34:50 +0800
commit8a03995d72a9afe999c243cffd1fae05b441c172 (patch)
tree527fc1e6b1961d93b1d7b4ef6ecb8bd896fb6731 /functions.php
parent6ea3d1d34ace40447f5505eb13f132d5876b4c70 (diff)
:books: Add: 支持自定义静态资源 CDN
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/functions.php b/functions.php
index 552454b..be3fccc 100644
--- a/functions.php
+++ b/functions.php
@@ -80,10 +80,18 @@ array_push($views, $cid);
/**
* 自动生成引用
*/
-function generate_require($files,$type,$cdn = NULL) {
- if ($cdn)
- $path = $cdn.themeVersion()."/";
- else $path = Helper::options()->themeUrl("","Miracles");
+function generate_require($files,$type,$cdn,$custom) {
+ if ($cdn=='1'){
+ $path = 'https://cdn.jsdelivr.net/gh/BigCoke233/miracles@'.themeVersion()."/";
+ }
+ elseif ($cdn=='2'){
+ $path = 'http://raw.githack.com/BigCoke233/miracles/master/';
+ }
+ elseif ($cdn=='3'){
+ $path = $custom;
+ }else{
+ $path = Helper::options()->themeUrl("","Miracles");
+ }
foreach ($files as $file) {
if ($type == "js")
echo "<script src=".$path."assets/".$type."/".$file.".".$type."></script>";