Ticket #32619: 32619.3.diff
File 32619.3.diff, 30.7 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-form-comment.php
171 171 * 172 172 * @since 3.0.0 173 173 * 174 * @param object $comment Comment object.174 * @param WP_Comment $comment Comment object. 175 175 */ 176 176 do_action( 'add_meta_boxes_comment', $comment ); 177 177 -
src/wp-admin/includes/comment.php
74 74 } 75 75 76 76 /** 77 * Returns a comment object based on comment ID.77 * Returns a WP_Comment object based on comment ID. 78 78 * 79 79 * @since 2.0.0 80 80 * 81 81 * @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. 83 83 */ 84 84 function get_comment_to_edit( $id ) { 85 85 if ( !$comment = get_comment($id) ) -
src/wp-admin/includes/dashboard.php
548 548 } 549 549 550 550 /** 551 * @global object $comment551 * @global WP_Comment $comment 552 552 * 553 * @param object $comment554 * @param bool $show_date553 * @param WP_Comment $comment 554 * @param bool $show_date 555 555 */ 556 556 function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { 557 557 $GLOBALS['comment'] =& $comment; … … 603 603 * 604 604 * @since 2.6.0 605 605 * 606 * @param array $actions An array of comment actions. Default actions include:607 * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',608 * 'Delete', and 'Trash'.609 * @param object $comment The comment object.606 * @param array $actions An array of comment actions. Default actions include: 607 * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam', 608 * 'Delete', and 'Trash'. 609 * @param WP_Comment $comment The comment object. 610 610 */ 611 611 $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment ); 612 612 -
src/wp-admin/includes/export.php
473 473 </wp:postmeta> 474 474 <?php endforeach; 475 475 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 ); 477 478 foreach ( $comments as $c ) : ?> 478 479 <wp:comment> 479 480 <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id> -
src/wp-admin/includes/template.php
743 743 * 744 744 * @since 0.71 745 745 * 746 * @global WP_Locale $wp_locale747 * @global object$comment746 * @global WP_Locale $wp_locale 747 * @global WP_Comment $comment 748 748 * 749 749 * @param int|bool $edit Accepts 1|true for editing the date, 0|false for adding the date. 750 750 * @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
146 146 * 147 147 * @since 3.4.0 148 148 * 149 * @param object $comment Comment object.150 * @param WP_User $userUser 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. 151 151 */ 152 152 do_action( 'set_comment_cookies', $comment, $user ); 153 153 … … 158 158 * 159 159 * @since 2.0.5 160 160 * 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. 163 163 */ 164 164 $location = apply_filters( 'comment_post_redirect', $location, $comment ); 165 165 -
src/wp-includes/class-wp-comment.php
1 <?php 2 /** 3 * Comments API: WP_Comment object class 4 * 5 * @package WordPress 6 * @subpackage Comments 7 * @since 4.4.0 8 */ 9 10 /** 11 * Core class used to organize comments as instantiated objects with defined members. 12 * 13 * @since 4.4.0 14 */ 15 final class WP_Comment { 16 /** 17 * Comment ID. 18 * 19 * @since 4.4.0 20 * @access public 21 * @var int 22 */ 23 public $comment_ID; 24 25 /** 26 * ID of the post the comment is associated with. 27 * 28 * @since 4.4.0 29 * @access public 30 * @var int 31 */ 32 public $comment_post_ID = 0; 33 34 /** 35 * Comment author ID. 36 * 37 * @since 4.4.0 38 * @access public 39 * @var string 40 */ 41 public $comment_author = ''; 42 43 /** 44 * Comment author email address. 45 * 46 * @since 4.4.0 47 * @access public 48 * @var string 49 */ 50 public $comment_author_email = ''; 51 52 /** 53 * Comment author URL. 54 * 55 * @since 4.4.0 56 * @access public 57 * @var string 58 */ 59 public $comment_author_url = ''; 60 61 /** 62 * Comment author IP address (IPv4 format). 63 * 64 * @since 4.4.0 65 * @access public 66 * @var string 67 */ 68 public $comment_author_IP = ''; 69 70 /** 71 * Comment date in YYYY-MM-DD HH:MM:SS format. 72 * 73 * @since 4.4.0 74 * @access public 75 * @var string 76 */ 77 public $comment_date = '0000-00-00 00:00:00'; 78 79 /** 80 * Comment GMT date in YYYY-MM-DD HH::MM:SS format. 81 * 82 * @since 4.4.0 83 * @access public 84 * @var string 85 */ 86 public $comment_date_gmt = '0000-00-00 00:00:00'; 87 88 /** 89 * Comment content. 90 * 91 * @since 4.4.0 92 * @access public 93 * @var string 94 */ 95 public $comment_content; 96 97 /** 98 * Comment karma count. 99 * 100 * @since 4.4.0 101 * @access public 102 * @var int 103 */ 104 public $comment_karma = 0; 105 106 /** 107 * Comment approval status. 108 * 109 * @since 4.4.0 110 * @access public 111 * @var string 112 */ 113 public $comment_approved = '1'; 114 115 /** 116 * Comment author HTTP user agent. 117 * 118 * @since 4.4.0 119 * @access public 120 * @var string 121 */ 122 public $comment_agent = ''; 123 124 /** 125 * Comment type. 126 * 127 * @since 4.4.0 128 * @access public 129 * @var string 130 */ 131 public $comment_type = ''; 132 133 /** 134 * Parent comment ID. 135 * 136 * @since 4.4.0 137 * @access public 138 * @var int 139 */ 140 public $comment_parent = 0; 141 142 /** 143 * Comment author ID. 144 * 145 * @since 4.4.0 146 * @access public 147 * @var int 148 */ 149 public $user_id = 0; 150 151 /** 152 * Retrieves a WP_Comment instance. 153 * 154 * @since 4.4.0 155 * @access public 156 * @static 157 * 158 * @global wpdb $wpdb WordPress database abstraction object. 159 * 160 * @param int $id Comment ID. 161 * @return WP_Comment|false Comment object, otherwise false. 162 */ 163 public static function get_instance( $id ) { 164 global $wpdb; 165 166 $comment_id = (int) $id; 167 if ( ! $comment_id ) { 168 return false; 169 } 170 171 // First try to get it from the cache. 172 $_comment = wp_cache_get( $comment_id, 'comment' ); 173 174 if ( ! $_comment ) { 175 $_comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id ) ); 176 177 if ( ! $_comment ) { 178 return false; 179 } 180 181 wp_cache_add( $_comment->comment_ID, $_comment, 'comment' ); 182 } 183 184 return new WP_Comment( $_comment ); 185 } 186 187 /** 188 * Constructor. 189 * 190 * Populates properties with object vars. 191 * 192 * @since 4.4.0 193 * @access public 194 * 195 * @param WP_Comment $comment Comment object. 196 */ 197 public function __construct( $comment ) { 198 foreach ( get_object_vars( $comment ) as $key => $value ) { 199 $this->$key = $value; 200 } 201 } 202 203 /** 204 * Magic method to check if the given property is set in meta. 205 * 206 * @since 4.4.0 207 * @access public 208 * 209 * @param string $key Property to check if set. 210 * @return bool Whether the given property is set. 211 */ 212 public function __isset( $key ) { 213 return metadata_exists( 'comment', $this->comment_ID, $key ); 214 } 215 216 /** 217 * Magic method to get the given property value from meta. 218 * 219 * @since 4.4.0 220 * @access public 221 * 222 * @param string $key Property to retrieve the value for. 223 * @return mixed Value of the given property (if set). 224 */ 225 public function __get( $key ) { 226 return get_comment_meta( $this->comment_ID, $key, true ); 227 } 228 } -
src/wp-includes/class-wp-xmlrpc-server.php
1042 1042 * 1043 1043 * @since 3.4.0 1044 1044 * 1045 * @param array $_comment An array of prepared comment data.1046 * @param object $comment Comment object.1045 * @param array $_comment An array of prepared comment data. 1046 * @param WP_Comment $comment Comment object. 1047 1047 */ 1048 1048 return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment ); 1049 1049 } -
src/wp-includes/comment-functions.php
164 164 * @global wpdb $wpdb WordPress database abstraction object. 165 165 * @global object $comment 166 166 * 167 * @param object|string|int $comment Comment to retrieve.167 * @param WP_Comment|string|int $comment Comment to retrieve. 168 168 * @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. 170 170 */ 171 171 function get_comment(&$comment, $output = OBJECT) { 172 global $wpdb; 172 if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) { 173 $comment = $GLOBALS['comment']; 174 } 173 175 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 ) { 181 177 $_comment = $comment; 178 } elseif ( is_object( $comment ) ) { 179 $_comment = WP_Comment::get_instance( $comment->comment_ID ); 182 180 } 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 ); 191 182 } 192 183 184 if ( ! $_comment ) { 185 return null; 186 } 187 193 188 /** 194 189 * Fires after a comment is retrieved. 195 190 * … … 479 474 * Sets the cookies used to store an unauthenticated commentator's identity. Typically used 480 475 * to recall previous comments by this commentator that are still held in moderation. 481 476 * 482 * @param object $comment Comment object.483 * @param object $userComment author's object.477 * @param WP_Comment $comment Comment object. 478 * @param object $user Comment author's object. 484 479 * 485 480 * @since 3.4.0 486 481 */ … … 760 755 * 761 756 * @global WP_Query $wp_query 762 757 * 763 * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments758 * @param array $comments Optional array of WP_Comment objects. Defaults to $wp_query->comments 764 759 * @param int $per_page Optional comments per page. 765 760 * @param bool $threaded Optional control over flat or threaded comments. 766 761 * @return int Number of comment pages. … … 1288 1283 * 1289 1284 * @since 2.7.0 1290 1285 * 1291 * @param object $comment Comment object.1286 * @param WP_Comment $comment Comment object. 1292 1287 */ 1293 1288 do_action( "comment_{$old_status}_to_{$new_status}", $comment ); 1294 1289 } … … 1303 1298 * 1304 1299 * @since 2.7.0 1305 1300 * 1306 * @param int $comment_ID The comment ID.1307 * @param obj$comment Comment object.1301 * @param int $comment_ID The comment ID. 1302 * @param WP_Comment $comment Comment object. 1308 1303 */ 1309 1304 do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment ); 1310 1305 } … … 1423 1418 * 1424 1419 * @since 2.8.0 1425 1420 * 1426 * @param int $id The comment ID.1427 * @param obj$comment Comment object.1421 * @param int $id The comment ID. 1422 * @param WP_Comment $comment Comment object. 1428 1423 */ 1429 1424 do_action( 'wp_insert_comment', $id, $comment ); 1430 1425 -
src/wp-includes/comment-template.php
37 37 * @since 1.5.0 38 38 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 39 39 * 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. 43 43 */ 44 44 return apply_filters( 'get_comment_author', $author, $comment_ID, $comment ); 45 45 } … … 83 83 * @since 1.5.0 84 84 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 85 85 * 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. 89 89 */ 90 90 return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment_ID, $comment ); 91 91 } … … 170 170 * @since 1.2.0 171 171 * @since 4.1.0 The `$comment` parameter was added. 172 172 * 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. 175 175 */ 176 176 $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); 177 177 if ((!empty($email)) && ($email != '@')) { … … 250 250 * @since 1.5.0 251 251 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 252 252 * 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. 256 256 */ 257 257 return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment_ID, $comment ); 258 258 } … … 289 289 * @since 1.5.0 290 290 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 291 291 * 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. 295 295 */ 296 296 return apply_filters( 'get_comment_author_url', $url, $comment_ID, $comment ); 297 297 } … … 508 508 * 509 509 * @param string|int $date Formatted date string or Unix timestamp. 510 510 * @param string $d The format of the date. 511 * @param object$comment The comment object.511 * @param WP_Comment $comment The comment object. 512 512 */ 513 513 return apply_filters( 'get_comment_date', $date, $d, $comment ); 514 514 } … … 563 563 * @since 1.5.0 564 564 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 565 565 * 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. 569 569 */ 570 570 return apply_filters( 'get_comment_excerpt', $excerpt, $comment_ID, $comment ); 571 571 } … … 611 611 * @since 1.5.0 612 612 * @since 4.1.0 The `$comment_ID` parameter was added. 613 613 * 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. 616 616 */ 617 617 return apply_filters( 'get_comment_ID', $comment->comment_ID, $comment ); 618 618 } … … 636 636 * @global WP_Rewrite $wp_rewrite 637 637 * @global bool $in_comment_loop 638 638 * 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. 641 641 * @return string The permalink to the given comment. 642 642 */ 643 643 function get_comment_link( $comment = null, $args = array() ) { … … 681 681 * 682 682 * @see get_page_of_comment() 683 683 * 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. 687 687 */ 688 688 return apply_filters( 'get_comment_link', $link, $comment, $args ); 689 689 } … … 825 825 * 826 826 * @see Walker_Comment::comment() 827 827 * 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. 831 831 */ 832 832 return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args ); 833 833 } … … 853 853 * 854 854 * @see Walker_Comment::comment() 855 855 * 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. 859 859 */ 860 860 echo apply_filters( 'comment_text', $comment_text, $comment, $args ); 861 861 } … … 890 890 * @param string $d Date format. 891 891 * @param bool $gmt Whether the GMT date is in use. 892 892 * @param bool $translate Whether the time is translated. 893 * @param object$comment The comment object.893 * @param WP_Comment $comment The comment object. 894 894 */ 895 895 return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate, $comment ); 896 896 } … … 925 925 * @since 1.5.0 926 926 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 927 927 * 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. 931 931 */ 932 932 return apply_filters( 'get_comment_type', $comment->comment_type, $comment_ID, $comment ); 933 933 } … … 1858 1858 * @see Walker::end_el() 1859 1859 * @see wp_list_comments() 1860 1860 * 1861 * @param string $output Passed by reference. Used to append additional content.1862 * @param object $comment The comment object. Default current comment.1863 * @param int $depth Depth of comment.1864 * @param array $args An array of arguments.1861 * @param string $output Passed by reference. Used to append additional content. 1862 * @param WP_Comment $comment The comment object. Default current comment. 1863 * @param int $depth Depth of comment. 1864 * @param array $args An array of arguments. 1865 1865 */ 1866 1866 public function end_el( &$output, $comment, $depth = 0, $args = array() ) { 1867 1867 if ( !empty( $args['end-callback'] ) ) { … … 1884 1884 * 1885 1885 * @see wp_list_comments() 1886 1886 * 1887 * @param object $comment The comment object.1888 * @param int $depth Depth of comment.1889 * @param array $args An array of arguments.1887 * @param WP_Comment $comment The comment object. 1888 * @param int $depth Depth of comment. 1889 * @param array $args An array of arguments. 1890 1890 */ 1891 1891 protected function ping( $comment, $depth, $args ) { 1892 1892 $tag = ( 'div' == $args['style'] ) ? 'div' : 'li'; … … 2048 2048 * @type bool $short_ping Whether to output short pings. Default false. 2049 2049 * @type bool $echo Whether to echo the output or return it. Default true. 2050 2050 * } 2051 * @param array $comments Optional. Array of comment objects.2051 * @param array $comments Optional. Array of WP_Comment objects. 2052 2052 */ 2053 2053 function wp_list_comments( $args = array(), $comments = null ) { 2054 2054 global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop; -
src/wp-includes/comment.php
6 6 * @subpackage Comment 7 7 */ 8 8 9 require_once( ABSPATH . WPINC . '/class-wp-comment.php' ); 9 10 require_once( ABSPATH . WPINC . '/class-wp-comment-query.php' ); 10 11 require_once( ABSPATH . WPINC . '/comment-functions.php' ); -
src/wp-includes/feed.php
264 264 * 265 265 * @since 2.5.0 266 266 * 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. 268 269 */ 269 270 function comment_guid($comment_id = null) { 270 271 echo esc_url( get_comment_guid($comment_id) ); … … 275 276 * 276 277 * @since 2.5.0 277 278 * 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. 279 281 * @return false|string false on failure or guid for comment on success. 280 282 */ 281 283 function get_comment_guid($comment_id = null) { -
src/wp-includes/link-template.php
3454 3454 * @since 4.2.0 3455 3455 * 3456 3456 * @param mixed $id_or_email The Gravatar to retrieve a URL for. Accepts a user_id, gravatar md5 hash, 3457 * user email, WP_User object, WP_Post object, or comment object.3457 * user email, WP_User object, WP_Post object, or WP_Comment object. 3458 3458 * @param array $args { 3459 3459 * Optional. Arguments to return instead of the default arguments. 3460 3460 * … … 3485 3485 * 3486 3486 * @since 4.2.0 3487 3487 * 3488 * @param mixed $id_or_email The Gravatar to check the data against. Accepts a user_id, gravatar md5 hash,3489 * user email, WP_User object, WP_Post object, or comment object.3488 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 3489 * user email, WP_User object, WP_Post object, or WP_Comment object. 3490 3490 * @param array $args { 3491 3491 * Optional. Arguments to return instead of the default arguments. 3492 3492 * … … 3586 3586 * 3587 3587 * @since 4.2.0 3588 3588 * 3589 * @param array $args Arguments passed to get_avatar_data(), after processing. 3590 * @param int|object|string $id_or_email A user ID, email address, or comment object. 3589 * @param array $args Arguments passed to get_avatar_data(), after processing. 3590 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 3591 * user email, WP_User object, WP_Post object, or WP_Comment object. 3591 3592 */ 3592 3593 $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); 3593 3594 … … 3616 3617 } elseif ( $id_or_email instanceof WP_Post ) { 3617 3618 // Post Object 3618 3619 $user = get_user_by( 'id', (int) $id_or_email->post_author ); 3619 } elseif ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { 3620 // Comment Object 3621 3620 } elseif ( $id_or_email instanceof WP_Comment ) { 3622 3621 /** 3623 3622 * Filter the list of allowed comment types for retrieving avatars. 3624 3623 * … … 3681 3680 * 3682 3681 * @since 4.2.0 3683 3682 * 3684 * @param string $url The URL of the avatar. 3685 * @param int|object|string $id_or_email A user ID, email address, or comment object. 3686 * @param array $args Arguments passed to get_avatar_data(), after processing. 3683 * @param string $url The URL of the avatar. 3684 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 3685 * user email, WP_User object, WP_Post object, or WP_Comment object. 3686 * @param array $args Arguments passed to get_avatar_data(), after processing. 3687 3687 */ 3688 3688 $args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args ); 3689 3689 … … 3692 3692 * 3693 3693 * @since 4.2.0 3694 3694 * 3695 * @param array $args Arguments passed to get_avatar_data(), after processing. 3696 * @param int|object|string $id_or_email A user ID, email address, or comment object. 3695 * @param array $args Arguments passed to get_avatar_data(), after processing. 3696 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 3697 * user email, WP_User object, WP_Post object, or WP_Comment object. 3697 3698 */ 3698 3699 return apply_filters( 'get_avatar_data', $args, $id_or_email ); 3699 3700 } -
src/wp-includes/pluggable.php
2190 2190 * @since 4.2.0 Optional `$args` parameter added. 2191 2191 * 2192 2192 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 2193 * user email, WP_User object, WP_Post object, or comment object.2193 * user email, WP_User object, WP_Post object, or WP_Comment object. 2194 2194 * @param int $size Optional. Height and width of the avatar image file in pixels. Default 96. 2195 2195 * @param string $default Optional. URL for the default image or a default type. Accepts '404' 2196 2196 * (return a 404 instead of a default image), 'retro' (8bit), 'monsterid' … … 2258 2258 * 2259 2259 * @since 4.2.0 2260 2260 * 2261 * @param string $avatar HTML for the user's avatar. Default null. 2262 * @param int|object|string $id_or_email A user ID, email address, or comment object. 2263 * @param array $args Arguments passed to get_avatar_url(), after processing. 2261 * @param string $avatar HTML for the user's avatar. Default null. 2262 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 2263 * user email, WP_User object, WP_Post object, or WP_Comment object. 2264 * @param array $args Arguments passed to get_avatar_url(), after processing. 2264 2265 */ 2265 2266 $avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args ); 2266 2267 … … 2314 2315 * @since 2.5.0 2315 2316 * @since 4.2.0 The `$args` parameter was added. 2316 2317 * 2317 * @param string $avatar <img> tag for the user's avatar. 2318 * @param int|object|string $id_or_email A user ID, email address, or comment object. 2319 * @param int $size Square avatar width and height in pixels to retrieve. 2320 * @param string $alt Alternative text to use in the avatar image tag. 2318 * @param string $avatar <img> tag for the user's avatar. 2319 * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, 2320 * user email, WP_User object, WP_Post object, or WP_Comment object. 2321 * @param int $size Square avatar width and height in pixels to retrieve. 2322 * @param string $alt Alternative text to use in the avatar image tag. 2321 2323 * Default empty. 2322 * @param array 2324 * @param array $args Arguments passed to get_avatar_data(), after processing. 2323 2325 */ 2324 2326 return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args ); 2325 2327 } -
src/wp-includes/query.php
3186 3186 $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; 3187 3187 $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; 3188 3188 3189 $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"); 3189 $comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"); 3190 $this->comments = array_map( 'get_comment', $comments ); 3190 3191 $this->comment_count = count($this->comments); 3191 3192 3192 3193 $post_ids = array(); … … 3812 3813 } 3813 3814 3814 3815 /** 3815 * Iterate current comment index and return comment object.3816 * Iterate current comment index and return WP_Comment object. 3816 3817 * 3817 3818 * @since 2.2.0 3818 3819 * @access public 3819 3820 * 3820 * @return object Comment object.3821 * @return WP_Comment Comment object. 3821 3822 */ 3822 3823 public function next_comment() { 3823 3824 $this->current_comment++;