After [33891], `get_comment()` returns `global $comment` if no args are passed and the global is set (after setting the default to `null` here). This allows us to ditch global comment imports.

See #33638.

Built from https://develop.svn.wordpress.org/trunk@33963


git-svn-id: http://core.svn.wordpress.org/trunk@33932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-09 02:51:24 +00:00
parent 67f90df6a4
commit d973339738
6 changed files with 10 additions and 23 deletions

View File

@ -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";
}

View File

@ -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'];
}

View File

@ -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' );

View File

@ -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;

View File

@ -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;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33962';
$wp_version = '4.4-alpha-33963';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.