boxmoe_header_banner_img

Hello! 欢迎来到盒子萌!

加载中

[笔记]typecho主题管理设置项功能functions函数收集


avatar
专收爆米花 2018年8月22日 4.89k
复制代码
  1. function themeConfig($form) {
  2. $logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('网站导航logo地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则使用站点名称'));
  3. $form->addInput($logoUrl->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
  4. $footerLogoUrl = new Typecho_Widget_Helper_Form_Element_Text('footerLogoUrl', NULL, NULL, _t('页尾logo地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则使用站点名称'));
  5. $form->addInput($footerLogoUrl->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
  6. $favicon = new Typecho_Widget_Helper_Form_Element_Text('favicon', NULL, NULL, _t('favicon地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则不设置favicon'));
  7. $form->addInput($favicon->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
  8. $iosicon = new Typecho_Widget_Helper_Form_Element_Text('iosicon', NULL, NULL, _t('apple touch icon地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则不设置Apple Touch Icon'));
  9. $form->addInput($iosicon->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
  10.  
  11. $searchPage = new Typecho_Widget_Helper_Form_Element_Text('searchPage', NULL, NULL, _t('搜索页地址'), _t('输入你的 Template Page of Search 的页面地址,记得带上 http:// 或 https://'));
  12. $form->addInput($searchPage->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  13.  
  14. $pjaxSet = new Typecho_Widget_Helper_Form_Element_Radio('pjaxSet',
  15. array('able' => _t('启用'),
  16. 'disable' => _t('禁止'),
  17. ),
  18. 'disable', _t('PJAX加速设置'), _t('默认禁止,若启用则需提前到关闭‘开启反垃圾保护’,开关在‘设置-评论’'));
  19. $form->addInput($pjaxSet);
  20.  
  21. $DnsPrefetch = new Typecho_Widget_Helper_Form_Element_Radio('DnsPrefetch',
  22. array('able' => _t('启用'),
  23. 'disable' => _t('禁止'),
  24. ),
  25. 'disable', _t('DNS预解析加速'), _t('默认禁止,启用则会对CDN资源和Gravatar进行加速'));
  26. $form->addInput($DnsPrefetch);
  27.  
  28. $htmlCompress = new Typecho_Widget_Helper_Form_Element_Radio('htmlCompress',
  29. array('able' => _t('启用'),
  30. 'disable' => _t('禁止'),
  31. ),
  32. 'disable', _t('代码压缩设置'), _t('默认禁止,启用则会对HTML代码进行压缩,可能会跟部分插件存在兼容问题,请自行测试'));
  33. $form->addInput($htmlCompress);
  34.  
  35. $fastClickSet = new Typecho_Widget_Helper_Form_Element_Radio('fastClickSet',
  36. array('able' => _t('启用'),
  37. 'disable' => _t('禁止'),
  38. ),
  39. 'disable', _t('移动端点击延迟消除设置'), _t('默认禁止,好多安卓原生浏览器有点击延迟,想开启就开启吧'));
  40. $form->addInput($fastClickSet);
  41.  
  42. $postListSwitch = new Typecho_Widget_Helper_Form_Element_Radio('postListSwitch',
  43. array('threeList' => _t('三栏'),
  44. 'oneList' => _t('单栏'),
  45. ),
  46. 'oneList', _t('首页文章列表设置'), _t('默认单栏,根据自己的喜好去做切换吧'));
  47. $form->addInput($postListSwitch);
  48.  
  49. $colorBgPosts = new Typecho_Widget_Helper_Form_Element_Radio('colorBgPosts',
  50. array('customColor' => _t('启用'),
  51. 'defaultColor' => _t('禁用'),
  52. ),
  53. 'defaultColor', _t('文章色块设置'), _t('默认禁止,启用则可以通过文章字段控制色块颜色,仅支持blue、purple、green、yellow、red'));
  54. $form->addInput($colorBgPosts);
  55.  
  56. $postshowthumb = new Typecho_Widget_Helper_Form_Element_Radio('postshowthumb',
  57. array('able' => _t('启用'),
  58. 'disable' => _t('禁用'),
  59. ),
  60. 'disable', _t('文章题图设置'), _t('默认禁止,启用则在文章页内显示缩略图'));
  61. $form->addInput($postshowthumb);
  62.  
  63. $relatedPosts = new Typecho_Widget_Helper_Form_Element_Radio('relatedPosts',
  64. array('able' => _t('启用'),
  65. 'disable' => _t('禁止'),
  66. ),
  67. 'disable', _t('相关文章设置'), _t('默认禁止,仅在文章页中生效,最多显示六条,文章是根据标签进行相关的'));
  68. $form->addInput($relatedPosts);
  69.  
  70. $tableOfContents = new Typecho_Widget_Helper_Form_Element_Radio('tableOfContents',
  71. array('able' => _t('启用'),
  72. 'disable' => _t('禁止'),
  73. ),
  74. 'disable', _t('文章目录设置'), _t('默认禁止,文章页右边目录生成,仅在网页宽度大于1000px时显示'));
  75. $form->addInput($tableOfContents);
  76.  
  77. $useHighline = new Typecho_Widget_Helper_Form_Element_Radio('useHighline',
  78. array('able' => _t('启用'),
  79. 'disable' => _t('禁止'),
  80. ),
  81. 'disable', _t('代码高亮设置'), _t('默认禁止,启用则会对 ``` 进行代码高亮,支持22种编程语言的高亮'));
  82. $form->addInput($useHighline);
  83.  
  84. $useMathjax = new Typecho_Widget_Helper_Form_Element_Radio('useMathjax',
  85. array('able' => _t('启用'),
  86. 'disable' => _t('禁止'),
  87. ),
  88. 'disable', _t('文章Mathjax设置'), _t('默认禁止,启用则会对内容页进行数学公式渲染,仅支持 $公式$ 和 $$公式$$ '));
  89. $form->addInput($useMathjax);
  90.  
  91. $GoogleAnalytics = new Typecho_Widget_Helper_Form_Element_Textarea('GoogleAnalytics', NULL, NULL, _t('Google Analytics代码'), _t('填写你从Google Analytics获取到的Universal Analytics跟踪代码,不需要script标签'));
  92. $form->addInput($GoogleAnalytics);
  93.  
  94.  
  95. $socialweibo = new Typecho_Widget_Helper_Form_Element_Text('socialweibo', NULL, NULL, _t('输入微博链接'), _t('在这里输入微博链接,支持 http:// 或 https:// 或 //'));
  96. $form->addInput($socialweibo->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  97. $socialzhihu = new Typecho_Widget_Helper_Form_Element_Text('socialzhihu', NULL, NULL, _t('输入知乎链接'), _t('在这里输入知乎链接,支持 http:// 或 https:// 或 //'));
  98. $form->addInput($socialzhihu->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  99. $socialgithub = new Typecho_Widget_Helper_Form_Element_Text('socialgithub', NULL, NULL, _t('输入GitHub链接'), _t('在这里输入GitHub链接,支持 http:// 或 https://或 //'));
  100. $form->addInput($socialgithub->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  101. $socialtwitter = new Typecho_Widget_Helper_Form_Element_Text('socialtwitter', NULL, NULL, _t('输入Twitter链接'), _t('在这里输入twitter链接,支持 http:// 或 https:// 或 //'));
  102. $form->addInput($socialtwitter->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  103.  
  104.  
  105. $srcAddress = new Typecho_Widget_Helper_Form_Element_Text('src_add', NULL, NULL, _t('图片CDN替换前地址'), _t('即你的附件存放链接,一般为http://www.yourblog.com/usr/uploads/'));
  106. $form->addInput($srcAddress->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  107. $cdnAddress = new Typecho_Widget_Helper_Form_Element_Text('cdn_add', NULL, NULL, _t('图片CDN替换后地址'), _t('即你的七牛云存储域名,一般为http://yourblog.qiniudn.com/,可能也支持其他有镜像功能的CDN服务'));
  108. $form->addInput($cdnAddress->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  109. $default_thumb = new Typecho_Widget_Helper_Form_Element_Text('default_thumb', NULL, '', _t('默认缩略图'),_t('文章没有图片时的默认缩略图,留空则无,一般为http://www.yourblog.com/image.png'));
  110. $form->addInput($default_thumb->addRule('xssCheck', _t('请不要在链接中使用特殊字符')));
  111. }


评论(4)

查看评论列表
评论头像
zvv 2018年08月27日
好,学习了。
评论头像
专收爆米花 博主 2018年08月27日
好,好学生
评论头像
永恒 2022年04月03日
请问博主这里的php怎么调用????? :shock:
评论头像
专收爆米花 博主 2022年04月16日
按typecho 函数标准,这个是后台主题设置项,会自动调用显示在主题设置中

发表评论

表情 颜文字
😀😁😂🤣😃😄😅😆😉😊😋😎😍🥰😘😗😙😚😛😝🤗🤔🤨😐😑😶🙄😏😣😥😮🤤😴😪😵😵😵🤯🤠🤡🤥🤫🤔🤨😐😑😶🙄