Make WordPress Core


Ignore:
Timestamp:
01/24/2025 12:02:08 AM (22 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename the $ID variable in wp_xmlrpc_server methods.

This resolves a WPCS warning:

Variable "$ID" is not in valid snake_case format, try "$i_d"

Follow-up to [28448].

See #62279.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r59680 r59697  
    51445144                $post_date_gmt = current_time( 'mysql', 1 );
    51455145
    5146                 $post_data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status' );
     5146                $post_data = compact(
     5147                        'post_author',
     5148                        'post_date',
     5149                        'post_date_gmt',
     5150                        'post_content',
     5151                        'post_title',
     5152                        'post_category',
     5153                        'post_status'
     5154                );
    51475155
    51485156                $post_id = wp_insert_post( $post_data );
    … …  
    55965604                }
    55975605
    5598                 $postdata = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template' );
     5606                $postdata = compact(
     5607                        'post_author',
     5608                        'post_date',
     5609                        'post_date_gmt',
     5610                        'post_content',
     5611                        'post_title',
     5612                        'post_category',
     5613                        'post_status',
     5614                        'post_excerpt',
     5615                        'comment_status',
     5616                        'ping_status',
     5617                        'to_ping',
     5618                        'post_type',
     5619                        'post_name',
     5620                        'post_password',
     5621                        'post_parent',
     5622                        'menu_order',
     5623                        'tags_input',
     5624                        'page_template'
     5625                );
    55995626
    56005627                $post_id        = get_default_post_to_edit( $post_type, true )->ID;
    … …  
    57785805                $this->escape( $postdata );
    57795806
    5780                 $ID             = $postdata['ID'];
     5807                $post_id        = $postdata['ID'];
    57815808                $post_content   = $postdata['post_content'];
    57825809                $post_title     = $postdata['post_title'];
    … …  
    59806007
    59816008                // We've got all the data -- post it.
    5982                 $newpost = compact( 'ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'edit_date', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template' );
     6009                $newpost = compact(
     6010                        'post_id',
     6011                        'post_content',
     6012                        'post_title',
     6013                        'post_category',
     6014                        'post_status',
     6015                        'post_excerpt',
     6016                        'comment_status',
     6017                        'ping_status',
     6018                        'edit_date',
     6019                        'post_date',
     6020                        'post_date_gmt',
     6021                        'to_ping',
     6022                        'post_name',
     6023                        'post_password',
     6024                        'post_parent',
     6025                        'menu_order',
     6026                        'post_author',
     6027                        'tags_input',
     6028                        'page_template'
     6029                );
    59836030
    59846031                $result = wp_update_post( $newpost, true );
    … …  
    60236070                $this->add_enclosure_if_new( $post_id, $enclosure );
    60246071
    6025                 $this->attach_uploads( $ID, $post_content );
     6072                $this->attach_uploads( $post_id, $post_content );
    60266073
    60276074                // Handle post formats if assigned, validation is handled earlier in this function.
    … …  
    64596506
    64606507                // Save the data.
    6461                 $id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
    6462                 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
     6508                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
     6509                wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) );
    64636510
    64646511                /**
    … …  
    64676514                 * @since 3.4.0
    64686515                 *
    6469                  * @param int   $id  ID of the new attachment.
    6470                  * @param array $args An array of arguments to add the attachment.
     6516                 * @param int   $attachment_id ID of the new attachment.
     6517                 * @param array $args          An array of arguments to add the attachment.
    64716518                 */
    6472                 do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
    6473 
    6474                 $struct = $this->_prepare_media_item( get_post( $id ) );
     6519                do_action( 'xmlrpc_call_success_mw_newMediaObject', $attachment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
     6520
     6521                $struct = $this->_prepare_media_item( get_post( $attachment_id ) );
    64756522
    64766523                // Deprecated values.
Note: See TracChangeset for help on using the changeset viewer.