mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Reorg comment functions. #2525
git-svn-id: https://develop.svn.wordpress.org/trunk@3714 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -690,38 +690,6 @@ function &get_category(&$category, $output = OBJECT) {
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieves comment data given a comment ID or comment object.
|
||||
// Handles comment caching.
|
||||
function &get_comment(&$comment, $output = OBJECT) {
|
||||
global $comment_cache, $wpdb;
|
||||
|
||||
if ( empty($comment) )
|
||||
return null;
|
||||
|
||||
if ( is_object($comment) ) {
|
||||
if ( !isset($comment_cache[$comment->comment_ID]) )
|
||||
$comment_cache[$comment->comment_ID] = &$comment;
|
||||
$_comment = & $comment_cache[$comment->comment_ID];
|
||||
} else {
|
||||
if ( !isset($comment_cache[$comment]) ) {
|
||||
$_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment' LIMIT 1");
|
||||
$comment_cache[$comment->comment_ID] = & $_comment;
|
||||
} else {
|
||||
$_comment = & $comment_cache[$comment];
|
||||
}
|
||||
}
|
||||
|
||||
if ( $output == OBJECT ) {
|
||||
return $_comment;
|
||||
} elseif ( $output == ARRAY_A ) {
|
||||
return get_object_vars($_comment);
|
||||
} elseif ( $output == ARRAY_N ) {
|
||||
return array_values(get_object_vars($_comment));
|
||||
} else {
|
||||
return $_comment;
|
||||
}
|
||||
}
|
||||
|
||||
function get_catname($cat_ID) {
|
||||
$category = &get_category($cat_ID);
|
||||
return $category->cat_name;
|
||||
|
||||
Reference in New Issue
Block a user