diff options
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | about.php | 8 | ||||
| -rw-r--r-- | assets/OwO.json | 8 | ||||
| -rw-r--r-- | assets/css/hint.min.css | 5 | ||||
| -rw-r--r-- | assets/css/main/comment.css | 1 | ||||
| -rw-r--r-- | assets/css/main/miracles.min.css | 22 | ||||
| -rw-r--r-- | assets/css/main/nav.css | 4 | ||||
| -rw-r--r-- | assets/js/cmt.miracles.js | 4 | ||||
| -rw-r--r-- | assets/js/miracles.min.js | 16 | ||||
| -rw-r--r-- | functions.php | 3 | ||||
| -rw-r--r-- | includes/comments.php | 18 | ||||
| -rw-r--r-- | includes/footer.php | 13 | ||||
| -rw-r--r-- | includes/head.php | 5 | ||||
| -rw-r--r-- | includes/header.php | 41 | ||||
| -rw-r--r-- | index.php | 2 | ||||
| -rw-r--r-- | libs/Contents.php | 28 | ||||
| -rw-r--r-- | libs/Language.php | 41 | ||||
| -rwxr-xr-x | libs/Options.php | 4 | ||||
| -rw-r--r-- | libs/Utils.php | 21 | ||||
| -rw-r--r-- | libs/lang/en-us.php | 80 | ||||
| -rw-r--r-- | libs/lang/en.php | 62 | ||||
| -rw-r--r-- | libs/lang/moe.php | 62 | ||||
| -rw-r--r-- | libs/lang/zh-cn.php | 70 | ||||
| -rw-r--r-- | libs/lang/zh-tw.php | 96 | ||||
| -rw-r--r-- | pagefile.php | 6 | ||||
| -rw-r--r-- | post.php | 18 | ||||
| -rw-r--r-- | saying.php | 4 | ||||
| -rw-r--r-- | themeConfig.php | 3 |
28 files changed, 398 insertions, 256 deletions
@@ -156,7 +156,11 @@ $ git clone https://github.com/BigCoke233/miracles.git **v20200714A** +- 新增:加入 html 压缩 +- 新增:多语言功能 +- 优化:将 title 改为 hint.css 提供的 tooltip - 修复:删除不必要的判断 +- 修复:自定义随机图失效 </details> @@ -164,13 +168,13 @@ $ git clone https://github.com/BigCoke233/miracles.git - [x] 优化:用 localStorage 替换储存夜间/日落模式等的 cookie - [x] 新增:支持快速写入`<details>`的短代码,并使用[垫片](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) - 文章图片灯箱~~(开发版已用新的方案替换) @@ -20,16 +20,16 @@ $this->need('includes/header.php'); </div>
<div class="about-social"><!-- 社交按钮 -->
<?php if($this->fields->github==!''): ?>
- <a href="https://github.com/<?php echo $this->fields->github(); ?>" target="_blank" title="GayHub"><i class="iconfont icon-github"></i></a>
+ <a href="https://github.com/<?php echo $this->fields->github(); ?>" target="_blank" title="<?php gtecho('aboutPageTexts','aboutShareGitHub'); ?>"><i class="iconfont icon-github"></i></a>
<?php endif; ?>
<?php if($this->fields->qq==!''): ?>
- <a href="tencent://Message/?Uin=<?php echo $this->fields->qq(); ?>&websiteName=q-zone.qq.com&Menu=yes" target="_blank" title="QQ"><i class="iconfont icon-qq1"></i></a>
+ <a href="tencent://Message/?Uin=<?php echo $this->fields->qq(); ?>&websiteName=q-zone.qq.com&Menu=yes" target="_blank" title="<?php gtecho('aboutPageTexts','aboutShareQQ'); ?>"><i class="iconfont icon-qq1"></i></a>
<?php endif; ?>
<?php if($this->fields->bilibili==!''): ?>
- <a href="https://space.bilibili.com/<?php echo $this->fields->bilibili(); ?>" target="_blank" title="Bilibili"><i class="iconfont icon-bilibili-"></i></a>
+ <a href="https://space.bilibili.com/<?php echo $this->fields->bilibili(); ?>" target="_blank" title="<?php gtecho('aboutPageTexts','aboutShareB'); ?>"><i class="iconfont icon-bilibili-"></i></a>
<?php endif; ?>
<?php if($this->fields->email==!''): ?>
- <a href="mailto:<?php echo $this->fields->email(); ?>"><i class="iconfont icon-mail_fill" target="_blank" title="email"></i></a>
+ <a href="mailto:<?php echo $this->fields->email(); ?>"><i class="iconfont icon-mail_fill" target="_blank" title="<?php gtecho('aboutPageTexts','aboutShareEmail'); ?>"></i></a>
<?php endif; ?>
</div>
</div>
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": "<img class=\"biaoqing\" data-src=\"/usr/themes/Miracles/images/biaoqing/aru/E9AB98E585B4_2x.png\">", @@ -339,7 +339,7 @@ "text": "中刀" }] }, - "泡泡": { + "Paopao": { "type": "image", "container": [{ "icon": "<img class=\"biaoqing\" data-src=\"/usr/themes/Miracles/images/biaoqing/paopao/E591B5E591B5_2x.png\">", @@ -615,7 +615,7 @@ "text": "弱" }] }, - "推特": { + "Twemoji": { "type": "image", "container": [{ "icon": "<img class=\"biaoqing\" data-src=\"/usr/themes/Miracles/images/biaoqing/twemoji/angry.png\">", 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; <span class="comment-author"><a href="<?php echo $comments->url; ?>" target="_blank"><?php echo $comments->author; ?></a></span>
<span class="comment-date">
<?php if ('waiting' == $comments->status) { ?>
- <em class="comment-waiting">您的评论正在等待审核!</em>
+ <em class="comment-waiting"><?php gtecho('commentListTexts','commentWaiting'); ?></em>
<?php } else { ?>
<?php $comments->date('Y-m-d H:i'); ?>
<?php } ?>
@@ -55,7 +55,7 @@ echo $commentClass; <?php if($this->fields->commentShow == 0)://如果显示评论列表 ?>
<?php if ($comments->have())://如果有评论 则显示 ?>
<div class="comment-container" id="comments">
- <h3 class="comment-title" id="response"><?php $this->commentsNum(_t('暂无评论'), _t('已有 1 条评论'), _t('已有 %d 条评论')); ?></h3>
+ <h3 class="comment-title" id="response"><?php $this->commentsNum(_t(gt('commentListTexts','commentNumNone')), _t(gta('commentListTexts','commentNum','1')), _t(gta('commentListTexts','commentNum','%d'))); ?></h3>
<?php $comments->listComments(array(
'before' => '<div class="comment-list" role="list">',
'after' => '</div>',
@@ -69,7 +69,7 @@ echo $commentClass; <?php endif;//有无评论判断结束?>
<?php else: //如果不显示评论列表 ?>
- <?php if($this->allow('comment')): ?><div class="comment-hidden">博主已关闭本页面的评论显示,您评论后将不会看到您的评论内容</div><?php endif; ?>
+ <?php if($this->allow('comment')): ?><div class="comment-hidden"><?php gtecho('commentListTexts','commentHidden'); ?></div><?php endif; ?>
<?php endif;//是否显示判断结束 ?>
<div class="comment-form">
@@ -81,14 +81,14 @@ echo $commentClass; <!-- 如果当前用户已经登录 -->
<?php if($this->user->hasLogin()): ?>
<!-- 显示当前登录用户的用户名以及登出连接 -->
- <p class="col-md-12 comment-logined-sign"><?php _e('登录身份: '); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> »</a></p>
+ <p class="col-md-12 comment-logined-sign"><?php gtecho('commentListTexts','commentStatus'); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php gtecho('commentListTexts','commentLogout'); ?></a></p>
<!-- 若当前用户未登录 -->
<?php else: ?>
<!-- 要求输入名字、邮箱、网址 -->
<div class="comment-input">
- <input type="text" name="author" id="author" class="text" placeholder="称呼*" value="<?php $this->remember('author'); ?>" required />
- <input type="email" name="mail" id="mail" class="text" placeholder="邮箱*" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
- <input type="url" name="url" id="url" class="text" placeholder="<?php _e('http(s)://'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
+ <input type="text" name="author" id="author" class="text" placeholder="<?php gtecho('commentFormTexts','nameInput'); ?>" value="<?php $this->remember('author'); ?>" required />
+ <input type="email" name="mail" id="mail" class="text" placeholder="<?php gtecho('commentFormTexts','emailInput'); ?>" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
+ <input type="url" name="url" id="url" class="text" placeholder="<?php gtecho('commentFormTexts','urlInput'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
</div>
<?php endif; ?>
<!-- 输入要回复的内容 -->
@@ -98,13 +98,13 @@ echo $commentClass; <p class="comment-submit-box">
<div title="OwO" class="OwO"></div>
<div class="cancel-comment-reply"><?php $comments->cancelReply(); ?></div>
- <button type="submit" onclick="return MiraclesComment.submitComment();" class="comment-submit submit"><?php _e('评论'); ?></button>
+ <button type="submit" onclick="return MiraclesComment.submitComment();" class="comment-submit submit"><?php gtecho('commentFormTexts','submit'); ?></button>
</p>
</form>
</div>
<!-- 若当前文章不允许进行评论 -->
<?php else: ?>
- <div class="comment-hidden"><?php _e('博主已关闭本页面的评论功能'); ?></div>
+ <div class="comment-hidden"><?php gtecho('commentListTexts','commentClosed'); ?></div>
<?php endif; ?>
</div>
</div>
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 @@ <p class="copyright"><span id="copyright">Powered by <a href="http://typecho.org">Typecho</a> | Theme <a href="https://github.com/BigCoke233/miracles" id="copyright-name">Miracles</a> by <a href="https://guhub.cn" id="copyright-author">Eltrac</a></span><br> Copyright © <?php echo date('Y'); ?> <a href="<?php $this->options->SiteUrl(); ?>"><?php $this->options->title(); ?></a>, All rights reserved.<br> <?php - echo $this->options->build_time?"记录已延续了 <span id=\"build-time\"></span>":""; + echo $this->options->build_time; + gtecho('footerTexts','startTime'); + echo " <span id=\"build-time\"></span>"; if($faces=$this->options->anime_face){ $faces = explode("&&",$faces); $faces = "<span class=\"anime-face\">".$faces[mt_rand(0,count($faces)-1)]."</span>"; @@ -18,7 +20,7 @@ </footer> <!-- Raised Buttons --> <div class="fixed-tools"> - <button title="返回顶部" class="fixed-button gotop-button" id="gotop"><i class="iconfont icon-chevron-up"></i></button> + <button class="fixed-button gotop-button hint--top" data-tooltip="<?php gtecho("otherTexts","goTop"); ?>" id="gotop"><i class="iconfont icon-chevron-up"></i></button> </div> <!-- JavaScript Require--> <?php @@ -35,6 +37,13 @@ var faviconUrl = '<?php if($this->options->favicon):$this->options->favicon();else:echo Utils::indexTheme('favicon.ico');endif; ?>'; var faviconDark = <?php $faviconDarkExist = file_exists('/faviconDark.ico'); if($faviconDarkExist=true): echo 'true'; else: echo 'false'; endif; ?>; + var commentSubmit = '<?php gtecho('commentFormTexts','submitLoading'); ?>'; + var commentSubmitLoading = '<?php gtecho('commentFormTexts','submit'); ?>'; + var footerTimeDay = '<?php gtecho('footerTexts','startTimeDay'); ?>'; + var footerTimeHour = '<?php gtecho('footerTexts','startTimeHour'); ?>'; + var footerTimeMin = '<?php gtecho('footerTexts','startTimeMin'); ?>'; + var footerTimeSec = '<?php gtecho('footerTexts','startTimeSec'); ?>'; + var footerTimeYear = '<?php gtecho('footerTexts','startTimeYear'); ?>'; <?php if($this->options->pjax && $this->options->pjax!=0) :?>var loadPjax = true; beforePjax = function() {NProgress.start();}; afterPjax = function() {owoLoad();<?php $this->options->pjax_complete(); ?>};<?php endif; ?></script><!--</nocompress>--> 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 截取开始 ?> <?php $this->options->headerEcho(); ?> <!-- css --> <?php - $css_files=array("codestyle","owo.min","nprogress","gazeimg","main/miracles.min"); + $css_files=array("codestyle","owo.min","nprogress","gazeimg","hint.min","main/miracles.min"); if($this->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; ?> <!-- Font CDN --> <link href="<?php echo $theme_font_url; ?>" rel="stylesheet"> - <?php endif; ?><style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat}<?php $this->options->cssEcho(); ?></style> + <?php endif; ?><style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat} + .comment-by-author > .comment-body-inner > .comment-main > .comment-meta > .comment-date:before {content: '<?php gtecho('commentListTexts','byAuthor'); ?>'!important}<?php $this->options->cssEcho(); ?></style> </head> <body class="<?php if($this->options->bodyFonts && $this->options->bodyFonts=1): ?>body-serif<?php 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 @@ <form method="post" action=""> <div class="search-form"> <input type="text" name="s" class="text" size="32" /> - <button type="submit" class="submit">搜索</button> + <button type="submit" class="submit"><i class="iconfont" style="font-size:30px"></i></button> </div> </form> </div> @@ -14,19 +14,19 @@ <div class="login ready"> <button class="login-close ready" id="login-close"><i class="iconfont icon-x"></i></button> <?php if($this->user->hasLogin()): ?> - <h1>你已经登陆了</h1> - <p class="large-screen" style="margin-top:0"> 不过康纳很乐意再次见到 <?php $this->user->screenName(); ?> 呢~</p> - <p class="login-enter-admin"><a href="/admin" class="col-md-3">进入后台</a></p> + <h1><?php gtecho('headerTexts','loginAlready'); ?></h1> + <p class="large-screen" style="margin-top:0"> <?php gtaecho('headerTexts','loginAlreadyInfo',$this->user->screenName); ?></p> + <p class="login-enter-admin"><a href="/admin" class="col-md-3"><?php gtecho('headerTexts','loginAdminEntrance');?></a></p> <?php else: ?> <form action="<?php $this->options->loginAction(); ?>" id="login-form" method="post" name="login" role="form" class="login-form"> - <h1>登录后台</h1> - <input type="text" name="name" autocomplete="username" placeholder="请输入用户名" required /> - <input type="password" name="password" autocomplete="current-password" placeholder="请输入密码" required /> + <h1><?php gtecho('headerTexts','loginTitle');?></h1> + <input type="text" name="name" autocomplete="username" placeholder="<?php gtecho('headerTexts','loginUsername');?>" required /> + <input type="password" name="password" autocomplete="current-password" placeholder="<?php gtecho('headerTexts','loginPassword');?>" required /> <input type="hidden" name="referer" value="<?php if($this->is('index')) $this->options->siteUrl(); else $this->permalink(); ?>"> - <button class="btn btn-normal" type="submit">登录</button> + <button class="btn btn-normal" type="submit"><?php gtecho('headerTexts','loginSubmit');?></button> </form> <?php endif; ?> </div> @@ -36,7 +36,7 @@ <!-- 移动端导航面板 --> <div class="mobile-menu ready"> <button class="mobile-menu-close ready" id="toggle-mobile-menu-close"><i class="iconfont icon-x"></i></button> - <h2 class="mobile-menu-title">页面导航</h2> + <h2 class="mobile-menu-title"><?php gtecho('headerTexts','navTitle'); ?></h2> <div class="mobile-menu-pagelist" role="navigation"><div class="container-fluid"><div class="row"> <?php if($this->options->customNav=='') { @@ -99,7 +99,7 @@ </div> </div> <div class="drawer-content"> - <a href="<?php $this->options->SiteUrl(); ?>" onclick="toggleDrawer()">首页</a> + <a href="<?php $this->options->SiteUrl(); ?>" onclick="toggleDrawer()"><?php gtecho('headerTexts','drawerHome'); ?></a> <?php if($this->options->customNav=='') { $this->widget('Widget_Contents_Page_List') @@ -143,33 +143,28 @@ <?php if($this->fields->meta==''): if($_SESSION["isPageArchive"]!=true){ ?> <div class="header-meta-line-one"> - <?php if($this->is('post')): ?><i class="iconfont icon-block" title="文章分类"></i> <?php $this->category(','); ?> <?php endif; ?> - <i class="iconfont icon-comments" title="共 <?php $this->commentsNum('0', '1', '%d'); ?> 条评论"></i> <?php $this->commentsNum('0', '1', '%d'); ?>  + <?php if($this->is('post')): ?><span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts','sort_title',$this->category) ?>"><i class="iconfont"></i> <?php $this->category(','); ?></span> <?php endif; ?> + <span class="hint--bottom" data-tooltip="<?php if($this->commentsNum=='0'): gtecho('commentListTexts', 'commentNumNone'); else:gtaecho('commentListTexts', 'commentNum', $this->commentsNum);endif; ?>"><i class="iconfont"></i> <?php $this->commentsNum('0', '1', '%d'); ?></span>  </div> <div class="header-meta-line-two"> - <i class="iconfont icon-clock" title="该文章发布于 <?php $this->date(); ?>"></i> <?php $this->date(); ?>  - <i class="icon-view iconfont" title="该文章被浏览 <?php Contents::postViews($this) ?> 次"></i> <?php Contents::postViews($this) ?> + <span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts', 'post_time', date('Y-m-d',$this->created)); ?>"><i class="iconfont"></i> <?php $this->date(); ?></span>  + <span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts', 'post_views', Contents::postViews($this)) ?>"><i class="iconfont"></i> <?php echo Contents::postViews($this) ?></span> </div> <?php }else{ ?> <div class="header-meta-line-one"> - <i class="iconfont icon-clock" title="一切开始于 <?php Utils::getOldestPostDate(); ?>"></i> <?php Utils::getOldestPostDate(); ?>  + <i class="iconfont"></i> <?php gtaecho('archivePageTexts', 'archiveStart', Contents::getOldestPostDate());?>  </div> <div class="header-meta-line-two"> - <i class="icon-view iconfont" title="该页面被浏览 <?php Contents::postViews($this) ?> 次"></i> <?php Contents::postViews($this) ?> + <span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts', 'post_views', Contents::postViews($this)) ?>"><i class="iconfont"></i> <?php echo Contents::postViews($this) ?></span> </div> <?php } else: ?> <?php $this->fields->meta(); ?><div style="display:none"><?php Contents::postViews($this) ?></div> <?php endif; - $_SESSION["isPageArchive"]=false; //清除归档页面标识,避免不必要的问题?> + $_SESSION["isPageArchive"]=false; //clear ?> </div> <?php elseif($this->is('archive')): ?> - <h1><?php $this->archiveTitle(array( - 'category' => _t('分类 %s 下的文章'), - 'search' => _t('包含关键字 %s 的文章'), - 'tag' => _t('标签 %s 下的文章'), - 'author' => _t('%s 发布的文章') - ), '', '');?></h1><?php else: endif; ?> + <h1><?php $this->archiveTitle($GLOBALS['archivesTitles'], '', '');?></h1><?php else: endif; ?> </div> </div> </div> @@ -39,7 +39,7 @@ $this->need('includes/header.php'); ?> </p> <p class="post-meta"><i class="iconfont icon-block"></i> <?php $this->category(','); ?> <i class="iconfont icon-comments"></i> <?php $this->commentsNum('0', '1', '%d'); ?> <i class="iconfont icon-clock"></i> <?php $this->date(); ?></p> - <p class="post-button-box large-screen"><a href="<?php $this->permalink(); ?>" class="button post-button">Read More</a></p> + <p class="post-button-box large-screen"><a href="<?php $this->permalink(); ?>" class="button post-button"><?php gtecho('postTexts','read_more'); ?></a></p> </div> </div></div> </div> 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 '<h'.$matchs[1].$matchs[2].' id="'.$id.'">'.$matchs[3].'<a href="#'.$id.'" title="章节链接" class="post-toc-link no-line"><i class="iconfont icon-paragraph"></i></a></h'.$matchs[1].'>'; + $id = trim($matchs[3]); + return '<h'.$matchs[1].$matchs[2].' id="'.$id.'">'.$matchs[3].'<a href="#'.$id.'" title="'.$GLOBALS['postTexts']['post_anchor'].'" class="post-toc-link no-line"><i class="iconfont icon-paragraph"></i></a></h'.$matchs[1].'>'; } /* == 其他内容 == */ @@ -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 @@ +<?php +if (!defined('__TYPECHO_ROOT_DIR__')) exit; + +/** + * Language.php + * 多语言 / 多語言 / Multi-Languages + * + * Author: Eltrac(BigCoke233) + * License: MIT + */ + +class Lang +{ + public static function getLang() { + $provided_lang = glob(Helper::options()->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 @@ <?php
/**
+ * Options.php
* 主题后台设置
+ *
+ * Author: Eltrac(BigCoke233)
+ * License: MIT
*/
function themeConfig($form) {
diff --git a/libs/Utils.php b/libs/Utils.php index 3d62f77..27d7658 100644 --- a/libs/Utils.php +++ b/libs/Utils.php @@ -1,6 +1,14 @@ <?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; +/** + * Utils.php + * 辅助工具 + * + * Author: Eltrac(BigCoke233) + * License: MIT + */ + class Utils { @@ -142,19 +150,6 @@ class Utils } /** - * 获取最早文章创建时间 - */ - 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)); - echo '一切开始于 '.date('Y-m-d', $content['created']); - } - - /** * 缩略图 */ public static function postBanner($post){ 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 @@ +<?php +$GLOBALS['langInfo'] = array( + "name" => "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 @@ -<?php -$langInfo = array( - "name" => "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 @@ <?php //语言包信息 -$langInfo = array( +$GLOBALS['langInfo'] = array( "name" => "萌语", "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 @@ <?php //语言包信息 -$langInfo = array( +$GLOBALS['langInfo'] = array( "name" => "简体中文", "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 @@ <?php -// 語言包信息 -$langInfo = array( - "name" => "簡體中文", +//語言包信息 +$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'); <div class="post-body">
<div class="post-content page-content">
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags); ?>
- <h2>文章标签</h2>
+ <h2><?php gtecho('archivePageTexts','archiveTagTitle'); ?></h2>
<?php if($tags->have()): ?>
<ul class="tags-list">
<?php while ($tags->next()): ?>
@@ -22,14 +22,14 @@ $this->need('includes/header.php'); </ul>
<?php endif; ?>
<br />
- <h2>文章归档</h2>
+ <h2><?php gtecho('archivePageTexts','archivePostTitle'); ?></h2>
<ul class="archives-list"><?php
$archives = Contents::archives($this);
$number = 0;
foreach($archives as $year => $posts) {
$detailsOpen = ($number === 0) ? ' open' : NULL;
echo '<details'.$detailsOpen.'>';
- echo '<summary>'.$year.' 年<small class="archives-count">共 '.count($posts).' 篇文章</small></summary>';
+ echo '<summary>'.$year.' '.gt('archivePageTexts','archiveTimeYear').'<small class="archives-count">'.gta('archivePageTexts','archiveYearTotal',count($posts)).'</small></summary>';
foreach($posts as $created => $post) {
echo '<li><a href="'.$post['permalink'].'" class="no-line">
<span class="archives-date">'.date('m-d', $created).'</span>
@@ -4,12 +4,12 @@ $this->need('includes/header.php'); ?> <main class="main-container container" role="main"> <div class="post-body"> - <div class="post-content" role="article" id="post-content"><!-- 文章内容 --> + <div class="post-content" role="article" id="post-content"><!-- Post Content --> <?php $postCheck = Utils::isOutdated($this); if($postCheck["is"] && $this->is('post')): ?> <div class="tip red" id="out-date-alert"> <div class="container-fluid"><div class="row"> <div class="col-1 tip-icon"><i class="iconfont icon-info"></i></div> - <div class="col-11 tip-content">本文编写于 <?php echo $postCheck["created"]; ?> 天前,最后修改于 <?php echo $postCheck["updated"]; ?> 天前,其中某些信息可能已经过时。</div> + <div class="col-11 tip-content"><?php gtaecho('postTexts','post_timeAlert_1',$postCheck["created"]); gtaecho('postTexts','post_timeAlert_2',$postCheck["updated"]); ?></div> </div></div> </div> <?php endif; ?> @@ -26,15 +26,15 @@ $this->need('includes/header.php'); </div> <div class="post-qr" id="post-qr"> </div> - <div class="post-footer"><!-- 文章页脚 --> - <div class="post-share">分享至: + <div class="post-footer"><!-- Post Footer --> + <div class="post-share"><?php gtecho('postTexts','post_share'); ?> <button class="social-share qrcode" id="post-qrcode-btn"><i class="iconfont icon-qr_code"></i></button> - <a class="social-share qq" target="_blank" href="https://connect.qq.com/widget/shareqq/index.html?url=<?php $this->permalink() ?>&title=<?php $this->title() ?>&summary=<?php $this->excerpt(100); ?>" title="分享至 QQ 好友"><i class="iconfont icon-qq1-copy"></i></a> - <a class="social-share weibo" target="_blank" href="http://service.weibo.com/share/share.php?url=<?php $this->permalink() ?>/&appkey=<?php $this->options->title(); ?>/&title=<?php $this->title() ?>" title="分享至新浪微博"><i class="iconfont icon-weibo-copy"></i></a> - <a class="social-share twitter" target="_blank" href="https://twitter.com/intent/tweet?text=<?php $this->excerpt(100); ?>&url=<?php $this->permalink() ?>"><i class="iconfont icon-twitter-copy" title="分享至 Twitter"></i></a> - <a class="social-share copyright" onclick="alertSend('文章未声明即为原创,转载请注明原作者')"><i class="iconfont icon-info1"></i></a> + <a class="social-share qq hint--bottom" target="_blank" href="https://connect.qq.com/widget/shareqq/index.html?url=<?php $this->permalink() ?>&title=<?php $this->title() ?>&summary=<?php $this->excerpt(100); ?>" data-tooltip="QQ"><i class="iconfont icon-qq1-copy"></i></a> + <a class="social-share weibo hint--bottom" target="_blank" href="http://service.weibo.com/share/share.php?url=<?php $this->permalink() ?>/&appkey=<?php $this->options->title(); ?>/&title=<?php $this->title() ?>" data-tooltip="Weibo"><i class="iconfont icon-weibo-copy"></i></a> + <a class="social-share twitter hint--bottom" target="_blank" href="https://twitter.com/intent/tweet?text=<?php $this->excerpt(100); ?>&url=<?php $this->permalink() ?>" data-tooltip="Twitter"><i class="iconfont icon-twitter-copy"></i></a> + <a class="social-share copyright" onclick="alertSend('<?php gtecho('otherTexts','copyrightAlert'); ?>')"><i class="iconfont icon-info1"></i></a> </div> - <span class="post-tags"><i class="iconfont icon-tags"></i> <?php $this->tags(' ', true, '这人还没有写标签哦~'); ?></span> + <span class="post-tags"><i class="iconfont icon-tags"></i> <?php $this->tags(' ', true, gt('postTexts','post_tag')); ?></span> </div> </div> <?php $this->need('includes/comments.php'); ?> @@ -46,10 +46,10 @@ echo $commentClass; <?php if($this->user->hasLogin()): ?>
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" class="saying-form" role="form">
<p>
- <textarea rows="8" cols="50" name="text" id="textarea" placeholder="Anything interesting happening?" class="OwO-textarea comment-textarea textarea" required ><?php $this->remember('text'); ?></textarea>
+ <textarea rows="8" cols="50" name="text" id="textarea" placeholder="<?php gtecho('sayingPageTexts','sayingPlaceholder'); ?>" class="OwO-textarea comment-textarea textarea" required ><?php $this->remember('text'); ?></textarea>
</p>
<p>
- <button type="submit" class="comment-submit submit"><?php _e('发表新鲜事'); ?></button>
+ <button type="submit" class="comment-submit submit"><?php gtecho('sayingPageTexts','sayingSubmit'); ?></button>
</p>
</form>
<br>
diff --git a/themeConfig.php b/themeConfig.php index ba13cfe..8a9a495 100644 --- a/themeConfig.php +++ b/themeConfig.php @@ -7,6 +7,9 @@ * 通常 'on' 表示开启;'off' 则表示关闭 */ +/* 语言 */ +$GLOBALS['miraclesLang'] = 'zh-cn'; //在这里写入语言文件的名字(如 zh-cn.php 就是 zh-cn) + /* 字体 */ //主题字体 CDN |
