Ticket #57671: 57671.diff
| File 57671.diff, 38.9 KB (added by , 3 years ago) |
|---|
-
src/wp-includes/class-wp-xmlrpc-server.php
3720 3720 3721 3721 $username = $args[1]; 3722 3722 $password = $args[2]; 3723 $comment_ ID= (int) $args[3];3723 $comment_id = (int) $args[3]; 3724 3724 3725 3725 $user = $this->login( $username, $password ); 3726 3726 if ( ! $user ) { … … 3727 3727 return $this->error; 3728 3728 } 3729 3729 3730 if ( ! get_comment( $comment_ ID) ) {3730 if ( ! get_comment( $comment_id ) ) { 3731 3731 return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); 3732 3732 } 3733 3733 3734 if ( ! current_user_can( 'edit_comment', $comment_ ID) ) {3734 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 3735 3735 return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) ); 3736 3736 } 3737 3737 … … 3738 3738 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3739 3739 do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this ); 3740 3740 3741 $status = wp_delete_comment( $comment_ ID);3741 $status = wp_delete_comment( $comment_id ); 3742 3742 3743 3743 if ( $status ) { 3744 3744 /** … … 3746 3746 * 3747 3747 * @since 3.4.0 3748 3748 * 3749 * @param int $comment_ IDID of the deleted comment.3749 * @param int $comment_id ID of the deleted comment. 3750 3750 * @param array $args An array of arguments to delete the comment. 3751 3751 */ 3752 do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase3752 do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 3753 3753 } 3754 3754 3755 3755 return $status; … … 3787 3787 3788 3788 $username = $args[1]; 3789 3789 $password = $args[2]; 3790 $comment_ ID= (int) $args[3];3790 $comment_id = (int) $args[3]; 3791 3791 $content_struct = $args[4]; 3792 3792 3793 3793 $user = $this->login( $username, $password ); … … 3795 3795 return $this->error; 3796 3796 } 3797 3797 3798 if ( ! get_comment( $comment_ ID) ) {3798 if ( ! get_comment( $comment_id ) ) { 3799 3799 return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); 3800 3800 } 3801 3801 3802 if ( ! current_user_can( 'edit_comment', $comment_ ID) ) {3802 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 3803 3803 return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); 3804 3804 } 3805 3805 … … 3806 3806 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3807 3807 do_action( 'xmlrpc_call', 'wp.editComment', $args, $this ); 3808 3808 $comment = array( 3809 'comment_ID' => $comment_ ID,3809 'comment_ID' => $comment_id, 3810 3810 ); 3811 3811 3812 3812 if ( isset( $content_struct['status'] ) ) { … … 3858 3858 * 3859 3859 * @since 3.4.0 3860 3860 * 3861 * @param int $comment_ IDID of the updated comment.3861 * @param int $comment_id ID of the updated comment. 3862 3862 * @param array $args An array of arguments to update the comment. 3863 3863 */ 3864 do_action( 'xmlrpc_call_success_wp_editComment', $comment_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase3864 do_action( 'xmlrpc_call_success_wp_editComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 3865 3865 3866 3866 return true; 3867 3867 } … … 3999 3999 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4000 4000 do_action( 'xmlrpc_call', 'wp.newComment', $args, $this ); 4001 4001 4002 $comment_ ID= wp_new_comment( $comment, true );4003 if ( is_wp_error( $comment_ ID) ) {4004 return new IXR_Error( 403, $comment_ ID->get_error_message() );4002 $comment_id = wp_new_comment( $comment, true ); 4003 if ( is_wp_error( $comment_id ) ) { 4004 return new IXR_Error( 403, $comment_id->get_error_message() ); 4005 4005 } 4006 4006 4007 if ( ! $comment_ ID) {4007 if ( ! $comment_id ) { 4008 4008 return new IXR_Error( 403, __( 'Something went wrong.' ) ); 4009 4009 } 4010 4010 … … 4013 4013 * 4014 4014 * @since 3.4.0 4015 4015 * 4016 * @param int $comment_ IDID of the new comment.4016 * @param int $comment_id ID of the new comment. 4017 4017 * @param array $args An array of new comment arguments. 4018 4018 */ 4019 do_action( 'xmlrpc_call_success_wp_newComment', $comment_ ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase4019 do_action( 'xmlrpc_call_success_wp_newComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 4020 4020 4021 return $comment_ ID;4021 return $comment_id; 4022 4022 } 4023 4023 4024 4024 /** … … 7040 7040 'remote_source_original' 7041 7041 ); 7042 7042 7043 $comment_ ID= wp_new_comment( $commentdata );7043 $comment_id = wp_new_comment( $commentdata ); 7044 7044 7045 if ( is_wp_error( $comment_ ID) ) {7046 return $this->pingback_error( 0, $comment_ ID->get_error_message() );7045 if ( is_wp_error( $comment_id ) ) { 7046 return $this->pingback_error( 0, $comment_id->get_error_message() ); 7047 7047 } 7048 7048 7049 7049 /** … … 7051 7051 * 7052 7052 * @since 0.71 7053 7053 * 7054 * @param int $comment_ IDComment ID.7054 * @param int $comment_id Comment ID. 7055 7055 */ 7056 do_action( 'pingback_post', $comment_ ID);7056 do_action( 'pingback_post', $comment_id ); 7057 7057 7058 7058 /* translators: 1: URL of the page linked from, 2: URL of the page linked to. */ 7059 7059 return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $pagelinkedfrom, $pagelinkedto ); -
src/wp-includes/comment-template.php
15 15 * assumed. 16 16 * 17 17 * @since 1.5.0 18 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.18 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 19 19 * 20 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to retrieve the author.20 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to retrieve the author. 21 21 * Default current comment. 22 22 * @return string The comment author 23 23 */ 24 function get_comment_author( $comment_ ID= 0 ) {25 $comment = get_comment( $comment_ ID);26 $comment_ ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_ID;24 function get_comment_author( $comment_id = 0 ) { 25 $comment = get_comment( $comment_id ); 26 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id; 27 27 28 28 if ( empty( $comment->comment_author ) ) { 29 29 $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false; … … 40 40 * Filters the returned comment author name. 41 41 * 42 42 * @since 1.5.0 43 * @since 4.1.0 The `$comment_ ID` and `$comment` parameters were added.43 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 44 44 * 45 45 * @param string $author The comment author's username. 46 * @param string $comment_ IDThe comment ID as a numeric string.46 * @param string $comment_id The comment ID as a numeric string. 47 47 * @param WP_Comment $comment The comment object. 48 48 */ 49 return apply_filters( 'get_comment_author', $author, $comment_ ID, $comment );49 return apply_filters( 'get_comment_author', $author, $comment_id, $comment ); 50 50 } 51 51 52 52 /** … … 53 53 * Displays the author of the current comment. 54 54 * 55 55 * @since 0.71 56 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.56 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 57 57 * 58 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to print the author.58 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author. 59 59 * Default current comment. 60 60 */ 61 function comment_author( $comment_ ID= 0 ) {62 $comment = get_comment( $comment_ ID);61 function comment_author( $comment_id = 0 ) { 62 $comment = get_comment( $comment_id ); 63 63 $author = get_comment_author( $comment ); 64 64 65 65 /** … … 66 66 * Filters the comment author's name for display. 67 67 * 68 68 * @since 1.2.0 69 * @since 4.1.0 The `$comment_ ID` parameter was added.69 * @since 4.1.0 The `$comment_id` parameter was added. 70 70 * 71 71 * @param string $author The comment author's username. 72 * @param string $comment_ IDThe comment ID as a numeric string.72 * @param string $comment_id The comment ID as a numeric string. 73 73 */ 74 74 echo apply_filters( 'comment_author', $author, $comment->comment_ID ); 75 75 } … … 78 78 * Retrieves the email of the author of the current comment. 79 79 * 80 80 * @since 1.5.0 81 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.81 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 82 82 * 83 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to get the author's email.83 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's email. 84 84 * Default current comment. 85 85 * @return string The current comment author's email 86 86 */ 87 function get_comment_author_email( $comment_ ID= 0 ) {88 $comment = get_comment( $comment_ ID);87 function get_comment_author_email( $comment_id = 0 ) { 88 $comment = get_comment( $comment_id ); 89 89 90 90 /** 91 91 * Filters the comment author's returned email address. 92 92 * 93 93 * @since 1.5.0 94 * @since 4.1.0 The `$comment_ ID` and `$comment` parameters were added.94 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 95 95 * 96 96 * @param string $comment_author_email The comment author's email address. 97 * @param string $comment_ IDThe comment ID as a numeric string.97 * @param string $comment_id The comment ID as a numeric string. 98 98 * @param WP_Comment $comment The comment object. 99 99 */ 100 100 return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment ); … … 110 110 * address and use it for their own means good and bad. 111 111 * 112 112 * @since 0.71 113 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.113 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 114 114 * 115 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to print the author's email.115 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's email. 116 116 * Default current comment. 117 117 */ 118 function comment_author_email( $comment_ ID= 0 ) {119 $comment = get_comment( $comment_ ID);118 function comment_author_email( $comment_id = 0 ) { 119 $comment = get_comment( $comment_id ); 120 120 $author_email = get_comment_author_email( $comment ); 121 121 122 122 /** … … 123 123 * Filters the comment author's email for display. 124 124 * 125 125 * @since 1.2.0 126 * @since 4.1.0 The `$comment_ ID` parameter was added.126 * @since 4.1.0 The `$comment_id` parameter was added. 127 127 * 128 128 * @param string $author_email The comment author's email address. 129 * @param string $comment_ IDThe comment ID as a numeric string.129 * @param string $comment_id The comment ID as a numeric string. 130 130 */ 131 131 echo apply_filters( 'author_email', $author_email, $comment->comment_ID ); 132 132 } … … 208 208 * Retrieves the HTML link to the URL of the author of the current comment. 209 209 * 210 210 * Both get_comment_author_url() and get_comment_author() rely on get_comment(), 211 * which falls back to the global comment variable if the $comment_ IDargument is empty.211 * which falls back to the global comment variable if the $comment_id argument is empty. 212 212 * 213 213 * @since 1.5.0 214 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.214 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 215 215 * 216 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to get the author's link.216 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's link. 217 217 * Default current comment. 218 218 * @return string The comment author name or HTML link for author's URL. 219 219 */ 220 function get_comment_author_link( $comment_ ID= 0 ) {221 $comment = get_comment( $comment_ ID);222 $comment_ ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_ID;220 function get_comment_author_link( $comment_id = 0 ) { 221 $comment = get_comment( $comment_id ); 222 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 223 223 $url = get_comment_author_url( $comment ); 224 224 $author = get_comment_author( $comment ); 225 225 … … 263 263 * Filters the comment author's link for display. 264 264 * 265 265 * @since 1.5.0 266 * @since 4.1.0 The `$author` and `$comment_ ID` parameters were added.266 * @since 4.1.0 The `$author` and `$comment_id` parameters were added. 267 267 * 268 268 * @param string $return The HTML-formatted comment author link. 269 269 * Empty for an invalid URL. 270 270 * @param string $author The comment author's username. 271 * @param string $comment_ IDThe comment ID as a numeric string.271 * @param string $comment_id The comment ID as a numeric string. 272 272 */ 273 return apply_filters( 'get_comment_author_link', $return, $author, $comment_ ID);273 return apply_filters( 'get_comment_author_link', $return, $author, $comment_id ); 274 274 } 275 275 276 276 /** … … 277 277 * Displays the HTML link to the URL of the author of the current comment. 278 278 * 279 279 * @since 0.71 280 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.280 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 281 281 * 282 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to print the author's link.282 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's link. 283 283 * Default current comment. 284 284 */ 285 function comment_author_link( $comment_ ID= 0 ) {286 echo get_comment_author_link( $comment_ ID);285 function comment_author_link( $comment_id = 0 ) { 286 echo get_comment_author_link( $comment_id ); 287 287 } 288 288 289 289 /** … … 290 290 * Retrieves the IP address of the author of the current comment. 291 291 * 292 292 * @since 1.5.0 293 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.293 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 294 294 * 295 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to get the author's IP address.295 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's IP address. 296 296 * Default current comment. 297 297 * @return string Comment author's IP address, or an empty string if it's not available. 298 298 */ 299 function get_comment_author_IP( $comment_ ID= 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid300 $comment = get_comment( $comment_ ID);299 function get_comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 300 $comment = get_comment( $comment_id ); 301 301 302 302 /** 303 303 * Filters the comment author's returned IP address. 304 304 * 305 305 * @since 1.5.0 306 * @since 4.1.0 The `$comment_ ID` and `$comment` parameters were added.306 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 307 307 * 308 308 * @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available. 309 * @param string $comment_ IDThe comment ID as a numeric string.309 * @param string $comment_id The comment ID as a numeric string. 310 310 * @param WP_Comment $comment The comment object. 311 311 */ 312 312 return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase … … 316 316 * Displays the IP address of the author of the current comment. 317 317 * 318 318 * @since 0.71 319 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.319 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 320 320 * 321 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to print the author's IP address.321 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's IP address. 322 322 * Default current comment. 323 323 */ 324 function comment_author_IP( $comment_ ID= 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid325 echo esc_html( get_comment_author_IP( $comment_ ID) );324 function comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 325 echo esc_html( get_comment_author_IP( $comment_id ) ); 326 326 } 327 327 328 328 /** … … 329 329 * Retrieves the URL of the author of the current comment, not linked. 330 330 * 331 331 * @since 1.5.0 332 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.332 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 333 333 * 334 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to get the author's URL.334 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's URL. 335 335 * Default current comment. 336 336 * @return string Comment author URL, if provided, an empty string otherwise. 337 337 */ 338 function get_comment_author_url( $comment_ ID= 0 ) {339 $comment = get_comment( $comment_ ID);338 function get_comment_author_url( $comment_id = 0 ) { 339 $comment = get_comment( $comment_id ); 340 340 $url = ''; 341 341 $id = 0; 342 342 … … 350 350 * Filters the comment author's URL. 351 351 * 352 352 * @since 1.5.0 353 * @since 4.1.0 The `$comment_ ID` and `$comment` parameters were added.353 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 354 354 * 355 355 * @param string $url The comment author's URL, or an empty string. 356 * @param string|int $comment_ IDThe comment ID as a numeric string, or 0 if not found.356 * @param string|int $comment_id The comment ID as a numeric string, or 0 if not found. 357 357 * @param WP_Comment|null $comment The comment object, or null if not found. 358 358 */ 359 359 return apply_filters( 'get_comment_author_url', $url, $id, $comment ); … … 363 363 * Displays the URL of the author of the current comment, not linked. 364 364 * 365 365 * @since 0.71 366 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.366 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 367 367 * 368 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or the ID of the comment for which to print the author's URL.368 * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's URL. 369 369 * Default current comment. 370 370 */ 371 function comment_author_url( $comment_ ID= 0 ) {372 $comment = get_comment( $comment_ ID);371 function comment_author_url( $comment_id = 0 ) { 372 $comment = get_comment( $comment_id ); 373 373 $author_url = get_comment_author_url( $comment ); 374 374 375 375 /** … … 376 376 * Filters the comment author's URL for display. 377 377 * 378 378 * @since 1.2.0 379 * @since 4.1.0 The `$comment_ ID` parameter was added.379 * @since 4.1.0 The `$comment_id` parameter was added. 380 380 * 381 381 * @param string $author_url The comment author's URL. 382 * @param string $comment_ IDThe comment ID as a numeric string.382 * @param string $comment_id The comment ID as a numeric string. 383 383 */ 384 384 echo apply_filters( 'comment_url', $author_url, $comment->comment_ID ); 385 385 } … … 575 575 * Retrieves the comment date of the current comment. 576 576 * 577 577 * @since 1.5.0 578 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.578 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 579 579 * 580 580 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. 581 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to get the date.581 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the date. 582 582 * Default current comment. 583 583 * @return string The comment's date. 584 584 */ 585 function get_comment_date( $format = '', $comment_ ID= 0 ) {586 $comment = get_comment( $comment_ ID);585 function get_comment_date( $format = '', $comment_id = 0 ) { 586 $comment = get_comment( $comment_id ); 587 587 588 588 $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); 589 589 … … 605 605 * Displays the comment date of the current comment. 606 606 * 607 607 * @since 0.71 608 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.608 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 609 609 * 610 610 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. 611 * @param int|WP_Comment $comment_ IDWP_Comment or ID of the comment for which to print the date.611 * @param int|WP_Comment $comment_id WP_Comment or ID of the comment for which to print the date. 612 612 * Default current comment. 613 613 */ 614 function comment_date( $format = '', $comment_ ID= 0 ) {615 echo get_comment_date( $format, $comment_ ID);614 function comment_date( $format = '', $comment_id = 0 ) { 615 echo get_comment_date( $format, $comment_id ); 616 616 } 617 617 618 618 /** … … 621 621 * Returns a maximum of 20 words with an ellipsis appended if necessary. 622 622 * 623 623 * @since 1.5.0 624 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.624 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 625 625 * 626 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to get the excerpt.626 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the excerpt. 627 627 * Default current comment. 628 628 * @return string The possibly truncated comment excerpt. 629 629 */ 630 function get_comment_excerpt( $comment_ ID= 0 ) {631 $comment = get_comment( $comment_ ID);630 function get_comment_excerpt( $comment_id = 0 ) { 631 $comment = get_comment( $comment_id ); 632 632 633 633 if ( ! post_password_required( $comment->comment_post_ID ) ) { 634 634 $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) ); … … 654 654 * Filters the retrieved comment excerpt. 655 655 * 656 656 * @since 1.5.0 657 * @since 4.1.0 The `$comment_ ID` and `$comment` parameters were added.657 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 658 658 * 659 659 * @param string $excerpt The comment excerpt text. 660 * @param string $comment_ IDThe comment ID as a numeric string.660 * @param string $comment_id The comment ID as a numeric string. 661 661 * @param WP_Comment $comment The comment object. 662 662 */ 663 663 return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment ); … … 667 667 * Displays the excerpt of the current comment. 668 668 * 669 669 * @since 1.2.0 670 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.670 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 671 671 * 672 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to print the excerpt.672 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the excerpt. 673 673 * Default current comment. 674 674 */ 675 function comment_excerpt( $comment_ ID= 0 ) {676 $comment = get_comment( $comment_ ID);675 function comment_excerpt( $comment_id = 0 ) { 676 $comment = get_comment( $comment_id ); 677 677 $comment_excerpt = get_comment_excerpt( $comment ); 678 678 679 679 /** … … 680 680 * Filters the comment excerpt for display. 681 681 * 682 682 * @since 1.2.0 683 * @since 4.1.0 The `$comment_ ID` parameter was added.683 * @since 4.1.0 The `$comment_id` parameter was added. 684 684 * 685 685 * @param string $comment_excerpt The comment excerpt text. 686 * @param string $comment_ IDThe comment ID as a numeric string.686 * @param string $comment_id The comment ID as a numeric string. 687 687 */ 688 688 echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID ); 689 689 } … … 697 697 */ 698 698 function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 699 699 $comment = get_comment(); 700 $comment_ ID= ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';700 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0'; 701 701 702 702 /** 703 703 * Filters the returned comment ID. … … 705 705 * @since 1.5.0 706 706 * @since 4.1.0 The `$comment` parameter was added. 707 707 * 708 * @param string $comment_ IDThe current comment ID as a numeric string.708 * @param string $comment_id The current comment ID as a numeric string. 709 709 * @param WP_Comment $comment The comment object. 710 710 */ 711 return apply_filters( 'get_comment_ID', $comment_ ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase711 return apply_filters( 'get_comment_ID', $comment_id, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 712 712 } 713 713 714 714 /** … … 985 985 * Retrieves the text of the current comment. 986 986 * 987 987 * @since 1.5.0 988 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.988 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 989 989 * @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed. 990 990 * 991 991 * @see Walker_Comment::comment() 992 992 * 993 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to get the text.993 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the text. 994 994 * Default current comment. 995 995 * @param array $args Optional. An array of arguments. Default empty array. 996 996 * @return string The comment content. 997 997 */ 998 function get_comment_text( $comment_ ID= 0, $args = array() ) {999 $comment = get_comment( $comment_ ID);998 function get_comment_text( $comment_id = 0, $args = array() ) { 999 $comment = get_comment( $comment_id ); 1000 1000 1001 1001 $comment_content = $comment->comment_content; 1002 1002 … … 1032 1032 * Displays the text of the current comment. 1033 1033 * 1034 1034 * @since 0.71 1035 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.1035 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 1036 1036 * 1037 1037 * @see Walker_Comment::comment() 1038 1038 * 1039 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to print the text.1039 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the text. 1040 1040 * Default current comment. 1041 1041 * @param array $args Optional. An array of arguments. Default empty array. 1042 1042 */ 1043 function comment_text( $comment_ ID= 0, $args = array() ) {1044 $comment = get_comment( $comment_ ID);1043 function comment_text( $comment_id = 0, $args = array() ) { 1044 $comment = get_comment( $comment_id ); 1045 1045 1046 1046 $comment_text = get_comment_text( $comment, $args ); 1047 1047 /** … … 1062 1062 * Retrieves the comment time of the current comment. 1063 1063 * 1064 1064 * @since 1.5.0 1065 * @since 6.2.0 Added the `$comment_ ID` parameter.1065 * @since 6.2.0 Added the `$comment_id` parameter. 1066 1066 * 1067 1067 * @param string $format Optional. PHP date format. Defaults to the 'time_format' option. 1068 1068 * @param bool $gmt Optional. Whether to use the GMT date. Default false. 1069 1069 * @param bool $translate Optional. Whether to translate the time (for use in feeds). 1070 1070 * Default true. 1071 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to get the time.1071 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the time. 1072 1072 * Default current comment. 1073 1073 * @return string The formatted time. 1074 1074 */ 1075 function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_ ID= 0 ) {1076 $comment = get_comment( $comment_ ID);1075 function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_id = 0 ) { 1076 $comment = get_comment( $comment_id ); 1077 1077 1078 1078 if ( null === $comment ) { 1079 1079 return ''; … … 1103 1103 * Displays the comment time of the current comment. 1104 1104 * 1105 1105 * @since 0.71 1106 * @since 6.2.0 Added the `$comment_ ID` parameter.1106 * @since 6.2.0 Added the `$comment_id` parameter. 1107 1107 * 1108 1108 * @param string $format Optional. PHP time format. Defaults to the 'time_format' option. 1109 * @param int|WP_Comment $comment_ ID Optional. WP_Comment or ID of the comment for which to get the time.1109 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the time. 1110 1110 * Default current comment. 1111 1111 */ 1112 function comment_time( $format = '', $comment_ ID= 0 ) {1113 echo get_comment_time( $format, $comment_ ID);1112 function comment_time( $format = '', $comment_id = 0 ) { 1113 echo get_comment_time( $format, $comment_id ); 1114 1114 } 1115 1115 1116 1116 /** … … 1117 1117 * Retrieves the comment type of the current comment. 1118 1118 * 1119 1119 * @since 1.5.0 1120 * @since 4.4.0 Added the ability for `$comment_ ID` to also accept a WP_Comment object.1120 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. 1121 1121 * 1122 * @param int|WP_Comment $comment_ IDOptional. WP_Comment or ID of the comment for which to get the type.1122 * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the type. 1123 1123 * Default current comment. 1124 1124 * @return string The comment type. 1125 1125 */ 1126 function get_comment_type( $comment_ ID= 0 ) {1127 $comment = get_comment( $comment_ ID);1126 function get_comment_type( $comment_id = 0 ) { 1127 $comment = get_comment( $comment_id ); 1128 1128 1129 1129 if ( '' === $comment->comment_type ) { 1130 1130 $comment->comment_type = 'comment'; … … 1134 1134 * Filters the returned comment type. 1135 1135 * 1136 1136 * @since 1.5.0 1137 * @since 4.1.0 The `$comment_ ID` and `$comment` parameters were added.1137 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 1138 1138 * 1139 1139 * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'. 1140 * @param string $comment_ IDThe comment ID as a numeric string.1140 * @param string $comment_id The comment ID as a numeric string. 1141 1141 * @param WP_Comment $comment The comment object. 1142 1142 */ 1143 1143 return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment ); -
src/wp-includes/comment.php
1039 1039 * 1040 1040 * @global wpdb $wpdb WordPress database abstraction object. 1041 1041 * 1042 * @param int $comment_ IDComment ID.1042 * @param int $comment_id Comment ID. 1043 1043 * @param array $args { 1044 1044 * Array of optional arguments. 1045 1045 * … … 1049 1049 * @type int $per_page Per-page count to use when calculating pagination. 1050 1050 * Defaults to the value of the 'comments_per_page' option. 1051 1051 * @type int|string $max_depth If greater than 1, comment page will be determined 1052 * for the top-level parent `$comment_ ID`.1052 * for the top-level parent `$comment_id`. 1053 1053 * Defaults to the value of the 'thread_comments_depth' option. 1054 1054 * } * 1055 1055 * @return int|null Comment page number or null on error. 1056 1056 */ 1057 function get_page_of_comment( $comment_ ID, $args = array() ) {1057 function get_page_of_comment( $comment_id, $args = array() ) { 1058 1058 global $wpdb; 1059 1059 1060 1060 $page = null; 1061 1061 1062 $comment = get_comment( $comment_ ID);1062 $comment = get_comment( $comment_id ); 1063 1063 if ( ! $comment ) { 1064 1064 return; 1065 1065 } … … 1175 1175 * Filters the calculated page on which a comment appears. 1176 1176 * 1177 1177 * @since 4.4.0 1178 * @since 4.7.0 Introduced the `$comment_ ID` parameter.1178 * @since 4.7.0 Introduced the `$comment_id` parameter. 1179 1179 * 1180 1180 * @param int $page Comment page. 1181 1181 * @param array $args { … … 1196 1196 * @type int $per_page Number of comments per page. 1197 1197 * @type int $max_depth Maximum comment threading depth allowed. 1198 1198 * } 1199 * @param int $comment_ IDID of the comment.1199 * @param int $comment_id ID of the comment. 1200 1200 */ 1201 return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ ID);1201 return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_id ); 1202 1202 } 1203 1203 1204 1204 /** … … 1837 1837 * 1838 1838 * @since 2.7.0 1839 1839 * 1840 * @param string $comment_ IDThe comment ID as a numeric string.1840 * @param string $comment_id The comment ID as a numeric string. 1841 1841 * @param WP_Comment $comment Comment object. 1842 1842 */ 1843 1843 do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment ); … … 2281 2281 return $commentdata['comment_approved']; 2282 2282 } 2283 2283 2284 $comment_ ID= wp_insert_comment( $commentdata );2284 $comment_id = wp_insert_comment( $commentdata ); 2285 2285 2286 if ( ! $comment_ ID) {2286 if ( ! $comment_id ) { 2287 2287 $fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' ); 2288 2288 2289 2289 foreach ( $fields as $field ) { … … 2299 2299 return $commentdata['comment_approved']; 2300 2300 } 2301 2301 2302 $comment_ ID= wp_insert_comment( $commentdata );2303 if ( ! $comment_ ID) {2302 $comment_id = wp_insert_comment( $commentdata ); 2303 if ( ! $comment_id ) { 2304 2304 return false; 2305 2305 } 2306 2306 } … … 2311 2311 * @since 1.2.0 2312 2312 * @since 4.5.0 The `$commentdata` parameter was added. 2313 2313 * 2314 * @param int $comment_ IDThe comment ID.2314 * @param int $comment_id The comment ID. 2315 2315 * @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam. 2316 2316 * @param array $commentdata Comment data. 2317 2317 */ 2318 do_action( 'comment_post', $comment_ ID, $commentdata['comment_approved'], $commentdata );2318 do_action( 'comment_post', $comment_id, $commentdata['comment_approved'], $commentdata ); 2319 2319 2320 return $comment_ ID;2320 return $comment_id; 2321 2321 } 2322 2322 2323 2323 /** … … 2325 2325 * 2326 2326 * @since 4.4.0 2327 2327 * 2328 * @param int $comment_ IDID of the comment.2328 * @param int $comment_id ID of the comment. 2329 2329 * @return bool True on success, false on failure. 2330 2330 */ 2331 function wp_new_comment_notify_moderator( $comment_ ID) {2332 $comment = get_comment( $comment_ ID);2331 function wp_new_comment_notify_moderator( $comment_id ) { 2332 $comment = get_comment( $comment_id ); 2333 2333 2334 2334 // Only send notifications for pending comments. 2335 2335 $maybe_notify = ( '0' == $comment->comment_approved ); 2336 2336 2337 2337 /** This filter is documented in wp-includes/comment.php */ 2338 $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ ID);2338 $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id ); 2339 2339 2340 2340 if ( ! $maybe_notify ) { 2341 2341 return false; 2342 2342 } 2343 2343 2344 return wp_notify_moderator( $comment_ ID);2344 return wp_notify_moderator( $comment_id ); 2345 2345 } 2346 2346 2347 2347 /** … … 2352 2352 * Uses the {@see 'notify_post_author'} filter to determine whether the post author 2353 2353 * should be notified when a new comment is added, overriding site setting. 2354 2354 * 2355 * @param int $comment_ IDComment ID.2355 * @param int $comment_id Comment ID. 2356 2356 * @return bool True on success, false on failure. 2357 2357 */ 2358 function wp_new_comment_notify_postauthor( $comment_ ID) {2359 $comment = get_comment( $comment_ ID);2358 function wp_new_comment_notify_postauthor( $comment_id ) { 2359 $comment = get_comment( $comment_id ); 2360 2360 2361 2361 $maybe_notify = get_option( 'comments_notify' ); 2362 2362 … … 2367 2367 * @since 4.4.0 2368 2368 * 2369 2369 * @param bool $maybe_notify Whether to notify the post author about the new comment. 2370 * @param int $comment_ IDThe ID of the comment for the notification.2370 * @param int $comment_id The ID of the comment for the notification. 2371 2371 */ 2372 $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ ID);2372 $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_id ); 2373 2373 2374 2374 /* 2375 2375 * wp_notify_postauthor() checks if notifying the author of their own comment. … … 2384 2384 return false; 2385 2385 } 2386 2386 2387 return wp_notify_postauthor( $comment_ ID);2387 return wp_notify_postauthor( $comment_id ); 2388 2388 } 2389 2389 2390 2390 /** -
src/wp-includes/deprecated.php
1225 1225 } 1226 1226 1227 1227 /** 1228 * Retrieve an array of comment data about comment $comment_ ID.1228 * Retrieve an array of comment data about comment $comment_id. 1229 1229 * 1230 1230 * @since 0.71 1231 1231 * @deprecated 2.7.0 Use get_comment() 1232 1232 * @see get_comment() 1233 1233 * 1234 * @param int $comment_ IDThe ID of the comment1234 * @param int $comment_id The ID of the comment 1235 1235 * @param int $no_cache Whether to use the cache (cast to bool) 1236 1236 * @param bool $include_unapproved Whether to include unapproved comments 1237 1237 * @return array The comment data 1238 1238 */ 1239 function get_commentdata( $comment_ ID, $no_cache = 0, $include_unapproved = false ) {1239 function get_commentdata( $comment_id, $no_cache = 0, $include_unapproved = false ) { 1240 1240 _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); 1241 return get_comment($comment_ ID, ARRAY_A);1241 return get_comment($comment_id, ARRAY_A); 1242 1242 } 1243 1243 1244 1244 /** -
src/wp-includes/feed-rss2-comments.php
110 110 * 111 111 * @since 2.1.0 112 112 * 113 * @param int $comment_ IDThe ID of the comment being displayed.114 * @param int $ IDThe ID of the post the comment is connected to.113 * @param int $comment_id The ID of the comment being displayed. 114 * @param int $comment_post_id The ID of the post the comment is connected to. 115 115 */ 116 116 do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID ); 117 117 ?> -
src/wp-includes/pluggable.php
1875 1875 * @since 4.4.0 1876 1876 * 1877 1877 * @param bool $maybe_notify Whether to notify blog moderator. 1878 * @param int $comment_ ID The idof the comment for the notification.1878 * @param int $comment_id The ID of the comment for the notification. 1879 1879 */ 1880 1880 $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id ); 1881 1881
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)