This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy patharchive.php
137 lines (122 loc) · 5.94 KB
/
archive.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
<?php
/**
* Castle Archive
* Last Update: 2022/04/04
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
if (@$_SERVER['HTTP_X_PJAX'] == true) {
header('HTTP/1.1 200 OK');
echo '<title>'.Castle_Header::title($this, '', ' - ', true, false).'</title>';
echo '<div id="moe-pjax-content"'.Castle_Header::cardTransparent().'>';
}else{
$this->need('core/inc/header.php');
}
?>
<main id="moe-post-list">
<div class="mdui-card moe-archive-top-card">
<main><?php
$this->archiveTitle(array(
'category' => _t('分类<i>%s</i>下的文章'),
'search' => _t('包含关键字<i>%s</i>的文章'),
'tag' => _t('标签<i>%s</i>下的文章'),
'author' => _t('<i>%s</i>发布的文章')), '', '');
?></main>
</div>
<?php while($this->next()): ?>
<?php
$PostType = $this->fields->PostType;
if ($PostType == 'nopic') { ?>
<div class="mdui-card mdui-hoverable moe-nopic-card">
<div class="moe-left-icon">
<i class="mdui-icon material-icons"><?php
$postSeting = Castle_Contents::getSetting($this, 'indexIcon');
echo (!empty($postSeting)) ? $postSeting : '';
?></i>
</div>
<h2 class="moe-nopic-title">
<a href="<?php $this->permalink() ?>"><?php $this->sticky(); $this->title() ?></a>
</h2>
<div class="moe-nopic-excerpt">
<?php if (!$this->excerpt && !$this->fields->excerpt) {
echo $GLOBALS['CastleLang']['index']['excerptEmpty'];
} elseif ($this->fields->excerpt) {
echo Castle_Contents::parseOwO($this->fields->excerpt);
} else {
$this->excerpt(100);
} ?>
</div>
<div class="mdui-divider"></div>
<div class="moe-nopic-info">
<i class="mdui-icon material-icons moe-author-icon">account_circle</i>
<span><?php $this->author(); ?></span>
<i class="mdui-icon material-icons moe-time-icon">access_time</i>
<span><?php $this->date($GLOBALS['CastleLang']['index']['time']); ?></span>
<i class="mdui-icon material-icons">forum</i>
<span><?php echo sprintf($GLOBALS['CastleLang']['index']['comment'], $this->commentsNum); ?></span>
<?php if (Helper::options()->WordsCounterSwitch && in_array('index', Helper::options()->WordsCounterSwitch)) { ?>
<i class="mdui-icon material-icons">border_color</i>
<span><?php echo sprintf($GLOBALS['CastleLang']['index']['wordNum'], Castle_WordCounter::charactersNum($this)); ?></span><?php } ?>
</div>
</div>
<?php }else{ ?>
<div class="mdui-card mdui-hoverable moe-default-card">
<div class="mdui-card-media">
<div class="moe-card-cover-image lazyload" data-src="<?php
$cover = $this->fields->cover;
if (!empty($cover)) {
echo $cover;
}else{
Castle_Libs::randCover(true);
}
?>" style="background-image:url('');"></div>
<div class="mdui-card-media-covered">
<div class="mdui-card-primary">
<a href="<?php $this->permalink() ?>" class="mdui-card-primary-title mdui-text-truncate"><?php $this->sticky(); $this->title() ?></a>
<div class="mdui-card-primary-subtitle"><?php echo sprintf($GLOBALS['CastleLang']['index']['view'], Castle_Contents::PostView($this)); ?> | <?php echo sprintf($GLOBALS['CastleLang']['index']['comment'], $this->commentsNum); ?><?php if (Helper::options()->WordsCounterSwitch && in_array('index', Helper::options()->WordsCounterSwitch)) { ?> | <?php echo sprintf($GLOBALS['CastleLang']['index']['wordNum'], Castle_WordCounter::charactersNum($this)); } ?></div>
</div>
</div>
</div>
<div class="mdui-card-actions">
<div class="moe-card-excerpt">
<?php if (!$this->excerpt && !$this->fields->excerpt) {
echo $GLOBALS['CastleLang']['index']['excerptEmpty'];
} elseif ($this->fields->excerpt) {
echo Castle_Contents::parseOwO($this->fields->excerpt);
} else {
$this->excerpt(100);
} ?>
</div>
</div>
<div class="mdui-divider"></div>
<div class="mdui-card-header">
<img class="mdui-card-header-avatar" src="<?php echo (Helper::options()->siteAvatar) ? Helper::options()->siteAvatar : Castle_Libs::resources('static/img/avatar.jpg'); ?>"/>
<div class="mdui-card-header-title"><?php $this->author(); ?></div>
<div class="mdui-card-header-subtitle"><?php $this->date($GLOBALS['CastleLang']['index']['time']); ?></div>
<div class="mdui-card-menu">
<a href="<?php $this->permalink() ?>" class="mdui-btn mdui-text-color-theme"><?php echo $GLOBALS['CastleLang']['index']['viewLink']; ?></a>
</div>
</div>
</div>
<?php } ?>
<?php endwhile; ?>
<div class="moe-pagination">
<?php if ($this->_currentPage>1){ ?>
<?php $this->pageLink('<button class="mdui-btn mdui-btn-icon mdui-ripple mdui-color-theme-accent mdui-shadow-5 moe-prev"><i class="mdui-icon material-icons">navigate_before</i></button>','prev'); ?>
<?php }else{ ?>
<button class="mdui-btn mdui-btn-icon mdui-ripple mdui-color-theme-accent mdui-shadow-5 mdui-btn-raised moe-prev" disabled><i class="mdui-icon material-icons">navigate_before</i></button>
<?php } ?>
<button class="mdui-btn moe-page-number"><span class=""><?php if($this->_currentPage>1) echo $this->_currentPage; else echo 1;?> / <?php echo ceil($this->getTotal() / $this->parameter->pageSize); ?></span></button>
<?php if ($this->_currentPage<ceil($this->getTotal()/$this->parameter->pageSize)){ ?>
<?php $this->pageLink('<button class="mdui-btn mdui-btn-icon mdui-ripple mdui-color-theme-accent mdui-shadow-5 moe-next"><i class="mdui-icon material-icons">navigate_next</i></button>','next'); ?>
<?php } else { ?>
<button class="mdui-btn mdui-btn-icon mdui-ripple mdui-color-theme-accent mdui-btn-raised mdui-shadow-5 moe-next" disabled><i class="mdui-icon material-icons">navigate_next</i></button>
<?php } ?>
</div>
</main>
<?php
if (@$_SERVER['HTTP_X_PJAX'] == true) {
echo '</div>';
}else{
$this->need('core/inc/footer.php');
}
?>