/**
* Filter the returned comment author name.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $author The comment author's username.
*/
/**
* Filter the comment author's name for display.
*
- * @since 1.2.1
+ * @since 1.2.0
*
* @param string $author The comment author's username.
*/
/**
* Filter the comment author's returned email address.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $comment->comment_author_email The comment author's email address.
*/
/**
* Filter the comment author's email for display.
*
- * @since 1.2.1
+ * @since 1.2.0
*
* @param string $author_email The comment author's email address.
*/
* Care should be taken to protect the email address and assure that email
* harvesters do not capture your commentors' email address.
*
- * @since 1.2.1
+ * @since 1.2.0
*
* @param string $comment->comment_author_email The comment author's email address.
*/
/**
* Filter the comment author's link for display.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $return The HTML-formatted comment author link. Empty for an invalid URL.
*/
/**
* Filter the comment author's returned IP address.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $comment->comment_author_IP The comment author's IP address.
*/
$comment = get_comment( $comment_ID );
$url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
$url = esc_url( $url, array('http', 'https') );
- return apply_filters('get_comment_author_url', $url);
+ /**
+ * Filter the comment author's URL.
+ *
+ * @since 1.5.0
+ *
+ * @param string $url The comment author's URL.
+ */
+ return apply_filters( 'get_comment_author_url', $url );
}
/**
/**
* Filter the comment author's URL for display.
*
- * @since 1.2.1
+ * @since 1.2.0
*
* @param string $author_url The comment author's URL.
*/
/**
* Filter the comment author's returned URL link.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $return The HTML-formatted comment author URL link.
*/
/**
* Filter the returned comment date.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string|int $date Formatted date string or Unix timestamp.
* @param string $d The format of the date.
/**
* Filter the comment excerpt for display.
*
- * @since 1.2.1
+ * @since 1.2.0
*
* @param string $comment_excerpt The comment excerpt text.
*/
/**
* Filter the returned comment ID.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param int $comment->comment_ID The current comment ID.
*/
/**
* Filter the returned comment count for a post.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param int $count The number of comments a post has.
* @param int|WP_Post $post_id The post ID or WP_Post object.
/**
* Filter the comments count for display.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $output A translatable string formatted based on whether the count is equal to 0, 1, or 1+. @see _n()
* @param int $number The number of post comments.
/**
* Filter the text of a comment.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $comment->comment_content The text of the comment.
* @param object $comment The comment object.
/**
* Filter the text of a comment to be displayed.
*
- * @since 1.2.1
+ * @since 1.2.0
*
* @param string $comment_text The text of the current comment.
* @param object $comment The comment object.
/**
* Filter the returned comment time.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string|int $date The comment time, formatted as a date string or Unix timestamp.
* @param string $d The date format.
/**
* Filter the returned comment type.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param string $comment->comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
*/
/**
* Filter the path to the theme template file used for the comments template.
*
- * @since 1.5.2
+ * @since 1.5.1
*
* @param string $theme_template The path to the theme template file.
*/
case 'div':
break;
case 'ol':
- echo '<ol class="children">' . "\n";
+ $output .= '<ol class="children">' . "\n";
break;
default:
case 'ul':
- echo '<ul class="children">' . "\n";
+ $output .= '<ul class="children">' . "\n";
break;
}
}
case 'div':
break;
case 'ol':
- echo "</ol><!-- .children -->\n";
+ $output .= "</ol><!-- .children -->\n";
break;
default:
case 'ul':
- echo "</ul><!-- .children -->\n";
+ $output .= "</ul><!-- .children -->\n";
break;
}
}
$GLOBALS['comment'] = $comment;
if ( !empty( $args['callback'] ) ) {
+ ob_start();
call_user_func( $args['callback'], $comment, $args, $depth );
+ $output .= ob_get_clean();
return;
}
if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
+ ob_start();
$this->ping( $comment, $depth, $args );
+ $output .= ob_get_clean();
} elseif ( 'html5' === $args['format'] ) {
+ ob_start();
$this->html5_comment( $comment, $depth, $args );
+ $output .= ob_get_clean();
} else {
+ ob_start();
$this->comment( $comment, $depth, $args );
+ $output .= ob_get_clean();
}
}
*/
function end_el( &$output, $comment, $depth = 0, $args = array() ) {
if ( !empty( $args['end-callback'] ) ) {
+ ob_start();
call_user_func( $args['end-callback'], $comment, $args, $depth );
+ $output .= ob_get_clean();
return;
}
if ( 'div' == $args['style'] )
- echo "</div><!-- #comment-## -->\n";
+ $output .= "</div><!-- #comment-## -->\n";
else
- echo "</li><!-- #comment-## -->\n";
+ $output .= "</li><!-- #comment-## -->\n";
}
/**
* @type string 'format' How to format the comments list.
* Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
* @type bool 'short_ping' Whether to output short pings. Default false.
+ * @type bool 'echo' Whether to echo the output or return it. Default true.
* }
* @param array $comments Optional. Array of comment objects. @see WP_Query->comments
*/
'reverse_children' => '',
'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
'short_ping' => false,
+ 'echo' => true,
);
$r = wp_parse_args( $args, $defaults );
if ( empty($walker) )
$walker = new Walker_Comment;
- $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
+ $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
$wp_query->max_num_comment_pages = $walker->max_pages;
$in_comment_loop = false;
+
+ if ( $r['echo'] )
+ echo $output;
+ else
+ return $output;
}
/**
/**
* Fires at the bottom of the comment form, inside the closing </form> tag.
*
- * @since 1.5.2
+ * @since 1.5.0
*
* @param int $post_id The post ID.
*/