-
Notifications
You must be signed in to change notification settings - Fork 26
/
codestar-framework.php
348 lines (333 loc) · 14.2 KB
/
codestar-framework.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<?php if (!defined('ABSPATH')) {
die;
} // Cannot access directly.
/**
*
* @package Codestar Framework - WordPress Options Framework
* @author Codestar <info@codestarthemes.com>
* @link http://codestarframework.com
* @copyright 2015-2021 Codestar
*
*
* Plugin Name: Codestar Framework
* Plugin URI: http://codestarframework.com/
* Author: Codestar
* Author URI: http://codestarthemes.com/
* Version: 2.2.4
* Description: A Simple and Lightweight WordPress Option Framework for Themes and Plugins
* Text Domain: csf
* Domain Path: /languages
*
*/
require_once plugin_dir_path(__FILE__) . 'classes/setup.class.php';
// Check core class for avoid errors
// Check core class for avoid errors
if (class_exists('CSF')) {
// Set a unique slug-like ID
$prefix = 'baolog_framework';
// Create options
CSF::createOptions($prefix, array(
'ajax_save' => false,
'menu_title' => 'baolog主题选项',
'menu_slug' => 'baolog-framework',
));
// 全局设置
CSF::createSection($prefix, array(
'title' => '全局设置',
'icon' => 'fa fa-home',
'fields' => array(
array(
'type' => 'heading',
'content' => '这里的全局记得填写好相关配置哦',
),
// A Notice
array(
'type' => 'notice',
'style' => 'success',
'content' => '当前主题版本为V0.3.3,请关注作者https://github.com/paopao233查看更新内容。加入QQ群一起探讨:781506134',
),
array(
'id' => 'baolog-favicon',
'type' => 'upload',
'title' => '网站图标',
'default' => get_stylesheet_directory_uri() . '/favicon.ico',
'desc' => '默认是主题根目录的favicon.ico,可直接替换或者在这里重新上传',
'help' => '默认是主题根目录的favicon.ico,可直接替换或者在这里重新上传',
'subtitle' => '全站icon',
),
array(
'id' => 'baolog-description',
'type' => 'text',
'title' => '网站描述',
'subtitle' => '针对SEO的描述 例如:又一个Wordpress网站',
'default' => '又一个Wordpress网站',
'help' => '可为空',
),
array(
'id' => 'baolog-keywords',
'type' => 'text',
'title' => '网站关键词',
'subtitle' => '针对SEO的关键字 例如:线报主题,parklot,github,线报',
'default' => '线报主题,parklot,github,线报',
'help' => '请使用英文逗号隔开,可为空',
),
// A text field
array(
'id' => 'baolog-beian',
'type' => 'text',
'title' => '备案号',
'subtitle' => '显示在底部的备案号信息 例如:粤ICP备19024161号',
'default' => '粤ICP备xxxxxxxx号',
'help' => '可为空',
),
array(
'id' => 'baolog-website-create',
'type' => 'text',
'title' => '网站成立时间',
'subtitle' => '显示在底部的网站成立时间 默认:2020-2021 ',
'default' => '2020-2021',
'help' => '可为空',
),
array(
'id' => 'baolog-posts-blank',
'type' => 'switcher',
'title' => '首页文章新标签打开方式',
'subtitle' => '默认是当前标签载入文章',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140
),
array(
'id' => 'baolog-gutenberg',
'type' => 'switcher',
'title' => '关闭古腾堡编辑器',
'desc' => '关闭新版的文章编辑器',
'subtitle' => '默认是开启古腾堡编辑器的,如果要禁用,需要自己在这里点开启此功能!',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140,
),
array(
'id' => 'baolog-index-menu',
'type' => 'switcher',
'title' => '关闭首页导航',
'desc' => '首页导航既是最新线报、24小时热门这个导航,做博客可关闭',
'subtitle' => '默认是开启',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140,
), array(
'id' => 'baolog-footer-custom',
'type' => 'code_editor',
'sanitize' => false,
'title' => '自定义footer',
'desc' => '例如:<p type="text/javascript">This is inserted at the footer</p>',
'subtitle' => '显示在底部的链接,支持html代码,同样支持javascript',
'help' => '为空则不显示',
), array(
'id' => 'baolog-footer-analysis',
'type' => 'code_editor',
'sanitize' => false,
'settings' => array(
'theme' => 'mbo',
'mode' => 'javascript',
),
'title' => '统计代码',
'desc' => '例如:<script>我是统计代码~</script>',
'subtitle' => '自定义统计代码,可用百度统计,CNZZ...',
'help' => '为空则不显示',
),
)
));
// 页面设置
CSF::createSection($prefix, array(
'title' => '页面设置',
'icon' => 'fa fa-navicon',
'fields' => array(
array(
'type' => 'heading',
'content' => '有关页面的设置',
),
array(
'type' => 'subheading',
'content' => '页面配置,不是文章页面,单纯的页面的相关配置',
),
array(
'id' => 'baolog-page-login',
'type' => 'text',
'title' => '用户登录页面地址',
'desc' => '文章里面的赞助网站页面链接,需要自己手动创建一个以登录为模板的页面。默认是:' . get_option('home') . '/login.html',
'default' => get_option('home') . '/login.html',
),
array(
'id' => 'baolog-page-signup',
'type' => 'text',
'title' => '用户注册页面地址',
'desc' => '显示在登录页面处的注册链接,需要自己手动创建一个以注册为模板的页面。默认是:' . get_option('home') . '/signup.html',
'default' => get_option('home') . '/signup.html',
),
)
));
// 文章设置
CSF::createSection($prefix, array(
'title' => '文章设置',
'icon' => 'fa fa-clipboard',
'fields' => array(
array(
'type' => 'heading',
'content' => '有关文章页面的设置',
),
array(
'type' => 'subheading',
'content' => '文章页面配置',
),
array(
'id' => 'baolog-posts-update',
'type' => 'switcher',
'title' => '文章3天内未更新提示',
'subtitle' => '显示在文章页面',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140
), array(
'id' => 'baolog-posts-autosave',
'type' => 'switcher',
'title' => '禁用文章自动保存功能',
'desc' => '编辑文章时,会自动保存草稿,如果嫌弃这个太累赘可以禁用!',
'subtitle' => '默认是禁用',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140,
),
array(
'id' => 'baolog-posts-revisions-to-keep',
'type' => 'switcher',
'title' => '禁用文章保存修订版本功能',
'desc' => '当我们发布一个新文章时,以前的版本会保留着,如果觉得这个是累赘,可以禁用掉',
'subtitle' => '默认是禁用',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140,
),
)
));
// 图片设置
CSF::createSection($prefix, array(
'title' => '图片设置',
'icon' => 'fa fa-image',
'fields' => array(
array(
'type' => 'heading',
'content' => '主题图片相关的配置都会在这里',
),
array(
'type' => 'subheading',
'content' => '页面相关图片配置',
),
array(
'id' => 'baolog-support-alipay',
'type' => 'upload',
'title' => '赞助我们-支付宝收款图片',
'default' => get_stylesheet_directory_uri() . '/images/page/support/alipay.png',
'desc' => '默认是作者的,需要自己更换',
'help' => '显示在文章的赞助网站的自定义页面图片',
'subtitle' => '显示在文章的赞助网站的自定义页面图片',
),
array(
'id' => 'baolog-support-wechat',
'type' => 'upload',
'title' => '赞助我们-微信收款图片',
'default' => get_stylesheet_directory_uri() . '/images/page/support/wechat.png',
'desc' => '默认是作者的,需要自己更换',
'help' => '显示在文章的赞助网站的自定义页面图片',
'subtitle' => '显示在文章的赞助网站的自定义页面图片',
),
array(
'type' => 'subheading',
'content' => '侧栏相关图片配置',
),
array(
'id' => 'baolog-sidebar-app-switcher',
'type' => 'switcher',
'title' => '侧栏的app悬浮',
'desc' => '关闭侧栏app悬浮以后,下面安卓app无论有没有图片都是不会显示的。',
'subtitle' => '默认是开启',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140,
),
array(
'id' => 'baolog-sidebar-app',
'type' => 'upload',
'title' => '安卓app',
'default' => get_stylesheet_directory_uri() . '/images/app.png',
'desc' => '默认是作者的,需要自己更换',
'help' => '显示在侧栏的安卓app二维码',
'subtitle' => '显示在侧栏的安卓app二维码',
),
array(
'id' => 'baolog-sidebar-qrcode-switcher',
'type' => 'switcher',
'title' => '侧栏的二维码悬浮',
'desc' => '关闭侧栏的二维码悬浮以后,下面二维码图片无论有没有图片都是不会显示的。',
'subtitle' => '默认是开启',
'text_off' => '点击开启此功能',
'text_on' => '点击关闭此功能',
'text_width' => 140,
),
array(
'id' => 'baolog-sidebar-wx',
'type' => 'upload',
'title' => '扫一扫关注微信公众号',
'default' => get_stylesheet_directory_uri() . '/images/wx.png',
'desc' => '默认是作者的,需要自己更换,可为空,为空不显示',
'help' => '显示在侧栏的扫描公众号二维码',
'subtitle' => '显示在侧栏的扫描公众号二维码',
),
array(
'id' => 'baolog-sidebar-miniapp',
'type' => 'upload',
'title' => '扫一扫打开微信小程序',
'default' => get_stylesheet_directory_uri() . '/images/miniapp.png',
'desc' => '默认是作者的,需要自己更换,可为空,为空不显示',
'help' => '显示在文章的赞助网站的自定义页面图片',
'subtitle' => '显示在侧栏的扫描微信小程序二维码',
),
array(
'id' => 'baolog-sidebar-qqapp',
'type' => 'upload',
'title' => '扫一扫打开QQ小程序',
'default' => get_stylesheet_directory_uri() . '/images/qqapp.png',
'desc' => '默认是作者的,需要自己更换,可为空,为空不显示',
'help' => '显示在文章的赞助网站的自定义页面图片',
'subtitle' => '显示在侧栏的扫描QQ小程序二维码',
),
)
));
// 首页设置
CSF::createSection($prefix, array(
'title' => '首页设置',
'icon' => 'fa fa-window-maximize',
'fields' => array(// A textarea field
array(
'type' => 'heading',
'content' => '这里还没有设置内容哦,等待parklot更新~',
),
)
));
//备份
CSF::createSection($prefix, array(
'title' => '备份配置',
'desc' => '这里是对主题配置的一个备份',
'icon' => 'fa fa-credit-card',
'fields' => array(
array(
'type' => 'heading',
'content' => '每次更新主题的时候,记得把相关配置导出备份哦~',
),
array(
'type' => 'backup',
),
)
));
}