summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorEltrac <45323514+BigCoke233@users.noreply.github.com>2019-07-11 18:55:48 +0800
committerGitHub <noreply@github.com>2019-07-11 18:55:48 +0800
commit27efb0e429817141e6009f0aefc79bdea17890fa (patch)
tree219d496cd79eebc34e2926672c139d19fb761563 /includes
parent79f92a1658063b9edbe2a1a9bd7a3dc57e1ce420 (diff)
🙉 The first release of Miracles 🙉
Diffstat (limited to 'includes')
-rw-r--r--includes/comments.php114
-rw-r--r--includes/footer.php88
-rw-r--r--includes/head.php66
-rw-r--r--includes/header.php67
4 files changed, 335 insertions, 0 deletions
diff --git a/includes/comments.php b/includes/comments.php
new file mode 100644
index 0000000..303349c
--- /dev/null
+++ b/includes/comments.php
@@ -0,0 +1,114 @@
+<?php function threadedComments($comments, $options) {
+ $commentClass = '';
+ if ($comments->authorId) {
+ if ($comments->authorId == $comments->ownerId) {
+ $commentClass .= ' comment-by-author'; //如果是文章作者的评论添加 .comment-by-author 样式
+ } else {
+ $commentClass .= ' comment-by-user'; //如果是评论作者的添加 .comment-by-user 样式
+ }
+ }
+ $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; //评论层数大于0为子级,否则是父级
+?>
+<li id="li-<?php $comments->theId(); ?>" class="comment-body<?php
+if ($comments->_levels > 0) {
+ echo ' comment-child';
+ $comments->levelsAlt(' comment-level-odd', ' comment-level-even');
+} else {
+ echo ' comment-parent';
+}
+$comments->alt(' comment-odd', ' comment-even');
+echo $commentClass;
+?>">
+ <div class="container-fluid">
+ <div class="row">
+ <div class="comment-author-avatar col-md-1">
+ <?php $comments->gravatar('100', ''); ?>
+ </div>
+ <div class="comment-author-info col-md-11">
+ <h4><?php $comments->author(); ?></h4>
+ <p><?php $comments->date('Y-m-d H:i'); ?></p>
+ <div class="comment-content">
+ <?php $comments->content(); ?>
+ <p class="comment-reply">
+ <?php $comments->reply(); ?>
+ </p>
+ </div>
+ <?php if ($comments->children) { ?>
+ <div class="comment-children">
+ <?php $comments->threadedComments($options); ?>
+ </div>
+ <?php } ?>
+ </div>
+ </div>
+ </div>
+</li>
+<?php } ?>
+ <div class="comment">
+ <?php $this->comments()->to($comments); ?>
+ <h3 class="comment-title">
+ <span style="color:#ccc">- </span>
+ <?php $this->commentsNum(_t('暂无评论'), _t('仅有一条评论'), _t('已有 %d 条评论')); ?>
+ <span style="color:#ddd"> -</span>
+ </h3>
+ <?php if ($comments->have()): ?>
+ <div class="comment-list">
+ <?php $comments->listComments(); ?>
+ <?php $comments->pageNav('<i class="iconfont icon-chevron-left"></i>', '<i class="iconfont icon-chevron-right"></i>'); ?>
+ </div>
+ <?php endif; ?>
+
+ <div class="comment-form">
+ <!-- 判断设置是否允许对当前文章进行评论 -->
+<?php if($this->allow('comment')): ?>
+ <div id="<?php $this->respondId(); ?>" class="respond">
+ <div class="cancel-comment-reply">
+ <?php $comments->cancelReply(); ?>
+ </div>
+
+ <h3 id="response"><?php _e('添加新评论'); ?></h3>
+<!-- 输入表单开始 -->
+ <form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
+<!-- 输入要回复的内容 -->
+ <div class="container-fluid"><div class="row">
+ <p class="col-md-12">
+ <textarea rows="8" cols="50" name="text" id="textarea" class="OwO-textarea comment-textarea textarea" required ><?php $this->remember('text'); ?></textarea>
+ </p>
+ </div></div>
+<!-- 如果当前用户已经登录 -->
+ <?php if($this->user->hasLogin()): ?>
+<!-- 显示当前登录用户的用户名以及登出连接 -->
+ <p><?php _e('登录身份: '); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a></p>
+<!-- 若当前用户未登录 -->
+ <?php else: ?>
+<!-- 要求输入名字、邮箱、网址 -->
+ <div class="container-fluid comment-input"><div class="row">
+ <p class="col-md-4">
+ <label for="author" class="required"><?php _e('称呼'); ?></label>
+ <input type="text" name="author" id="author" class="text" placeholder="称呼" value="<?php $this->remember('author'); ?>" required />
+ </p>
+ <p class="col-md-4">
+ <label for="mail"<?php if ($this->options->commentsRequireMail): ?> class="required"<?php endif; ?>><?php _e('Email'); ?></label>
+ <input type="email" name="mail" id="mail" class="text" placeholder="邮箱" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
+ </p>
+ <p class="col-md-4">
+ <label for="url"<?php if ($this->options->commentsRequireURL): ?> class="required"<?php endif; ?>><?php _e('网站'); ?></label>
+ <input type="url" name="url" id="url" class="text" placeholder="<?php _e('http://'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
+ </p>
+ </div></div>
+ <?php endif; ?>
+ <div class="container-fluid"><div class="row">
+ <p class="col-md-12 owo-para">
+ <div title="OwO" class="OwO"></div>
+ </p>
+ <p class="comment-submit col-md-12">
+ <button type="submit" class="submit"><?php _e('提交评论'); ?></button>
+ </p>
+ </div></div>
+ </form>
+ </div>
+<!-- 若当前文章不允许进行评论 -->
+ <?php else: ?>
+ <h3 class="comment-closed-alert"><?php _e('<i class="iconfont icon-x"></i> 评论已关闭'); ?></h3>
+ <?php endif; ?>
+ </div>
+ </div> \ No newline at end of file
diff --git a/includes/footer.php b/includes/footer.php
new file mode 100644
index 0000000..f014627
--- /dev/null
+++ b/includes/footer.php
@@ -0,0 +1,88 @@
+<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
+ </div>
+ <footer>
+ <div class="footer-info footer-dark">
+ <p>&copy; <?php echo date('Y'); ?> <a href="<?php $this->options->SiteUrl(); ?>"><?php $this->options->title(); ?></a> All rights reserved.<br />
+ Powered by <a href="http://typecho.org">Typecho</a> | Theme <a href="https://guhub.cn/p/miracles.html">Miracles</a> by <a href="https://guhub.cn">Eltrac</a></p>
+ <?php $this->options->footerEcho(); ?>
+ </div>
+ </footer>
+
+ <div class="fixed-tools">
+ <button onclick="GoTop()" title="返回顶部" class="gotop-button" style="color:white;"><i class="iconfont icon-chevron-up"></i></button>
+ <button onclick="Dark()" title="护眼模式" class="dark-button"><i class="iconfont icon-envira"></i></button>
+ </div>
+
+ <script src="<?php Utils::indexTheme('assets/js/jquery.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/pjax.jquery.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/jquery.fancybox.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/jquery.lazyload.min.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/nprogress.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/OwO.min.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/prism.js'); ?>"></script>
+ <script src="<?php Utils::indexTheme('assets/js/main.js'); ?>"></script>
+
+ <script>
+ //pjax-loader
+ var siteurl = '<?php $this->options->SiteUrl() ;?>';
+ $(document).pjax('a[href^="'+siteurl+'"]:not(a[target="_blank"], a[no-pjax])', {
+ container: '#pjax-container',
+ fragment: '#pjax-container',
+ timeout: 8000
+ }).on('pjax:send', function () {
+ NProgress.start();
+ GoTop();
+ }).on('pjax:complete', function () {
+ NProgress.done();
+ if (typeof Prism !== 'undefined') {
+ var pres = document.getElementsByTagName('pre');
+ for (var i = 0; i < pres.length; i++){
+ if (pres[i].getElementsByTagName('code').length > 0)
+ pres[i].className = 'line-numbers';}
+ Prism.highlightAll(true,null);}
+ $('form#login-form').addClass('need-refresh');
+ var OwO_demo = new OwO({
+ logo: 'OωO表情',
+ container: document.getElementsByClassName('OwO')[0],
+ target: document.getElementsByClassName('OwO-textarea')[0],
+ api: '<?php Utils::indexTheme('assets/OwO.json'); ?>',
+ position: 'down',
+ width: '400px',
+ maxHeight: '250px'
+ });
+ });
+ //解决刷新后不显示行号的问题
+ var pres = document.getElementsByTagName('pre');
+ for (var i = 0; i < pres.length; i++){
+ if (pres[i].getElementsByTagName('code').length > 0)
+ pres[i].className = 'line-numbers';
+ }
+ //Search
+ function Search() {
+ $(".search").toggleClass("ready");
+ $(".search-close").toggleClass("ready");
+ }
+ //Login
+ function Login() {
+ $(".login").toggleClass("ready");
+ $(".login-close").toggleClass("ready");
+ }
+ var OwO_demo = new OwO({
+ logo: 'OωO表情',
+ container: document.getElementsByClassName('OwO')[0],
+ target: document.getElementsByClassName('OwO-textarea')[0],
+ api: '<?php Utils::indexTheme('assets/OwO.json'); ?>',
+ position: 'down',
+ width: '400px',
+ maxHeight: '250px'
+ });</script>
+ </script>
+ <?php $this->footer(); ?>
+
+ <?php if($this->options->jsEcho && $this->options->jsEcho!=''): ?>
+ <style>
+ <?php $this->options->jsEcho(); ?>
+ </style>
+ <?php endif; ?>
+ </body>
+</html>
diff --git a/includes/head.php b/includes/head.php
new file mode 100644
index 0000000..7f7e20b
--- /dev/null
+++ b/includes/head.php
@@ -0,0 +1,66 @@
+<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit;
+if (isset($_POST['action'])) {
+ if ($_POST['action'] == 'getLoginAction') {
+ echo $this->options->loginAction;
+ exit;
+ }
+}?>
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="<?php $this->options->charset(); ?>">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="renderer" content="webkit">
+ <meta name="HandheldFriendly" content="true">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <?php
+ $banner = '';
+ $description = '';
+ if($this->is('post') || $this->is('page')){
+ if(isset($this->fields->banner))
+ $banner=$this->fields->banner;
+ if(isset($this->fields->excerpt))
+ $description = $this->fields->excerpt;
+ }else{
+ $description = Helper::options()->description;
+ }
+ ?>
+ <title><?php Contents::title($this); ?></title>
+ <meta name="author" content="<?php $this->author(); ?>" />
+ <meta name="description" content="<?php if($description != '') echo $description; else $this->excerpt(50); ?>" />
+ <meta property="og:title" content="<?php Contents::title($this); ?>" />
+ <meta property="og:description" content="<?php if($description != '') echo $description; else $this->excerpt(50); ?>" />
+ <meta property="og:site_name" content="<?php Helper::options()->title(); ?>" />
+ <meta property="og:type" content="<?php if($this->is('post') || $this->is('page')) echo 'article'; else echo 'website'; ?>" />
+ <meta property="og:url" content="<?php $this->permalink(); ?>" />
+ <meta property="og:image" content="<?php echo $banner; ?>" />
+ <meta property="article:published_time" content="<?php echo date('c', $this->created); ?>" />
+ <meta property="article:modified_time" content="<?php echo date('c', $this->modified); ?>" />
+ <meta name="twitter:title" content="<?php Contents::title($this); ?>" />
+ <meta name="twitter:description" content="<?php if($description != '') echo $description; else $this->excerpt(50); ?>" />
+ <meta name="twitter:card" content="summary" />
+ <meta name="twitter:image" content<?php echo $banner; ?>" />
+
+ <link rel="icon" type="image/png" href="<?php Utils::indexTheme('favicon.ico'); ?>" />
+ <?php $this->header('description=&'); ?>
+ <?php $this->options->headerEcho(); ?>
+ <!-- css -->
+ <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/normalize.css'); ?>" />
+ <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/miracles.min.css'); ?>" />
+ <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/nprogress.css'); ?>" />
+ <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/prism.css'); ?>" />
+ <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/owo.min.css'); ?>" />
+ <link rel="stylesheet" href="<?php Utils::indexTheme('assets/css/fancybox.css'); ?>" />
+ <!-- icon font -->
+ <link rel="stylesheet" href="//at.alicdn.com/t/font_1165190_nm7coh35jtk.css" />
+ <!-- Google Fonts -->
+ <link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:300|Noto+Serif+SC:300&display=swap" rel="stylesheet">
+
+ <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(); ?>
+ <?php $this->options->cssEcho(); ?>
+ </style>
+ </head>
+ <body class="font-sans-serif"> \ No newline at end of file
diff --git a/includes/header.php b/includes/header.php
new file mode 100644
index 0000000..abc57ca
--- /dev/null
+++ b/includes/header.php
@@ -0,0 +1,67 @@
+<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
+ <div class="search ready">
+ <button class="search-close ready" onclick="Search()"><i class="iconfont icon-x"></i></button>
+ <form method="post" action="">
+ <div class="search-form">
+ <input type="text" name="s" class="text" size="32" />
+ <button type="submit" class="submit">搜索</button>
+ </div>
+ </form>
+ </div>
+ <div class="login ready">
+ <button class="login-close ready" onclick="Login()"><i class="iconfont icon-x"></i></button>
+ <?php if($this->user->hasLogin()): ?>
+ <h1>你已经登陆过了哦</h1>
+ <p class="large-screen">&emsp;不过康纳很乐意再次见到<a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></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/>
+ <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>
+ </form>
+ <?php endif; ?>
+ </div>
+ <nav class="nav<?php if($this->options->nav_position && $this->options->nav_position=1): ?> nav-fixed<?php endif; ?>">
+ <div class="container">
+ <p class="nav-content">
+ <a href="<?php $this->options->SiteUrl(); ?>" class="nav-title"><?php $this->options->title(); ?></a>
+ <span class="nav-content-item">
+ <?php $this->widget('Widget_Contents_Page_List')
+ ->parse('<a href="{permalink}">{title}</a>'); ?>
+ </span>
+ </p>
+ <button class="nav-icon-button search-button" onclick="Search()"><i class="iconfont icon-chaxun"></i></button>
+ <button class="nav-icon-button login-button" onclick="Login()"><i class="iconfont icon-user"></i></button>
+ </div>
+ </nav>
+ <div id="pjax-container">
+ <header>
+ <?php if($this->is('post') || $this->is('page')): ?>
+ <div class="index-banner" style="background:url('<?php if($this->fields->banner && $this->fields->banner=!''): ?><?php $this->fields->banner(); ?><?php else: ?><?php $this->options->bannerUrl(); ?><?php endif; ?>') no-repeat;height:<?php $this->options->bannerHeight(); ?>vh;background-size:cover;">
+ <?php else: ?>
+ <div class="index-banner" style="background:url('<?php $this->options->bannerUrl(); ?>') no-repeat;height:<?php $this->options->bannerHeight(); ?>vh;background-size:cover;">
+ <?php endif; ?>
+ <div class="dark-cover">
+ <div class="main-container container">
+ <div class="banner-content">
+ <?php if($this->is('index')): ?>
+ <h1><?php $this->options->bannerTitle(); ?></h1>
+ <p><?php $this->options->bannerIntro(); ?></p>
+ <?php elseif($this->is('post') || $this->is('page')): ?>
+ <h1><?php $this->title(); ?></h1>
+ <p class="header-meta"><?php if($this->is('post')): ?><i class="iconfont icon-block"></i> <?php $this->category(','); ?>&emsp;<?php endif; ?><i class="iconfont icon-comments"></i> <?php $this->commentsNum('None', 'Only 1', '%d'); ?>&emsp;<i class="iconfont icon-clock"></i> <?php $this->date(); ?></p>
+ <?php else: ?>
+
+ <?php endif; ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ </header>
+ <br><br><br>
+ \ No newline at end of file