forked from awinds/xaink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
220 lines (194 loc) · 5.38 KB
/
functions.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;
error_reporting(0);
use \Typecho\Widget\Helper\Form\Element\Text;
use \Typecho\Widget\Helper\Form\Element\Checkbox;
use \Typecho\Widget\Helper\Form\Element\Radio;
use \Typecho\Widget\Helper\Form\Element\Textarea;
require_once('core/utils.php');
require_once('core/like.php');
function themeConfig($form)
{
$logoUrl = new Text(
'logoUrl',
null,
null,
_t('站点LOGO地址'),
_t('站点LOGO地址, 建议大小比例为202*66, 为空则显示asset/images/logo.png')
);
$form->addInput($logoUrl);
$authorAvatar = new Text(
'authorAvatar',
null,
null,
_t('自定义头像'),
_t('作者显示的头像,为空则使用email显示头像')
);
$form->addInput($authorAvatar);
$authorSign = new Text(
'authorSign',
null,
null,
_t('签名'),
_t('作者签名,为空则显示博客站点描述')
);
$form->addInput($authorSign);
$authorProfile = new Text(
'authorProfile',
null,
null,
_t('作者简介'),
_t('作者自我简介')
);
$form->addInput($authorProfile);
$authorWechat = new Text(
'authorWechat',
null,
null,
_t('微信'),
_t('微信用户名')
);
$form->addInput($authorWechat);
$authorQQ = new Text(
'authorQQ',
null,
null,
_t('QQ'),
_t('QQ号')
);
$form->addInput($authorQQ);
$authorEmail = new Text(
'authorEmail',
null,
null,
_t('联系Email'),
_t('联系Email')
);
$form->addInput($authorEmail);
$authorGithub = new Text(
'authorGithub',
null,
null,
_t('Github'),
_t('Github用户名')
);
$form->addInput($authorGithub);
$authorWeibo = new Text(
'authorWeibo',
null,
null,
_t('微博'),
_t('微博用户名')
);
$form->addInput($authorWeibo);
$authorTwitter = new Text(
'authorTwitter',
null,
null,
_t('Twitter'),
_t('Twitter用户名')
);
$form->addInput($authorTwitter);
$authorTelegram = new Text(
'authorTelegram',
null,
null,
_t('Telegram'),
_t('Telegram用户名')
);
$form->addInput($authorTelegram);
$authorInstagram = new Text(
'authorInstagram',
null,
null,
_t('Instagram'),
_t('Instagram用户名')
);
$form->addInput($authorInstagram);
$siteBeiAn = new Text(
'siteBeiAn',
null,
null,
_t('网站备案号'),
_t('网站备案号')
);
$form->addInput($siteBeiAn);
$sidebarBlock = new Checkbox(
'sidebarBlock',
[
'ShowPopularArticles' => _t('显示最热文章'),
'ShowRecentComments' => _t('显示最新评论'),
'ShowArchive' => _t('显示归档'),
'PopularTags' => _t('显示热门标签'),
],
['ShowPopularArticles', 'ShowRecentComments', 'ShowArchive', 'PopularTags'],
_t('侧边栏显示'),
_t('默认显示最热文章,最新评论,归档,热门标签')
);
$form->addInput($sidebarBlock->multiMode());
$enablePostCopyright = new Radio(
"enablePostCopyright",
[
"yes" => _t("开启"),
"no" => _t("关闭"),
],
"no",
_t("启用文章版权显示,转载文章请添加来源url到自定义copy_link字段"),
_t("默认关闭")
);
$form->addInput($enablePostCopyright);
$siteFooterHtml = new Textarea(
'siteFooterHtml',
null,
null,
_t('底部自定义html'),
_t('底部自定义html')
);
$form->addInput($siteFooterHtml);
$menuCategoryNum = new Text(
'menuCategoryNum',
null,
6,
_t('目录显示的分类数(包括首页),超过使用更多下拉,更多只显示一级分类'),
_t('太多的分类显示不好看,默认6个')
);
$form->addInput($menuCategoryNum);
$categoryIconSvg = new Textarea(
'categoryIconSvg',
null,
null,
_t('分类对应图标SVG,每行一个,id|svg,svg的宽高设置为16'),
_t('所有分类:'.xaGetCategoryies())
);
$form->addInput($categoryIconSvg);
$categoryListStyle = new Text(
'categoryListStyle',
null,
null,
_t('有子目录则显示子目录的列表,没子目录则显示文章的标题列表,列表ID(多个用半角,分隔):1,2'),
_t('一般用于小说目录页,所有分类:'.xaGetCategoryies())
);
$form->addInput($categoryListStyle);
}
/**
* 文章与独立页自定义缩略图字段
*/
function themeFields(Typecho_Widget_Helper_Layout $layout)
{
$thumbnail = new Typecho_Widget_Helper_Form_Element_Text(
"thumbnail",
null,
null,
_t("缩略图"),
_t("输入一个图片 url,作为缩略图显示在文章列表,没有则不显示")
);
$layout->addItem($thumbnail);
$copy_link = new Typecho_Widget_Helper_Form_Element_Text(
"copy_link",
null,
null,
_t("转发来源"),
_t("输入转发来源的 url,原创则保持为空")
);
$layout->addItem($copy_link);
}