summaryrefslogtreecommitdiffstats
path: root/saying.php
blob: 3fcf651a106363caa6f731f8557f4e0c8116376a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
 * 说说页面
 *
 * @package custom
 */
$this->need('includes/head.php');
$this->need('includes/header.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为子级,否则是父级
?>
<div 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="saying-item">
    <div class="saying-inner saying-header">
	  <p class="saying-meta">
	    <?php $comments->gravatar('100', ''); ?><span class="saying-author"><?php $comments->author(); ?></span><br>
	    <?php $comments->date('Y-m-d H:i'); ?>
	  </p>
	</div>
	<div class="saying-hr"></div>
	<div class="saying-inner saying-middle">
	  <?php echo Contents::parseEmo($comments->content); ?>
	</div>
  </div>
</div>
<?php } ?>
    <main class="main-container container">
	  <div class="saying-body">
	    <?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="<?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 gtecho('sayingPageTexts','sayingSubmit'); ?></button>
          </p>
		</form>
		<br>
		<?php endif; ?>
	    <?php $this->comments()->to($comments); ?>
	    <?php $comments->listComments(array(
            'before'        =>  '<div class="comment-list">',
            'after'         =>  '</div>',
            'avatarSize'    =>  200,
            'dateFormat'    =>  'Y-m-d H:i'
        )); ?>
		<div class="comment-pagenav">
          <?php $comments->pageNav('<i class="iconfont icon-chevron-left comment-pagenav-icon"></i>', '<i class="iconfont icon-chevron-right comment-pagenav-icon"></i>'); ?>
        </div>
      </div>
	</main>
<?php $this->need('includes/footer.php'); ?>