From e70a3aa7486fd4b759918893476dff1c4e6147ef Mon Sep 17 00:00:00 2001 From: Eltrac <45323514+BigCoke233@users.noreply.github.com> Date: Mon, 5 Aug 2019 12:54:44 +0800 Subject: =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96/=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96/Bug=20Fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/Contents.php | 24 +++++++++++++++++++++++- libs/Options.php | 4 ++-- libs/Utils.php | 7 +------ 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'libs') diff --git a/libs/Contents.php b/libs/Contents.php index 40a27c6..c376824 100644 --- a/libs/Contents.php +++ b/libs/Contents.php @@ -50,7 +50,29 @@ class Contents } return $text; } - + + /** + * 通过查询数据库 + * 获取上级评论人 + */ + public static function getParent($comment) + { + $recipients = []; + $db = Typecho_Db::get(); + $widget = new Widget_Abstract_Comments(new Typecho_Request(), new Typecho_Response()); + // 查询 + $select = $widget->select()->where('coid' . ' = ?', $comment->parent)->limit(1); + $parent = $db->fetchRow($select, [$widget, 'push']); // 获取上级评论对象 + if ($parent && $parent['mail']) { + $recipients = [ + 'name' => $parent['author'], + 'mail' => $parent['mail'], + ]; + } + return $recipients; + } + + //从这里开始的代码来自 熊猫小A (https://imalan.cn) /** * 根据 id 返回对应的对象 * 此方法在 Typecho 1.2 以上可以直接调用 Helper::widgetById(); diff --git a/libs/Options.php b/libs/Options.php index 1af856a..047335f 100644 --- a/libs/Options.php +++ b/libs/Options.php @@ -80,7 +80,7 @@ function themeConfig($form) { $form->addInput($news); //nav - $navStyle = new Typecho_Widget_Helper_Form_Element_Select('navStyle',array('0'=>'顶部导航栏','1'=>'左侧抽屉蓝'),'0','

导航栏 Nav

类型','选择导航栏的类型(若选择左侧抽屉蓝,则下一条设置失效)'); + $navStyle = new Typecho_Widget_Helper_Form_Element_Select('navStyle',array('0'=>'顶部导航栏','1'=>'左侧抽屉栏'),'0','

导航栏 Nav

类型','选择导航栏的类型(若选择左侧抽屉蓝,则下一条设置失效)'); $form->addInput($navStyle); $nav_position = new Typecho_Widget_Helper_Form_Element_Select('nav_position',array('0'=>'不固定','1'=>'固定'),'0','是否固定','固定后,导航栏不会随滚动条滚动而移动在屏幕上的位置
'); $form->addInput($nav_position); @@ -102,7 +102,7 @@ function themeConfig($form) { $form->addInput($pjax_complete); //improve - $CDN = new Typecho_Widget_Helper_Form_Element_Select('CDN',array('0'=>'关闭','1'=>'开启'),'0','

优化

CDN 加速加载静态资源','开启后静态资源文件调用 JSdelivr 的 CDN 公用库,加快网页加载速度。本身有 CDN 的就不用了,不然反而可能会拖慢速度。
'); + $CDN = new Typecho_Widget_Helper_Form_Element_Select('CDN',array('0'=>'关闭','1'=>'开启'),'0','

优化

CDN 加速加载静态资源(Beta)','开启后静态资源文件调用 JSdelivr 的 CDN 公用库,加快网页加载速度。本身有 CDN 的就不用了,不然反而可能会拖慢速度。
'); $form->addInput($CDN); //custom style diff --git a/libs/Utils.php b/libs/Utils.php index 902b7d4..a95ca4b 100644 --- a/libs/Utils.php +++ b/libs/Utils.php @@ -1,14 +1,9 @@