-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathfunctions.php
More file actions
5751 lines (5514 loc) · 261 KB
/
Copy pathfunctions.php
File metadata and controls
5751 lines (5514 loc) · 261 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
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
error_reporting(0);
use Typecho\Common;
use Typecho\Exception;
use Typecho\Router;
use Utils\Helper;
use Widget\Options;
if(!class_exists('CSF')){
require_once Helper::options()->pluginDir('BsCore').'/bsoptions-framework.php';
}
if (!class_exists('bsOptions')){
require_once \Utils\Helper::options()->pluginDir('BsCore').'/bsOptions.php';
}
require_once('core/func.php');
function themeVersion()
{
return '2.9.9.20250803';
}
function themeVersionOnly()
{
return '2.9.9';
}
$options = bsOptions::getInstance()::get_option( 'bearsimple' );
function Bsoptions($key, $default = false){
$options = bsOptions::getInstance()::get_option( 'bearsimple' );
return $options[$key];
}
/**解析表情**/
$emo = false;
function reEmo($comment,$type){
global $emo;
$options = Helper::options();
if(!$emo){
$opts = array(
'http'=>array(
'method' => 'GET',
'header' => 'Content-type: application/json',
'timeout' => 60,
'Connection'=>"close"
)
);
$context = stream_context_create($opts);
if(Bsoptions('Emoji_HideDefault') == false || Bsoptions('Emoji_HideDefault') == ''){
$res = json_decode(file_get_contents(__DIR__.'/assets/vendors/bs-emoji/bs-emoji.json', false, $context),true);
$emo = $res;
}
if(Bsoptions('Emoji_Diy') == true && Bsoptions('Emoji_DiyUrl') !== ''){
$res2 = json_decode(file_get_contents(Bsoptions('Emoji_DiyUrl'), false, $context),true);
if(Bsoptions('Emoji_HideDefault') == false || Bsoptions('Emoji_HideDefault') == ''){
$emo = array_merge($res,$res2);
}
else{
$emo = $res2;
}
}
}
foreach ($emo as $v){
if($v['category'] !== ''){
if($type == 'comment'){
$comment = str_replace($v['data'], '<img width="30" src='.$v['icon'] .''.' loading="lazy" style="vertical-align:bottom">', $comment);
}
elseif($type == 'reply'){
$comment = str_replace($v['data'], '<img width="20" src='.$v['icon'] .''.' loading="lazy" style="vertical-align:middle">', $comment);
}
elseif($type == 'circle'){
$comment = str_replace($v['data'], '<img width="30" src='.$v['icon'] .''.' loading="lazy" style="vertical-align:middle">', $comment);
$comment = str_replace($v['codex'], '<img width="30" src='.$v['icon'] .''.' loading="lazy" style="vertical-align:middle">', $comment);
}
else{
$comment = str_replace($v['data'], '<img width="30" src='.$v['icon'] .''.' loading="lazy" style="vertical-align:middle">', $comment);
}
}
}
//当评论没有私密评论时去除私密评论识别标签
$comment = str_replace('@私密@', '', $comment);
return $comment;
}
function reEmoPost($post){
global $emo;
$options = Helper::options();
if(!$emo){
$opts = array(
'http'=>array(
'method' => 'GET',
'header' => 'Content-type: application/json',
'timeout' => 60 * 10,
'Connection'=>"close"
)
);
$context = stream_context_create($opts);
if(Bsoptions('Emoji_HideDefault') == false || Bsoptions('Emoji_HideDefault') == ''){
$res = json_decode(file_get_contents($options->themeUrl."/assets/vendors/bs-emoji/bs-emoji.json", false, $context),true);
$emo = $res;
}
if(Bsoptions('Emoji_Diy') == true && Bsoptions('Emoji_DiyUrl') !== ''){
$res2 = json_decode(file_get_contents(Bsoptions('Emoji_DiyUrl'), false, $context),true);
if(Bsoptions('Emoji_HideDefault') == false || Bsoptions('Emoji_HideDefault') == ''){
$emo = array_merge($res,$res2);
}
else{
$emo = $res2;
}
}
}
foreach ($emo as $v){
if($v['category'] !== ''){
$post = str_replace($v['data'], '<img style="display:inline-block;margin: 0;padding: 0;width:30px;height:30px;vertical-align: middle;" class="emoji" src="'.$v['icon'] .'"'.' loading="lazy">', $post);
}
}
return $post;
}
if( class_exists( 'CSF' ) ) {
$Tyoptions = Helper::options();
$db = \Typecho\Db::get();
$adapter = $db->getAdapterName();
$prefix = 'bearsimple';
syncDb();
CSF::createOptions( $prefix, array(
'menu_title' => 'Bearsimple',
'menu_slug' => 'my-bearsimple',
) );
CSF::createSection( $prefix, array(
'title' => '使用说明',
'icon' => 'fas fa-question-circle',
'description' => '欢迎使用BearSimple主题v2版本,本主题为<strong>简约式主题</strong>,适合喜欢简约类的博客站长使用,以下是本主题的使用说明。<span class="button button-info csf--button" id="driver_open">
😎
功能引导
</span>',
'fields' => array(
array(
'type' => 'heading',
'content' => '使用说明',
),
array(
'type' => 'content',
'content' => '1、使用本主题尽量少安装插件,否则可能因存在冲突导致各种各样的问题<br>2、主题用户交流QQ群:561848356<br>3、主题文档中心:<a href="https://docs.whitebear.dev/">戳这里访问</a><br><font color=red>4、若主题配置保存失败请检查是否开启了防火墙,且防火墙是否拦截了请求</font><br>5、不懂的问题或本主题存在的问题可加群或在社区中进行反馈 <br>
6、
BearTalk社区是为使用者提供的一个讨论交流社区,传送门:<a href="https://www.beartalk.ru" target="_blank">戳这里</a>
<center> <br>
<div class="csf-submessage csf-submessage-info">当前版本:v'.themeVersion().' / 最新版本:v<font id="version"></font></div>
<div id="versiontips" style="margin-top:10px"></div></center>
<script src="'.Helper::options()->themeUrl.'/assets/js/jquery.min.js"></script>
<script src="'.Helper::options()->themeUrl.'/assets/vendors/layer/layer.min.js?v=1" type="application/javascript"></script>
<script>
$(function() {
$.post("https://upgrade.typecho.co.uk/Bearsimple/version.php",function(data,status){
switch(status)
{
case "success":
json = JSON.parse(data);
nowversion = "'.themeVersion().'";
$("#version").html(json.version);
if(json.version > nowversion){
if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
$("#versiontips").html(\'<div class="csf-submessage csf-submessage-warning">检测到有新版本可以更新,请及时完成更新!<br><a href="#check" class="ui warning label">前往更新<a></div>\');
} else {
$("#versiontips").html(\'<div class="csf-submessage csf-submessage-warning">检测到有新版本可以更新,请及时完成更新!<br><a href="#tab=在线升级" class="ui warning label">前往更新<a></div>\');
};
}
break;
case "error":
$("#version").html("最新版本获取失败");
break;
case "timeout":
$("#version").html("最新版本获取超时");
break;
default: $("#version").html("'.themeVersion().'");
}
});
});
</script>',
),
array(
'type' => 'submessage',
'style' => 'info',
'content' => '在反馈本主题相关的问题时,请务必将以下内容放入您要反馈的内容中',
),
array(
'type' => 'notice',
'style' => 'info',
'content' => '<ul style="margin:0 auto;"><li>BearSimple主题版本:v'.themeVersion().'[<a href="https://docs.whitebear.dev/index.php/archives/6/" target="_blank">更新日志</a>]</li><li>PHP版本:'.PHP_VERSION.'</li><li>网站服务器:'.$_SERVER['SERVER_SOFTWARE'].'</li><li>数据库:'.$db->getAdapterName().'[Version:'.$db->getVersion().']</li><li>Typecho版本:'.$Tyoptions->version.'</li><li>User Agent信息:'.$_SERVER['HTTP_USER_AGENT'].'</li></ul>',
),
)
) );
$siteMaintenance_files = glob(__DIR__ . '/modules/siteMaintenance/*.html');
$siteMaintenance_styles = array_map('basename', $siteMaintenance_files);
$siteMaintenance_associative = array_combine($siteMaintenance_styles, $siteMaintenance_styles);
CSF::createSection( $prefix, array(
'title' => '基础设置',
'icon' => 'fas fa-cog',
'fields' => array(
array(
'id' => 'header_choose',
'type' => 'radio',
'title' => '站点LOGO类型',
'inline' => true,
'options' => array(
'text' => '文字LOGO',
'image' => '图片LOGO',
),
'default' => 'text'
),
array(
'id' => 'textlogo_text',
'type' => 'text',
'title' => '站点文字LOGO',
'default' => $Tyoptions->title,
'after' => '请填入站点文字LOGO',
'dependency' => array( 'header_choose', '==', 'text' ),
),
array(
'id' => 'textlogo_dec',
'type' => 'textarea',
'title' => '站点文字介绍',
'after' => '请填入站点文字介绍',
'dependency' => array( 'header_choose', '==', 'text' ),
),
array(
'id' => 'imagelogo',
'title' => '站点图片LOGO',
'after' => '请上传站点图片LOGO,最佳尺寸为250X70',
'type' => 'upload',
'dependency' => array( 'header_choose', '==', 'image' ),
),
array(
'id' => 'imagelogo_dark',
'title' => '站点图片LOGO[黑暗模式]',
'after' => '请上传黑暗模式时的站点图片LOGO,最佳尺寸为250X70',
'type' => 'upload',
'dependency' => array( 'header_choose', '==', 'image' ),
),
array(
'id' => 'favicon',
'type' => 'upload',
'title' => '站点Favicon图标',
),
array(
'id' => 'siteMaintenance_Open',
'type' => 'switcher',
'title' => '是否开启维护模式',
'subtitle' => '选择开启则前台访客访问将显示维护模式页面,仅管理员身份登录后可正常访问前台',
'default' => false,
),
array(
'id' => 'siteMaintenance_templates',
'type' => 'select',
'title' => '维护模式模板',
'after' => '选择维护模式模板,邮件模板可自由DIY,目录位于/usr/themes/bearsimple/modules/siteMaintenance',
'options' => $siteMaintenance_associative,
'default' => 'default.html',
'dependency' => array( 'siteMaintenance_Open', '==', 'true' ),
),
array(
'id' => 'avatar__choose',
'type' => 'radio',
'title' => '头像服务选择',
'inline' => true,
'options' => array(
'cravatar' => 'Cravatar服务',
'weavatar' => 'Weavatar服务',
'gravatar' => 'Gravatar服务',
'diyavatar' => '自定义头像',
'closeavatar' => '不显示头像',
),
'default' => 'cravatar',
'after' => 'Cravatar服务:Cravatar适合在国内使用,优先级:Cravatar头像->Gravatar头像->QQ头像<br>Weavatar服务:Weavatar也适合在国内使用,优先级:Weavatar头像->Gravatar头像->QQ头像<br>Gravatar服务:在国内官方源可能访问不了头像,支持了多个镜像源并支持您填写自定义镜像源<br>自定义头像:您可以通过自定义头像在前台为每个用户显示出随机头像,在自定义头像栏为空时默认为Cravatar<br>不显示头像:若选择不显示头像,则评论区和侧边栏最新评论都将不显示头像<br><font color=red>目前QQ头像调用的是Weavatar,若注册过Weavatar,则不会显示QQ头像</font>',
),
array(
'id' => 'Cravatar_default',
'type' => 'upload',
'title' => 'Cravatar默认头像',
'after' => '考虑到Cravatar默认头像略丑的问题,这里支持自定义Cravatar默认头像。',
'dependency' => array( 'avatar__choose', '==', 'cravatar' ),
),
array(
'id' => 'Weavatar_default',
'type' => 'upload',
'title' => 'Weavatar默认头像',
'after' => '考虑到Weavatar默认头像略丑的问题,这里支持自定义Weavatar默认头像。',
'dependency' => array( 'avatar__choose', '==', 'weavatar' ),
),
array(
'id' => 'DiyAvatar',
'type' => 'textarea',
'title' => '自定义头像',
'after' => '您可以自定义前台评论区随机头像,格式为a.png,b.png,保证每个头像图片都为直链可直接访问,多个头像图片使用英文逗号分隔,当本栏为空时默认使用Cravatar服务。',
'dependency' => array( 'avatar__choose', '==', 'diyavatar' ),
),
array(
'id' => 'Gravatar',
'type' => 'select',
'title' => 'Gravatar源选择',
'after' => '因Gravatar官方在中国大陆地区被Q,导致在中国大陆访问使用Gravatar的站点时头像不显示,这里支持您自主选择合适的源,若为自定义,举例:cdn.v2ex.com/gravatar/<br>本功能适配QQ,当填写的邮箱为QQ邮箱时则显示QQ头像',
'options' => array('1' => 'Gravatar官方源', '3' => 'V2EX*Gravatar镜像源','4' => 'LOLI.NET*Gravatar镜像源','7' => '自定义Gravatar镜像源'),
'default' => '5',
'dependency' => array( 'avatar__choose', '==', 'gravatar' ),
),
array(
'id' => 'GravatarUrl',
'type' => 'text',
'title' => '自定义Gravatar源地址',
'after' => '请填入自定义Gravatar镜像源地址,格式:cdn.v2ex.com/gravatar/<br>Tips:当您所填写的自定义地址访问时能够显示图片时则您所填写的地址是正常的',
'dependency' => array( 'Gravatar|avatar__choose', '==|==', '7|gravatar' ),
),
array(
'id' => 'Assets',
'type' => 'select',
'title' => '资源CDN加速',
'placeholder' => '选择合适的CDN加速方式',
'after' => '本主题支持您选择合适的储存方式来储存样式资源文件进而达到网站加速的效果。',
'options' => array('1' => '本地储存', '3' => '自定义储存'),
'default' => '1',
),
array(
'id' => 'Assets_Custom',
'type' => 'text',
'title' => '自定义CDN加速源地址',
'after' => '请填入风格文件储存源地址,例子:https://xxxx.com/,或者https://xxxx.com/xxx/,请务必将整个assets目录都放进去!!!当你填写的是https://xxxx.com/时,风格存储地址应该是https://xxxx.com/assets<br>检测结果:'.GetCheck(),
'dependency' => array( 'Assets', '==', '3' ),
),
array(
'id' => 'BackGround',
'type' => 'upload',
'title' => '网站背景',
'after' => '请上传网站背景图片,若为空则不显示<br><a style="color:red">提醒:图片名请勿带括号等特殊符号,如xxx(1).jpg,可能会出现无法显示的情况</a>',
),
array(
'id' => 'Diyfont',
'type' => 'upload',
'title' => '自定义字体',
'after' => '您可以自定义网站所显示的字体,请填入字体直链,或直接上传字体文件,若为空则表示使用默认字体',
),
array(
'id' => 'hcsticky',
'type' => 'switcher',
'title' => '是否对侧边栏使用粘住',
'subtitle' => '若开启,则侧边栏吸顶。',
'default' => false,
),
array(
'id' => 'global_shadow',
'type' => 'switcher',
'title' => '全局增加阴影效果',
'subtitle' => '阴影效果在宽屏模式下看不到效果。',
'default' => false,
),
array(
'id' => 'global_transparent',
'type' => 'switcher',
'title' => '全局增加透明效果',
'subtitle' => '透明效果需设置一张背景图方可显示。',
'default' => false,
),
array(
'id' => 'pagination_style',
'type' => 'select',
'title' => '分页样式选择',
'after' => '选择上一页下一页的分页样式,默认为新样式。',
'options' => array('1' => '新样式', '2' => '旧样式'),
'default' => '1',
),
array(
'id' => 'site_style',
'type' => 'select',
'title' => '页面布局选择',
'after' => '选择页面布局,双栏或单栏。',
'options' => array('1' => '双栏(文章展现列表+侧边区块栏)', '2' => '单栏(仅文章展现列表)'),
'default' => '1',
),
array(
'id' => 'width_Selection',
'type' => 'select',
'title' => '页面宽度模式',
'options' => array(
'1' => '窄屏',
'2' => '宽屏',
),
'after' => '选择前台是要宽屏模式还是窄屏模式,若为窄屏模式则为固定宽度,若为宽屏模式则跟随屏幕的宽度而变化。',
'default' => '1'
),
)
) );
CSF::createSection( $prefix, array(
'title' => '首页及分类',
'icon' => 'fas fa-list-alt',
'fields' => array(
array(
'id' => 'Sticky',
'type' => 'switcher',
'title' => '是否开启文章置顶',
'default' => false,
),
array(
'id' => 'Sticky_cids',
'type' => 'select',
'title' => '首页需要置顶的文章',
'chosen' => true,
'multiple' => true,
'sortable' => true,
'ajax' => true,
'options' => 'posts',
'placeholder' => '选择需要置顶的文章',
'dependency' => array( 'Sticky', '==', 'true' ),
),
array(
'id' => 'Sticky_cids_pages',
'type' => 'select',
'title' => '首页需要置顶的页面',
'chosen' => true,
'multiple' => true,
'sortable' => true,
'ajax' => true,
'options' => 'pages',
'placeholder' => '选择需要置顶的页面',
'dependency' => array( 'Sticky', '==', 'true' ),
),
array(
'id' => 'Sticky_cids_category',
'type' => 'select',
'title' => '分类需要置顶的文章',
'chosen' => true,
'multiple' => true,
'sortable' => true,
'ajax' => true,
'options' => 'posts',
'placeholder' => '选择需要置顶的文章',
'dependency' => array( 'Sticky', '==', 'true' ),
),
array(
'id' => 'Sticky_Category',
'type' => 'switcher',
'title' => '开启后分类置顶只在文章所属分类置顶',
'default' => false,
'dependency' => array( 'Sticky', '==', 'true' ),
),
array(
'id' => 'Sticky_Mod',
'type' => 'code_editor',
'title' => '文章置顶样式',
'subtitle' => '可自定义文章置顶样式,支持HTML',
'default' => '<span style="color:red">[置顶]</span>',
'dependency' => array( 'Sticky', '==', 'true' ),
),
array(
'id' => 'Cate_Encrypt_open',
'type' => 'switcher',
'title' => '是否开启文章分类加密',
'subtitle' => '您可以对一些不想显示的隐私分类设置密码,本项对已登录用户无效。',
'default' => false,
),
array(
'id' => 'Cate_Encrypt_hide',
'type' => 'switcher',
'title' => '加密分类中的文章是否在首页显示',
'subtitle' => '若开启,则加密分类的所有文章均正常显示在首页中,本项对已登录用户无效。',
'default' => false,
'dependency' => array( 'Cate_Encrypt_open', '==', 'true'),
),
array(
'id' => 'Cate_Encrypt',
'type' => 'group',
'title' => '分类加密',
'subtitle' => '您可以通过本项增加指定分类的加密<br>若同个分类设置多个加密,则排越后面越优先。',
'dependency' => array( 'Cate_Encrypt_open', '==', 'true'),
'fields' => array(
array(
'id' => 'Cate_Encrypt_Name',
'type' => 'text',
'title' => '标识',
'after' => '您可以给该分类加密加个标注,该项仅后台可见~',
),
array(
'id' => 'Cate_Encrypt_Id',
'type' => 'select',
'title' => '要加密的分类选择',
'chosen' => true,
'multiple' => false,
'sortable' => true,
'ajax' => true,
'options' => 'category',
'placeholder' => '选择需要加密的分类',
),
array(
'id' => 'Cate_Encrypt_Note',
'type' => 'text',
'title' => '该分类加密页面描述',
'after' => '您可以给该分类加密页面加个描述,该描述前台访客可见~',
),
array(
'id' => 'Cate_Encrypt_Password',
'type' => 'text',
'title' => '该分类加密密码',
'after' => '请填写该分类加密的密码,若该项为空,则默认密码为654321',
),
),
),
array(
'id' => 'Article_forma',
'type' => 'select',
'title' => '选择首页、分类等页面输出文章的展现样式',
'after' => '图文样式优先级:文章封面->附件首图->文章首图->自定义随机图片<font color=red>[当图文样式开启使用自定义随机图片为首选时优先级将改变]</font>,无图片时默认显示预设图片',
'options' => array('1' => '图文样式', '2' => '纯文字样式'),
'default' => '1',
),
array(
'id' => 'Article_forma_randchoose',
'type' => 'switcher',
'title' => '图文样式是否使用自定义随机图片为首选',
'subtitle' => '若开启本项,自定义随机图片的优先级将上调到最高等级,优先级:自定义随机图片->文章封面->附件首图->文章首图',
'default' => false,
'dependency' => array( 'Article_forma', 'any', '1,3,5' ),
),
array(
'id' => 'Article_forma_randapi',
'type' => 'switcher',
'title' => '图文样式是否使用随机图API',
'subtitle' => '若开启本项,则自定义随机图片中仅需填写一个随机图API即可',
'default' => false,
'dependency' => array( 'Article_forma', 'any', '1,3,5' ),
),
array(
'id' => 'Article_forma_pic',
'type' => 'textarea',
'title' => '图文样式自定义随机图片',
'after' => '请填入图文样式自定义随机图片,多张图片使用|间隔<br>当开启了随机图API选项后,若为随机图API,仅需填写一个即可,或者可以填写多个随机图API地址,也是使用|间隔<br><a style="color:red">提醒:图片地址建议不要带参数之类的,可能会出现无法显示的情况</a>',
'dependency' => array( 'Article_forma', 'any', '1,3,5' ),
),
array(
'id' => 'articletitlenum',
'type' => 'number',
'title' => '首页、分类等页面输出文章的标题字数',
'after' => '<br><br>首页、分类等页面输出文章的标题字数, 填写数字即可',
'unit' => '个字',
),
array(
'id' => 'articleexcerptnum',
'type' => 'number',
'title' => '首页、分类等页面输出文章的摘要字数',
'after' => '<br><br>填写数字即可,该项仅应用于自动截取摘要,当文章内存在手动填写摘要时该项无效',
'unit' => '个字',
),
)
) );
$all = Typecho_Plugin::export();
if (!array_key_exists('TePass', $all['activated'])){
$Tepass_check = '<font color=red>当前Tepass插件未启用~</font>';
}
else{
$Tepass_check = '<font color=green>当前Tepass插件已启用~</font>';
}
CSF::createSection( $prefix, array(
'title' => '顶部设置',
'icon' => 'fas fa-chevron-up',
'fields' => array(
array(
'id' => 'DNSYJX',
'type' => 'switcher',
'title' => 'DNS预解析',
'default' => false,
),
array(
'id' => 'DNSYJX_AR',
'type' => 'repeater',
'title' => 'DNS预解析地址',
'after' => '对于某些情况而言开启能够提升访问速度,而禁用的话能节省每月100亿的DNS查询',
'dependency' => array( 'DNSYJX', '==', 'true' ),
'fields' => array(
array(
'id' => 'DNSADDRESS',
'type' => 'text',
'title' => '预解析地址'
),
array(
'id' => 'DNSADDRESS_Preconnect',
'type' => 'switcher',
'title' => '是否启用预连接',
'default' => false,
),
array(
'id' => 'DNSADDRESS_Crossorign',
'type' => 'switcher',
'title' => '是否启用跨域资源共享(CORS)',
'default' => false,
'dependency' => array( 'DNSADDRESS_Preconnect', '==', 'true' ),
),
),
),
array(
'id' => 'CustomizationCode',
'type' => 'code_editor',
'title' => '顶部自定义代码',
'subtitle' => '如百度Meta验证代码,均可以放在这里',
),
array(
'id' => 'menu_style',
'type' => 'select',
'title' => '导航栏显示选择',
'after' => '选择头部导航栏的显示,默认为显示。',
'options' => array('1' => '显示', '3' => '不显示'),
'default' => '1',
),
array(
'id' => 'menu_tem',
'type' => 'select',
'title' => '导航栏样式',
'after' => '选择头部导航栏的样式,默认为新样式。',
'options' => array('1' => '旧样式', '2' => '新样式'),
'default' => '2',
'dependency' => array( 'menu_style', '==', '1' ),
),
array(
'id' => 'menu_NewtemSticky',
'type' => 'switcher',
'title' => '导航栏吸顶',
'dependency' => array( 'menu_style|menu_tem', '==|==', '1|2' ),
),
array(
'id' => 'menu_NewtemToggle',
'type' => 'select',
'title' => '导航栏展开方向[手机端]',
'after' => '选择头部导航栏的展开方向,默认为左边。',
'options' => array('left' => '左边', 'right' => '右边', 'top' => '上边', 'bottom' => '下边'),
'default' => '1',
'dependency' => array( 'menu_style|menu_tem', '==|==', '1|2' ),
),
array(
'id' => 'CategoryMenu',
'type' => 'switcher',
'title' => '导航栏显示下拉分类',
'text_on' => '显示',
'text_off' => '不显示',
'text_width' => '100',
'dependency' => array( 'menu_style', '==', '1' ),
),
array(
'id' => 'PageMenu',
'type' => 'select',
'title' => '导航栏页面输出选择',
'after' => '选择集合下拉则将所有自定义页面集合为下拉列表,而横向排列则把所有自定义页面链接直接输出,隐藏则隐藏所有页面',
'options' => array('1' => '集合下拉', '2' => '横向排列', '3' => '隐藏'),
'default' => '1',
'dependency' => array( 'menu_style', '==', '1' ),
),
array(
'id' => 'Menu',
'type' => 'repeater',
'title' => '自定义导航',
'after' => '自由添加前台自定义导航,且可设置是否登录可见',
'dependency' => array( 'menu_style', '==', '1' ),
'fields' => array(
array(
'id' => 'Menu_Text',
'type' => 'link',
'title' => '导航链接及文字'
),array(
'id' => 'Menu_LoginShow',
'type' => 'switcher',
'title' => '是否登录可见',
),
),
),
)
) );
CSF::createSection( $prefix, array(
'title' => '底部设置',
'icon' => 'fas fa-chevron-down',
'fields' => array(
array(
'id' => 'IcpBa',
'type' => 'text',
'title' => 'ICP备案号',
'after' => '请填写您网站的ICP备案号,若无ICP备案请为空',
),
array(
'id' => 'PoliceBa',
'type' => 'text',
'title' => '公安备案号',
'after' => '请填写您网站的公安备案号,若无公安备案请为空',
),
array(
'id' => 'allOfCharacters',
'type' => 'switcher',
'title' => '底部显示站点文章总字数',
'default' => false,
),
array(
'id' => 'CustomizationFooterCode',
'type' => 'code_editor',
'title' => '底部自定义代码',
'after' => '可放置网站统计代码等<br><font color=red>谨慎填写,仅需填写代码即可!</font>需注意语法,若语法错误可能会造成前台报错甚至组件动作失效!',
),
array(
'id' => 'CustomizationFooterJsCode',
'type' => 'code_editor',
'title' => '底部自定义JS代码',
'after' => '可放置自定义JS代码等<br><font color=red>谨慎填写,仅需填写代码即可!</font>需注意JS语法,若语法错误可能会造成前台报错甚至组件动作失效!',
),
array(
'id' => 'load_Time',
'type' => 'switcher',
'title' => '显示页面加载时间',
'text_on' => '是',
'text_off' => '否',
'text_width' => '100',
),
array(
'id' => 'blogsclub_shuttle',
'type' => 'switcher',
'title' => '展现BlogsClub空间穿梭传送门',
'text_on' => '是',
'text_off' => '否',
'text_width' => '100',
'after' => '<br><br>BlogsClub是BearNotion推出的博客俱乐部项目,每一位博主都可以加入,官方网站:<a href="https://www.blogsclub.org/">戳这里</a><br>您可以开启本项来支持BlogsClub~~~',
),
)
) );
CSF::createSection( $prefix, array(
'title' => '幻灯片设置',
'icon' => 'fas fa-images',
'fields' => array(
array(
'id' => 'Slidersss',
'type' => 'switcher',
'title' => '是否开启幻灯片功能',
'default' => false,
),
array(
'id' => 'SliderIndexs',
'type' => 'switcher',
'title' => '首页开启幻灯片',
'default' => false,
'subtitle' => '对象:首页',
'dependency' => array( 'Slidersss', '==', 'true' ),
),
array(
'id' => 'SliderOthers',
'type' => 'switcher',
'title' => '其他位置开启幻灯片',
'default' => false,
'subtitle' => ' 对象:分类、标签、搜索',
'dependency' => array( 'Slidersss', '==', 'true' ),
),
array(
'id' => 'slider__content',
'type' => 'group',
'title' => '幻灯片',
'after' => '添加幻灯片需注意幻灯片图片务必为直链。',
'dependency' => array( 'Slidersss', '==', 'true' ),
'fields' => array(
array(
'id' => 'slider__note',
'type' => 'text',
'title' => '幻灯片备注',
'after'=>'可以备注下该幻灯片,仅后台可见'
),
array(
'id' => 'slider__pic',
'title' => '幻灯片图片',
'after' => '图片链接务必为直链',
'type' => 'upload',
),
array(
'id' => 'slider__url',
'type' => 'text',
'title' => '幻灯片跳转链接',
'after'=>'链接务必带http(s)://'
),
array(
'id' => 'slider__title',
'type' => 'text',
'title' => '幻灯片标题',
'after' => '留空则不显示该幻灯片的标题'
),
array(
'id' => 'slider__desc',
'type' => 'text',
'title' => '幻灯片描述',
'after' => '留空则不显示该幻灯片的描述'
),
array(
'id' => 'slider__window',
'type' => 'switcher',
'title' => '新窗口打开',
'default' => false,
),
),
),
)
) );
CSF::createSection( $prefix, array(
'title' => '公告栏设置',
'icon' => 'fas fa-bullhorn',
'fields' => array(
array(
'id' => 'Popup',
'type' => 'switcher',
'title' => '是否开启网站公告栏',
'subtitle' => '若开启公告栏,则网站左下角会出现公告栏,可填写要向访客展示的公告。',
'default' => false,
),
array(
'id' => 'PopupTitle',
'type' => 'text',
'title' => '公告栏标题',
'after' => '请填写公告栏标题,它将显示在公告栏顶部,不填写则不显示',
'dependency' => array( 'Popup', '==', 'true' ),
),
array(
'id' => 'PopupKey',
'type' => 'text',
'title' => '公告栏更新识别码',
'after' => '请填写公告栏更新识别码,默认为announcement<br>作用是当访客设置多久不显示公告时,只要更新识别码,公告就会再显示。
<br>可以作为公告更新后提醒访客使用,注意每次识别码的填写都需要与前面所填写的值不同,建议为字母+数字~',
'default'=> 'announcement',
'dependency' => array( 'Popup', '==', 'true' ),
),
array(
'id' => 'Popup_Value',
'type' => 'repeater',
'title' => '创建公告',
'after' => '可添加多条公告,分别填写公告标题和内容,公告内容支持HTML',
'dependency' => array( 'Popup', '==', 'true' ),
'fields' => array(
array(
'id' => 'Popup_Title_Value',
'type' => 'text',
'title' => '公告栏标题'
),
array(
'id' => 'Popup_Content_Value',
'type' => 'textarea',
'title' => '公告栏内容'
),
),
),
)
) );
if(isset($Tyoptions->cronKey)){
$cronUrl = 'php '.__DIR__.'/core/widget/cron.php '.$Tyoptions->cronKey;
}
else{
$cronUrl = '未初始化自动检查密钥,请刷新后重新查看';
}
$lastestCron = $db->fetchRow($db->select()->from('table.bscore_cron_data')->where('type =? ', 'checkLinks')->order('id',Typecho\Db::SORT_DESC));
if($lastestCron['checksuccess'] !== null){
$lastestCron_Time = '<div><font color=green>自动检查任务运行正常</font>(上一次自动检查执行时间:'.date('Y年m月d日 H:i:s',$lastestCron['checktime']).')</div>';
}
else{
$lastestCron_Time = '<div><font color=red>自动检查任务运行异常</font>(上一次自动检查执行时间:'.date('Y年m月d日 H:i:s',$lastestCron['checktime']).')</div>';
}
$lastestCron_Success = $lastestCron['checksuccess'];
$lastestCron_Failed = $lastestCron['checkfailed'];
$lastestCron_Total = $lastestCron['checktotal'];
CSF::createSection( $prefix, array(
'title' => '友链设置',
'icon' => 'fas fa-link',
'fields' => array(
array(
'id' => 'FriendLinkChoose',
'type' => 'switcher',
'title' => '是否开启右侧友情链接栏',
'subtitle' => '若选择开启,则站点右侧增加友情链接栏',
'default' => false,
),
array(
'id' => 'FriendLink',
'type' => 'textarea',
'title' => '友链内容',
'after' => '请填入友链内容,格式:友链名称|友链简介|友链地址,多个直接换行',
'dependency' => array( 'FriendLinkChoose', '==', 'true' ),
),
array(
'id' => 'FriendLink_place',
'type' => 'select',
'title' => '右侧友情链接显示场景',
'after' => '针对SEO优化考虑,这里可自主选择右侧友情链接显示场景',
'options' => array('1' => '全局显示', '2' => '仅首页显示'),
'default' => '1',
'dependency' => array( 'FriendLinkChoose', '==', 'true' ),
),
array(
'id' => 'FriendLinkFoot',
'type' => 'switcher',
'title' => '是否将右侧友情链接放置到底部',
'subtitle' => '若选择开启,则站点右侧友情链接将放置到站点底部,同时右侧友情链接栏则会被移除',
'default' => false,
'dependency' => array( 'FriendLinkChoose', '==', 'true' ),
),
array(
'id' => 'FriendLinkSubmit',
'type' => 'switcher',
'title' => '是否允许在独立友链页面自助提交友链',
'after' => '<br><br>若为是,则独立友链页面将支持访客自助提交友链(仅当自定义模板选择友链[新]时本项有效)',
'default' => true,
),
array(
'id' => 'FriendLinkLogomust',
'type' => 'switcher',
'title' => '自助提交友链LOGO图标是否必填',
'after' => '<br><br>若为否,则独立友链页面提交友链时友链LOGO图标为非必填,并可以自定义设置一个默认LOGO图标(仅当自定义模板选择友链[新]时本项有效)',
'default' => true,
'text_on' => '是',
'text_off' => '否',
),
array(
'id' => 'FriendLinkLogoDefault',
'type' => 'upload',
'title' => '友链默认LOGO图标',
'after' => '若设置友链LOGO图标为非必填,则可在本项填写默认LOGO图标地址或上传默认LOGO图标',
'dependency' => array( 'FriendLinkLogomust', '==', 'false' ),
),
array(
'id' => 'FriendLinkEmailmust',
'type' => 'switcher',
'title' => '自助提交友链联系邮箱是否必填',
'after' => '<br><br>若为是,则独立友链页面提交友链时需要提交者填写邮箱(仅当自定义模板选择友链[新]时本项有效)',
'default' => false,
'text_on' => '是',
'text_off' => '否',
),
array(
'id' => 'FriendLinkSubmitSendMail',
'type' => 'switcher',
'title' => '友链提交后是否发送邮件给博主',
'after' => '<br><br>若为是,则在前台提交友链申请后系统将自动发送一封邮件给博主提醒进行审核(仅当自定义模板选择友链[新]本项有效,并需要您在SMTP设置中开启SMTP服务并配置SMTP信息)',
'default' => false,
'text_on' => '是',
'text_off' => '否',
),
array(
'id' => 'FriendLinkAcceptSendMail',
'type' => 'switcher',
'title' => '友链审核后是否发送邮件给提交者',
'after' => '<br><br>若为是,则当博主审核友链后将发送审核通过或者审核不通过的邮件给提交者(仅当自定义模板选择友链[新]且提交者邮件地址存在时本项有效,并需要您在SMTP设置中开启SMTP服务并配置SMTP信息)',
'default' => false,
'text_on' => '是',
'text_off' => '否',
),
array(
'id' => 'FriendLinkSkin',
'type' => 'select',
'title' => '友链样式',
'after' => '选择友链样式,分为默认和简约',
'options' => array('0' => '默认', '1' => '简约', '2' => '传统', '3' => '新版'),
'default' => '0',