-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·122 lines (110 loc) · 4.04 KB
/
Copy pathfunctions.php
File metadata and controls
executable file
·122 lines (110 loc) · 4.04 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
<?php
function themeConfig($form) {
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点LOGO地址'), _t('在这里填入一个图片URL地址, 以在网站标题前加上一个LOGO'));
$form->addInput($logoUrl);
$sidebarBlock = new Typecho_Widget_Helper_Form_Element_Checkbox('sidebarBlock',
array('ShowRecentPosts' => _t('显示最新文章'),
'ShowRecentComments' => _t('显示最近回复'),
'ShowCategory' => _t('显示分类'),
'ShowArchive' => _t('显示归档'),
'ShowOther' => _t('显示其它杂项')),
array('ShowRecentPosts', 'ShowRecentComments', 'ShowCategory', 'ShowArchive', 'ShowOther'), _t('侧边栏显示'));
$form->addInput($sidebarBlock->multiMode());
}
function themeFields($layout) {
$isLatex = new Typecho_Widget_Helper_Form_Element_Radio('isLatex',
array(1 => _t('启用'),
0 => _t('关闭')),
0, _t('LaTeX 渲染'), _t('默认关闭增加网页访问速度,如文章内存在LaTeX语法则需要启用'));
$layout->addItem($isLatex);
}
?>
<?php
function threadedComments($comments, $options) {
$commentClass = '';
if ($comments->authorId) {
if ($comments->authorId == $comments->ownerId) {
$commentClass .= ' commentbyauthor';
} else {
$commentClass .= ' commentbyuser';
}
}
$commentLevelClass = $comments->levels > 0 ? ' comment-child' : 'comment-parent';
?>
<li id="li-comment-<?php $comments->theId(); ?>" class="mb-3 comment comments-area<?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;
?>">
<article id="<?php $comments->theId(); ?>" class="comment">
<header class="comment-meta comment-author vcard">
<?php $comments->gravatar('40', ''); ?>
<span class="fn">
<?php $comments->author(); ?>
</span>
<small href="<?php $comments->permalink(); ?>">
<time datetime="<?php $comments->date('c'); ?>">
<?php $comments->date('Y年m月d日G:i'); ?>
</time>
</small>
</header>
<section class="comment-content comment">
<?php $comments->content(); ?>
</section>
<div class="reply badge" style="font-size: 105%;">
<?php
$comments->reply('回复');
_e('<span>↓</span>');
?>
</div>
</article>
<hr style="border-style: dashed;" />
<?php if ($comments->children) { ?>
<div class="children mt-2">
<?php $comments->threadedComments($options); ?>
</div>
<?php } ?>
</li>
<?php } ?>
<?php function Postviews($archive) {
$db = Typecho_Db::get();
$cid = $archive->cid;
if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) {
$db->query('ALTER TABLE `'.$db->getPrefix().'contents` ADD `views` INT(10) DEFAULT 0;');
}
$exist = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid))['views'];
if ($archive->is('single')) {
$cookie = Typecho_Cookie::get('contents_views');
$cookie = $cookie ? explode(',', $cookie) : array();
if (!in_array($cid, $cookie)) {
$db->query($db->update('table.contents')
->rows(array('views' => (int)$exist+1))
->where('cid = ?', $cid));
$exist = (int)$exist+1;
array_push($cookie, $cid);
$cookie = implode(',', $cookie);
Typecho_Cookie::set('contents_views', $cookie);
}
}
echo $exist == 0 ? ' 暂无阅读' : ' 阅读:' .$exist;
}
?>
<?php
function formatPostDate($post) {
$currentDate = time();
$dateFormat = '';
if (date('Y', $currentDate) == $post->date('Y')) {
if (date('mj', $currentDate) == $post->date('mj')) {
return 'H:i';
} else {
return 'm月j日H:i';
}
} else {
}
}
?>