function blog_comments_children($comments, $children) { if (!$children) { return ''; } ?> <ul class="children"> <?php $isGravatar = Option::get('isgravatar'); foreach ($children as $child) { $comment = $comments[$child]; $isNofollow = isset($comment['url']) && false === strpos($comment['url'], rtrim(BLOG_URL, '/')) ? 'rel="external nofollow"' : ''; $comment['poster'] = $comment['url'] ? '<a href="' . $comment['url'] . '" target="_blank" ' . $isNofollow . '>' . $comment['poster'] . '</a>' : $comment['poster']; ?> <li class="comment comment_children" id="comment-<?php echo $comment['cid']; ?> "> <a name="<?php echo $comment['cid']; ?> "></a> <?php if ($isGravatar == 'y') { echo '<div class="avatar"><img src="' . TEMPLATE_URL . 'images/noAvator.jpg" data-src="' . $comment['figure'] . '" /></div>'; } else { echo '<div class="avatar"><img src="' . TEMPLATE_URL . 'images/noAvator.jpg" /></div>'; } ?> <div class="comment-info"> <div class="comment-content"><p><?php echo comment2emoji($comment['content']); ?> </p></div> <div class="comment-meata"> <span class="comment-poster <?php echo $comment['role']; ?> " title="<?php echo $comment['roledes']; ?> "><?php echo $comment['poster']; ?> </span> <span class="comment-time"><?php if (strtotime($comment['date'])) { echo timeago(strtotime($comment['date'])); } else { echo str_replace(' ', '', $comment['date']); } ?> </span> <?php if ($comment['level'] < 3) { echo '<a href="#comment-' . $comment['cid'] . '" onclick="commentReply(' . $comment['cid'] . ',this)" class="comment-reply-btn">回复</a>'; } ?> </div> </div> <?php blog_comments_children($comments, $comment['children']); ?> </li> <?php } ?> </ul> <?php }
function blog_comments_children($comments, $children) { $isGravatar = Option::get('isgravatar'); foreach ($children as $child) { $comment = $comments[$child]; $isNofollow = $comment['url'] && $comment['url'] != BLOG_URL ? 'rel="nofollow"' : ''; $comment['poster'] = $comment['url'] ? '<a href="' . $comment['url'] . '" target="_blank" ' . $isNofollow . '>' . $comment['poster'] . '</a>' : $comment['poster']; ?> <div class="comment comment-children" id="comment-<?php echo $comment['cid']; ?> "> <a name="<?php echo $comment['cid']; ?> "></a> <?php if ($isGravatar == 'y') { echo '<div class="avatar"><img src="' . TEMPLATE_URL . 'images/0.gif" data-src="' . J_getGravatar($comment['mail']) . '" /></div>'; } else { echo '<div class="avatar"><img src="' . TEMPLATE_URL . 'images/noAvator.jpg" /></div>'; } ?> <div class="comment-info"> <div class="comment-content"><?php echo comment2emoji($comment['content']); ?> </div> <div class="comment-meata"> <span class="comment-poster"><?php echo $comment['poster']; ?> </span> <span class="comment-time"><?php if (strtotime($comment['date'])) { echo timeago(strtotime($comment['date'])); } else { echo str_replace(' ', '', $comment['date']); } ?> </span> <?php if ($comment['level'] < 3) { echo '<a href="#comment-' . $comment['cid'] . '" onclick="commentReply(' . $comment['cid'] . ',this)" class="comment-reply-btn">回复</a>'; } ?> </div> </div> <?php blog_comments_children($comments, $comment['children']); ?> </div> <?php } }