summaryrefslogtreecommitdiffstats
path: root/functions.php
diff options
context:
space:
mode:
authorEltrac <45323514+BigCoke233@users.noreply.github.com>2020-01-22 16:30:55 +0800
committerGitHub <noreply@github.com>2020-01-22 16:30:55 +0800
commit51cf09ff8d7d806d55158905abd2e5c52b611130 (patch)
treedd2e6cf3513b634a0c094b78f375f00876edfe64 /functions.php
parent904ccb7d9c58cf9f677a3535221ba4be6e72c6e5 (diff)
👆 Add: 回复时 @ 上级评论人
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/functions.php b/functions.php
index d8e80b0..6d6b0f3 100644
--- a/functions.php
+++ b/functions.php
@@ -90,4 +90,32 @@ function generate_require($files,$type,$cdn = NULL) {
elseif ($type == "css")
echo "<link rel=\"stylesheet\" href=".$path."assets/".$type."/".$file.".".$type." />";
}
-} \ No newline at end of file
+}
+
+/**
+ * 获取上级评论人
+ */
+ function getCommentHF($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('text','author','status')
+ ->from('table.comments')
+ ->where('coid = ?', $parent));
+ $author = $arow['author'];
+ $status = $arow['status'];
+ if($author){
+ if($status=='approved'){
+ $href = '<a class="at" uid="'.$parent.'" href="#li-comment-'.$parent.'">@'.$author.'</a>';;
+ }else if($status=='waiting'){
+ $href = '<a>评论审核中···</a>';
+ }
+ }
+ echo $href;
+ } else {
+ echo "";
+ }
+ } \ No newline at end of file