-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathindex.php
executable file
·289 lines (268 loc) · 19.2 KB
/
index.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?php
/**
* 这是 Viosey 基于 Google Material Design 开发的 Typecho 主题
*
* @package Theme.Material
* @author viosey
* @version 2.4.0
* @link https://viosey.com
*/
$this->need('header.php');?>
<div class="demo-blog mdl-layout mdl-js-layout has-drawer is-upgraded">
<main class="mdl-layout__content" id="main">
<div id="top"></div>
<!-- Sidebar hamburger button -->
<button class="MD-burger-icon sidebar-toggle">
<span class="MD-burger-layer"></span>
</button>
<div class="demo-blog__posts mdl-grid">
<!-- Daily Pic -->
<div class="mdl-card daily-pic mdl-cell mdl-cell--8-col index-top-block">
<?php if (!empty($this->options->dailypic)): ?>
<div class="mdl-card__media mdl-color-text--grey-50" style="background-image:url(<?php $this->options->dailypic() ?>)">
<?php else: ?>
<?php if (!empty($this->options->CDNURL)): ?>
<div class="mdl-card__media mdl-color-text--grey-50" style="background-image:url(<?php $this->options->CDNURL() ?>/MaterialCDN/img/hiyou.jpg)">
<?php else: ?>
<div class="mdl-card__media mdl-color-text--grey-50" style="background-image:url(<?php $this->options->themeUrl('img/hiyou.jpg') ?>)">
<?php endif; ?>
<?php endif; ?>
<p class="index-top-block-slogan"><a href="<?php $this->options->dailypicLink() ?>"><?php $this->options->slogan() ?></a></p>
</div>
<div class="mdl-card__supporting-text meta mdl-color-text--grey-600">
<!-- Author avatar -->
<div id="author-avatar">
<?php if (!empty($this->options->avatarURL)): ?>
<img src="<?php $this->options->avatarURL() ?>" width="32px" height="32px" />
<?php else: ?>
<?php $this->author->gravatar(32); ?>
<?php endif; ?>
</div>
<div>
<span class="author-name-span"><a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a></span>
</div>
</div>
</div>
<!-- Blog info -->
<div class="mdl-card something-else mdl-cell mdl-cell--8-col mdl-cell--4-col-desktop index-top-block">
<!-- Search -->
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable" method="post" action="">
<label id="search-label" class="mdl-button mdl-js-ripple-effect mdl-js-button mdl-button--fab mdl-color--accent mdl-shadow--4dp" for="search">
<!-- For modern browsers. -->
<i class="material-icons mdl-color-text--white" role="presentation">search</i>
</label>
<form id="search-form" method="post" action="" class="mdl-textfield__expandable-holder">
<input class="mdl-textfield__input search-input" type="text" name="s" id="search">
<label id="search-form-label" class="mdl-textfield__label" for="search">Enter your query...</label>
</form>
</div>
<!-- LOGO -->
<div class="something-else-logo mdl-color--white mdl-color-text--grey-600">
<?php if (!empty($this->options->logoLink)): ?>
<a href="<?php $this->options->logoLink() ?>">
<?php endif; ?>
<?php if (!empty($this->options->logo)): ?>
<img src="<?php $this->options->logo() ?>">
<?php else: ?>
<?php if (!empty($this->options->CDNURL)): ?>
<img src="<?php $this->options->CDNURL() ?>/MaterialCDN/img/MaterialLOGO.png">
<?php else: ?>
<img src="<?php $this->options->themeUrl('img/MaterialLOGO.png') ?>">
<?php endif; ?>
<?php endif; ?>
</a>
</div>
<!-- Infomation -->
<div class="mdl-card__supporting-text meta meta--fill mdl-color-text--grey-600">
<div>
<strong><?php $this->options->title(); ?></strong>
</div>
<div class="section-spacer"></div>
<!-- Pages button -->
<button id="show-pages-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">view_carousel</i>
<span class="visuallyhidden">Pages</span>
</button>
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" for="show-pages-button">
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while ($pages->next()): ?>
<a href="<?php $pages->permalink(); ?>" class="md-menu-list-a" title="<?php $pages->title(); ?>">
<li class="mdl-menu__item mdl-js-ripple-effect">
<?php $pages->title(); ?>
</li>
</a>
<?php endwhile; ?>
</ul>
<!-- Menu button-->
<button id="menubtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">more_vert</i>
<span class="visuallyhidden">show menu</span>
</button>
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" for="menubtn">
<a href="<?php $this->options->feedUrl(); ?>" class="md-menu-list-a">
<li class="mdl-menu__item mdl-js-ripple-effect">
<?php if ($this->options->langis == '0'): ?> Article RSS
<?php else: ?> 文章 RSS
<?php endif; ?>
</li>
</a>
<!-- 文章的RSS地址连接 -->
<a class="md-menu-list-a" href="https://www.facebook.com/sharer/sharer.php?u=<?php $this->options->siteUrl(); ?>">
<li class="mdl-menu__item">
<?php if ($this->options->langis == '0'): ?> Share to Facebook
<?php else: ?> 分享到 Facebook
<?php endif; ?>
</li>
</a>
<a class="md-menu-list-a" href="https://telegram.me/share/url?url=<?php $this->options->siteUrl(); ?>&text=<?php $this->options->title(); ?>" >
<li class="mdl-menu__item">
<?php if ($this->options->langis == '0'): ?> Share to Telegram
<?php else: ?> 分享到 Telegram
<?php endif; ?>
</li>
</a>
<a class="md-menu-list-a" href="https://twitter.com/intent/tweet?text=<?php $this->options->title(); ?>&url=<?php $this->options->siteUrl(); ?>&via=<?php $this->author->screenName(); ?>">
<li class="mdl-menu__item">
<?php if ($this->options->langis == '0'): ?> Share to Twitter
<?php else: ?> 分享到 Twitter
<?php endif; ?>
</li>
</a>
<a class="md-menu-list-a" href="https://plus.google.com/share?url=<?php $this->options->siteUrl(); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
<li class="mdl-menu__item">
<?php if ($this->options->langis == '0'): ?> Share to Google+
<?php else: ?> 分享到 Google+
<?php endif; ?>
</li>
</a>
<a class="md-menu-list-a" href="http://service.weibo.com/share/share.php?appkey=&title=<?php $this->options->title(); ?>&url=<?php $this->options->siteUrl(); ?>&pic=&searchPic=false&style=simple ">
<li class="mdl-menu__item">
<?php if ($this->options->langis == '0'): ?> Share to Weibo
<?php else: ?> 分享到新浪微博
<?php endif; ?>
</li>
</a>
</ul>
</div>
</div>
<?php if ($this->is('index')): ?>
<?php
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
$sticky_posts = $db->fetchAll($this->db
->select()->from($prefix.'contents')
->orWhere('cid = ?', $this->options->sticky_1)
->orWhere('cid = ?', $this->options->sticky_2)
->where('type = ? AND status = ? AND password IS NULL', 'post', 'publish'));
rsort($sticky_posts);//对数组逆向排序,即大ID在前
foreach ($sticky_posts as $sticky_posts) {
$result = Typecho_Widget::widget('Widget_Abstract_Contents')->push($sticky_posts);
$post_views = number_format($result['views']);
$post_title = htmlspecialchars($result['title']);
$post_date = date('M d,Y', $result['created']);
$permalink = $result['permalink'];
/*if($post_views > $this->options->view_num){echo 'HOT';} else {echo ''.$post_views.''' VIEW';};*/
echo '
<!-- Article module -->
<div class="mdl-article-top mdl-cell mdl-cell--12-col '.((!empty($this->options->switch) && in_array('ShowLoadingLine', $this->options->switch))?"fade out":"").' ">
<p class="article-headline-p-top"><a href="'.$permalink.'" target="_self"><span style="color:">[置顶] </span><span style="color:#757575">'.$post_title .'</span></a></p>
</div>
'."\n\r";
}
?>
<?php endif; ?>
<?php while ($this->next()): ?>
<!-- Article module -->
<div class="mdl-card mdl-cell mdl-cell--12-col article-module <?php if (!empty($this->options->switch) && in_array('ShowLoadingLine', $this->options->switch)): ?>fade out<?php endif; ?>">
<!-- Article link & title -->
<?php if ($this->options->ThumbnailOption == '1'): ?>
<div class="mdl-card__media mdl-color-text--grey-50 " style="background-image:url(<?php showThumbnail($this); ?>)">
<p class="article-headline-p"><a href="<?php $this->permalink() ?>" target="_self"><?php $this->title() ?></a></p>
</div>
<?php elseif ($this->options->ThumbnailOption == '2'): ?>
<div class="mdl-card__media mdl-color-text--grey-50" style="background-color:<?php $this->options->TitleColor()?> !important;color:#757575 !important;">
<p class="article-headline-p-nopic">
<a href="<?php $this->permalink() ?>" target="_self">
“</br><?php $this->title() ?></br>”
</a>
</p>
</div>
<?php elseif ($this->options->ThumbnailOption == '3'): ?>
<div class="mdl-card__media mdl-color-text--grey-50 " style="background-image:url(<?php randomThumbnail($this); ?>)">
<p class="article-headline-p"><a href="<?php $this->permalink() ?>" target="_self"><?php $this->title() ?></a></p>
</div>
<?php endif; ?>
<!-- Article content -->
<div class="mdl-color-text--grey-600 mdl-card__supporting-text index-article-content">
<!-- $this->content('Continue Reading...'); -->
<?php $this->excerpt(80, '...'); ?>
<span>
<a href="<?php $this->permalink(); ?>" target="_self">
<?php if ($this->options->langis == '0'): ?>
Continue Reading
<?php elseif ($this->options->langis == '1'): ?>
继续阅读
<?php elseif ($this->options->langis == '2'): ?>
繼續閱讀
<?php endif; ?>
</a>
</span>
</div>
<!-- Article info-->
<div id="article-info">
<div class="mdl-card__supporting-text meta mdl-color-text--grey-600 " id="article-author-date">
<!-- Author avatar -->
<div id="author-avatar">
<?php if (!empty($this->options->avatarURL)): ?>
<img src="<?php $this->options->avatarURL() ?>" width="44px" height="44px" />
<?php else: ?>
<?php $this->author->gravatar(44); ?>
<?php endif; ?>
</div>
<div>
<span class="author-name-span"><a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a></span>
<span>
<?php if ($this->options->langis == '0'): ?>
<?php $this->date('F j, Y'); ?>
<?php else: ?>
<?php $this->dateWord(); ?>
<?php endif; ?>
</span>
</div>
</div>
<div id="article-category-comment" style="color:<?php $this->options->alinkcolor(); ?>">
<?php $this->category(', '); ?> |
<a href="<?php $this->permalink() ?>">
<!-- 使用多说评论 -->
<?php if ($this->options->commentis == '1'): ?><span class="ds-thread-count" data-thread-key="<?php echo $this->cid;?>" data-count-type="comments"></span>
<!-- 使用原生评论 -->
<?php else: ?>
<?php $this->commentsNum('%d 评论'); ?>
<?php endif; ?>
</a>
</div>
</div>
</div>
<?php endwhile; ?>
<nav class="demo-nav mdl-cell mdl-cell--12-col">
<?php $this->pageLink(
'<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">arrow_back</i>
</button>'); ?>
<div class="section-spacer"></div>
page
<?php if ($this->_currentPage>1) {
echo $this->_currentPage;
} else {
echo 1;
}?> of
<?php echo ceil($this->getTotal() / $this->parameter->pageSize); ?>
<div class="section-spacer"></div>
<?php $this->pageLink(
'<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">arrow_forward</i>
</button>', 'next'); ?>
</nav>
</div>
<?php include('sidebar.php'); ?>
<?php include('footer.php'); ?>