diff options
Diffstat (limited to 'libs/Utils.php')
| -rw-r--r-- | libs/Utils.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libs/Utils.php b/libs/Utils.php index ab3cb9a..69ebe60 100644 --- a/libs/Utils.php +++ b/libs/Utils.php @@ -109,4 +109,35 @@ class Utils } }</style>'; } + + /** + * 自动生成引用 + */ + function addRequires($files,$type,$cdn,$custom) { + if ($cdn=='1'){ + $path = 'https://cdn.jsdelivr.net/gh/BigCoke233/miracles@'.themeVersion()."/assets/"; + } + elseif ($cdn=='2'){ + $path = 'https://raw.githack.com/BigCoke233/miracles/master/assets/'; + } + elseif ($cdn=='4'){ + $path = 'https://rawcdn.githack.com/BigCoke233/miracles/master/assets/'; + } + elseif ($cdn=='5'){ + $path = 'https://cdn.9jojo.cn/Miracles/'.themeVersion().'/'; + } + elseif ($cdn=='3'){ + $path = $custom; + }else{ + $path = Helper::options()->themeUrl("","Miracles/assets"); + } + foreach ($files as $file) { + if ($type == "js"){ + echo "<script src=".$path. $type."/".$file.".".$type."></script>"; + } + elseif ($type == "css"){ + echo "<link rel=\"stylesheet\" href=".$path. $type."/".$file.".".$type." />"; + } + } + } }
\ No newline at end of file |
