Skip to content

Commit

Permalink
v0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FaithPatrick committed Jul 28, 2017
1 parent 25699a7 commit 42c7dbb
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 22 deletions.
24 changes: 13 additions & 11 deletions comments.php
@@ -1,3 +1,4 @@
<?php if($this->allow('comment')): ?>
<?php
$GLOBALS['z'] = $this->options->CDNURL;
function threadedComments($comments, $options) {
Expand Down Expand Up @@ -44,7 +45,7 @@ function threadedComments($comments, $options) {
<div class="comment-meta">
<span class="comment-author"><?php echo $author; ?></span>
<time class="comment-time"><?php $comments->date('Y-m-d H:i:s'); ?></time>
<span class="comment-reply"><?php $comments->reply(); ?></span>
<span class="comment-reply"><?php $comments->reply('Reply'); ?></span>
</div>
</div>
</div>
Expand All @@ -62,7 +63,7 @@ function threadedComments($comments, $options) {
<div id="comments" class="cf">
<?php $this->comments()->to($comments); ?>
<?php if ($comments->have()): ?>
<span class="comment-num"><?php $this->commentsNum(_t('暂无评论'), _t('已有 1 条评论'), _t('已有 %d 条评论')); ?></span>
<span class="comment-num"><?php $this->commentsNum(_t('No comments'), _t('1 comment'), _t('%d comments')); ?></span>

<?php $comments->listComments(); ?>

Expand All @@ -72,36 +73,36 @@ function threadedComments($comments, $options) {

<?php if($this->allow('comment')): ?>
<div id="<?php $this->respondId(); ?>" class="respond">
<div class="cancel-comment-reply"><span class="response"><?php _e('发表新评论'); ?></span><span class="cancel-reply"><?php $comments->cancelReply(); ?></span></div>
<div class="cancel-comment-reply"><span class="response"><?php _e('To fill this form if you wanna discuss'); ?></span><span class="cancel-reply"><?php $comments->cancelReply('Cancel reply'); ?></span></div>
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
<?php if($this->user->hasLogin()): ?>
<p style="padding-top:10px;"><?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>
<p style="padding-top:10px;"><?php _e('Already login as: '); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('Logout'); ?> &raquo;</a></p>
<?php else: ?>
<?php if($this->remember('author',true) != "" && $this->remember('mail',true) != "") : ?>

<p style="padding-top:10px;color:#aaa;">
<span onClick='showhidediv("author_info")'; style="cursor:pointer;color:#2479cc;"><?php $this->remember('author'); ?></span><?php _e('欢迎回来'); ?>
<span id="cancel-comment-reply"><?php $comments->cancelReply(); ?></span>
<span onClick='showhidediv("author_info")'; style="cursor:pointer;color:#2479cc;"><?php $this->remember('author'); ?></span><?php _e('Welcome back'); ?>
<span id="cancel-comment-reply"><?php $comments->cancelReply('Cancel reply'); ?></span>
</p>
<div id="author_info" style="display:none;">
<?php else : ?>
<div id="author_info">
<?php endif ; ?>
<input type="text" name="author" maxlength="12" id="author" class="form-control" placeholder="<?php _e('称呼 *'); ?>" value="<?php $this->remember('author'); ?>">
<input type="text" name="author" maxlength="12" id="author" class="form-control" placeholder="<?php _e('Name *'); ?>" value="<?php $this->remember('author'); ?>">
<input type="email" name="mail" id="mail" class="form-control" placeholder="<?php _e('Email *'); ?>" value="<?php $this->remember('mail'); ?>">
<input type="url" name="url" id="url" class="form-control" placeholder="<?php _e('网站'); ?>" value="<?php $this->remember('url'); ?>">
<input type="url" name="url" id="url" class="form-control" placeholder="<?php _e('Website'); ?>" value="<?php $this->remember('url'); ?>">
</div>
<?php endif; ?>

<textarea name="text" id="textarea" class="form-control" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('misubmit').click();return false};" placeholder="<?php _e('Enter your comment here...'); ?>" required ><?php $this->remember('text',false); ?></textarea>
<button type="submit" class="submit" id="misubmit"><?php _e('提交评论'); ?></button>
<textarea name="text" id="textarea" class="form-control" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('misubmit').click();return false};" placeholder="<?php _e('Type your comment here...'); ?>" required ><?php $this->remember('text',false); ?></textarea>
<button type="submit" class="submit" id="misubmit"><?php _e('Submit'); ?></button>
<?php $security = $this->widget('Widget_Security'); ?>
<input type="hidden" name="_" value="<?php echo $security->getToken($this->request->getReferer())?>">
</form>
</div>
</div>
<?php else: ?>
<h4 class="comment-close">此处评论已关闭</h4>
<h4 class="comment-close">Comment closed</h4>
<?php endif; ?>
<script>
function showhidediv(id){
Expand Down Expand Up @@ -244,4 +245,5 @@ function showhidediv(id){
})();
</script>
<?php else : ?>
<?php endif; ?>
<?php endif; ?>
2 changes: 1 addition & 1 deletion footer.php
Expand Up @@ -10,13 +10,13 @@
</footer>
</div>
<?php $this->footer(); ?>
<script src="<?php $this->options->themeUrl('js/main.js'); ?>"></script>
<script src="//cdn.staticfile.org/instantclick/3.0.1/instantclick.min.js" data-no-instant></script>
<script src="<?php $this->options->themeUrl('js/prism.js'); ?>" data-no-instant></script>
<script data-no-instant>
InstantClick.on('change', function(isInitialLoad) {
if (isInitialLoad === false) {
if (typeof Prism !== 'undefined') Prism.highlightAll(true,null);
if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
}
});
InstantClick.init();
Expand Down
28 changes: 28 additions & 0 deletions functions.php
Expand Up @@ -116,4 +116,32 @@ function get_filtered_comment($coid){
function print_summary($obj, $length){
$str = preg_replace('/<script>.*?<\/script>/is', '', $obj->excerpt);
echo Typecho_Common::subStr(strip_tags($str), 0, $length, '...');
}

function theNext($obj, $format = '%s', $default = NULL, $custom = array()) {
$content = $obj->db->fetchRow($obj->select()->where('table.contents.created > ? AND table.contents.created < ?',
$obj->created, $obj->options->gmtTime)
->where('table.contents.status = ?', 'publish')
->where('table.contents.type = ?', $obj->type)
->where('table.contents.password IS NULL')
->order('table.contents.created', Typecho_Db::SORT_ASC)
->limit(1));

if ($content) {
$content = $obj->filter($content);
$default = array(
'title' => NULL,
'tagClass' => NULL
);
$custom = array_merge($default, $custom);
extract($custom);

$linkText = empty($title) ? $content['title'] : $title;
$linkClass = empty($tagClass) ? '' : 'class="' . $tagClass . '" ';
$link = '<a ' . $linkClass . 'href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $linkText . '</a>';

printf($format, $link);
} else {
echo $default;
}
}
10 changes: 5 additions & 5 deletions header.php
Expand Up @@ -31,12 +31,12 @@
<![endif]-->
<div class="wrap">
<header>
<a href="/" class="logo-link"><img src="<?php $this->options->themeUrl('img/logo.png'); ?>"></a>
<a href="<?php $this->options->siteUrl(); ?>" class="logo-link"><img src="<?php $this->options->themeUrl('img/logo.png'); ?>"></a>
<ul class="nav nav-list">
<li class="nav-list-item"><a href="#" target="_self" class="nav-list-link <?php if($this->is('index')) echo 'active'; ?>">BLOG</a></li>
<li class="nav-list-item"><a href="#" target="_self" class="nav-list-link">ARCHIVES</a></li>
<li class="nav-list-item"><a href="#" target="_self" class="nav-list-link">ABOUT</a></li>
<li class="nav-list-item"><a href="#" target="_self" class="nav-list-link">GUESTBOOK</a></li>
<li class="nav-list-item"><a href="<?php $this->options->siteUrl(); ?>" class="nav-list-link <?php if($this->is('index')) echo 'active'; ?>">BLOG</a></li>
<li class="nav-list-item"><a href="<?php $this->options->siteUrl('index.php/archives.html'); ?>" class="nav-list-link <?php if($this->is('page', 'archives')) echo 'active'; ?>">ARCHIVES</a></li>
<li class="nav-list-item"><a href="<?php $this->options->siteUrl('about.html'); ?>" class="nav-list-link <?php if($this->is('page', 'about')) echo 'active'; ?>">ABOUT</a></li>
<li class="nav-list-item"><a href="<?php $this->options->siteUrl('guestbook.html'); ?>" class="nav-list-link <?php if($this->is('page', 'guestbook')) echo 'active'; ?>">GUESTBOOK</a></li>
</ul>
</header>
<section class="container">
Expand Down
16 changes: 16 additions & 0 deletions js/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions page-archives.php
@@ -0,0 +1,39 @@
<?php
/**
* archives
*
* @package custom
*/
$this->need('header.php'); ?>


<div class="post">
<article class="post-block">
<h1 class="post-title"><?php $this->title() ?></h1>
<div class="post-content">
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
$year=0; $mon=0; $i=0; $j=0;
while($archives->next()):
$year_tmp = date('Y',$archives->created);
$mon_tmp = date('m',$archives->created);
$y=$year; $m=$mon;
if ($mon != $mon_tmp && $mon > 0) $output .= '</ul>';
if ($year != $year_tmp && $year > 0) $output .= '</ul>';
if ($year != $year_tmp) {
$year = $year_tmp;
}
if ($mon != $mon_tmp || ($mon == $mon_tmp && $y != $year_tmp)) {
$mon = $mon_tmp;
$output .= '<h4>'. $year_tmp .' 年'. $mon_tmp .' 月</h4>';
$output .= '<ul>';
}
$output .= '<li><a href="'.$archives->permalink .'">'. $archives->title .'</a>&nbsp;&nbsp;&nbsp;&nbsp;('.date('M j, Y',$archives->created).')</li>';
endwhile;
$output .= '</ul>';
echo $output;
?>
</div>
</article>
</div>

<?php $this->need('footer.php'); ?>
1 change: 0 additions & 1 deletion page.php
Expand Up @@ -5,7 +5,6 @@
<div class="post">
<article class="post-block">
<h1 class="post-title"><?php $this->title() ?></h1>
<div class="post-info"><time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date('F j, Y'); ?></time></div>
<div class="post-content">
<?php $this->content(); ?>
</div>
Expand Down
1 change: 1 addition & 0 deletions post.php
Expand Up @@ -10,6 +10,7 @@
<?php $this->content(); ?>
</div>
</article>
<div class="paginator"><?php $this->thePrev('%s', '', ['title'=>'PREV ARTICLE', 'tagClass'=>'prev']); ?> <?php $this->theNext('%s', '', ['title'=>'NEXT ARTICLE', 'tagClass'=>'next']); ?></div>
<?php $this->need('comments.php'); ?>
</div>

Expand Down

0 comments on commit 42c7dbb

Please sign in to comment.