Repository navigation
Expand file tree
/
Copy pathcomments.php
More file actions
150 lines (133 loc) · 6.83 KB
/
Copy pathcomments.php
File metadata and controls
150 lines (133 loc) · 6.83 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
if ( 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
die( 'Please do not load this page directly. Thanks.' );
}
if ( post_password_required() ) {
echo '<div id="comments">';
echo '<div class="nopassword">' . __( 'This post is protected. Enter the password to view any comments.', 'nirvana' ) . '</div>';
echo '</div><!-- .comments -->';
return;
}
if ( comments_open() || get_comments_number() > 0 ) : ?>
<div id="comments">
<div class="post-model"><i class="far fa-comment-alt"></i><?php echo esc_html( get_comments_number() ); ?> 条回应</div>
<!-- 评论输入框 -->
<?php
if ( comments_open() ) {
if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) : ?>
<div class="tip">
<p>必须<a href="<?php echo esc_url(/sitelet?url=https%3A%2F%2Fgithub.com%2FSatoMini%2FniRvana-theme%2Fblob%2Fmain%2Fwp_registration_url%28) ); ?>" style="color:#fff;font-weight: bold;"> 注册 </a>为本站用户,
<a href="<?php echo esc_url(/sitelet?url=https%3A%2F%2Fgithub.com%2FSatoMini%2FniRvana-theme%2Fblob%2Fmain%2Fwp_login_url%28) ); ?>" style="color:#fff;font-weight: bold;"> 登录 </a>后才可以发表评论!</p>
</div>
<?php else : ?>
<div id="respond" class="comment-respond clearfix">
<?php
$cmt_face_arr = (array) get_faces_from_dir();
$cmt_face_imgs = '';
foreach ( $cmt_face_arr as $face ) {
$cmt_face_fmt = 'png';
if ( isset( $face['type'] ) && $face['type'] === 'g' ) {
$cmt_face_fmt = 'gif';
}
$img_src = esc_url(/sitelet?url=https%3A%2F%2Fgithub.com%2FSatoMini%2FniRvana-theme%2Fblob%2Fmain%2Fget_stylesheet_directory_uri%28) . '/faces/' . ( isset( $face['name'] ) ? $face['name'] : '' ) . '.' . $cmt_face_fmt );
$type_attr = isset( $face['type'] ) ? $face['type'] : '';
$name_attr = isset( $face['name'] ) ? $face['name'] : '';
$cmt_face_imgs .= '<img src="' . $img_src . '" @click="this.addCommentFace(\'[face ' . esc_attr( $type_attr ) . '=' . esc_attr( $name_attr ) . ']\')">';
}
?>
<div class="popover_faces hidden">
<?php echo $cmt_face_imgs; ?>
</div>
<div class="popover_loggedin hidden">
<div style="text-align: right; width: 100px;">
<a>取消</a>
<a href="<?php echo esc_url(/sitelet?url=https%3A%2F%2Fgithub.com%2FSatoMini%2FniRvana-theme%2Fblob%2Fmain%2Fwp_logout_url%28%2520get_permalink%28) ) ); ?>" class="primary"><i class="fas fa-check"></i> 确定</a>
</div>
</div>
<div class="popover_guests hidden">
<p>
<label><i class="fas fa-user"></i></label>
<input v-model="comment_author" class="comment-input" placeholder="昵称">
</p>
<p>
<label><i class="fas fa-envelope"></i></label>
<input v-model="comment_email" class="comment-input" placeholder="邮箱">
</p>
<p>
<label><i class="fas fa-globe-americas"></i></label>
<input v-model="comment_url" class="comment-input" placeholder="网站">
</p>
</div>
<form method="post" id="cmt_form" class="comment-form clear-float">
<div class="comment-form-comment">
<textarea
id="comment"
name="comment"
rows="5"
aria-required="true"
placeholder="<?php echo esc_attr( _eopt( 'comment_area_placeholder', '请输入...' ) ); ?>"
v-model="comment_text"
class="comment-input"
></textarea>
</div>
<input name="author" v-model="comment_author" class="hidden">
<input name="email" v-model="comment_email" class="hidden">
<input name="url" v-model="comment_url" class="hidden">
<p class="form-meta">
<?php
do_action( 'pf_comment_form_before_face' );
if ( count( $cmt_face_arr ) > 0 ) {
echo '<a id="comment_faces_toggle" tabindex="0"><i class="far fa-smile-wink" data-toggle="tooltip" title="表情"></i></a>';
}
do_action( 'pf_comment_form_after_face' );
?>
<a
class="comment-meta nick-name guests"
tabindex="0"
v-show="!this.is_user_loggedin"
:html="this.comment_author ? this.comment_author.replace(/ /g, '') != '' ? this.comment_author : '昵称' : '昵称'"
></a>
<a class="comment-meta nick-name loggedin" tabindex="0" v-show="this.is_user_loggedin">
<?php
global $current_user;
wp_get_current_user();
echo esc_html( $current_user->user_login );
?>
</a>
<span class="big_fa_ding" data-toggle="tooltip" title="同时点赞">
<input name="big_fa_ding" type="checkbox" v-model="comment_ding" class="jv-switcher">
</span>
</p>
<p class="form-submit">
<?php echo get_cancel_comment_reply_link( '<i class="fas fa-ban"></i> 取消回复' ); ?>
<button name="submit" class="submit-comment" value="提交评论" @click="this.submit_comments(event);"><i class="fas fa-paper-plane"></i> 提交评论</button>
<?php
comment_id_fields();
do_action( 'comment_form', isset( $post->ID ) ? $post->ID : 0 );
?>
</p>
</form>
</div>
<?php endif;
}
?>
<!-- 评论列表 -->
<?php if ( comments_open() || get_comments_number() > 0 ) : ?>
<div id="comments-list" class="comments">
<ol class="commentlist">
<?php wp_list_comments( array( 'type' => 'comment', 'callback' => 'mytheme_comment' ) ); ?>
</ol>
<?php
if ( get_option( 'page_comments' ) ) {
$comment_pages = paginate_comments_links( array( 'echo' => 0 ) );
if ( $comment_pages ) : ?>
<div id="commentnavi">
<?php echo $comment_pages; ?>
</div>
<?php endif;
}
?>
</div>
<?php endif; ?>
</div><!-- #comments -->
<?php endif; ?>