Changeset 53723
- Timestamp:
- 07/19/2022 04:17:56 PM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r53455 r53723 1278 1278 check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); 1279 1279 1280 $comment_post_ ID= (int) $_POST['comment_post_ID'];1281 $post = get_post( $comment_post_ ID);1280 $comment_post_id = (int) $_POST['comment_post_ID']; 1281 $post = get_post( $comment_post_id ); 1282 1282 1283 1283 if ( ! $post ) { … … 1285 1285 } 1286 1286 1287 if ( ! current_user_can( 'edit_post', $comment_post_ ID) ) {1287 if ( ! current_user_can( 'edit_post', $comment_post_id ) ) { 1288 1288 wp_die( -1 ); 1289 1289 } … … 1332 1332 1333 1333 $comment_auto_approved = false; 1334 $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' ); 1334 1335 $commentdata = array( 1336 'comment_post_ID' => $comment_post_id, 1337 ); 1338 1339 $commentdata += compact( 1340 'comment_author', 1341 'comment_author_email', 1342 'comment_author_url', 1343 'comment_content', 1344 'comment_type', 1345 'comment_parent', 1346 'user_ID' 1347 ); 1335 1348 1336 1349 // Automatically approve parent comment. … … 1338 1351 $parent = get_comment( $comment_parent ); 1339 1352 1340 if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_ ID) {1353 if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_id ) { 1341 1354 if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) { 1342 1355 wp_die( -1 ); -
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r53132 r53723 7014 7014 $pagelinkedfrom = $this->escape( $pagelinkedfrom ); 7015 7015 7016 $comment_post_ ID= (int) $post_ID;7016 $comment_post_id = (int) $post_ID; 7017 7017 $comment_author = $title; 7018 7018 $comment_author_email = ''; … … 7023 7023 $comment_type = 'pingback'; 7024 7024 7025 $commentdata = compact( 7026 'comment_post_ID', 7025 $commentdata = array( 7026 'comment_post_ID' => $comment_post_id, 7027 ); 7028 7029 $commentdata += compact( 7027 7030 'comment_author', 7028 7031 'comment_author_url', -
trunk/src/wp-includes/comment-template.php
r53719 r53723 275 275 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 276 276 * 277 * @param string $comment_author_ IPThe comment author's IP address, or an empty string if it's not available.277 * @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available. 278 278 * @param string $comment_ID The comment ID as a numeric string. 279 279 * @param WP_Comment $comment The comment object. -
trunk/src/wp-includes/comment.php
r53715 r53723 727 727 * @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`. 728 728 * 729 * @param string $comment_author_ IPComment author's IP address.729 * @param string $comment_author_ip Comment author's IP address. 730 730 * @param string $comment_author_email Comment author's email. 731 731 * @param string $comment_date_gmt GMT date the comment was posted. … … 750 750 * 751 751 * @param bool $is_flood Is a comment flooding occurring? Default false. 752 * @param string $comment_author_ IPComment author's IP address.752 * @param string $comment_author_ip Comment author's IP address. 753 753 * @param string $comment_author_email Comment author's email. 754 754 * @param string $comment_date_gmt GMT date the comment was posted. … … 1998 1998 $comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email']; 1999 1999 $comment_author_url = ! isset( $data['comment_author_url'] ) ? '' : $data['comment_author_url']; 2000 $comment_author_ IP= ! isset( $data['comment_author_IP'] ) ? '' : $data['comment_author_IP'];2000 $comment_author_ip = ! isset( $data['comment_author_IP'] ) ? '' : $data['comment_author_IP']; 2001 2001 2002 2002 $comment_date = ! isset( $data['comment_date'] ) ? current_time( 'mysql' ) : $data['comment_date']; 2003 2003 $comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt']; 2004 2004 2005 $comment_post_ ID= ! isset( $data['comment_post_ID'] ) ? 0 : $data['comment_post_ID'];2005 $comment_post_id = ! isset( $data['comment_post_ID'] ) ? 0 : $data['comment_post_ID']; 2006 2006 $comment_content = ! isset( $data['comment_content'] ) ? '' : $data['comment_content']; 2007 2007 $comment_karma = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma']; … … 2013 2013 $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id']; 2014 2014 2015 $compacted = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id' ); 2015 $compacted = array( 2016 'comment_post_ID' => $comment_post_id, 2017 'comment_author_IP' => $comment_author_ip, 2018 ); 2019 2020 $compacted += compact( 2021 'comment_author', 2022 'comment_author_email', 2023 'comment_author_url', 2024 'comment_date', 2025 'comment_date_gmt', 2026 'comment_content', 2027 'comment_karma', 2028 'comment_approved', 2029 'comment_agent', 2030 'comment_type', 2031 'comment_parent', 2032 'user_id' 2033 ); 2034 2016 2035 if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) { 2017 2036 return false; … … 2021 2040 2022 2041 if ( 1 == $comment_approved ) { 2023 wp_update_comment_count( $comment_post_ ID);2042 wp_update_comment_count( $comment_post_id ); 2024 2043 2025 2044 $data = array(); … … 2214 2233 2215 2234 $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; 2235 2216 2236 if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) { 2217 2237 $commentdata['user_ID'] = (int) $commentdata['user_ID']; … … 2498 2518 } 2499 2519 2500 $comment_ ID= $data['comment_ID'];2501 $comment_post_ ID= $data['comment_post_ID'];2520 $comment_id = $data['comment_ID']; 2521 $comment_post_id = $data['comment_post_ID']; 2502 2522 2503 2523 /** … … 2525 2545 } 2526 2546 2527 $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' ); 2547 $keys = array( 2548 'comment_post_ID', 2549 'comment_author', 2550 'comment_author_email', 2551 'comment_author_url', 2552 'comment_author_IP', 2553 'comment_date', 2554 'comment_date_gmt', 2555 'comment_content', 2556 'comment_karma', 2557 'comment_approved', 2558 'comment_agent', 2559 'comment_type', 2560 'comment_parent', 2561 'user_id', 2562 ); 2563 2528 2564 $data = wp_array_slice_assoc( $data, $keys ); 2529 2565 2530 $r val = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID') );2531 2532 if ( false === $r val) {2566 $result = $wpdb->update( $wpdb->comments, $data, array( 'comment_ID' => $comment_id ) ); 2567 2568 if ( false === $result ) { 2533 2569 if ( $wp_error ) { 2534 2570 return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error ); … … 2541 2577 if ( isset( $commentarr['comment_meta'] ) && is_array( $commentarr['comment_meta'] ) ) { 2542 2578 foreach ( $commentarr['comment_meta'] as $meta_key => $meta_value ) { 2543 update_comment_meta( $comment_ ID, $meta_key, $meta_value );2544 } 2545 } 2546 2547 clean_comment_cache( $comment_ ID);2548 wp_update_comment_count( $comment_post_ ID);2579 update_comment_meta( $comment_id, $meta_key, $meta_value ); 2580 } 2581 } 2582 2583 clean_comment_cache( $comment_id ); 2584 wp_update_comment_count( $comment_post_id ); 2549 2585 2550 2586 /** … … 2556 2592 * @since 4.6.0 Added the `$data` parameter. 2557 2593 * 2558 * @param int $comment_ IDThe comment ID.2594 * @param int $comment_id The comment ID. 2559 2595 * @param array $data Comment data. 2560 2596 */ 2561 do_action( 'edit_comment', $comment_ ID, $data );2562 2563 $comment = get_comment( $comment_ ID);2597 do_action( 'edit_comment', $comment_id, $data ); 2598 2599 $comment = get_comment( $comment_id ); 2564 2600 2565 2601 wp_transition_comment_status( $comment->comment_approved, $old_status, $comment ); 2566 2602 2567 return $r val;2603 return $result; 2568 2604 } 2569 2605 … … 3387 3423 function wp_handle_comment_submission( $comment_data ) { 3388 3424 3389 $comment_post_ ID= 0;3425 $comment_post_id = 0; 3390 3426 $comment_parent = 0; 3391 3427 $user_ID = 0; … … 3396 3432 3397 3433 if ( isset( $comment_data['comment_post_ID'] ) ) { 3398 $comment_post_ ID= (int) $comment_data['comment_post_ID'];3434 $comment_post_id = (int) $comment_data['comment_post_ID']; 3399 3435 } 3400 3436 if ( isset( $comment_data['author'] ) && is_string( $comment_data['author'] ) ) { … … 3414 3450 } 3415 3451 3416 $post = get_post( $comment_post_ ID);3452 $post = get_post( $comment_post_id ); 3417 3453 3418 3454 if ( empty( $post->comment_status ) ) { … … 3423 3459 * @since 1.5.0 3424 3460 * 3425 * @param int $comment_post_ IDPost ID.3461 * @param int $comment_post_id Post ID. 3426 3462 */ 3427 do_action( 'comment_id_not_found', $comment_post_ ID);3463 do_action( 'comment_id_not_found', $comment_post_id ); 3428 3464 3429 3465 return new WP_Error( 'comment_id_not_found' ); … … 3434 3470 $status = get_post_status( $post ); 3435 3471 3436 if ( ( 'private' === $status ) && ! current_user_can( 'read_post', $comment_post_ ID) ) {3472 if ( ( 'private' === $status ) && ! current_user_can( 'read_post', $comment_post_id ) ) { 3437 3473 return new WP_Error( 'comment_id_not_found' ); 3438 3474 } … … 3440 3476 $status_obj = get_post_status_object( $status ); 3441 3477 3442 if ( ! comments_open( $comment_post_ ID) ) {3478 if ( ! comments_open( $comment_post_id ) ) { 3443 3479 3444 3480 /** … … 3447 3483 * @since 1.5.0 3448 3484 * 3449 * @param int $comment_post_ IDPost ID.3485 * @param int $comment_post_id Post ID. 3450 3486 */ 3451 do_action( 'comment_closed', $comment_post_ ID);3487 do_action( 'comment_closed', $comment_post_id ); 3452 3488 3453 3489 return new WP_Error( 'comment_closed', __( 'Sorry, comments are closed for this item.' ), 403 ); … … 3460 3496 * @since 2.9.0 3461 3497 * 3462 * @param int $comment_post_ IDPost ID.3498 * @param int $comment_post_id Post ID. 3463 3499 */ 3464 do_action( 'comment_on_trash', $comment_post_ ID);3500 do_action( 'comment_on_trash', $comment_post_id ); 3465 3501 3466 3502 return new WP_Error( 'comment_on_trash' ); … … 3473 3509 * @since 1.5.1 3474 3510 * 3475 * @param int $comment_post_ IDPost ID.3511 * @param int $comment_post_id Post ID. 3476 3512 */ 3477 do_action( 'comment_on_draft', $comment_post_ ID);3478 3479 if ( current_user_can( 'read_post', $comment_post_ ID) ) {3513 do_action( 'comment_on_draft', $comment_post_id ); 3514 3515 if ( current_user_can( 'read_post', $comment_post_id ) ) { 3480 3516 return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 ); 3481 3517 } else { 3482 3518 return new WP_Error( 'comment_on_draft' ); 3483 3519 } 3484 } elseif ( post_password_required( $comment_post_ ID) ) {3520 } elseif ( post_password_required( $comment_post_id ) ) { 3485 3521 3486 3522 /** … … 3489 3525 * @since 2.9.0 3490 3526 * 3491 * @param int $comment_post_ IDPost ID.3527 * @param int $comment_post_id Post ID. 3492 3528 */ 3493 do_action( 'comment_on_password_protected', $comment_post_ ID);3529 do_action( 'comment_on_password_protected', $comment_post_id ); 3494 3530 3495 3531 return new WP_Error( 'comment_on_password_protected' ); … … 3502 3538 * @since 2.8.0 3503 3539 * 3504 * @param int $comment_post_ IDPost ID.3540 * @param int $comment_post_id Post ID. 3505 3541 */ 3506 do_action( 'pre_comment_on_post', $comment_post_ ID);3542 do_action( 'pre_comment_on_post', $comment_post_id ); 3507 3543 3508 3544 } … … 3514 3550 $user->display_name = $user->user_login; 3515 3551 } 3552 3516 3553 $comment_author = $user->display_name; 3517 3554 $comment_author_email = $user->user_email; 3518 3555 $comment_author_url = $user->user_url; 3519 3556 $user_ID = $user->ID; 3557 3520 3558 if ( current_user_can( 'unfiltered_html' ) ) { 3521 3559 if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] ) 3522 || ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_ ID)3560 || ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_id ) 3523 3561 ) { 3524 3562 kses_remove_filters(); // Start with a clean slate. … … 3544 3582 } 3545 3583 3546 $commentdata = compact( 3547 'comment_post_ID', 3584 $commentdata = array( 3585 'comment_post_ID' => $comment_post_id, 3586 ); 3587 3588 $commentdata += compact( 3548 3589 'comment_author', 3549 3590 'comment_author_email', -
trunk/src/wp-includes/post.php
r53715 r53723 4336 4336 4337 4337 // Expected_slashed (everything!). 4338 $data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ); 4338 $data = compact( 4339 'post_author', 4340 'post_date', 4341 'post_date_gmt', 4342 'post_content', 4343 'post_content_filtered', 4344 'post_title', 4345 'post_excerpt', 4346 'post_status', 4347 'post_type', 4348 'comment_status', 4349 'ping_status', 4350 'post_password', 4351 'post_name', 4352 'to_ping', 4353 'pinged', 4354 'post_modified', 4355 'post_modified_gmt', 4356 'post_parent', 4357 'menu_order', 4358 'post_mime_type', 4359 'guid' 4360 ); 4339 4361 4340 4362 $emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
Note: See TracChangeset
for help on using the changeset viewer.