mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Add type argument to wp_list_comments(). Make comments arg optional. Introduce separate_comments(). see #7635
git-svn-id: https://develop.svn.wordpress.org/trunk@8897 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -456,6 +456,27 @@ function check_comment_flood_db( $ip, $email, $date ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Separates an array of comments into an array keyed by comment_type.
|
||||
*
|
||||
* @since 2.7
|
||||
*
|
||||
* @param array $comments Array of comments
|
||||
* @return array Array of comments keyed by comment_type.
|
||||
*/
|
||||
function &separate_comments(&$comments) {
|
||||
$comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array());
|
||||
$count = count($comments);
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
$type = $comments[$i]->comment_type;
|
||||
$comments_by_type[$type][] = &$comments[$i];
|
||||
if ( 'trackback' == $type || 'pingback' == $type )
|
||||
$comments_by_type['pings'][] = &$comments[$i];
|
||||
}
|
||||
|
||||
return $comments_by_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does comment contain blacklisted characters or words.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user