-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathsidebar.php
More file actions
217 lines (201 loc) · 8.84 KB
/
Copy pathsidebar.php
File metadata and controls
217 lines (201 loc) · 8.84 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<aside class="layout__sidebar sidebar">
<!-- start Abouts widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowAbouts', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">关于</h4>
<?php if (!empty($this->options->cardBg)): ?>
<div class="card__bg" style="background-image: url('<?php $this->options->cardBg(); ?>'); <?php if (in_array('ShowSearch', $this->options->sidebarBlock)) ?>"></div>
<?php endif; ?>
<div class="card">
<div class="card__info">
<img class="card__avatar" src="<?php $this->options->cardImg(); ?>" alt="<?php $this->options->cardName(); ?>">
<div class="card__name"><?php $this->options->cardName(); ?></div>
<div class="card__bio"><?php $this->options->cardDescription(); ?></div>
</div>
<?php add_cardlinks($this); ?>
<div class="card__stats">
<?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?>
<div class="card__stat">
<div class="card__stat-label">文章</div>
<div class="card__stat-value"><?php $stat->publishedPostsNum() ?></div>
</div>
<div class="card__stat">
<div class="card__stat-label">分类</div>
<div class="card__stat-value"><?php $stat->categoriesNum() ?></div>
</div>
<div class="card__stat">
<div class="card__stat-label">评论</div>
<div class="card__stat-value"><?php $stat->publishedCommentsNum() ?></div>
</div>
<div class="card__stat">
<div class="card__stat-label">页面</div>
<div class="card__stat-value"><?php echo $stat->publishedPagesNum + $stat->publishedPostsNum; ?></div>
</div>
</div>
<div class="card__footer">
<span>已在风雨中度过 <?php echo getBuildTime(); ?></span>
</div>
</div>
</div>
<?php endif; ?>
<!-- end Abouts widget -->
<!-- start TOC widget -->
<?php if ($this->is('single') && $this->options->showToc != '0' && count($GLOBALS['waxy_toc_items'] ?? []) >= 3): ?>
<div class="widget widget--toc" id="waxy-toc-sidebar">
<div class="waxy-toc-sidebar__header">
<h4 class="widget__title">目录</h4>
</div>
<ul class="waxy-toc-sidebar__list widget__body">
<?php foreach ($GLOBALS['waxy_toc_items'] as $item): ?>
<li class="waxy-toc-sidebar__item waxy-toc-sidebar__item--h<?php echo $item['level']; ?>">
<a class="waxy-toc-sidebar__link" href="#<?php echo htmlspecialchars($item['id']); ?>">
<?php echo htmlspecialchars($item['text'], ENT_QUOTES, 'UTF-8'); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<div class="waxy-toc-sidebar__footer">
<div class="waxy-toc-sidebar__bar"><div class="waxy-toc-sidebar__bar-fill" id="waxy-toc-bar"></div></div>
<span class="waxy-toc-sidebar__progress" id="waxy-toc-progress">0%</span>
</div>
</div>
<?php endif; ?>
<!-- end TOC widget -->
<!-- start Category widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowCategory', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">分类</h4>
<div class="widget__body">
<?php $this->widget('Widget_Metas_Category_List')->to($category); $lestLevels = 0; ?>
<ul class="menu-list">
<?php while ($category->next()): ?>
<?php if ($category->levels === 0){ if ($lestLevels > $category->levels){ echo '</ul>'; } ?>
<li>
<a href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>">
<span class="menu-list__title"><?php $category->name(); ?></span>
<span class="menu-list__count"><?php $category->count(); ?></span>
</a>
</li>
<?php } else { if ($lestLevels < $category->levels && $lestLevels === 0){ echo '<ul>'; } ?>
<li>
<a href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>">
<span class="menu-list__title"><?php $category->name(); ?></span>
<span class="menu-list__count"><?php $category->count(); ?></span>
</a>
</li>
<?php } $lestLevels = $category->levels; ?>
<?php endwhile; ?>
</ul>
</div>
</div>
<?php endif; ?>
<!-- end Category widget -->
<!-- start Tags widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowTags', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">标签云</h4>
<div class="widget__body tag-cloud">
<?php $this->widget('Widget_Metas_Tag_Cloud', array('sort' => 'count', 'ignoreZeroCount' => true, 'desc' => true, 'limit' => 50))->to($tags); ?>
<?php while ($tags->next()): ?>
<a rel="tag" href="<?php $tags->permalink(); ?>"><?php $tags->name(); ?>(<?php $tags->count(); ?>)</a>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<!-- end Tags widget -->
<!-- start RecentPosts widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowRecentPosts', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">最新文章</h4>
<div class="widget__body recent-posts">
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=3')->to($contents); $cont = 1; ?>
<?php while ($contents->next()): ?>
<div class="recent-posts__item">
<a href="<?php $contents->permalink() ?>" class="recent-posts__title"><?php $contents->title() ?></a>
<div class="recent-posts__date"><?php $contents->date('Y年m月d日') ?></div>
</div>
<?php $cont += 1; if ($cont > 3) break; ?>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<!-- end RecentPosts widget -->
<!-- start RecentComments widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowRecentComments', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">最新评论</h4>
<div class="widget__body recent-posts">
<?php $this->widget('Widget_Comments_Recent', 'ignoreAuthor=true&pageSize=3')->to($comments); ?>
<?php while ($comments->next()): ?>
<div class="recent-posts__item">
<a href="<?php $comments->permalink() ?>" class="recent-posts__title"><?php $comments->excerpt('40'); ?></a>
<div class="recent-posts__date"><?php $comments->date('Y年m月d日') ?> # <?php $comments->author(false); ?></div>
</div>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<!-- end RecentComments widget -->
<!-- start Archive widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowArchive', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">归档列表</h4>
<div class="widget__body">
<ul class="menu-list">
<?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=Y年 m月')->to($parses); ?>
<?php while ($parses->next()): ?>
<li>
<a href="<?php $parses->permalink() ?>">
<span class="menu-list__title"><?php $parses->date('Y年m月') ?></span>
<span class="menu-list__count"><?php $parses->count() ?>篇</span>
</a>
</li>
<?php endwhile; ?>
</ul>
</div>
</div>
<?php endif; ?>
<!-- end Archive widget -->
<!-- start Text widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowText', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title"><?php $this->options->text_title(); ?></h4>
<div class="widget__body widget__body--center">
<?php $this->options->text_info(); ?>
</div>
</div>
<?php endif; ?>
<!-- end Text widget -->
<!-- start Links widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowLinks', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">友情链接</h4>
<div class="widget__body recent-posts">
<?php add_links($this); ?>
</div>
</div>
<?php endif; ?>
<!-- end Links widget -->
<!-- start Others widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowOther', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="widget__title">管理功能</h4>
<div class="widget__body">
<ul class="menu-list">
<?php if ($this->user->hasLogin()): ?>
<li>
<a href="<?php $this->options->adminUrl(); ?>"><?php _e('进入后台'); ?> (<?php $this->user->screenName(); ?>)</a>
<a href="<?php $this->options->logoutUrl(); ?>"><?php _e('退出'); ?></a>
</li>
<?php else: ?>
<li><a href="<?php $this->options->adminUrl('login.php'); ?>"><?php _e('登录'); ?></a></li>
<?php endif; ?>
<li><a href="<?php $this->options->feedUrl(); ?>"><?php _e('文章 RSS'); ?></a></li>
<li><a href="<?php $this->options->commentsFeedUrl(); ?>"><?php _e('评论 RSS'); ?></a></li>
</ul>
</div>
</div>
<?php endif; ?>
<!-- end Others widget -->
</aside>