From 67e03e74c572f67fac6d90fc821021e07692bb47 Mon Sep 17 00:00:00 2001 From: Zisbusy <49525016+Zisbusy@users.noreply.github.com> Date: Thu, 28 May 2020 15:50:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=84=E8=AE=BA=E5=A4=B4?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Akina/comments.php | 49 ++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/Akina/comments.php b/Akina/comments.php index 6aa8c1a..b5395c4 100644 --- a/Akina/comments.php +++ b/Akina/comments.php @@ -1,27 +1,30 @@ -authorId) { - if ($comments->authorId == $comments->ownerId) { - $commentClass .= ' comment-by-author'; //如果是文章作者的评论添加 .comment-by-author 样式 - } else { - $commentClass .= ' comment-by-user'; //如果是评论作者的添加 .comment-by-user 样式 - } - } - $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; //评论层数大于0为子级,否则是父级 +authorId) { + if ($comments->authorId == $comments->ownerId) { + //如果是文章作者的评论添加 .comment-by-author 样式,规定博主头像 + $commentClass .= 'comment-by-author'; + $avatar = $avatar2x = theprofile; + } else { + //如果是评论作者的添加 .comment-by-user 样式 + $commentClass .= 'comment-by-user'; + $email = $comments->mail; + //判断邮箱类型选取头像地址 + if(preg_match('|^[1-9]\d{4,10}@qq\.com$|i',$email)){ + $qqnumber = explode("@",$email); + $avatar = '//q.qlogo.cn/g?b=qq&nk=' . $commentClass. '&s=100'; + $avatar2x = '//q.qlogo.cn/g?b=qq&nk=' . $qqnumber[0]. '&s=160'; + }else{ + $avatar = 'https://gravatar.loli.net/avatar/' . md5(strtolower($comments->mail)) . '?s=80&r=X&d=mm'; + $avatar2x = 'https://gravatar.loli.net/avatar/' . md5(strtolower($comments->mail)) . '?s=160&r=X&d=mm'; + } + } + } + //评论层数大于0为子级,否则是父级 + $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; $depth = $comments->levels +1; ?> - mail; - if(preg_match('|^[1-9]\d{4,10}@qq\.com$|i',$email)){ - $qqnumber = explode("@",$email); - $avatar = '//q.qlogo.cn/g?b=qq&nk=' . $qqnumber[0]. '&s=100'; - $avatar2x = '//q.qlogo.cn/g?b=qq&nk=' . $qqnumber[0]. '&s=160'; - }else{ - $avatar = 'https://gravatar.loli.net/avatar/' . md5(strtolower($comments->mail)) . '?s=80&r=X&d=mm'; - $avatar2x = 'https://gravatar.loli.net/avatar/' . md5(strtolower($comments->mail)) . '?s=160&r=X&d=mm'; - - } - ?>
  • @@ -122,4 +125,4 @@
    - \ No newline at end of file +