allow('comment')) echo "";
}
/**
* 获取上级评论人
*/
public static function getParent($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 = ' ';;
}else if($status=='waiting'){
$href = '评论审核中···';
}
}
echo $href;
} else {
echo "";
}
}
/**
* 获取 Cravatar 头像链接
*/
public static function gravatar($email, int $size = 100, int $useCDN = NULL)
{
//MD5 EMail
$email = md5($email);
// 如果配置了 CustomGravatarCDN,则用 CustomGravatarCDN 拼接
if (Helper::options()->CustomGravatarCDN) {
$avatar = Helper::options()->CustomGravatarCDN . $email . '?s=' . $size;
} // 否则,使用 Cravatar
else {
$avatar = 'https://cravatar.cn/avatar/' . $email . '?s=' . $size;
}
return $avatar;
}
/**
* 获取评论者头像
*/
public static function getAvatar($email, int $size = 100)
{
//Hash
$email_hash = md5(strtolower($email));
//EMail
$email = strtolower($email);
$avatar = self::gravatar($email, $size);
return $avatar;
}
}