-
Notifications
You must be signed in to change notification settings - Fork 33
/
functions.php
136 lines (115 loc) · 5.55 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
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
function themeConfig($form)
{
include_once 'libray/i18n/index.php';
include_once 'libray/update.php';
Update::valid();
$fav = new Typecho_Widget_Helper_Form_Element_Text('fav', NULL, NULL, _t('Favicon'), _i18n('请填入完整链接,作为网站标签页图标,手机建议大小 114x114'));
$form->addInput($fav);
$default_thumb = new Typecho_Widget_Helper_Form_Element_Text('default_thumb', NULL, NULL, _i18n('文章默认、随机头图'), _i18n('若文章内未抓取到图片则默认使用此地址作为图片'));
$form->addInput($default_thumb);
$backGroundImage = new Typecho_Widget_Helper_Form_Element_Text('backGroundImage', NULL, NULL, _i18n('网站 Banner 背景图'), _i18n('请填入完整链接'));
$form->addInput($backGroundImage);
$authorImage = new Typecho_Widget_Helper_Form_Element_Text('authorImage', NULL, NULL, _i18n('网站概要头像'), _i18n('请填入完整链接,作为网站头像,不填则为默认,建议为方形'));
$form->addInput($authorImage);
$liveTime = new Typecho_Widget_Helper_Form_Element_Text('liveTime', NULL, NULL, _i18n('建站日期'), _i18n('格式:2017/11/02 11:31:29'));
$form->addInput($liveTime);
/* Social account */
$GitHubLink = new Typecho_Widget_Helper_Form_Element_Text('GitHubLink', NULL, NULL, _t('GitHub'), _i18n('请填入完整链接'));
$form->addInput($GitHubLink);
$TwitterLink = new Typecho_Widget_Helper_Form_Element_Text('TwitterLink', NULL, NULL, _t('twitter'), _i18n('请填入完整链接'));
$form->addInput($TwitterLink);
$QQLink = new Typecho_Widget_Helper_Form_Element_Text('QQLink', NULL, NULL, _t('QQ'), _i18n('请填入完整链接'));
$form->addInput($QQLink);
$WechatQR = new Typecho_Widget_Helper_Form_Element_Text('WechatQR', NULL, NULL, _i18n('微信二维码'), _i18n('请填入完整二维码图片链接'));
$form->addInput($WechatQR);
$AlipayQR = new Typecho_Widget_Helper_Form_Element_Text('AlipayQR', NULL, NULL, _i18n('支付宝二维码'), _i18n('请填入完整二维码图片链接'));
$form->addInput($AlipayQR);
$customCss = new Typecho_Widget_Helper_Form_Element_Textarea('customCss', NULL, NULL, _t('Custom CSS Code'), _i18n('需要 `style` 标签'));
$form->addInput($customCss);
$customScript = new Typecho_Widget_Helper_Form_Element_Textarea('customScript', NULL, NULL, _t('Custom JS Code ( eg:Google Analytics Code ) '), _i18n('不需要 `script` 标签'));
$form->addInput($customScript);
$StyleSettings = new Typecho_Widget_Helper_Form_Element_Checkbox(
'StyleSettings',
array(
'Banner' => _i18n('是否显示 Banner'),
),
array('Banner'),
_i18n('主题样式设置')
);
$form->addInput($StyleSettings->multiMode());
/* Theme feature */
$feature = new Typecho_Widget_Helper_Form_Element_Checkbox(
'feature',
array(
'showThumb' => _i18n('文章缩略图'),
'ribbons' => _i18n('彩带背景'),
'codeHighlight' => _i18n('代码高亮'),
'commentEmoji' => _i18n('评论表情'),
'lazyImg' => _i18n('文章内图片懒加载'),
'pjax' => _i18n('instantclick 支持'),
),
array(),
_i18n('额外功能设置')
);
$form->addInput($feature->multiMode());
$siderbarOption = new Typecho_Widget_Helper_Form_Element_Checkbox(
'siderbarOption',
array(
'TopViewPost' => _i18n('热门文章'),
'topComnentPost' => _i18n('热评文章'),
'randomPost' => _i18n('随机文章'),
),
array(),
_i18n('侧栏相关设置')
);
$form->addInput($siderbarOption->multiMode());
$CDN = new Typecho_Widget_Helper_Form_Element_Radio(
'CDN',
array(
'local' => _i18n('local'),
'jsdelivr' => _i18n('jsdelivr'),
'sourcegcdn' => _i18n('sourcegcdn'),
'fivecdn' => _i18n('fivecdn'),
),
'local',
_i18n('CDN setting'),
_i18n('CDN setting')
);
$form->addInput($CDN);
$codeHighlightTheme = new Typecho_Widget_Helper_Form_Element_Radio(
'codeHighlightTheme',
array(
'default' => _i18n('Default'),
'okaidia' => _i18n('Okaidia'),
'coy' => _i18n('COY'),
'solarizedlight' => _i18n('Solarized Light'),
'tomorrow' => _i18n('Tomorrow Night'),
),
'default',
_i18n('代码高亮'),
_i18n('代码高亮')
);
$form->addInput($codeHighlightTheme);
}
function themeInit($widget)
{
require_once 'libray/update.php';
define('__THEME_VERSION__', Update::getLocalVersion());
require_once 'libray/i18n/index.php';
require_once 'libray/theme-helper.php';
require_once 'libray/field.php';
require_once 'libray/short-code.php';
require_once 'libray/cdn.php';
}
function themeFields(Typecho_Widget_Helper_Layout $layout)
{
require_once 'libray/i18n/index.php';
$thumb = new Typecho_Widget_Helper_Form_Element_Text('thumb', NULL, NULL, _t('头图地址(thumb)'), _t('输入图片URL,则优先使用该图片作为头图。'));
$layout->addItem($thumb);
$thumbAlt = new Typecho_Widget_Helper_Form_Element_Text('thumbAlt', NULL, NULL, _t('头图描述(alt)'), _t('输入图片的描述。'));
$layout->addItem($thumbAlt);
$views = new Typecho_Widget_Helper_Form_Element_Text('views', NULL, 0, _i18n('文章浏览数'), _i18n('文章浏览数统计'));
$layout->addItem($views);
}