-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·35 lines (32 loc) · 1.21 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
function themeConfig($form) {
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点LOGO地址'), _t('填入图片URL地址(包含http://的完整地址), 建议尺寸150*30,填写后网站名称会被隐藏。'));
$form->addInput($logoUrl);
}
//获取评论的锚点链接
function get_comment_at($coid)
{
$db = Typecho_Db::get();
$prow = $db->fetchRow($db->select('parent')->from('table.comments')
->where('coid = ? AND status = ?', $coid, 'approved'));
$parent = $prow['parent'];
if ($parent != "0") {
$arow = $db->fetchRow($db->select('author')->from('table.comments')
->where('coid = ? AND status = ?', $parent, 'approved'));
$author = $arow['author'];
$href = '<a href="#comment-' . $parent . '">@' . $author . '</a>';
echo $href;
} else {
echo '';
}
}
//输出评论内容
function get_filtered_comment($coid)
{
$db = Typecho_Db::get();
$rs = $db->fetchRow($db->select('text')->from('table.comments')
->where('coid = ? AND status = ?', $coid, 'approved'));
$content = $rs['text'];
echo $content;
}