-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7307f3c
commit 384fc6d
Showing
3 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
function threadedComments($comments, $options) { | ||
$cby = $comments->authorId == $comments->ownerId ? '<span class="cby">admin</span>' : ''; | ||
$clevel = $comments->levels > 0 ? 'c_c' : 'c_p'; | ||
$author = $comments->url ? '<a href="' . $comments->url . '"'.'" target="_blank"' . ' rel="external">' . $comments->author . '</a>' : $comments->author; | ||
?> | ||
<li id="li-<?php $comments->theId(); ?>" class="<?php echo $clevel;?>"> | ||
<div id="<?php $comments->theId(); ?>"> | ||
<?php | ||
$t = 1209600*8; | ||
$a = Helper::options()->siteUrl . 'usr/uploads/avatar/' . md5(strtolower($comments->mail)) . '.jpg'; | ||
$e = __TYPECHO_ROOT_DIR__ . '/' . 'usr/uploads/avatar/' . md5(strtolower($comments->mail)) . '.jpg'; | ||
if ( !is_file($e) || (time() - filemtime($e)) > $t ){ | ||
$a = 'https://cdn.v2ex.com/gravatar/' . md5(strtolower($comments->mail)) . '?s=80&r=X&d='; | ||
copy($a, $e); | ||
if (!is_file($e)){ | ||
copy($d, $e); | ||
}; | ||
}; | ||
if ( filesize($e) < 900 ) copy($d, $e); | ||
?> | ||
<img class="avatar" src="<?php echo $a ?>" alt="<?php echo $comments->author; ?>" /> | ||
<div class="cp"> | ||
<?php $comments->content(); ?> | ||
<div class="cm"><span class="ca"><?php echo $author ?></span> <?php echo $cby;?> <?php $comments->date(); ?><span class="cr"><?php $comments->reply(); ?></span></div> | ||
</div> | ||
</div> | ||
<?php if ($comments->children){ ?><div class="children"><?php $comments->threadedComments($options); ?></div><?php } ?> | ||
</li> | ||
<?php } ?> | ||
<style type="text/css"> | ||
.cf{margin:1rem 0 3rem 0} | ||
.cf .page-navigator{margin:3.75rem 0 3rem 0} | ||
.response{margin:2rem 0} | ||
.hinfo{display:none} | ||
.cf a{color:#aaa} | ||
.comment-list{padding-left:0;list-style-type:none;margin:0} | ||
.avatar{display:block;float:left;width:40px;height:40px;margin:1.4rem 1rem 0 0;border-radius:50%} | ||
.cp{overflow:hidden;padding:1rem 0;border-bottom:1px dotted #e0e0e0} | ||
.cp p{margin:0} | ||
.cr{float:right;display:none} | ||
.cp:hover .cr{display:block} | ||
.ccr,.cm{font-size:.766rem;margin-top:1rem;color:#aaa} | ||
.ccr{text-align:right} | ||
.ca,.cby{padding:.1rem .25rem;border-radius:2px;background:#eee;font-size:.7rem} | ||
.ca a:hover{color:#f08f00!important} | ||
.c_p>.children{margin-left:1rem;padding-left:40px} | ||
.tbox{padding:0 0 0 18px} | ||
.ci{font-size:14px;line-height:1.5;color:#555;height:30px;margin:10px 0;border:1px solid #ccc;border-radius:2px;width:100%;padding:3px 7px;margin-left:-18px;overflow:auto} | ||
.ci:focus{border-color:#999;outline:0} | ||
textarea.ci{padding-top:8px;height:10rem;resize:none} | ||
.submit{font-size:1rem;border:1px solid #f0f0f0;padding:0 30px;line-height:36px;text-align:center;height:36px;margin:0 auto;display:block;background:#f5f5f5} | ||
.submit:hover{color:#000;border-color:#ddd;background:#ddd;cursor:pointer} | ||
@media only screen and (max-width:767px){.c_p .children{margin-left:0;padding-left:0}} | ||
</style> | ||
<div id="comments" class="cf"> | ||
<?php $this->comments()->to($comments); ?> | ||
<?php if ($comments->have()): ?> | ||
<h4><?php $this->commentsNum(_t('暂无评论'), _t('仅有 1 条评论'), _t('已有 %d 条评论')); ?></h4><br> | ||
<?php $comments->listComments(); ?><?php $comments->pageNav('«', '»'); ?> | ||
<?php endif; ?> | ||
<div id="<?php $this->respondId(); ?>" class="respond"> | ||
<div class="ccr"><?php $comments->cancelReply(); ?></div> | ||
<h4 class="response">发表新评论</h3> | ||
<form method="post" action="<?php $this->commentUrl() ?>" id="cf" role="form"> | ||
<?php if($this->user->hasLogin()): ?> | ||
<span>已登入<a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout">退出 »</a></span> | ||
<?php else: ?> | ||
<?php if($this->remember('author',true) != "" && $this->remember('mail',true) != "") : ?> | ||
<span>欢迎【<?php $this->remember('author'); ?>】的归来 | <small style="cursor: pointer;" onclick = "tg_c('ainfo','hinfo');"> 编辑资料</small></span> | ||
<div id ="ainfo" class="ainfo hinfo"> | ||
<?php else : ?> | ||
<div class="ainfo"> | ||
<?php endif ; ?> | ||
<div class="tbox"> | ||
<input type="text" name="author" id="author" class="ci" placeholder="称呼" value="<?php $this->remember('author'); ?>" required> | ||
<input type="email" name="mail" id="mail" class="ci" placeholder="邮箱" value="<?php $this->remember('mail'); ?>" required> | ||
<input type="url" name="url" id="url" class="ci" placeholder="http://" value="<?php $this->remember('url'); ?>"> | ||
</div> | ||
</div> | ||
<?php endif; ?> | ||
<div class="tbox"><textarea name="text" id="textarea" class="ci" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('submit').click();return false};" placeholder="在这里输入你的评论" required ><?php $this->remember('text',false); ?></textarea></div> | ||
<button type="submit" class="submit" id="submit">提交评论 (Ctrl + Enter)</button> | ||
</form> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; | ||
|
||
function themeFields($layout) { // 文章版权信息 | ||
$url = new Typecho_Widget_Helper_Form_Element_Text('url', NULL, NULL, _t('转载文章地址'), _t('url')); | ||
$author = new Typecho_Widget_Helper_Form_Element_Text('author', NULL, NULL, _t('作者名'), _t('author')); | ||
$layout->addItem($url); | ||
$layout->addItem($author); | ||
} | ||
|
||
function themeConfig($form) { // 网站底部联系邮箱 | ||
$email = new Typecho_Widget_Helper_Form_Element_Text('email', NULL, NULL, _t('电子邮件地址'), _t('在这里填入你的联系邮箱')); | ||
$form->addInput($email); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/** | ||
* 极简模板 | ||
* | ||
* @package simplifier | ||
* @author 夏目贵志/simplifier | ||
* @version 1.0 | ||
* @link https://xiamuyourenzhang.cn/ | ||
*/ | ||
|
||
if (!defined('__TYPECHO_ROOT_DIR__')) 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="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
<title><?php $this->archiveTitle(array( | ||
'category' => _t('分类 %s 下的文章'), | ||
'search' => _t('包含关键字 %s 的文章'), | ||
'tag' => _t('标签 %s 下的文章'), | ||
'author' => _t('%s 发布的文章') | ||
), '', ' - '); ?><?php $this->options->title(); ?></title> | ||
<style> | ||
body{word-break:break-all;word-wrap:break-word;text-align:justify}img{max-width:100%}pre{background:#f7f7f7;margin:1.25rem 0;padding:.9375rem;overflow:auto;color:#4d4d4c;line-height:1.75}pre code{background:0;text-shadow:none;padding:0;margin:0}blockquote{padding:0 15px;color:#666;border-left:4px solid #ddd}table{width:100%;display:table;border-spacing:2px;margin:20px 0;letter-spacing:0}td,th{display:table-cell;padding:5px;text-align:center}th{background:#DDD}td{background:#EEE;text-align:left;padding:5px 10px;font-size:14px}tr:hover td{background:#ffa}#top{position:fixed;bottom:80px;right:30px;opacity:1;cursor:pointer}h1:before,h2:before,h3:before{content:'# ';color:#000} | ||
|
||
</style> | ||
<?php $this->header(); ?> | ||
</head> | ||
|
||
<body name="top"> | ||
<tt> | ||
<a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>. | ||
<hr> | ||
<?php $this->widget('Widget_Contents_Page_List') | ||
->parse('{day}/{month}/{year} <a href="{permalink}" >{title}</a><br>'); ?> | ||
<hr> | ||
|
||
<?php if(($this->is('index'))||($this->is('archive'))): ?><!-- 判断① 判断是否首页或者是archive 通用(分类、搜索、标签、作者)页面文件 只要是其中一个 输出文章 不是则继续循环--> | ||
|
||
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->parse('{year}/{month}/{day} <a href="{permalink}">{title}</a><br>'); ?><!--输出1w篇文章/后输出发布时间;标题文章链接--> | ||
|
||
<?php else: ?><!--不是首页继续循环判断--> | ||
|
||
<?php if(($this->is('post'))||($this->is('page'))): ?><!--判断② 判断是否文章页或者是独立页面 只要是其中一个 输出文章 不是则继续循环--> | ||
|
||
<article><!--是文章页面 输出文章标题和内容--> | ||
<h2><?php $this->title() ?></h2> | ||
<p> <?php $this->content('Continue Reading...'); ?></p> | ||
<?php | ||
if(isset($this->fields->author)||($this->fields->url)){ | ||
echo '<blockquote>'; | ||
echo '<p>文章作者:'.$this->fields->author . '</p>'; | ||
echo '<p>原文链接:'.$this->fields->url . '</p>'; | ||
echo '<p>著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。</p>'; | ||
echo '</blockquote>'; | ||
}else{ | ||
} | ||
?> | ||
</article> | ||
|
||
<hr/> | ||
<?php $this->need('comments.php'); ?><!--加载评论--> | ||
|
||
<?php endif; ?><!-- 判断②判断结束 --> | ||
|
||
<?php endif; ?><!-- 判断① 结束 --> | ||
|
||
<hr> | ||
最后更新于 <?php echo date('Y 年 m 月 d 日', $this->modified);?>.<br> | ||
Contact me at <?php $this->options->email(); ?>. | ||
<a href="javascript:window.scrollTo( 0, 0 );" target="_self" id="top">回到顶部</a> | ||
</tt> | ||
<?php $this->footer(); ?> | ||
</body> | ||
</html> |