diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/Contents.php | 24 | ||||
| -rw-r--r-- | libs/Options.php | 4 | ||||
| -rw-r--r-- | libs/Utils.php | 7 |
3 files changed, 26 insertions, 9 deletions
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','<h2>导航栏 Nav</h2>类型','选择导航栏的类型(若选择左侧抽屉蓝,则下一条设置失效)');
+ $navStyle = new Typecho_Widget_Helper_Form_Element_Select('navStyle',array('0'=>'顶部导航栏','1'=>'左侧抽屉栏'),'0','<h2>导航栏 Nav</h2>类型','选择导航栏的类型(若选择左侧抽屉蓝,则下一条设置失效)');
$form->addInput($navStyle);
$nav_position = new Typecho_Widget_Helper_Form_Element_Select('nav_position',array('0'=>'不固定','1'=>'固定'),'0','是否固定','固定后,导航栏不会随滚动条滚动而移动在屏幕上的位置<hr>');
$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','<h2>优化</h2>CDN 加速加载静态资源','开启后静态资源文件调用 JSdelivr 的 CDN 公用库,加快网页加载速度。本身有 CDN 的就不用了,不然反而可能会拖慢速度。<hr>');
+ $CDN = new Typecho_Widget_Helper_Form_Element_Select('CDN',array('0'=>'关闭','1'=>'开启'),'0','<h2>优化</h2>CDN 加速加载静态资源(Beta)','开启后静态资源文件调用 JSdelivr 的 CDN 公用库,加快网页加载速度。本身有 CDN 的就不用了,不然反而可能会拖慢速度。<hr>');
$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 @@ <?php - -/* - * 该文件代码来自 熊猫小A(AlanDecode) 的项目,感谢~ - * https://github.com/AlanDecode/typecho-theme-dev-framework - */ - if (!defined('__TYPECHO_ROOT_DIR__')) exit; class Utils { + /** * 输出相对首页路由,本方法会自适应伪静态,用于动态文件 */ |
