1
1
<?php
2
2
if (!defined ('__TYPECHO_ROOT_DIR__ ' )) exit ;
3
3
4
- define ('CACTUS_VERSION ' , '1.0.3 ' );
4
+ define ('CACTUS_VERSION ' , '1.0.4 ' );
5
5
6
6
function themeConfig ($ form ) {
7
7
$ avatarUrl = new Typecho_Widget_Helper_Form_Element_Text ('avatarUrl ' , NULL , NULL , _t ('头像 URL 地址 ' ), _t ('在这里填入一个图片 URL 地址, 留空则返回 Gravatar, 不建议留空. ' ));
@@ -14,15 +14,31 @@ function themeConfig($form) {
14
14
$ form ->addInput ($ icpNumber );
15
15
16
16
$ optimizeOptions = new Typecho_Widget_Helper_Form_Element_Checkbox ('optimizeOptions ' , array (
17
+ 'EnableHighlighting ' => _t ('启用代码高亮 ' ),
17
18
'EnableCdn ' => _t ('使用 CDN 加速本主题内的 CSS & JS 文件 ' )
18
19
), array (
20
+ 'EnableHighlighting ' ,
19
21
'EnableCdn '
20
22
), _t ('优化选项 ' ));
21
23
$ form ->addInput ($ optimizeOptions ->multiMode ());
22
24
25
+ $ srcAddress = new Typecho_Widget_Helper_Form_Element_Text ('srcAddress ' , NULL , NULL , _t ('附件原始地址 ' ), _t ('例如: http(s)://www.example.com/usr/uploads/ 留空则不启用. ' ));
26
+ $ form ->addInput ($ srcAddress );
27
+
28
+ $ cdnAddress = new Typecho_Widget_Helper_Form_Element_Text ('cdnAddress ' , NULL , NULL , _t ('附件 CDN 地址 ' ), _t ('例如: http(s)://cdn.example.com/usr/uploads/ 留空则不启用. ' ));
29
+ $ form ->addInput ($ cdnAddress );
30
+
23
31
$ header = new Typecho_Widget_Helper_Form_Element_Textarea ('header ' , NULL , NULL , _t ('自定义 Header ' ), _t ('在这里填入自定义 Header, 如自定义 CSS 样式等. ' ));
24
32
$ form ->addInput ($ header );
25
33
26
34
$ footer = new Typecho_Widget_Helper_Form_Element_Textarea ('footer ' , NULL , NULL , _t ('自定义 Footer ' ), _t ('在这里填入自定义 Footer, 如自定义 JavaScript 脚本等. ' ));
27
35
$ form ->addInput ($ footer );
28
36
}
37
+
38
+ function parseContent ($ obj ) {
39
+ $ options = Typecho_Widget::widget ('Widget_Options ' );
40
+ if (!empty ($ options ->srcAddress ) && !empty ($ options ->cdnAddress )) {
41
+ $ obj ->content = str_ireplace ($ options ->srcAddress , $ options ->cdnAddress , $ obj ->content );
42
+ }
43
+ echo trim ($ obj ->content );
44
+ }
0 commit comments