Skip to content

Commit

Permalink
feat: footer link
Browse files Browse the repository at this point in the history
  • Loading branch information
KawaiiZapic committed Sep 12, 2024
1 parent 1cad4cd commit f1478fe
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 21 deletions.
73 changes: 55 additions & 18 deletions src/footer.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,60 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
<?php
if (!defined('__TYPECHO_ROOT_DIR__'))
exit;
Typecho\Plugin::export();
/** @var \Widget\Archive $this */
?>
</div>
<mdui-card class="mt-20px h-100px bottom-0 left-0 w-full flex justify-center text-center items-center rounded-b-0">
<div class="mdui-prose">
<div>Copyright &copy; <?php echo date("Y"); ?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a></div>
<?php if(Matecho::$BeianText) { ?>
<div class="text-sm"><?php echo Matecho::$BeianText ?></div>
<?php }?>
</div>
</mdui-card>
</main>
<script type="text/javascript">
!new RegExp("<%= CompatibilityUserAgentRegex %>").test(navigator.userAgent)&&(document.body.innerHTML+='<div class="un-br"><h1 class="un-br_sf">{ ᗜ˰ᗜ }</h1> <h1>浏览器不受支持</h1><p>您当前使用的浏览器不受支持,请更新你的浏览器。</p></div>')
</script>
<?php echo Matecho::$ExtraCode; ?>
<?php Matecho::themeCSS(); Matecho::generateJSOptions(); ?>
<?php $this->footer(); ?>
</div>
<mdui-card class="mt-20px h-100px bottom-0 left-0 w-full flex justify-center text-center items-center rounded-b-0">
<div class="mdui-prose">
<div>
Copyright &copy; <?php echo date("Y"); ?>
<a href="<?php $this->options->siteUrl(); ?>">
<?php $this->options->title(); ?>
</a>
</div>
<?php if (Matecho::$BeiAnText) { ?>
<div class="text-sm opacity-80 mb-1"><?php echo Matecho::$BeiAnText ?></div>
<?php } ?>
<div class="text-sm flex flex-gap-2 items-center justify-center">
<?php if (Matecho::$LinkBilibili) { ?>
<a href="<?php echo Matecho::$LinkBilibili; ?>" target="_blank" class="decoration-none! border-none!">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
<path
d="M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z" />

</svg>
</a>
<?php } ?>
<?php if (Matecho::$LinkTwitter) { ?>
<a href="<?php echo Matecho::$LinkTwitter; ?>" target="_blank" class="decoration-none! border-none!">
<svg class="w-4 h-4" viewBox="0 0 24 24">
<path fill="currentColor"
d="M19.7828 3.91825C20.1313 3.83565 20.3743 3.75444 20.5734 3.66915C20.8524 3.54961 21.0837 3.40641 21.4492 3.16524C21.7563 2.96255 22.1499 2.9449 22.4739 3.11928C22.7979 3.29366 23 3.6319 23 3.99986C23 5.08079 22.8653 5.96673 22.5535 6.7464C22.2911 7.40221 21.9225 7.93487 21.4816 8.41968C21.2954 11.7828 20.3219 14.4239 18.8336 16.4248C17.291 18.4987 15.2386 19.8268 13.0751 20.5706C10.9179 21.3121 8.63863 21.4778 6.5967 21.2267C4.56816 20.9773 2.69304 20.3057 1.38605 19.2892C1.02813 19.0108 0.902313 18.5264 1.07951 18.109C1.25671 17.6916 1.69256 17.4457 2.14144 17.5099C3.42741 17.6936 4.6653 17.4012 5.6832 16.9832C5.48282 16.8742 5.29389 16.7562 5.11828 16.6346C4.19075 15.9925 3.4424 15.1208 3.10557 14.4471C2.96618 14.1684 2.96474 13.8405 3.10168 13.5606C3.17232 13.4161 3.27562 13.293 3.40104 13.1991C2.04677 12.0814 1.49999 10.5355 1.49999 9.49986C1.49999 9.19192 1.64187 8.90115 1.88459 8.71165C1.98665 8.63197 2.10175 8.57392 2.22308 8.53896C2.12174 8.24222 2.0431 7.94241 1.98316 7.65216C1.71739 6.3653 1.74098 4.91284 2.02985 3.75733C2.1287 3.36191 2.45764 3.06606 2.86129 3.00952C3.26493 2.95299 3.6625 3.14709 3.86618 3.50014C4.94369 5.36782 6.93116 6.50943 8.78086 7.18568C9.6505 7.50362 10.4559 7.70622 11.0596 7.83078C11.1899 6.61019 11.5307 5.6036 12.0538 4.80411C12.7439 3.74932 13.7064 3.12525 14.74 2.84698C16.5227 2.36708 18.5008 2.91382 19.7828 3.91825ZM10.7484 9.80845C10.0633 9.67087 9.12171 9.43976 8.09412 9.06408C6.7369 8.56789 5.16088 7.79418 3.84072 6.59571C3.86435 6.81625 3.89789 7.03492 3.94183 7.24766C4.16308 8.31899 4.5742 8.91899 4.94721 9.10549C5.40342 9.3336 5.61484 9.8685 5.43787 10.3469C5.19827 10.9946 4.56809 11.0477 3.99551 10.9046C4.45603 11.595 5.28377 12.2834 6.66439 12.5135C7.14057 12.5929 7.49208 13.0011 7.49986 13.4838C7.50765 13.9665 7.16949 14.3858 6.69611 14.4805L5.82565 14.6546C5.95881 14.7703 6.103 14.8838 6.2567 14.9902C6.95362 15.4727 7.65336 15.6808 8.25746 15.5298C8.70991 15.4167 9.18047 15.6313 9.39163 16.0472C9.60278 16.463 9.49846 16.9696 9.14018 17.2681C8.49626 17.8041 7.74425 18.2342 6.99057 18.5911C6.63675 18.7587 6.24134 18.9241 5.8119 19.0697C6.14218 19.1402 6.48586 19.198 6.84078 19.2417C8.61136 19.4594 10.5821 19.3126 12.4249 18.6792C14.2614 18.0479 15.9589 16.9385 17.2289 15.2312C18.497 13.5262 19.382 11.1667 19.5007 7.96291C19.51 7.71067 19.6144 7.47129 19.7929 7.29281C20.2425 6.84316 20.6141 6.32777 20.7969 5.7143C20.477 5.81403 20.1168 5.90035 19.6878 5.98237C19.3623 6.04459 19.0272 5.94156 18.7929 5.70727C18.0284 4.94274 16.5164 4.43998 15.2599 4.77822C14.6686 4.93741 14.1311 5.28203 13.7274 5.89906C13.3153 6.52904 13 7.51045 13 8.9999C13 9.28288 12.8801 9.5526 12.6701 9.74221C12.1721 10.1917 11.334 9.92603 10.7484 9.80845Z" />
</svg>
</a>
<?php } ?>
<?php if (Matecho::$LinkGithub) { ?>
<a href="<?php echo Matecho::$LinkGithub; ?>" target="_blank" class="decoration-none! border-none!">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
<path
d="M4.0744 2.9938C4.13263 1.96371 4.37869 1.51577 5.08432 1.15606C5.84357 0.768899 7.04106 0.949072 8.45014 1.66261C9.05706 1.97009 9.11886 1.97635 10.1825 1.83998C11.5963 1.65865 13.4164 1.65929 14.7213 1.84164C15.7081 1.97954 15.7729 1.97265 16.3813 1.66453C18.3814 0.651679 19.9605 0.71795 20.5323 1.8387C20.8177 2.39812 20.8707 3.84971 20.6494 5.04695C20.5267 5.71069 20.5397 5.79356 20.8353 6.22912C22.915 9.29385 21.4165 14.2616 17.8528 16.1155C17.5801 16.2574 17.3503 16.3452 17.163 16.4167C16.5879 16.6363 16.4133 16.703 16.6247 17.7138C16.7265 18.2 16.8491 19.4088 16.8973 20.4002C16.9844 22.1922 16.9831 22.2047 16.6688 22.5703C16.241 23.0676 15.6244 23.076 15.2066 22.5902C14.9341 22.2734 14.9075 22.1238 14.9075 20.9015C14.9075 19.0952 14.7095 17.8946 14.2417 16.8658C13.6854 15.6415 14.0978 15.185 15.37 14.9114C17.1383 14.531 18.5194 13.4397 19.2892 11.8146C20.0211 10.2698 20.1314 8.13501 18.8082 6.83668C18.4319 6.3895 18.4057 5.98446 18.6744 4.76309C18.7748 4.3066 18.859 3.71768 18.8615 3.45425C18.8653 3.03823 18.8274 2.97541 18.5719 2.97541C18.4102 2.97541 17.7924 3.21062 17.1992 3.49805L16.2524 3.95695C16.1663 3.99866 16.07 4.0147 15.975 4.0038C13.5675 3.72746 11.2799 3.72319 8.86062 4.00488C8.76526 4.01598 8.66853 3.99994 8.58215 3.95802L7.63585 3.49882C7.04259 3.21087 6.42482 2.97541 6.26317 2.97541C5.88941 2.97541 5.88379 3.25135 6.22447 4.89078C6.43258 5.89203 6.57262 6.11513 5.97101 6.91572C5.06925 8.11576 4.844 9.60592 5.32757 11.1716C5.93704 13.1446 7.4295 14.4775 9.52773 14.9222C10.7926 15.1903 11.1232 15.5401 10.6402 16.9905C10.26 18.1319 10.0196 18.4261 9.46707 18.4261C8.72365 18.4261 8.25796 17.7821 8.51424 17.1082C8.62712 16.8112 8.59354 16.7795 7.89711 16.5255C5.77117 15.7504 4.14514 14.0131 3.40172 11.7223C2.82711 9.95184 3.07994 7.64739 4.00175 6.25453C4.31561 5.78028 4.32047 5.74006 4.174 4.83217C4.09113 4.31822 4.04631 3.49103 4.0744 2.9938Z" />
<path
d="M3.33203 15.9454C3.02568 15.4859 2.40481 15.3617 1.94528 15.6681C1.48576 15.9744 1.36158 16.5953 1.66793 17.0548C1.8941 17.3941 2.16467 17.6728 2.39444 17.9025C2.4368 17.9449 2.47796 17.9858 2.51815 18.0257C2.71062 18.2169 2.88056 18.3857 3.05124 18.5861C3.42875 19.0292 3.80536 19.626 4.0194 20.6962C4.11474 21.1729 4.45739 21.4297 4.64725 21.5419C4.85315 21.6635 5.07812 21.7352 5.26325 21.7819C5.64196 21.8774 6.10169 21.927 6.53799 21.9559C7.01695 21.9877 7.53592 21.998 7.99999 22.0008C8.00033 22.5527 8.44791 23.0001 8.99998 23.0001C9.55227 23.0001 9.99998 22.5524 9.99998 22.0001V21.0001C9.99998 20.4478 9.55227 20.0001 8.99998 20.0001C8.90571 20.0001 8.80372 20.0004 8.69569 20.0008C8.10883 20.0026 7.34388 20.0049 6.67018 19.9603C6.34531 19.9388 6.07825 19.9083 5.88241 19.871C5.58083 18.6871 5.09362 17.8994 4.57373 17.2891C4.34391 17.0194 4.10593 16.7834 3.91236 16.5914C3.87612 16.5555 3.84144 16.5211 3.80865 16.4883C3.5853 16.265 3.4392 16.1062 3.33203 15.9454Z" />
</svg>
</a>
<?php } ?>
</div>
</div>
</mdui-card>
</main>
<script type="text/javascript">
!new RegExp("<%= CompatibilityUserAgentRegex %>").test(navigator.userAgent) && (document.body.innerHTML += '<div class="un-br"><h1 class="un-br_sf">{ ᗜ˰ᗜ }</h1> <h1>浏览器不受支持</h1><p>您当前使用的浏览器不受支持,请更新你的浏览器。</p></div>')
</script>
<?php echo Matecho::$ExtraCode; ?>
<?php Matecho::themeCSS();
Matecho::generateJSOptions(); ?>
<?php $this->footer(); ?>
</body>

</html>
15 changes: 12 additions & 3 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ function themeConfig(Form $form): void {
$form->addInput(new Radio("EnableMermaid", [1 => "自动", 0 => "禁用"], 1, "Mermaid", "渲染流程图, 将Mermaid代码包括在mermaid代码块(```mermaid```)中, 即可自动渲染."));
$form->addInput(new Radio("ExSearchIntegration", ["enhanced" => "增强", "normal" => "普通"], "enhanced", "ExSearch即时搜索集成", "ExSearch集成模式, 在普通的状态下使用原版搜索框, 在增强状态下使用主题自带的搜索框."));
$form->addInput(new Text("GlotAccessToken", null, "", "glot.io 访问密钥", "填入后, 可以通过调用glot.io API直接运行代码块中的代码, 详细获取方法请查看文档,"));
$form->addInput(new Text("BeianText", null, "", "备案信息", "显示在页脚版权信息下方"));
$form->addInput(new Text("BeiAnText", null, "", "备案信息", "显示在页脚版权信息下方"));
$form->addInput(new Textarea("ExtraCode", null, "", "页脚HTML代码", "插入统计代码或者额外的插件"));
$form->addInput(new Text("TwitterCardRef", null, "", "X(Twitter) 引用的用户名", "给站点设置twitter:site值, 在Twitter分享此站点的链接时引用到自己的Twitter账号, 例如@KawaiiZapic."));
$form->addInput(new Radio("TwitterCardDefaultStyle", ["summary" => "小图(标题+描述)", "summary_large_image" => "大图(仅标题)"], "summary", "X(Twitter) 链接卡片样式", "设置默认twitter:card值, 在把文章链接分享到Twitter时展示成不同样式, 可为文章单独指定样式."));
$form->addInput(new Text("LinkBilibili", null, "", "哔哩哔哩链接", "哔哩哔哩主页链接, 显示在页脚."));
$form->addInput(new Text("LinkTwitter", null, "", "X(Twitter) 链接", "X(Twitter)主页链接, 显示在页脚."));
$form->addInput(new Text("LinkGithub", null, "", "Github 链接", "Github主页链接, 显示在页脚."));
$form->addInput(new Hidden("ColorSchemeCSS"));
require("settings-header.php");
}
Expand All @@ -39,8 +42,11 @@ function themeInit(Archive $context): void {
exit();
}
$options = Helper::options();
Matecho::$BeianText = $options->BeianText ?? "";
Matecho::$BeiAnText = $options->BeiAnText ?? "";
Matecho::$ExtraCode = $options->ExtraCode ?? "";
Matecho::$LinkBilibili = $options->LinkBilibili ?? "";
Matecho::$LinkTwitter = $options->LinkTwitter ?? "";
Matecho::$LinkGithub = $options->LinkGithub ?? "";
if ($options->ColorSchemeCache && $options->ColorScheme && !file_exists(__DIR__."/assets/color-scheme.css")) {
Matecho::generateThemeCSS();
}
Expand All @@ -61,8 +67,11 @@ function themeFields(\Typecho\Widget\Helper\Layout $layout){
}

class Matecho {
static string $BeianText;
static string $BeiAnText;
static string $ExtraCode;
static string $LinkBilibili;
static string $LinkTwitter;
static string $LinkGithub;

static array $LangExtMap = [
"assembly" => "asm",
Expand Down

0 comments on commit f1478fe

Please sign in to comment.