diff --git a/src/wp-admin/includes/comment.php b/src/wp-admin/includes/comment.php index b0c6db51f0..c9087ec962 100644 --- a/src/wp-admin/includes/comment.php +++ b/src/wp-admin/includes/comment.php @@ -156,14 +156,11 @@ function get_pending_comments_num( $post_id ) { * * @since 2.5.0 * - * @global object $comment - * * @param string $name User name. * @return string Avatar with Admin name. */ function floated_admin_avatar( $name ) { - global $comment; - $avatar = get_avatar( $comment, 32, 'mystery' ); + $avatar = get_avatar( get_comment(), 32, 'mystery' ); return "$avatar $name"; } diff --git a/src/wp-includes/comment-functions.php b/src/wp-includes/comment-functions.php index 9bfc7bc7d8..e258cab384 100644 --- a/src/wp-includes/comment-functions.php +++ b/src/wp-includes/comment-functions.php @@ -169,7 +169,7 @@ function get_approved_comments( $post_id, $args = array() ) { * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants. * @return WP_Comment|array|null Depends on $output value. */ -function get_comment(&$comment, $output = OBJECT) { +function get_comment( &$comment = null, $output = OBJECT ) { if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) { $comment = $GLOBALS['comment']; } diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index b19b88bd1d..6ad965f86a 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -152,8 +152,6 @@ function comment_author_email_link( $linktext = '', $before = '', $after = '' ) * enable anyone, including those that people don't want to get the email * address and use it for their own means good and bad. * - * @global object $comment The current Comment row object. - * * @since 2.7.0 * * @param string $linktext Optional. Text to display instead of the comment author's email address. @@ -163,8 +161,7 @@ function comment_author_email_link( $linktext = '', $before = '', $after = '' ) * @return string */ function get_comment_author_email_link( $linktext = '', $before = '', $after = '' ) { - global $comment; - + $comment = get_comment(); /** * Filter the comment author's email for display. * @@ -604,12 +601,10 @@ function comment_excerpt( $comment_ID = 0 ) { * * @since 1.5.0 * - * @global object $comment - * * @return int The comment ID. */ function get_comment_ID() { - global $comment; + $comment = get_comment(); /** * Filter the returned comment ID. @@ -873,8 +868,6 @@ function comment_text( $comment_ID = 0, $args = array() ) { * * @since 1.5.0 * - * @global object $comment - * * @param string $d Optional. The format of the time. Default user's settings. * @param bool $gmt Optional. Whether to use the GMT date. Default false. * @param bool $translate Optional. Whether to translate the time (for use in feeds). @@ -882,7 +875,8 @@ function comment_text( $comment_ID = 0, $args = array() ) { * @return string The formatted time. */ function get_comment_time( $d = '', $gmt = false, $translate = true ) { - global $comment; + $comment = get_comment(); + $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; if ( '' == $d ) $date = mysql2date(get_option('time_format'), $comment_date, $translate); @@ -1653,8 +1647,6 @@ function comment_id_fields( $id = 0 ) { * * @since 2.7.0 * - * @global object $comment - * * @param string $noreplytext Optional. Text to display when not replying to a comment. * Default false. * @param string $replytext Optional. Text to display when replying to a comment. @@ -1664,7 +1656,7 @@ function comment_id_fields( $id = 0 ) { * to their comment. Default true. */ function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) { - global $comment; + $comment = get_comment(); if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' ); if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' ); diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index f483e36521..dac08903b5 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -1311,14 +1311,12 @@ function get_edit_comment_link( $comment_id = 0 ) { * * @since 1.0.0 * - * @global object $comment - * * @param string $text Optional. Anchor text. * @param string $before Optional. Display before edit link. * @param string $after Optional. Display after edit link. */ function edit_comment_link( $text = null, $before = '', $after = '' ) { - global $comment; + $comment = get_comment(); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; diff --git a/src/wp-includes/query.php b/src/wp-includes/query.php index 0d45bcbbf8..270d0eb5dc 100644 --- a/src/wp-includes/query.php +++ b/src/wp-includes/query.php @@ -3844,7 +3844,7 @@ class WP_Query { * * @since 2.2.0 * @access public - * @global object $comment Current comment. + * @global WP_Comment $comment Current comment. */ public function the_comment() { global $comment;