-
Notifications
You must be signed in to change notification settings - Fork 33
/
sidebar.php
220 lines (198 loc) · 8.44 KB
/
sidebar.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
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
218
219
220
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<aside class="col-md-4 sidebar">
<!-- start Search widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowSearch', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="title">搜索</h4>
<div class="content community sidebar-search">
<form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
<label for="s" class="sr-only"><?php _e('搜索关键字'); ?></label>
<input aria-label="search input" type="text" name="s" class="text asearch" placeholder="<?php _e('输入关键字搜索'); ?>" />
<button type="submit"></button>
</form>
</div>
</div>
<?php endif; ?>
<!-- end Search widget -->
<!-- start Abouts widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowAbouts', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="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)){echo 'top: 168px;';} ?>"></div>
<?php endif; ?>
<div class="card">
<div class="card-info">
<img class="card-info-img" src="<?php $this->options->cardImg(); ?>">
<div class="card-info-name"><?php $this->options->cardName(); ?></div>
<div class="card-info-description"><?php $this->options->cardDescription(); ?></div>
</div>
<!--div class="card-icon"-->
<?php add_cardlinks($this); ?>
<!--/div-->
<div class="card-data">
<?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?>
<div class="card-data-item">
<div class="headline">文章</div>
<div class="length-num"><?php $stat->publishedPostsNum() ?></div>
</div>
<div class="card-data-item">
<div class="headline">分类</div>
<div class="length-num"><?php $stat->categoriesNum() ?></div>
</div>
<div class="card-data-item">
<div class="headline">评论</div>
<div class="length-num"><?php $stat->publishedCommentsNum() ?></div>
</div>
<div class="card-data-item">
<div class="headline">页面</div>
<div class="length-num"><?php echo $stat->publishedPagesNum + $stat->publishedPostsNum; ?></div>
</div>
</div>
<div class="card-text">
<span>已在风雨中度过 <?php echo getBuildTime();?></span>
</div>
</div>
</div>
<?php endif; ?>
<!-- end Abouts widget -->
<!-- start Category widget -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowCategory', $this->options->sidebarBlock)): ?>
<div class="widget">
<h4 class="title">分类</h4>
<div class="category">
<?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-title"><?php $category->name(); ?></span>
<span class="menu-count label"><?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-title"><?php $category->name(); ?></span>
<span class="menu-count label"><?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="title">标签云</h4>
<div class="content 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="title">最新文章</h4>
<div class="content recent-post">
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=3')->to($contents); $cont=1;?>
<?php while($contents->next()): ?>
<div class="recent-single-post">
<a href="<?php $contents->permalink() ?>" class="post-title">
<?php $contents->title() ?></a>
<div class="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="title">最新评论</h4>
<div class="content recent-post">
<?php $this->widget('Widget_Comments_Recent','ignoreAuthor=true&pageSize=3')->to($comments); ?>
<?php while ($comments->next()): ?>
<div class="recent-single-post">
<a href="<?php $comments->permalink() ?>" class="post-title">
<?php $comments->excerpt('40'); ?></a>
<div class="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="title">归档列表</h4>
<div class="category">
<ul class="custom-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=".custom-title"><?php $parses->date('Y年m月') ?></span><span class="custom-count label"><?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="title"><?php $this->options->text_title(); ?></h4>
<div class="content recent-post">
<div class="recent-single-post" align="center">
<?php $this->options->text_info(); ?>
</div>
</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="title">友情链接</h4>
<div class="content recent-post">
<!-- start Links list -->
<?php add_links($this); ?>
<!-- end Links list -->
</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="title">其他</h4>
<div class="category">
<ul class="widget-list">
<?php if($this->user->hasLogin()): ?>
<li class="category-level-0 category-parent">
<a href="<?php $this->options->adminUrl(); ?>"><?php _e('进入后台'); ?> (<?php $this->user->screenName(); ?>)</a>
<a href="<?php $this->options->logoutUrl(); ?>"><?php _e('退出'); ?>
</li>
<?php else: ?>
<li class="category-level-0 category-parent"><a href="<?php $this->options->adminUrl('login.php'); ?>"><?php _e('登录'); ?></a></li>
<?php endif; ?>
<li class="category-level-0 category-parent"><a href="<?php $this->options->feedUrl(); ?>"><?php _e('文章 RSS'); ?></a></li>
<li class="category-level-0 category-parent"><a href="<?php $this->options->commentsFeedUrl(); ?>"><?php _e('评论 RSS'); ?></a></li>
</ul>
</div>
</div>
<?php endif; ?>
<!-- end Others widget -->
</aside>