From 9b1fa5c2d6df13e3c10fb36eff022102debe7d62 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 24 Jan 2025 00:04:22 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@59697 git-svn-id: http://core.svn.wordpress.org/trunk@59039 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-xmlrpc-server.php | 69 ++++++++++++++++++++++---- wp-includes/version.php | 2 +- 2 files changed, 59 insertions(+), 12 deletions(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index f94e2f3d46..87d182f5aa 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -5143,7 +5143,15 @@ class wp_xmlrpc_server extends IXR_Server { $post_date = current_time( 'mysql' ); $post_date_gmt = current_time( 'mysql', 1 ); - $post_data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status' ); + $post_data = compact( + 'post_author', + 'post_date', + 'post_date_gmt', + 'post_content', + 'post_title', + 'post_category', + 'post_status' + ); $post_id = wp_insert_post( $post_data ); if ( is_wp_error( $post_id ) ) { @@ -5595,7 +5603,26 @@ class wp_xmlrpc_server extends IXR_Server { } } - $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' ); + $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' + ); $post_id = get_default_post_to_edit( $post_type, true )->ID; $postdata['ID'] = $post_id; @@ -5777,7 +5804,7 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape( $postdata ); - $ID = $postdata['ID']; + $post_id = $postdata['ID']; $post_content = $postdata['post_content']; $post_title = $postdata['post_title']; $post_excerpt = $postdata['post_excerpt']; @@ -5979,7 +6006,27 @@ class wp_xmlrpc_server extends IXR_Server { } // We've got all the data -- post it. - $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' ); + $newpost = compact( + 'post_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' + ); $result = wp_update_post( $newpost, true ); if ( is_wp_error( $result ) ) { @@ -6022,7 +6069,7 @@ class wp_xmlrpc_server extends IXR_Server { $enclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; $this->add_enclosure_if_new( $post_id, $enclosure ); - $this->attach_uploads( $ID, $post_content ); + $this->attach_uploads( $post_id, $post_content ); // Handle post formats if assigned, validation is handled earlier in this function. if ( isset( $content_struct['wp_post_format'] ) ) { @@ -6458,20 +6505,20 @@ class wp_xmlrpc_server extends IXR_Server { ); // Save the data. - $id = wp_insert_attachment( $attachment, $upload['file'], $post_id ); - wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); + $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id ); + wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) ); /** * Fires after a new attachment has been added via the XML-RPC MovableType API. * * @since 3.4.0 * - * @param int $id ID of the new attachment. - * @param array $args An array of arguments to add the attachment. + * @param int $attachment_id ID of the new attachment. + * @param array $args An array of arguments to add the attachment. */ - do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase + do_action( 'xmlrpc_call_success_mw_newMediaObject', $attachment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase - $struct = $this->_prepare_media_item( get_post( $id ) ); + $struct = $this->_prepare_media_item( get_post( $attachment_id ) ); // Deprecated values. $struct['id'] = $struct['attachment_id']; diff --git a/wp-includes/version.php b/wp-includes/version.php index 25fda9d89d..8b9641deda 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59696'; +$wp_version = '6.8-alpha-59697'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.