Make WordPress Core

Ticket #32619: 32619.diff

File 32619.diff, 28.7 KB (added by wonderboymusic, 10 years ago)
  • src/wp-admin/edit-form-comment.php

     
    161161 *
    162162 * @since 3.0.0
    163163 *
    164  * @param object $comment Comment object.
     164 * @param WP_Comment $comment Comment object.
    165165 */
    166166do_action( 'add_meta_boxes_comment', $comment );
    167167
  • src/wp-admin/includes/comment.php

     
    7474}
    7575
    7676/**
    77  * Returns a comment object based on comment ID.
     77 * Returns a WP_Comment object based on comment ID.
    7878 *
    7979 * @since 2.0.0
    8080 *
    8181 * @param int $id ID of comment to retrieve.
    82  * @return object|false Comment if found. False on failure.
     82 * @return WP_Comment|false Comment if found. False on failure.
    8383 */
    8484function get_comment_to_edit( $id ) {
    8585        if ( !$comment = get_comment($id) )
  • src/wp-admin/includes/dashboard.php

     
    544544}
    545545
    546546/**
    547  * @global object $comment
     547 * @global WP_Comment $comment
    548548 *
    549  * @param object $comment
    550  * @param bool   $show_date
     549 * @param WP_Comment $comment
     550 * @param bool       $show_date
    551551 */
    552552function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
    553553        $GLOBALS['comment'] =& $comment;
     
    599599                 *
    600600                 * @since 2.6.0
    601601                 *
    602                  * @param array  $actions An array of comment actions. Default actions include:
    603                  *                        'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
    604                  *                        'Delete', and 'Trash'.
    605                  * @param object $comment The comment object.
     602                 * @param array      $actions An array of comment actions. Default actions include:
     603                 *                            'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
     604                 *                            'Delete', and 'Trash'.
     605                 * @param WP_Comment $comment The comment object.
    606606                 */
    607607                $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
    608608
  • src/wp-admin/includes/export.php

     
    473473                </wp:postmeta>
    474474<?php   endforeach;
    475475
    476                 $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
     476                $_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
     477                $comments = array_map( 'get_comment', $_comments );
    477478                foreach ( $comments as $c ) : ?>
    478479                <wp:comment>
    479480                        <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
  • src/wp-admin/includes/template.php

     
    743743 *
    744744 * @since 0.71
    745745 *
    746  * @global WP_Locale $wp_locale
    747  * @global object    $comment
     746 * @global WP_Locale  $wp_locale
     747 * @global WP_Comment $comment
    748748 *
    749749 * @param int|bool $edit      Accepts 1|true for editing the date, 0|false for adding the date.
    750750 * @param int|bool $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
  • src/wp-comments-post.php

     
    146146 *
    147147 * @since 3.4.0
    148148 *
    149  * @param object $comment Comment object.
    150  * @param WP_User $user   User object. The user may not exist.
     149 * @param WP_Comment $comment Comment object.
     150 * @param WP_User    $user    User object. The user may not exist.
    151151 */
    152152do_action( 'set_comment_cookies', $comment, $user );
    153153
     
    158158 *
    159159 * @since 2.0.5
    160160 *
    161  * @param string $location The 'redirect_to' URI sent via $_POST.
    162  * @param object $comment  Comment object.
     161 * @param string     $location The 'redirect_to' URI sent via $_POST.
     162 * @param WP_Comment $comment  Comment object.
    163163 */
    164164$location = apply_filters( 'comment_post_redirect', $location, $comment );
    165165
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    10431043                 *
    10441044                 * @since 3.4.0
    10451045                 *
    1046                  * @param array  $_comment An array of prepared comment data.
    1047                  * @param object $comment  Comment object.
     1046                 * @param array      $_comment An array of prepared comment data.
     1047                 * @param WP_Comment $comment  Comment object.
    10481048                 */
    10491049                return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment );
    10501050        }
  • src/wp-includes/comment-template.php

     
    3737         * @since 1.5.0
    3838         * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
    3939         *
    40          * @param string $author     The comment author's username.
    41          * @param int    $comment_ID The comment ID.
    42          * @param object $comment    The comment object.
     40         * @param string     $author     The comment author's username.
     41         * @param int        $comment_ID The comment ID.
     42         * @param WP_Comment $comment    The comment object.
    4343         */
    4444        return apply_filters( 'get_comment_author', $author, $comment_ID, $comment );
    4545}
     
    8383         * @since 1.5.0
    8484         * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
    8585         *
    86          * @param string $comment_author_email The comment author's email address.
    87          * @param int    $comment_ID           The comment ID.
    88          * @param object $comment              The comment object.
     86         * @param string     $comment_author_email The comment author's email address.
     87         * @param int        $comment_ID           The comment ID.
     88         * @param WP_Comment $comment              The comment object.
    8989         */
    9090        return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment_ID, $comment );
    9191}
     
    170170         * @since 1.2.0
    171171         * @since 4.1.0 The `$comment` parameter was added.
    172172         *
    173          * @param string $comment_author_email The comment author's email address.
    174          * @param object $comment              The comment object.
     173         * @param string     $comment_author_email The comment author's email address.
     174         * @param WP_Comment $comment              The comment object.
    175175         */
    176176        $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
    177177        if ((!empty($email)) && ($email != '@')) {
     
    250250         * @since 1.5.0
    251251         * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
    252252         *
    253          * @param string $comment_author_IP The comment author's IP address.
    254          * @param int    $comment_ID        The comment ID.
    255          * @param object $comment           The comment object.
     253         * @param string     $comment_author_IP The comment author's IP address.
     254         * @param int        $comment_ID        The comment ID.
     255         * @param WP_Comment $comment           The comment object.
    256256         */
    257257        return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment_ID, $comment );
    258258}
     
    289289         * @since 1.5.0
    290290         * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
    291291         *
    292          * @param string $url        The comment author's URL.
    293          * @param int    $comment_ID The comment ID.
    294          * @param object $comment    The comment object.
     292         * @param string     $url        The comment author's URL.
     293         * @param int        $comment_ID The comment ID.
     294         * @param WP_Comment $comment    The comment object.
    295295         */
    296296        return apply_filters( 'get_comment_author_url', $url, $comment_ID, $comment );
    297297}
     
    508508         *
    509509         * @param string|int $date    Formatted date string or Unix timestamp.
    510510         * @param string     $d       The format of the date.
    511          * @param object    $comment The comment object.
     511         * @param WP_Comment $comment The comment object.
    512512         */
    513513        return apply_filters( 'get_comment_date', $date, $d, $comment );
    514514}
     
    563563         * @since 1.5.0
    564564         * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
    565565         *
    566          * @param string $excerpt    The comment excerpt text.
    567          * @param int    $comment_ID The comment ID.
    568          * @param object $comment    The comment object.
     566         * @param string     $excerpt    The comment excerpt text.
     567         * @param int        $comment_ID The comment ID.
     568         * @param WP_Comment $comment    The comment object.
    569569         */
    570570        return apply_filters( 'get_comment_excerpt', $excerpt, $comment_ID, $comment );
    571571}
     
    611611         * @since 1.5.0
    612612         * @since 4.1.0 The `$comment_ID` parameter was added.
    613613         *
    614          * @param int    $comment_ID The current comment ID.
    615          * @param object $comment    The comment object.
     614         * @param int        $comment_ID The current comment ID.
     615         * @param WP_Comment $comment    The comment object.
    616616         */
    617617        return apply_filters( 'get_comment_ID', $comment->comment_ID, $comment );
    618618}
     
    636636 * @global WP_Rewrite $wp_rewrite
    637637 * @global bool       $in_comment_loop
    638638 *
    639  * @param mixed $comment Comment to retrieve. Default current comment.
    640  * @param array $args    Optional. An array of arguments to override the defaults.
     639 * @param WP_Comment|int|null $comment Comment to retrieve. Default current comment.
     640 * @param array               $args    Optional. An array of arguments to override the defaults.
    641641 * @return string The permalink to the given comment.
    642642 */
    643643function get_comment_link( $comment = null, $args = array() ) {
     
    681681         *
    682682         * @see get_page_of_comment()
    683683         *
    684          * @param string $link    The comment permalink with '#comment-$id' appended.
    685          * @param object $comment The current comment object.
    686          * @param array  $args    An array of arguments to override the defaults.
     684         * @param string     $link    The comment permalink with '#comment-$id' appended.
     685         * @param WP_Comment $comment The current comment object.
     686         * @param array      $args    An array of arguments to override the defaults.
    687687         */
    688688        return apply_filters( 'get_comment_link', $link, $comment, $args );
    689689}
     
    825825         *
    826826         * @see Walker_Comment::comment()
    827827         *
    828          * @param string $comment_content Text of the comment.
    829          * @param object $comment         The comment object.
    830          * @param array  $args            An array of arguments.
     828         * @param string     $comment_content Text of the comment.
     829         * @param WP_Comment $comment         The comment object.
     830         * @param array      $args            An array of arguments.
    831831         */
    832832        return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args );
    833833}
     
    853853         *
    854854         * @see Walker_Comment::comment()
    855855         *
    856          * @param string $comment_text Text of the current comment.
    857          * @param object $comment      The comment object.
    858          * @param array  $args         An array of arguments.
     856         * @param string     $comment_text Text of the current comment.
     857         * @param WP_Comment $comment      The comment object.
     858         * @param array      $args         An array of arguments.
    859859         */
    860860        echo apply_filters( 'comment_text', $comment_text, $comment, $args );
    861861}
     
    890890         * @param string     $d         Date format.
    891891         * @param bool       $gmt       Whether the GMT date is in use.
    892892         * @param bool       $translate Whether the time is translated.
    893          * @param object    $comment   The comment object.
     893         * @param WP_Comment $comment   The comment object.
    894894         */
    895895        return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate, $comment );
    896896}
     
    925925         * @since 1.5.0
    926926         * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
    927927         *
    928          * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
    929          * @param int    $comment_ID   The comment ID.
    930          * @param object $comment      The comment object.
     928         * @param string     $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
     929         * @param int        $comment_ID   The comment ID.
     930         * @param WP_Comment $comment      The comment object.
    931931         */
    932932        return apply_filters( 'get_comment_type', $comment->comment_type, $comment_ID, $comment );
    933933}
     
    18591859         * @see Walker::end_el()
    18601860         * @see wp_list_comments()
    18611861         *
    1862          * @param string $output  Passed by reference. Used to append additional content.
    1863          * @param object $comment The comment object. Default current comment.
    1864          * @param int    $depth   Depth of comment.
    1865          * @param array  $args    An array of arguments.
     1862         * @param string     $output  Passed by reference. Used to append additional content.
     1863         * @param WP_Comment $comment The comment object. Default current comment.
     1864         * @param int        $depth   Depth of comment.
     1865         * @param array      $args    An array of arguments.
    18661866         */
    18671867        public function end_el( &$output, $comment, $depth = 0, $args = array() ) {
    18681868                if ( !empty( $args['end-callback'] ) ) {
     
    18851885         *
    18861886         * @see wp_list_comments()
    18871887         *
    1888          * @param object $comment The comment object.
    1889          * @param int    $depth   Depth of comment.
    1890          * @param array  $args    An array of arguments.
     1888         * @param WP_Comment $comment The comment object.
     1889         * @param int        $depth   Depth of comment.
     1890         * @param array      $args    An array of arguments.
    18911891         */
    18921892        protected function ping( $comment, $depth, $args ) {
    18931893                $tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
     
    20492049 *     @type bool   $short_ping        Whether to output short pings. Default false.
    20502050 *     @type bool   $echo              Whether to echo the output or return it. Default true.
    20512051 * }
    2052  * @param array $comments Optional. Array of comment objects.
     2052 * @param array $comments Optional. Array of WP_Comment objects.
    20532053 */
    20542054function wp_list_comments( $args = array(), $comments = null ) {
    20552055        global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
  • src/wp-includes/comment.php

     
    164164 * @global wpdb   $wpdb WordPress database abstraction object.
    165165 * @global object $comment
    166166 *
    167  * @param object|string|int $comment Comment to retrieve.
     167 * @param WP_Comment|int|null $comment Comment to retrieve.
    168168 * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants.
    169  * @return object|array|null Depends on $output value.
     169 * @return WP_Comment|array|null Depends on $output value.
    170170 */
    171 function get_comment(&$comment, $output = OBJECT) {
    172         global $wpdb;
     171function get_comment( &$comment = null, $output = OBJECT ) {
     172        if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) {
     173                $comment = $GLOBALS['comment'];
     174        }
    173175
    174         if ( empty($comment) ) {
    175                 if ( isset($GLOBALS['comment']) )
    176                         $_comment = & $GLOBALS['comment'];
    177                 else
    178                         $_comment = null;
    179         } elseif ( is_object($comment) ) {
    180                 wp_cache_add($comment->comment_ID, $comment, 'comment');
     176        if ( $comment instanceof WP_Comment ) {
    181177                $_comment = $comment;
     178        } elseif ( is_object( $comment ) ) {
     179                $_comment = WP_Comment::get_instance( $comment->comment_ID );
    182180        } else {
    183                 if ( isset($GLOBALS['comment']) && ($GLOBALS['comment']->comment_ID == $comment) ) {
    184                         $_comment = & $GLOBALS['comment'];
    185                 } elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) {
    186                         $_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment));
    187                         if ( ! $_comment )
    188                                 return null;
    189                         wp_cache_add($_comment->comment_ID, $_comment, 'comment');
    190                 }
     181                $_comment = WP_Comment::get_instance( $comment );
    191182        }
    192183
     184        if ( ! $_comment ) {
     185                return null;
     186        }
     187
    193188        /**
    194189         * Fires after a comment is retrieved.
    195190         *
     
    213208}
    214209
    215210/**
     211 * WordPress Comment class
     212 *
     213 * @since 4.3.0
     214 */
     215final class WP_Comment {
     216        /**
     217         * @var int
     218         */
     219        public $comment_ID;
     220        /**
     221         * @var int
     222         */
     223        public $comment_post_ID = 0;
     224        /**
     225         * @var int
     226         */
     227        public $comment_author;
     228        /**
     229         * @var string
     230         */
     231        public $comment_author_email = '';
     232        /**
     233         * @var string
     234         */
     235        public $comment_author_url = '';
     236        /**
     237         * @var string
     238         */
     239        public $comment_author_IP = '';
     240        /**
     241         * @var string
     242         */
     243        public $comment_date = '0000-00-00 00:00:00';
     244        /**
     245         * @var string
     246         */
     247        public $comment_date_gmt = '0000-00-00 00:00:00';
     248        /**
     249         * @var string
     250         */
     251        public $comment_content;
     252        /**
     253         * @var int
     254         */
     255        public $comment_karma = 0;
     256        /**
     257         * @var string
     258         */
     259        public $comment_approved = '1';
     260        /**
     261         * @var string
     262         */
     263        public $comment_agent = '';
     264        /**
     265         * @var string
     266         */
     267        public $comment_type = '';
     268        /**
     269         * @var int
     270         */
     271        public $comment_parent = 0;
     272        /**
     273         * @var int
     274         */
     275        public $user_id = 0;
     276
     277        /**
     278         * Retrieve WP_Comment instance.
     279         *
     280         * @static
     281         * @access public
     282         *
     283         * @global wpdb $wpdb
     284         *
     285         * @param int $id Comment ID.
     286         * @return WP_Comment|false Comment object, false otherwise.
     287         */
     288        public static function get_instance( $id ) {
     289                global $wpdb;
     290
     291                $comment_id = (int) $id;
     292                if ( ! $comment_id ) {
     293                        return false;
     294                }
     295
     296                $_comment = wp_cache_get( $comment_id, 'comment' );
     297
     298                if ( ! $_comment ) {
     299                        $_comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id ) );
     300
     301                        if ( ! $_comment ) {
     302                                return false;
     303                        }
     304
     305                        wp_cache_add( $_comment->comment_ID, $_comment, 'comment' );
     306                }
     307
     308                return new WP_Comment( $_comment );
     309        }
     310
     311        /**
     312         * Constructor.
     313         *
     314         * @param WP_Comment $comment Comment object.
     315         */
     316        public function __construct( $comment ) {
     317                foreach ( get_object_vars( $comment ) as $key => $value ) {
     318                        $this->$key = $value;
     319                }
     320        }
     321
     322        /**
     323         * Isset-er.
     324         *
     325         * @param string $key Property to check if set.
     326         * @return bool
     327         */
     328        public function __isset( $key ) {
     329                return metadata_exists( 'comment', $this->comment_ID, $key );
     330        }
     331
     332        /**
     333         * Getter.
     334         *
     335         * @param string $key Key to get.
     336         * @return mixed
     337         */
     338        public function __get( $key ) {
     339                return get_comment_meta( $this->comment_ID, $key, true );
     340        }
     341}
     342
     343/**
    216344 * Retrieve a list of comments.
    217345 *
    218346 * The comment list can be for the blog as a whole or for an individual post.
     
    12061334 * Sets the cookies used to store an unauthenticated commentator's identity. Typically used
    12071335 * to recall previous comments by this commentator that are still held in moderation.
    12081336 *
    1209  * @param object $comment Comment object.
    1210  * @param object $user Comment author's object.
     1337 * @param WP_Comment $comment Comment object.
     1338 * @param object     $user Comment author's object.
    12111339 *
    12121340 * @since 3.4.0
    12131341 */
     
    14871615 *
    14881616 * @global WP_Query $wp_query
    14891617 *
    1490  * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments
     1618 * @param array $comments Optional array of WP_Comment objects. Defaults to $wp_query->comments
    14911619 * @param int $per_page Optional comments per page.
    14921620 * @param boolean $threaded Optional control over flat or threaded comments.
    14931621 * @return int Number of comment pages.
     
    20302158                 *
    20312159                 * @since 2.7.0
    20322160                 *
    2033                  * @param object $comment Comment object.
     2161                 * @param WP_Comment $comment Comment object.
    20342162                 */
    20352163                do_action( "comment_{$old_status}_to_{$new_status}", $comment );
    20362164        }
     
    20452173         *
    20462174         * @since 2.7.0
    20472175         *
    2048          * @param int $comment_ID The comment ID.
    2049          * @param obj $comment    Comment object.
     2176         * @param int        $comment_ID The comment ID.
     2177         * @param WP_Comment $comment    Comment object.
    20502178         */
    20512179        do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
    20522180}
     
    21612289         *
    21622290         * @since 2.8.0
    21632291         *
    2164          * @param int $id      The comment ID.
    2165          * @param obj $comment Comment object.
     2292         * @param int        $id      The comment ID.
     2293         * @param WP_Comment $comment Comment object.
    21662294         */
    21672295        do_action( 'wp_insert_comment', $id, $comment );
    21682296
  • src/wp-includes/feed.php

     
    264264 *
    265265 * @since 2.5.0
    266266 *
    267  * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
     267 * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     268 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
    268269 */
    269270function comment_guid($comment_id = null) {
    270271        echo esc_url( get_comment_guid($comment_id) );
     
    275276 *
    276277 * @since 2.5.0
    277278 *
    278  * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
     279 * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     280 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
    279281 * @return false|string false on failure or guid for comment on success.
    280282 */
    281283function get_comment_guid($comment_id = null) {
     
    642644         */
    643645        do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
    644646        $feed->init();
    645         $feed->set_output_encoding( get_option( 'blog_charset' ) ); 
     647        $feed->set_output_encoding( get_option( 'blog_charset' ) );
    646648        $feed->handle_content_type();
    647649
    648650        if ( $feed->error() )
  • src/wp-includes/link-template.php

     
    34393439 * @since 4.2.0
    34403440 *
    34413441 * @param mixed $id_or_email The Gravatar to retrieve a URL for. Accepts a user_id, gravatar md5 hash,
    3442  *                           user email, WP_User object, WP_Post object, or comment object.
     3442 *                           user email, WP_User object, WP_Post object, or WP_Comment object.
    34433443 * @param array $args {
    34443444 *     Optional. Arguments to return instead of the default arguments.
    34453445 *
     
    34703470 *
    34713471 * @since 4.2.0
    34723472 *
    3473  * @param mixed $id_or_email The Gravatar to check the data against. Accepts a user_id, gravatar md5 hash,
    3474  *                           user email, WP_User object, WP_Post object, or comment object.
     3473 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     3474 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
    34753475 * @param array $args {
    34763476 *     Optional. Arguments to return instead of the default arguments.
    34773477 *
     
    35713571         *
    35723572         * @since 4.2.0
    35733573         *
    3574          * @param array             $args          Arguments passed to get_avatar_data(), after processing.
    3575          * @param int|object|string $id_or_email   A user ID, email address, or comment object.
     3574         * @param array  $args        Arguments passed to get_avatar_data(), after processing.
     3575         * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     3576         *                            user email, WP_User object, WP_Post object, or WP_Comment object.
    35763577         */
    35773578        $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email );
    35783579
     
    36013602        } elseif ( $id_or_email instanceof WP_Post ) {
    36023603                // Post Object
    36033604                $user = get_user_by( 'id', (int) $id_or_email->post_author );
    3604         } elseif ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
    3605                 // Comment Object
    3606 
     3605        } elseif ( $id_or_email instanceof WP_Comment ) {
    36073606                /**
    36083607                 * Filter the list of allowed comment types for retrieving avatars.
    36093608                 *
     
    36623661         *
    36633662         * @since 4.2.0
    36643663         *
    3665          * @param string            $url         The URL of the avatar.
    3666          * @param int|object|string $id_or_email A user ID, email address, or comment object.
    3667          * @param array             $args        Arguments passed to get_avatar_data(), after processing.
     3664         * @param string $url         The URL of the avatar.
     3665         * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     3666         *                            user email, WP_User object, WP_Post object, or WP_Comment object.
     3667         * @param array  $args        Arguments passed to get_avatar_data(), after processing.
    36683668         */
    36693669        $args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args );
    36703670
     
    36733673         *
    36743674         * @since 4.2.0
    36753675         *
    3676          * @param array             $args        Arguments passed to get_avatar_data(), after processing.
    3677          * @param int|object|string $id_or_email A user ID, email address, or comment object.
     3676         * @param array  $args        Arguments passed to get_avatar_data(), after processing.
     3677         * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     3678         *                            user email, WP_User object, WP_Post object, or WP_Comment object.
    36783679         */
    36793680        return apply_filters( 'get_avatar_data', $args, $id_or_email );
    36803681}
  • src/wp-includes/pluggable.php

     
    21462146 * @since 4.2.0 Optional `$args` parameter added.
    21472147 *
    21482148 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
    2149  *                           user email, WP_User object, WP_Post object, or comment object.
     2149 *                           user email, WP_User object, WP_Post object, or WP_Comment object.
    21502150 * @param int    $size       Optional. Height and width of the avatar image file in pixels. Default 96.
    21512151 * @param string $default    Optional. URL for the default image or a default type. Accepts '404'
    21522152 *                           (return a 404 instead of a default image), 'retro' (8bit), 'monsterid'
     
    22142214         *
    22152215         * @since 4.2.0
    22162216         *
    2217          * @param string            $avatar      HTML for the user's avatar. Default null.
    2218          * @param int|object|string $id_or_email A user ID, email address, or comment object.
    2219          * @param array             $args        Arguments passed to get_avatar_url(), after processing.
     2217         * @param string $avatar      HTML for the user's avatar. Default null.
     2218         * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     2219         *                            user email, WP_User object, WP_Post object, or WP_Comment object.
     2220         * @param array  $args        Arguments passed to get_avatar_url(), after processing.
    22202221         */
    22212222        $avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
    22222223
     
    22702271         * @since 2.5.0
    22712272         * @since 4.2.0 The `$args` parameter was added.
    22722273         *
    2273          * @param string            $avatar      &lt;img&gt; tag for the user's avatar.
    2274          * @param int|object|string $id_or_email A user ID, email address, or comment object.
    2275          * @param int               $size        Square avatar width and height in pixels to retrieve.
    2276          * @param string            $alt         Alternative text to use in the avatar image tag.
     2274         * @param string $avatar      &lt;img&gt; tag for the user's avatar.
     2275         * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
     2276         *                            user email, WP_User object, WP_Post object, or WP_Comment object.
     2277         * @param int    $size        Square avatar width and height in pixels to retrieve.
     2278         * @param string $alt         Alternative text to use in the avatar image tag.
    22772279         *                                       Default empty.
    2278          * @param array             $args        Arguments passed to get_avatar_data(), after processing.
     2280         * @param array  $args        Arguments passed to get_avatar_data(), after processing.
    22792281         */
    22802282        return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
    22812283}
  • src/wp-includes/query.php

     
    31603160                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
    31613161                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
    31623162
    3163                         $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
     3163                        $comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
     3164                        $this->comments = array_map( 'get_comment', $comments );
    31643165                        $this->comment_count = count($this->comments);
    31653166
    31663167                        $post_ids = array();
     
    37863787        }
    37873788
    37883789        /**
    3789          * Iterate current comment index and return comment object.
     3790         * Iterate current comment index and return WP_Comment object.
    37903791         *
    37913792         * @since 2.2.0
    37923793         * @access public
    37933794         *
    3794          * @return object Comment object.
     3795         * @return WP_Comment Comment object.
    37953796         */
    37963797        public function next_comment() {
    37973798                $this->current_comment++;