forked from bhaoo/Cuckoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinks.php
167 lines (166 loc) · 7.6 KB
/
links.php
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
/**
* Links
*
* @package custom
* @author Bhao
* @link https://dwd.moe/
* @version 1.0.5
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->comments()->to($comments);
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="<?php $comments->theId(); ?>"class="comments-list
<?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="comment-header">
<div class="comment-header-image">
<img class="mdui-img-circle" src="<?php get_comment_avatar($comments->mail); ?>"/>
</div>
<?php get_comment_prefix($comments->mail); if($comments->authorId == $comments->ownerId){ ?>
<img src="<?php staticFiles('images/grade/author.png') ?>" class="comment-prefix" mdui-tooltip="{content: '博主'}"/>
<?php } ?>
</div>
<div class="mdui-card-header-title mdui-typo comment-author"><?php $comments->author(); ?><?php getBrowser($comments->agent); getOs($comments->agent); ?></div>
<div class="mdui-card-header-subtitle"><?php $comments->date('Y-m-d H:i'); ?><?php if ('waiting' == $comments->status) { ?>
<br>
<div class="mdui-text-color-red-400 comment-waiting" style="font-weight:bold;">您的评论正在等待审核</div>
<?php } ?></div>
<div class="mdui-card-menu">
<?php $comments->reply('<button class="mdui-btn mdui-btn-dense mdui-ripple comment-reply">回复</button>'); ?>
</div>
<div class="comment-content mdui-typo">
<?php echo preg_replace('#</?[p][^>]*>#','', parseBiaoQing($comments->content)); ?>
</div>
<?php if ($comments->children) { ?>
<div class="comment-children">
<?php $comments->threadedComments($options); ?>
</div>
<?php } ?>
</div>
<?php
}
$this->need('includes/header.php');
?>
<div class="container">
<?php
$this->need('includes/sidebar.php');
?>
<div class="left">
<div class="links-content">
<?php if(array_key_exists("Links", Typecho_Plugin::export()['activated'])){
Links_Plugin::output("
<a class='links-url' href='{url}'>
<div class='mdui-col-sm-6'>
<div class='links-card mdui-shadow-10'>
<div class='links-img'><img class='mdui-img-circle' src='{image}'/></div>
<div class='links-name'>{name}</div>
<div class='links-describe'>{description}</div>
</div>
</div>
</a>");}
echo '</div>';
if(!$this->content == ""){echo '<div class="mdui-card page-card mdui-shadow-10 mdui-typo links-comments">'.parseBiaoQing(parseContent($this->content)).'</div>';}
if($this->allow('comment')): ?>
<div id="<?php $this->respondId(); ?>" class="mdui-card page-card mdui-shadow-10 links-comments comment-id">
<div class="comment-cancel">
<button class='mdui-btn mdui-btn-icon' mdui-dialog="{target: '#emoji'}"><i class='mdui-icon material-icons'>insert_emoticon</i></button>
<?php $comments->cancelReply("<button class='mdui-btn mdui-btn-icon'><i class='mdui-icon material-icons'>cancel</i></button>"); ?>
</div>
<h3>交换友链</h3>
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
<textarea placeholder="大佬呐!看这里!在这里交换鸭!" id="comment-textarea" name="text" class="comment-textarea" rows="8" cols="50" tabindex="4" required ><?php $this->remember('text'); ?></textarea>
<?php if($this->user->hasLogin()): ?>
<div class="mdui-typo">
<p>
登录身份:<a no-pjax href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>
<a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> »</a>
</p>
</div>
<?php else: ?>
<div class="mdui-textfield comment-left">
<img src="<?php staticFiles('images/avatar.png') ?>" class="mdui-icon mdui-img-circle comments-avatar"/>
<label class="mdui-textfield-label">昵称</label>
<input class="mdui-textfield-input" type="text" name="author" value="<?php $this->remember('author'); ?>" required></input>
</div>
<div class="mdui-textfield comment-right">
<i class="mdui-icon material-icons">email</i>
<label class="mdui-textfield-label" <?php if ($this->options->commentsRequireMail): ?> class="required"<?php endif; ?>>邮箱</label>
<input class="mdui-textfield-input" id="email" type="email" name="mail" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?>></input>
</div>
<div class="mdui-textfield comment-middle">
<i class="mdui-icon material-icons">web</i>
<label class="mdui-textfield-label" <?php if ($this->options->commentsRequireURL): ?> class="required"<?php endif; ?>>网址(选填)</label>
<input class="mdui-textfield-input" type="url" name="url" placeholder="<?php _e('http://'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?>></input>
</div>
<?php endif; ?>
<center>
<button type="submit" id="submit" class="mdui-btn mdui-btn-block mdui-text-color-theme mdui-ripple submit">发表评论</button>
</center>
</form>
</div>
<div id="comment-list" class="mdui-card page-card mdui-shadow-10 links-comment-list">
<div class="mdui-card-content">
<div class="comment-count">
<h3>全部留言 (<?php $this->commentsNum(_t('<span>暂无留言</span>'), _t('共 <span>1</span> 条留言'), _t('共 <span>%d</span> 条留言')); ?>)</h3>
</div>
<?php if ($comments->have()): ?>
<div class="comment-container">
<?php $comments->listComments(); ?>
</div>
<div class="comment-line"></div>
<?php else: ?>
<div class="comment-line"></div>
<div class="comment-info">
<p><i class="mdui-icon material-icons">info</i> 还没有任何留言,快来和咱交换友链伐!</p>
</div>
<?php endif; ?>
</div>
<?php else: ?>
<div id="comment-list" class="mdui-card page-card mdui-shadow-10">
<div class="mdui-card-content single-comments-content">
<h3>全部留言</h3>
<div class="comment-line"></div>
<div class="comment-info">
<p><i class="mdui-icon material-icons">info</i> 交换友链已经关闭了呐!</p>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div><div class="mdui-dialog" id="emoji">
<div class="emoji-box">
<div class="emoji-top mdui-dialog-title">
Emoji
<div class="emoji-cancel">
<button class='mdui-btn mdui-btn-icon' mdui-dialog-close><i class='mdui-icon material-icons'>cancel</i></button>
</div>
</div>
<div class="mdui-divider"></div>
<div class="mdui-dialog-body mdui-dialog-content"><?php Smile::getOwO(); ?></div>
<div class="mdui-tab mdui-tab-full-width tab" mdui-tab>
<?php Smile::getTitle(); ?>
</div>
</div>
</div></div>
</div>
<?php $this->need('includes/footer.php'); ?>