summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functions.php26
1 files changed, 5 insertions, 21 deletions
diff --git a/functions.php b/functions.php
index dd70365..adc4fa6 100644
--- a/functions.php
+++ b/functions.php
@@ -9,8 +9,6 @@ date_default_timezone_set("Asia/Shanghai");
/**
* 注册文章解析 hook
- * 具体的解析代码需要在 Contents::parseContent() 方法中实现
- * 解析不会改变数据库中的内容,体现在文章前台输出、RSS 输出时
* From AlanDecode(https://imalan.cn)
*/
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Contents','parseContent');
@@ -20,24 +18,11 @@ Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Contents
* 主题启用时执行的方法
*/
function themeInit() {
- $db = Typecho_Db::get();
-
- $query = $db->update('table.options')->rows(array('value'=>'0'))->where('name=?', 'commentsAntiSpam');
- $db->query($query);
- $query = $db->update('table.options')->rows(array('value'=>'0'))->where('name=?', 'commentsCheckReferer');
- $db->query($query);
-
- /* 设置评论最大嵌套层数 */
- $query = $db->update('table.options')->rows(array('value'=>'999'))->where('name=?', 'commentsMaxNestingLevels');
- $db->query($query);
-
- /* 强制新评论在前 */
- $query = $db->update('table.options')->rows(array('value'=>'DESC'))->where('name=?', 'commentsOrder');
- $db->query($query);
-
- /* 默认显示第一页评论 */
- $query = $db->update('table.options')->rows(array('value'=>'first'))->where('name=?', 'commentsPageDisplay');
- $db->query($query);
+ Helper::options()->commentsAntiSpam = false;//关闭反垃圾
+ Helper::options()->commentsHTMLTagAllowed = '<a href=""> <img src=""> <img src="" class=""> <code> <del>';
+ Helper::options()->commentsMaxNestingLevels = '9999';//最大嵌套层数
+ Helper::options()->commentsPageDisplay = 'first';//强制评论第一页
+ Helper::options()->commentsOrder = 'DESC';//将最新的评论展示在前
}
/**
@@ -46,7 +31,6 @@ function themeInit() {
function themeFields(Typecho_Widget_Helper_Layout $layout) {
$banner = new Typecho_Widget_Helper_Form_Element_Text('banner', NULL, NULL,_t('文章头图'), _t('输入一个图片 url,作为缩略图显示在文章列表,没有则不显示'));
$layout->addItem($banner);
-
$excerpt = new Typecho_Widget_Helper_Form_Element_Text('excerpt', NULL, NULL,_t('文章摘要'), _t('输入一段文本来自定义摘要,如果为空则自动提取文章前 130 字。'));
$layout->addItem($excerpt);
}