From 08e6e289626620abd5dea49c0485fa80dc011e79 Mon Sep 17 00:00:00 2001 From: BigCoke233 Date: Wed, 15 Jul 2020 00:18:04 +0800 Subject: =?UTF-8?q?:poop:=20Add:=20=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20hint.css=20=E6=B7=BB=E5=8A=A0=20tooltip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++- about.php | 8 ++-- assets/OwO.json | 8 ++-- assets/css/hint.min.css | 5 +++ assets/css/main/comment.css | 1 - assets/css/main/miracles.min.css | 22 ++++----- assets/css/main/nav.css | 4 +- assets/js/cmt.miracles.js | 4 +- assets/js/miracles.min.js | 16 +++---- functions.php | 3 ++ includes/comments.php | 18 ++++---- includes/footer.php | 13 +++++- includes/head.php | 5 ++- includes/header.php | 41 ++++++++--------- index.php | 2 +- libs/Contents.php | 28 +++++++----- libs/Language.php | 41 +++++++++++++++++ libs/Options.php | 4 ++ libs/Utils.php | 21 ++++----- libs/lang/en-us.php | 80 +++++++++++++++++++++++++++++++++ libs/lang/en.php | 62 -------------------------- libs/lang/moe.php | 62 +++++++++++++++++--------- libs/lang/zh-cn.php | 70 ++++++++++++++++++----------- libs/lang/zh-tw.php | 96 ++++++++++++++++++++++++---------------- pagefile.php | 6 +-- post.php | 18 ++++---- saying.php | 4 +- themeConfig.php | 3 ++ 28 files changed, 398 insertions(+), 256 deletions(-) create mode 100644 assets/css/hint.min.css create mode 100644 libs/Language.php create mode 100644 libs/lang/en-us.php delete mode 100644 libs/lang/en.php diff --git a/README.md b/README.md index a1b976b..da47133 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,11 @@ $ git clone https://github.com/BigCoke233/miracles.git **v20200714A** +- 新增:加入 html 压缩 +- 新增:多语言功能 +- 优化:将 title 改为 hint.css 提供的 tooltip - 修复:删除不必要的判断 +- 修复:自定义随机图失效 @@ -164,13 +168,13 @@ $ git clone https://github.com/BigCoke233/miracles.git - [x] 优化:用 localStorage 替换储存夜间/日落模式等的 cookie - [x] 新增:支持快速写入`
`的短代码,并使用[垫片](https://github.com/javan/details-element-polyfill)优化兼容性 +- [x] 新增:添加语言包功能,通过 php 数组储存各个语言版本的文字 +- [x] 优化:文章缩略图自动剪裁 - [ ] 增加:内置站点缓存规则 - [ ] 优化:「说说页面」的样式 -- [ ] 优化:文章缩略图自动剪裁 - [ ] 新增:图片横向排版「相册功能」(参考:https://blog.imalan.cn/archives/282/) - [ ] 新增:全站加密功能 - [ ] 新增:支持 PWA - 渐进式 Web 应用 -- [ ] 新增:添加语言包功能,通过 php 数组储存各个语言版本的文字 - [ ] 新增:嵌入 GitHub 仓库 / 用户(以卡片形式展示) - [ ] 新增:根据 cid 嵌入本站文章(以卡片形式展示) - [ ] 新增:文章目录 @@ -199,6 +203,7 @@ $ git clone https://github.com/BigCoke233/miracles.git - [qrcode.js](https://github.com/davidshimjs/qrcodejs) - 生成文章二维码 - [gazeimg](https://github.com/ganxiaozhe/gazeimg) - 图片懒加载 & 灯箱 - [details-element-polyfill](https://github.com/javan/details-element-polyfill) - 优化 details 标签兼容性 +- [hint.css](https://kushagra.dev/lab/hint/) - 工具提示 Tooltip - ~~[LazyLoad](https://github.com/tuupola/lazyload) - 图片懒加载~~(开发版已用新的方案替换) - ~~[FancyBox](https://github.com/fancyapps/fancybox) - 文章图片灯箱~~(开发版已用新的方案替换) diff --git a/about.php b/about.php index 0113c0a..e43dfff 100644 --- a/about.php +++ b/about.php @@ -20,16 +20,16 @@ $this->need('includes/header.php');
fields->github==!''): ?> - + fields->qq==!''): ?> - + fields->bilibili==!''): ?> - + fields->email==!''): ?> - +
diff --git a/assets/OwO.json b/assets/OwO.json index 75b4a8c..2b29251 100644 --- a/assets/OwO.json +++ b/assets/OwO.json @@ -1,5 +1,5 @@ { - "颜文字": { + "Emotes": { "type": "emoticon", "container": [{ "icon": "OωO", @@ -87,7 +87,7 @@ "text": "" }] }, - "阿鲁": { + "Aru": { "type": "image", "container": [{ "icon": "", @@ -339,7 +339,7 @@ "text": "中刀" }] }, - "泡泡": { + "Paopao": { "type": "image", "container": [{ "icon": "", @@ -615,7 +615,7 @@ "text": "弱" }] }, - "推特": { + "Twemoji": { "type": "image", "container": [{ "icon": "", diff --git a/assets/css/hint.min.css b/assets/css/hint.min.css new file mode 100644 index 0000000..904b688 --- /dev/null +++ b/assets/css/hint.min.css @@ -0,0 +1,5 @@ +/*! Hint.css - v2.6.0 - 2019-04-27 +* http://kushagragour.in/lab/hint/ +* Copyright (c) 2019 Kushagra Gour */ + +[class*=hint--]{position:relative;display:inline-block;cursor:pointer!important;}[class*=hint--]:after,[class*=hint--]:before{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0s;-moz-transition-delay:0s;transition-delay:0s}[class*=hint--]:hover:after,[class*=hint--]:hover:before{visibility:visible;opacity:1;-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}[class*=hint--]:before{content:'';position:absolute;background:0 0;border:6px solid transparent;z-index:1000001}[class*=hint--]:after{background:#383838;color:#fff;padding:8px 10px;font-size:12px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap;text-shadow:0 -1px 0 #000;box-shadow:4px 4px 8px rgba(0,0,0,.3)}[class*=hint--][data-tooltip]:after{content:attr(data-tooltip)}[class*=hint--][data-hint]:after{content:attr(data-hint)}[data-tooltip='']:after,[data-tooltip='']:before,[data-hint='']:after,[data-hint='']:before{display:none!important}.hint--top-left:before,.hint--top-right:before,.hint--top:before{border-top-color:#383838}.hint--bottom-left:before,.hint--bottom-right:before,.hint--bottom:before{border-bottom-color:#383838}.hint--top:after,.hint--top:before{bottom:100%;left:50%}.hint--top:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--bottom:after,.hint--bottom:before{top:100%;left:50%}.hint--bottom:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translateX(-50%)}.hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--right:before{border-right-color:#383838;margin-left:-11px;margin-bottom:-6px}.hint--right:after{margin-bottom:-14px}.hint--right:after,.hint--right:before{left:100%;bottom:50%}.hint--right:hover:after,.hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--left:before{border-left-color:#383838;margin-right:-11px;margin-bottom:-6px}.hint--left:after{margin-bottom:-14px}.hint--left:after,.hint--left:before{right:100%;bottom:50%}.hint--left:hover:after,.hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--top-left:after,.hint--top-left:before{bottom:100%;left:50%}.hint--top-left:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--top-right:after,.hint--top-right:before{bottom:100%;left:50%}.hint--top-right:before{margin-bottom:-11px;left:calc(50% - 6px)}.hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--top-right:hover:after,.hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--bottom-left:after,.hint--bottom-left:before{top:100%;left:50%}.hint--bottom-left:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translateX(-100%);margin-left:12px}.hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--bottom-right:after,.hint--bottom-right:before{top:100%;left:50%}.hint--bottom-right:before{margin-top:-11px;left:calc(50% - 6px)}.hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translateX(0);margin-left:-12px}.hint--bottom-right:hover:after,.hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--large:after,.hint--medium:after,.hint--small:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.hint--small:after{width:80px}.hint--medium:after{width:150px}.hint--large:after{width:300px}.hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0 #592726}.hint--error.hint--top-left:before,.hint--error.hint--top-right:before,.hint--error.hint--top:before{border-top-color:#b34e4d}.hint--error.hint--bottom-left:before,.hint--error.hint--bottom-right:before,.hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.hint--error.hint--left:before{border-left-color:#b34e4d}.hint--error.hint--right:before{border-right-color:#b34e4d}.hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0 #6c5328}.hint--warning.hint--top-left:before,.hint--warning.hint--top-right:before,.hint--warning.hint--top:before{border-top-color:#c09854}.hint--warning.hint--bottom-left:before,.hint--warning.hint--bottom-right:before,.hint--warning.hint--bottom:before{border-bottom-color:#c09854}.hint--warning.hint--left:before{border-left-color:#c09854}.hint--warning.hint--right:before{border-right-color:#c09854}.hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0 #1a3c4d}.hint--info.hint--top-left:before,.hint--info.hint--top-right:before,.hint--info.hint--top:before{border-top-color:#3986ac}.hint--info.hint--bottom-left:before,.hint--info.hint--bottom-right:before,.hint--info.hint--bottom:before{border-bottom-color:#3986ac}.hint--info.hint--left:before{border-left-color:#3986ac}.hint--info.hint--right:before{border-right-color:#3986ac}.hint--success:after{background-color:#458746;text-shadow:0 -1px 0 #1a321a}.hint--success.hint--top-left:before,.hint--success.hint--top-right:before,.hint--success.hint--top:before{border-top-color:#458746}.hint--success.hint--bottom-left:before,.hint--success.hint--bottom-right:before,.hint--success.hint--bottom:before{border-bottom-color:#458746}.hint--success.hint--left:before{border-left-color:#458746}.hint--success.hint--right:before{border-right-color:#458746}.hint--always:after,.hint--always:before{opacity:1;visibility:visible}.hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translateX(-50%) translateY(-8px)}.hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translateX(-100%) translateY(-8px)}.hint--always.hint--top-right:after,.hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translateX(-50%) translateY(8px)}.hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translateX(-100%) translateY(8px)}.hint--always.hint--bottom-right:after,.hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.hint--always.hint--left:after,.hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translateX(-8px)}.hint--always.hint--right:after,.hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translateX(8px)}.hint--rounded:after{border-radius:4px}.hint--no-animate:after,.hint--no-animate:before{-webkit-transition-duration:0s;-moz-transition-duration:0s;transition-duration:0s}.hint--bounce:after,.hint--bounce:before{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.hint--no-shadow:after,.hint--no-shadow:before{text-shadow:initial;box-shadow:initial} \ No newline at end of file diff --git a/assets/css/main/comment.css b/assets/css/main/comment.css index 16242ff..e1d9901 100644 --- a/assets/css/main/comment.css +++ b/assets/css/main/comment.css @@ -106,7 +106,6 @@ -webkit-box-shadow: 0 0 0 #fff; } .comment-by-author > .comment-body-inner > .comment-main > .comment-meta > .comment-date:before { - content: '博主'; color: gray; font-size: 0.8em; background: rgb(240,240,240); diff --git a/assets/css/main/miracles.min.css b/assets/css/main/miracles.min.css index eb6bc06..14a07d9 100644 --- a/assets/css/main/miracles.min.css +++ b/assets/css/main/miracles.min.css @@ -16,23 +16,23 @@ @import url("special.css"); @import url("themes.css"); +/* iconfont */ +@font-face { + font-family: 'iconfont'; /* project id 1165190 */ + src: url('//at.alicdn.com/t/font_1165190_1djdjjwge4m.eot'); + src: url('//at.alicdn.com/t/font_1165190_1djdjjwge4m.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_1165190_1djdjjwge4m.woff2') format('woff2'), + url('//at.alicdn.com/t/font_1165190_1djdjjwge4m.woff') format('woff'), + url('//at.alicdn.com/t/font_1165190_1djdjjwge4m.ttf') format('truetype'), + url('//at.alicdn.com/t/font_1165190_1djdjjwge4m.svg#iconfont') format('svg'); + } + /* Varriable */ :root { --shadow-color: rgb(190,190,190); scroll-behavior: smooth; /* 平滑滚动 */ } -/* Icon Font */ -@font-face { - font-family: 'iconfont'; /* project id 1165190 */ - src: url('//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.eot'); - src: url('//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.woff2') format('woff2'), - url('//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.woff') format('woff'), - url('//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.ttf') format('truetype'), - url('//at.alicdn.com/t/font_1165190_t5sh6mq8n6i.svg#iconfont') format('svg'); -} - ::selection{ background: rgb(230,230,230); color:black; diff --git a/assets/css/main/nav.css b/assets/css/main/nav.css index 10f764f..eb3db8a 100644 --- a/assets/css/main/nav.css +++ b/assets/css/main/nav.css @@ -234,7 +234,7 @@ width: 45px; border-radius: 100%; background: rgb(246,246,246); - transition: background: 0.2s; + transition: background 0.2s; margin: 0 3px; border: none; outline: none; @@ -333,7 +333,7 @@ padding-top: 5px; background: rgba(0,0,0,0); border: none; - margin-left: -90px; + margin-left: -70px; } .search-close, .search-form button, diff --git a/assets/js/cmt.miracles.js b/assets/js/cmt.miracles.js index f0b2bf6..e3c313a 100644 --- a/assets/js/cmt.miracles.js +++ b/assets/js/cmt.miracles.js @@ -109,7 +109,7 @@ var MiraclesComment = { //禁用按钮 $('#comment-form .comment-submit').attr('disabled', true); $('#comment-form').addClass('comment-sending'); - $('#comment-form .comment-submit').text('提交中...'); + $('#comment-form .comment-submit').text(commentSubmit); }; beforeComment(); @@ -118,7 +118,7 @@ var MiraclesComment = { //取消禁用评论按钮 $('#comment-form .comment-submit').removeAttr('disabled'); $('#comment-form').removeClass('comment-sending'); - $('#comment-form .comment-submit').text('评论'); + $('#comment-form .comment-submit').text(commentSubmitLoading); //判断是否评论成功 if(status) { diff --git a/assets/js/miracles.min.js b/assets/js/miracles.min.js index fa6a6a8..e31feb5 100644 --- a/assets/js/miracles.min.js +++ b/assets/js/miracles.min.js @@ -179,7 +179,7 @@ function highlight() { function owoLoad() { if($(".OwO").length>0){ var OwO_demo = new OwO({ - logo: 'OωO表情', + logo: 'OωO', container: document.getElementsByClassName('OwO')[0], target: document.getElementsByClassName('OwO-textarea')[0], api: owoJson, @@ -411,25 +411,25 @@ function startTime(a) { var time = a; startTimeV = time; var b = new Date().getTime() - new Date(startTimeV); - if (b < 0) return '0 秒'; + if (b < 0) return '0'+footerTimeSec; let result = ''; if (b >= 365 * 86400000) { - result += parseInt(b / (365 * 86400000)) + ' 年 '; + result += parseInt(b / (365 * 86400000)) + footerTimeYear; b = (b % (365 * 86400000)) } if (b >= 86400000) { - result += parseInt(b / 86400000) + ' 天 '; + result += parseInt(b / 86400000) + footerTimeDay; b = (b % 86400000) } if (b >= 3600000) { - result += parseInt(b / 3600000) + ' 小时 '; + result += parseInt(b / 3600000) + footerTimeHour; b = (b % 3600000) } if (b >= 60000) { - result += parseInt(b / 60000) + ' 分 '; + result += parseInt(b / 60000) + footerTimeMin; b = (b % 60000) } - result += parseInt(b / 1000) + ' 秒 '; + result += parseInt(b / 1000) + footerTimeSec; $('#build-time').html(result); buildTimeout = setTimeout('startTime(startTimeV)', 1000) } @@ -530,7 +530,7 @@ if (loadPjax = true) { getWordsNum(); if(navBar.length>0){ navColor(); - } + } })(); diff --git a/functions.php b/functions.php index 8e62dce..e8f5271 100644 --- a/functions.php +++ b/functions.php @@ -8,6 +8,9 @@ require_once("libs/Utils.php"); require_once("libs/Contents.php"); require_once("libs/Comments.php"); require_once("libs/Options.php"); +require_once("libs/Language.php"); +//引入语言文件 +require_once("libs/lang/".$GLOBALS['miraclesLang'].".php"); /** * 注册文章解析 hook diff --git a/includes/comments.php b/includes/comments.php index 7439c90..74cea9c 100644 --- a/includes/comments.php +++ b/includes/comments.php @@ -34,7 +34,7 @@ echo $commentClass; author; ?> status) { ?> - 您的评论正在等待审核! + date('Y-m-d H:i'); ?> @@ -55,7 +55,7 @@ echo $commentClass; fields->commentShow == 0)://如果显示评论列表 ?> have())://如果有评论 则显示 ?>
-

commentsNum(_t('暂无评论'), _t('已有 1 条评论'), _t('已有 %d 条评论')); ?>

+

commentsNum(_t(gt('commentListTexts','commentNumNone')), _t(gta('commentListTexts','commentNum','1')), _t(gta('commentListTexts','commentNum','%d'))); ?>

listComments(array( 'before' => '
', 'after' => '
', @@ -69,7 +69,7 @@ echo $commentClass; - allow('comment')): ?>
博主已关闭本页面的评论显示,您评论后将不会看到您的评论内容
+ allow('comment')): ?>
@@ -81,14 +81,14 @@ echo $commentClass; user->hasLogin()): ?> -

user->screenName(); ?>. »

+

user->screenName(); ?>.

- - options->commentsRequireMail): ?> required /> - options->commentsRequireURL): ?> required /> + + options->commentsRequireMail): ?> required /> + options->commentsRequireURL): ?> required />
@@ -98,13 +98,13 @@ echo $commentClass;

cancelReply(); ?>
- +

-
+
diff --git a/includes/footer.php b/includes/footer.php index 82d39dc..61d9bd4 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -7,7 +7,9 @@
- +
options->favicon):$this->options->favicon();else:echo Utils::indexTheme('favicon.ico');endif; ?>'; var faviconDark = ; + var commentSubmit = ''; + var commentSubmitLoading = ''; + var footerTimeDay = ''; + var footerTimeHour = ''; + var footerTimeMin = ''; + var footerTimeSec = ''; + var footerTimeYear = ''; options->pjax && $this->options->pjax!=0) :?>var loadPjax = true; beforePjax = function() {NProgress.start();}; afterPjax = function() {owoLoad();options->pjax_complete(); ?>}; diff --git a/includes/head.php b/includes/head.php index 41f143d..3a9c475 100644 --- a/includes/head.php +++ b/includes/head.php @@ -45,7 +45,7 @@ if($GLOBALS['miraclesIfCompressHTML']=='on') ob_start(); //ob 截取开始 ?> options->headerEcho(); ?> options->customCDN): $custom=$this->options->customCDN; else: $custom=Helper::options()->themeUrl("","Miracles"); endif; Utils::addRequires($css_files,"css",$this->options->CDN,$custom); ?> @@ -61,6 +61,7 @@ if($GLOBALS['miraclesIfCompressHTML']=='on') ob_start(); //ob 截取开始 ?> endif; ?> - + \ No newline at end of file diff --git a/includes/header.php b/includes/header.php index 1a228c2..2497966 100644 --- a/includes/header.php +++ b/includes/header.php @@ -6,7 +6,7 @@
- +
@@ -14,19 +14,19 @@ @@ -36,7 +36,7 @@
-

页面导航

+

diff --git a/index.php b/index.php index f2de215..b432a4e 100644 --- a/index.php +++ b/index.php @@ -39,7 +39,7 @@ $this->need('includes/header.php'); ?>

-

Read More

+

diff --git a/libs/Contents.php b/libs/Contents.php index bad09a9..da7d321 100644 --- a/libs/Contents.php +++ b/libs/Contents.php @@ -246,17 +246,8 @@ class Contents static private $CurrentTocID = 0; static public function parseHeaderCallback($matchs) { - // 增加单独标记,否则冲突 - $id = $matchs[3]; - $id = str_replace(' ','_',$id); - $id = str_replace('&','_',$id); - $id = str_replace('?','_',$id); - $id = str_replace("'",'_',$id); - $id = str_replace('"','_',$id); - $id = str_replace('’','_',$id); - $id = str_replace('“','_',$id); - $id = str_replace('?','_',$id); - return ''.$matchs[3].''; + $id = trim($matchs[3]); + return ''.$matchs[3].''; } /* == 其他内容 == */ @@ -377,6 +368,19 @@ class Contents Typecho_Cookie::set('extend_contents_views', $views); //记录查看cookie } } - echo $row['views']; + return $row['views']; + } + + /** + * 获取最早文章创建时间 + */ + public static function getOldestPostDate() { + $db = Typecho_Db::get(); + $content = $db->fetchRow($db->select()->from('table.contents') + ->where('table.contents.status = ?', 'publish') + ->where('table.contents.password IS NULL') + ->order('table.contents.created', Typecho_Db::SORT_ASC) + ->limit(1)); + return date('Y-m-d', $content['created']); } } \ No newline at end of file diff --git a/libs/Language.php b/libs/Language.php new file mode 100644 index 0000000..d24ae77 --- /dev/null +++ b/libs/Language.php @@ -0,0 +1,41 @@ +themeFile("lang/*.php")); + if(in_array($GLOBALS['miraclesLang'].'.php', $provided_lang)){ + require_once("lang/"+$GLOBALS['miraclesLang'].".php"); + $GLOBALS['miraclesLangError']=false; + }else{ + require_once("lang/zh-cn.php"); + $GLOBALS['miraclesLangError']=true; + } + } +} + +//快速获取对应语言文本 +function gt($a, $b) { + return $GLOBALS[$a][$b]; +} +function gtecho($a, $b) { + echo $GLOBALS[$a][$b]; +} +//有参数的文本获取 +function gta($a, $b, $c) { + $content = str_replace('%s', $c, $GLOBALS[$a][$b]); + return $content; +} +function gtaecho($a, $b, $c) { + $content = str_replace('%s', $c, $GLOBALS[$a][$b]); + echo $content; +} \ No newline at end of file diff --git a/libs/Options.php b/libs/Options.php index 0e3d31c..96721cd 100755 --- a/libs/Options.php +++ b/libs/Options.php @@ -1,6 +1,10 @@ fetchRow($db->select()->from('table.contents') - ->where('table.contents.status = ?', 'publish') - ->where('table.contents.password IS NULL') - ->order('table.contents.created', Typecho_Db::SORT_ASC) - ->limit(1)); - echo '一切开始于 '.date('Y-m-d', $content['created']); - } - /** * 缩略图 */ diff --git a/libs/lang/en-us.php b/libs/lang/en-us.php new file mode 100644 index 0000000..acd637a --- /dev/null +++ b/libs/lang/en-us.php @@ -0,0 +1,80 @@ + "English", + "author" => "Eltrac", + "last_update" => "2020\/5\/3" +); +$GLOBALS['postTexts'] = array( + "read_more" => "Read More", + "sort_title" => "Category: %s", + "post_time" => "Published on %s", + "post_views" => "Viewd by %s people", + "post_anchor" => "Paragraph Link", + "post_share" => "Share by: ", + "post_tag" => "None.", + "post_timeAlert_1" => "This articles is published %s days ago and ", + "post_timeAlert_2" => "last updated %s days ago, some information may be out of date." +); +$GLOBALS['commentFormTexts'] = array( + "nameInput" => "Name*", + "emailInput" => "Email*", + "urlInput" => "http(s):\/\/", + "submit" => "Comment", + "submitLoading" => "Posting..." +); +$GLOBALS['commentListTexts'] = array( + "byAuthor" => "Author", + "commentNum" => "There're %s comments", + "commentNumNone" => "Not any comments", + "commentHidden" => "The author has hidden the comment list, you won't see your comment, either.", + "commentClosed" => "The author has turned the comment function off.", + "commentWaiting" => "Your comment is awaiting moderation!", + "commentStatus" => "Hello, ", + "commentLogout" => "Sign out" +); +$GLOBALS['footerTexts'] = array( + "startTime" => "The site has built for", + "startTimeDay" => " days ", + "startTimeHour" => "h ", + "startTimeMin" => "min ", + "startTimeSec" => "s ", + "startTimeYear" => " years " +); +$GLOBALS['headerTexts'] = array( + "loginAlready" => "You've already loged in", + "loginAlreadyInfo" => "But still nice to see you, %s~", + "loginAdminEntrance" => "Enter the Dashboard", + "loginTitle" => "Login", + "loginUsername" => "Username", + "loginPassword" => "Password", + "loginSubmit" => "login", + "navTitle" => "Navigation", + "drawerHome" => "Home" +); +$GLOBALS['archivePageTexts'] = array( + "archiveTagTitle" => "Tags", + "archivePostTitle" => "Posts", + "archiveTimeYear" => "", + "archiveYearTotal" => "%s articles in total", + "archiveStart" => "Everything started on %s" +); +$GLOBALS['archivesTitles'] = array( + 'category' => _t('Posts with category %s'), + 'search' => _t('Posts with keyword %s'), + 'tag' => _t('Posts with tag %s'), + 'author' => _t('Posts by %s') +); +$GLOBALS['aboutPageTexts'] = array( + "aboutShareGithub" => "GitHub", + "aboutShareQQ" => "QQ", + "aboutShareB" => "Bilibili", + "aboutShareEmail" => "E-mail" +); +$GLOBALS['sayingPageTexts'] = array( + "sayingPlaceholder" => "Anything interesting happening?", + "sayingSubmit" => "Publish" +); +$GLOBALS['otherTexts'] = array( + "copyrightAlert" => "The article is original if not stated, please credit the original author.", + "goTop" => "Go Top" +); \ No newline at end of file diff --git a/libs/lang/en.php b/libs/lang/en.php deleted file mode 100644 index b86de3c..0000000 --- a/libs/lang/en.php +++ /dev/null @@ -1,62 +0,0 @@ - "English", - "author" => "Eltrac", - "last_update" => "2020\/5\/3" -); -$postTexts = array( - "read_more" => "Read More", - "sort_title" => "Category", - "post_time" => "Published on %s", - "post_views" => "Viewd %s times", - "post_anchor" => "Paragraph Link", - "post_share" => "Share to %s", - "post_tag" => "None." -); -$commentFormTexts = array( - "nameInput" => "Name*", - "emailInput" => "Email*", - "urlInput" => "http(s):\/\/", - "submit" => "Comment", - "submitLoading" => "Posting..." -); -$commentListTexts = array( - "byAuthor" => "Author", - "commentNum" => "There're %s comments", - "commentNumNone" => "Not any comments", - "commentHidden" => "The author has hidden the comment list, you won't see your comment, either.", - "commentClosed" => "The author has turned the comment function off.", - "commentWaiting" => "Your comment is awaiting moderation!" -); -$footerTexts = array( - "startTime" => "The site has built for %s", - "startTimeDay" => "%s days", - "startTimeHour" => "%s h", - "startTimeMin" => "%s min", - "startTimeSec" => "%s s" -); -$headerTexts = array( - "loginAlready" => "You've already loged in", - "loginAlreadyInfo" => "But still nice to see you, %s~", - "loginAdminEntrance" => "Enter the Dashboard", - "loginTitle" => "Login", - "loginUsername" => "Username", - "loginPassword" => "Password", - "loginSubmit" => "login" -); -$archivePageTexts = array( - "archiveTagTitle" => "Tags", - "archivePostTitle" => "Posts", - "archiveTimeYear" => "%s" -); -$aboutPageTexts = array( - "aboutShareGithub" => "GitHub", - "aboutShareQQ" => "QQ", - "aboutShareB" => "Bilibili", - "aboutShareEmail" => "E-mail" -); -$sayingPageTexts = array( - "sayingPlaceholder" => "Anything interesting happening?", - "sayingSubmit" => "Publish" -); -?> \ No newline at end of file diff --git a/libs/lang/moe.php b/libs/lang/moe.php index e02a582..b7aee4c 100644 --- a/libs/lang/moe.php +++ b/libs/lang/moe.php @@ -1,22 +1,24 @@ "萌语", "author" => "Eltrac", "last_update" => "2020\/5\/3" ); //文章 -$postTexts = array( +$GLOBALS['postTexts'] = array( "read_more" => "戳进去康", - "sort_title" => "垃圾分类", + "sort_title" => "垃圾分类:这是 %s 垃圾", "post_time" => "在 %s 的时候粗生的", "post_views" => "被偷窥 %s 次惹", "post_anchor" => "戳我!戳我!", - "post_share" => "种草给 %s", - "post_tag" => "这个人好懒哦,连标签都不写的" + "post_share" => "种草给:", + "post_tag" => "这个人好懒哦,连标签都不写的", + "post_timeAlert_1" => "这篇文是在 %s 天前水的,", + "post_timeAlert_2" => "憨憨作者 %s 天前改了下,估计不能看了。" ); //评论表单 -$commentFormTexts = array( +$GLOBALS['commentFormTexts'] = array( "nameInput" => "你叫啥名啊*", "emailInput" => "你的邮箱在哪哇*", "urlInput" => "http(s):\/\/", @@ -24,48 +26,66 @@ $commentFormTexts = array( "submitLoading" => "在发了在发了" ); //评论列表 -$commentListTexts = array( +$GLOBALS['commentListTexts'] = array( "byAuthor" => "傻子", "commentNum" => "%s 条咸鱼躺在这", "commentNumNone" => "连一条咸鱼都没有", "commentHidden" => "评论列表被博主吃了!你看不到评论了!", "commentClosed" => "评论功能被博主吃了!你不能评论了!", - "commentWaiting" => "博主正在检查你有没有 ghs" + "commentWaiting" => "博主正在检查你有没有 ghs", + "commentStatus" => "你素 ", + "commentLogout" => "我不做人了!" ); //页脚 -$footerTexts = array( - "startTime" => "苟延残喘了 %s", - "startTimeDay" => "%s 天", - "startTimeHour" => "%s 小时", - "startTimeMin" => "%s 分", - "startTimeSec" => "%s 秒" +$GLOBALS['footerTexts'] = array( + "startTime" => "苟延残喘了", + "startTimeDay" => " 天 ", + "startTimeHour" => " 小时 ", + "startTimeMin" => " 分 ", + "startTimeSec" => " 秒 ", + "startTimeYear" => " 年 " ); //页眉 -$headerTexts = array( +$GLOBALS['headerTexts'] = array( "loginAlready" => "登陆了,快爪巴", "loginAlreadyInfo" => "你素 %s!奶思吐蜜特由", "loginAdminEntrance" => "去后宫", "loginTitle" => "快点进来", "loginUsername" => "你哒名字", "loginPassword" => "密码!我不会看的 qwq", - "loginSubmit" => "爪巴进去" + "loginSubmit" => "爪巴进去", + "navTitle" => "要去哪里", + "drawerHome" => "回家" ); //归档页面 -$archivePageTexts = array( +$GLOBALS['archivePageTexts'] = array( "archiveTagTitle" => "博主贴的标签", "archivePostTitle" => "博主写的水文", - "archiveTimeYear" => "%s 年的水" + "archiveTimeYear" => "年的水", + "archiveYearTotal" => "这年水了 %s 篇文", + "archiveStart" => "从 %s 开始水文" +); +//检索 +$GLOBALS['archivesTitles'] = array( + 'category' => _t('分类 %s 下的水文'), + 'search' => _t('搜 %s 粗来的水文'), + 'tag' => _t('标签 %s 下的水文'), + 'author' => _t('%s 这个憨憨水的文章') ); //关于页面 -$aboutPageTexts = array( +$GLOBALS['aboutPageTexts'] = array( "aboutShareGithub" => "GayHub", "aboutShareQQ" => "疼讯扣扣", "aboutShareB" => "某破站", "aboutShareEmail" => "是邮箱呢!" ); //说说页面 -$sayingPageTexts = array( +$GLOBALS['sayingPageTexts'] = array( "sayingPlaceholder" => "嘤嘤嘤 QAQ", "sayingSubmit" => "发粗去" ); -?> \ No newline at end of file +//其他 +$GLOBALS['otherTexts'] = array( + "copyrightAlert" => "呐呐呐,没有说的话这篇文就是我写的,转载请注明我的名字鸭", + "goTop" => "爬到上面" +); \ No newline at end of file diff --git a/libs/lang/zh-cn.php b/libs/lang/zh-cn.php index 29bc2d1..c0b3cd1 100644 --- a/libs/lang/zh-cn.php +++ b/libs/lang/zh-cn.php @@ -1,22 +1,24 @@ "简体中文", "author" => "Eltrac", - "last_update" => "2020\/5\/3" + "last_update" => "2020\/7\/14" ); //文章 -$postTexts = array( +$GLOBALS['postTexts'] = array( "read_more" => "阅读全文", - "sort_title" => "文章分类", + "sort_title" => "文章分类:%s", "post_time" => "该文章发布于 %s", "post_views" => "该文章被浏览 %s 次", "post_anchor" => "章节链接", - "post_share" => "分享至 %s", - "post_tag" => "这人还没有写标签哦~" + "post_share" => "分享至:", + "post_tag" => "这人还没有写标签哦~", + "post_timeAlert_1" => "本文编写于 %s 天前,", + "post_timeAlert_2" => "最后修改于 %s 天前,其中某些信息可能已经过时。" ); //评论表单 -$commentFormTexts = array( +$GLOBALS['commentFormTexts'] = array( "nameInput" => "称呼*", "emailInput" => "邮箱*", "urlInput" => "http(s):\/\/", @@ -24,48 +26,66 @@ $commentFormTexts = array( "submitLoading" => "提交中..." ); //评论列表 -$commentListTexts = array( +$GLOBALS['commentListTexts'] = array( "byAuthor" => "博主", "commentNum" => "已有 %s 条评论", "commentNumNone" => "暂无评论", "commentHidden" => "博主已关闭本页面的评论显示,您评论后将不会看到您的评论内容", "commentClosed" => "博主已关闭本页面的评论功能", - "commentWaiting" => "您的评论正在等待审核!" + "commentWaiting" => "您的评论正在等待审核!", + "commentStatus" => "登陆身份:", + "commentLogout" => "登出" ); //页脚 -$footerTexts = array( - "startTime" => "记录已延续了 %s", - "startTimeDay" => "%s 天", - "startTimeHour" => "%s 小时", - "startTimeMin" => "%s 分", - "startTimeSec" => "%s 秒" +$GLOBALS['footerTexts'] = array( + "startTime" => "记录已延续了", + "startTimeDay" => " 天 ", + "startTimeHour" => " 小时 ", + "startTimeMin" => " 分 ", + "startTimeSec" => " 秒 ", + "startTimeYear" => " 年 " ); //页眉 -$headerTexts = array( +$GLOBALS['headerTexts'] = array( "loginAlready" => "你已经登陆了", "loginAlreadyInfo" => "不过康纳很乐意再次见到 %s 呢~", "loginAdminEntrance" => "进入后台", "loginTitle" => "登录后台", "loginUsername" => "请输入用户名", "loginPassword" => "请输入密码", - "loginSubmit" => "登录" + "loginSubmit" => "登录", + "navTitle" => "页面导航", + "drawerHome" => "首页" ); //归档页面 -$archivePageTexts = array( +$GLOBALS['archivePageTexts'] = array( "archiveTagTitle" => "文章标签", "archivePostTitle" => "文章归档", - "archiveTimeYear" => "%s 年" + "archiveTimeYear" => "年", + "archiveYearTotal" => "共 %s 篇文章", + "archiveStart" => "一切开始于 %s" +); +//检索 +$GLOBALS['archivesTitles'] = array( + 'category' => _t('分类 %s 下的文章'), + 'search' => _t('包含关键字 %s 的文章'), + 'tag' => _t('标签 %s 下的文章'), + 'author' => _t('%s 发布的文章') ); //关于页面 -$aboutPageTexts = array( +$GLOBALS['aboutPageTexts'] = array( "aboutShareGithub" => "GitHub", "aboutShareQQ" => "QQ", - "aboutShareB" => "Bilibili", - "aboutShareEmail" => "E-mail" + "aboutShareB" => "哔哩哔哩", + "aboutShareEmail" => "电子邮件" ); //说说页面 -$sayingPageTexts = array( - "sayingPlaceholder" => "Anything interesting happening?", +$GLOBALS['sayingPageTexts'] = array( + "sayingPlaceholder" => "有什么有趣的事情吗?", "sayingSubmit" => "发表新鲜事" ); -?> \ No newline at end of file +//其他 +$GLOBALS['otherTexts'] = array( + "copyrightAlert" => "文章未声明即为原创,请注明原作者", + "goTop" => "返回顶部" +); \ No newline at end of file diff --git a/libs/lang/zh-tw.php b/libs/lang/zh-tw.php index fb4c29d..994a413 100644 --- a/libs/lang/zh-tw.php +++ b/libs/lang/zh-tw.php @@ -1,71 +1,91 @@ "簡體中文", +//語言包信息 +$GLOBALS['langInfo'] = array( + "name" => "簡體中文", "author" => "Eltrac", "last_update" => "2020\/5\/3" ); -// 文章 -$postTexts = array( -    "read_more" => "閱讀全文", - "sort_title" => "文章分類", +//文章 +$GLOBALS['postTexts'] = array( + "read_more" => "閱讀全文", + "sort_title" => "文章分類:%s", "post_time" => "該文章發佈於 %s", "post_views" => "該文章被瀏覽 %s 次", "post_anchor" => "章節鏈接", - "post_share" => "分享至 %s", - "post_tag" => "這人還沒有寫標籤哦~" + "post_share" => "分享至:", + "post_tag" => "這人還沒有寫標籤哦~", + "post_timeAlert_1" => "本文編寫於 %s 天前,", + "post_timeAlert_2" => "最後修改於 %s 天前,其中某些信息可能已經過時。" ); -// 評論表單 -$commentFormTexts = array( -    "nameInput" => "稱呼 *", +//評論表單 +$GLOBALS['commentFormTexts'] = array( + "nameInput" => "稱呼 *", "emailInput" => "郵箱 *", "urlInput" => "http(s):\/\/", "submit" => "評論", "submitLoading" => "提交中..." ); -// 評論列表 -$commentListTexts = array( -    "byAuthor" => "博主", +//評論列表 +$GLOBALS['commentListTexts'] = array( + "byAuthor" => "博主", "commentNum" => "已有 %s 條評論", "commentNumNone" => "暫無評論", "commentHidden" => "博主已關閉本頁面的評論顯示,您評論後將不會看到您的評論內容", "commentClosed" => "博主已關閉本頁面的評論功能", - "commentWaiting" => "您的評論正在等待審核!" + "commentWaiting" => "您的評論正在等待審核!", + "commentStatus" => "登陸身份:", + "commentLogout" => "登出" ); -// 頁腳 -$footerTexts = array( -    "startTime" => "記錄已延續了 %s", - "startTimeDay" => "%s 天", - "startTimeHour" => "%s 小時", - "startTimeMin" => "%s 分", - "startTimeSec" => "%s 秒" +//頁腳 +$GLOBALS['footerTexts'] = array( + "startTime" => "記錄已延續了", + "startTimeDay" => " 天 ", + "startTimeHour" => " 小時 ", + "startTimeMin" => " 分 ", + "startTimeSec" => " 秒 ", + "startTimeYear" => " 年 " ); -// 頁眉 -$headerTexts = array( -    "loginAlready" => "你已經登陸了", +//頁眉 +$GLOBALS['headerTexts'] = array( + "loginAlready" => "你已經登陸了", "loginAlreadyInfo" => "不過康納很樂意再次見到 %s 呢~", "loginAdminEntrance" => "進入後台", "loginTitle" => "登錄後台", "loginUsername" => "請輸入用戶名", "loginPassword" => "請輸入密碼", - "loginSubmit" => "登錄" + "loginSubmit" => "登錄", + "navTitle" => "頁面導航", + "drawerHome" => "首頁" ); -// 歸檔頁面 -$archivePageTexts = array( -    "archiveTagTitle" => "文章標籤", +//歸檔頁面 +$GLOBALS['archivePageTexts'] = array( + "archiveTagTitle" => "文章標籤", "archivePostTitle" => "文章歸檔", - "archiveTimeYear" => "%s 年" + "archiveTimeYear" => "年", + "archiveYearTotal" => "共 %s 篇文章", + "archiveStart" => "壹切開始於 %s" ); -// 關於頁面 -$aboutPageTexts = array( -    "aboutShareGithub" => "GitHub", +//检索 +$GLOBALS['archivesTitles'] = array( + 'category' => _t('分類 %s 下的文章'), + 'search' => _t('包含關鍵字 %s 的文章'), + 'tag' => _t('標簽 %s 下的文章'), + 'author' => _t('%s 發布的文章') +); +//關於頁面 +$GLOBALS['aboutPageTexts'] = array( + "aboutShareGithub" => "GitHub", "aboutShareQQ" => "QQ", "aboutShareB" => "Bilibili", "aboutShareEmail" => "E-mail" ); -// 說說頁面 -$sayingPageTexts = array( -    "sayingPlaceholder" => "Anything interesting happening?", +//說說頁面 +$GLOBALS['sayingPageTexts'] = array( + "sayingPlaceholder" => "Anything interesting happening?", "sayingSubmit" => "發表新鮮事" ); -?> \ No newline at end of file +//其他 +$GLOBALS['otherTexts'] = array( + "copyrightAlert" => "文章未聲明即為原創,請註明原作者", + "goTop" => "返回頂部" +); \ No newline at end of file diff --git a/pagefile.php b/pagefile.php index a24d2bb..d444708 100644 --- a/pagefile.php +++ b/pagefile.php @@ -13,7 +13,7 @@ $this->need('includes/header.php');
widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags); ?> -

文章标签

+

have()): ?>
    next()): ?> @@ -22,14 +22,14 @@ $this->need('includes/header.php');

-

文章归档

+