/** * Displays the avatar for the comment author and wraps it in the comment author's URL if it is * available. Adds a call to BON_IMAGES . "/{$comment_type}.png" for the default avatars for * trackbacks and pingbacks. * * @since 1.0 * @access public * @global $comment The current comment's DB object. * @global $bon The global Bon object. * @return void */ function bon_avatar() { global $comment, $bon; /* Make sure avatars are allowed before proceeding. */ if (!get_option('show_avatars')) { return false; } /* Get/set some comment variables. */ $comment_type = get_comment_type($comment->comment_ID); $author = get_comment_author($comment->comment_ID); $url = get_comment_author_url($comment->comment_ID); $avatar = ''; $default_avatar = ''; /* Get comment types that are allowed to have an avatar. */ $avatar_comment_types = apply_filters('get_avatar_comment_types', array('comment')); /* If comment type is in the allowed list, check if it's a pingback or trackback. */ if (in_array($comment_type, $avatar_comment_types)) { /* Set a default avatar for pingbacks and trackbacks. */ $default_avatar = 'pingback' == $comment_type || 'trackback' == $comment_type ? trailingslashit(BON_IMAGES) . "{$comment_type}.png" : ''; /* Allow the default avatar to be filtered by comment type. */ $default_avatar = apply_filters("{$bon->prefix}{$comment_type}_avatar", $default_avatar); } /* Set up the avatar size. */ $comment_list_args = bon_list_comments_args(); $size = $comment_list_args['avatar_size'] ? $comment_list_args['avatar_size'] : 80; /* Get the avatar provided by the get_avatar() function. */ $avatar = get_avatar($comment, absint($size), $default_avatar, $author); /* If URL input, wrap avatar in hyperlink. */ if (!empty($url) && !empty($avatar)) { $avatar = '<a href="' . esc_url($url) . '" rel="external nofollow" class="avatar-url" title="' . esc_attr($author) . '">' . $avatar . '</a>'; } /* Display the avatar and allow it to be filtered. Note: Use the get_avatar filter hook where possible. */ echo apply_filters("{$bon->prefix}avatar", $avatar); }
<span class="page-numbers"><?php printf(__('Page %1$s of %2$s', 'bon'), get_query_var('cpage') ? absint(get_query_var('cpage')) : 1, get_comment_pages_count()); ?> </span> <?php next_comments_link(__('Next →', 'bon')); ?> </div><!-- .comments-nav --> <?php } ?> <ol class="comment-list"> <?php wp_list_comments(bon_list_comments_args()); ?> </ol><!-- .comment-list --> <?php } ?> <?php if (pings_open() && !comments_open()) { ?> <!-- <p class="comments-closed pings-open"> <?php printf(__('Comments are closed, but <a href="%s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'bon'), esc_url(get_trackback_url())); ?>