@@ -5143,7 +5143,15 @@ public function blogger_newPost( $args ) {
51435143 $ post_date = current_time ( 'mysql ' );
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 );
51495157 if ( is_wp_error ( $ post_id ) ) {
@@ -5595,7 +5603,26 @@ public function mw_newPost( $args ) {
55955603 }
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 ;
56015628 $ postdata ['ID ' ] = $ post_id ;
@@ -5777,7 +5804,7 @@ public function mw_editPost( $args ) {
57775804
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 ' ];
57835810 $ post_excerpt = $ postdata ['post_excerpt ' ];
@@ -5979,7 +6006,27 @@ public function mw_editPost( $args ) {
59796006 }
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 );
59856032 if ( is_wp_error ( $ result ) ) {
@@ -6022,7 +6069,7 @@ public function mw_editPost( $args ) {
60226069 $ enclosure = isset ( $ content_struct ['enclosure ' ] ) ? $ content_struct ['enclosure ' ] : null ;
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.
60286075 if ( isset ( $ content_struct ['wp_post_format ' ] ) ) {
@@ -6458,20 +6505,20 @@ public function mw_newMediaObject( $args ) {
64586505 );
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 /**
64656512 * Fires after a new attachment has been added via the XML-RPC MovableType API.
64666513 *
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
6519+ do_action ( 'xmlrpc_call_success_mw_newMediaObject ' , $ attachment_id , $ args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
64736520
6474- $ struct = $ this ->_prepare_media_item ( get_post ( $ id ) );
6521+ $ struct = $ this ->_prepare_media_item ( get_post ( $ attachment_id ) );
64756522
64766523 // Deprecated values.
64776524 $ struct ['id ' ] = $ struct ['attachment_id ' ];
0 commit comments