diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index f3196af31a..c473d89455 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -3950,13 +3950,13 @@ function wp_ajax_crop_image() { } /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ - $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. - $object = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); - unset( $object['ID'] ); + $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. + $attachment = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); + unset( $attachment['ID'] ); // Update the attachment. add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); - $attachment_id = $wp_site_icon->insert_attachment( $object, $cropped ); + $attachment_id = $wp_site_icon->insert_attachment( $attachment, $cropped ); remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); // Additional sizes in wp_prepare_attachment_for_js(). @@ -3988,9 +3988,9 @@ function wp_ajax_crop_image() { $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; // Get the original image's post to pre-populate the cropped image. - $original_attachment = get_post( $attachment_id ); - $sanitized_post_title = sanitize_file_name( $original_attachment->post_title ); - $use_original_title = ( + $original_attachment = get_post( $attachment_id ); + $sanitized_post_title = sanitize_file_name( $original_attachment->post_title ); + $use_original_title = ( ( '' !== trim( $original_attachment->post_title ) ) && /* * Check if the original image has a title other than the "filename" default, @@ -4001,7 +4001,7 @@ function wp_ajax_crop_image() { ); $use_original_description = ( '' !== trim( $original_attachment->post_content ) ); - $object = array( + $attachment = array( 'post_title' => $use_original_title ? $original_attachment->post_title : wp_basename( $cropped ), 'post_content' => $use_original_description ? $original_attachment->post_content : $url, 'post_mime_type' => $image_type, @@ -4011,17 +4011,17 @@ function wp_ajax_crop_image() { // Copy the image caption attribute (post_excerpt field) from the original image. if ( '' !== trim( $original_attachment->post_excerpt ) ) { - $object['post_excerpt'] = $original_attachment->post_excerpt; + $attachment['post_excerpt'] = $original_attachment->post_excerpt; } // Copy the image alt text attribute from the original image. if ( '' !== trim( $original_attachment->_wp_attachment_image_alt ) ) { - $object['meta_input'] = array( + $attachment['meta_input'] = array( '_wp_attachment_image_alt' => wp_slash( $original_attachment->_wp_attachment_image_alt ), ); } - $attachment_id = wp_insert_attachment( $object, $cropped ); + $attachment_id = wp_insert_attachment( $attachment, $cropped ); $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); /** diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index 641d89eb9e..df246313f4 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -510,8 +510,8 @@ class Custom_Background { $file = $file['file']; $filename = wp_basename( $file ); - // Construct the object array. - $object = array( + // Construct the attachment array. + $attachment = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, @@ -520,7 +520,7 @@ class Custom_Background { ); // Save the data. - $id = wp_insert_attachment( $object, $file ); + $id = wp_insert_attachment( $attachment, $file ); // Add the metadata. wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 8336cfb76a..c5efc071e1 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -973,7 +973,7 @@ endif; $file = $file['file']; $filename = wp_basename( $file ); - // Construct the array with attachment object data. + // Construct the attachment array. $attachment = array( 'post_title' => $filename, 'post_content' => $url, diff --git a/wp-admin/includes/class-file-upload-upgrader.php b/wp-admin/includes/class-file-upload-upgrader.php index 3bdae332c8..28cc4402c7 100644 --- a/wp-admin/includes/class-file-upload-upgrader.php +++ b/wp-admin/includes/class-file-upload-upgrader.php @@ -71,8 +71,8 @@ class File_Upload_Upgrader { $this->filename = $_FILES[ $form ]['name']; $this->package = $file['file']; - // Construct the object array. - $object = array( + // Construct the attachment array. + $attachment = array( 'post_title' => $this->filename, 'post_content' => $file['url'], 'post_mime_type' => $file['type'], @@ -82,7 +82,7 @@ class File_Upload_Upgrader { ); // Save the data. - $this->id = wp_insert_attachment( $object, $file['file'] ); + $this->id = wp_insert_attachment( $attachment, $file['file'] ); // Schedule a cleanup for 2 hours from now in case of failed installation. wp_schedule_single_event( time() + 2 * HOUR_IN_SECONDS, 'upgrader_scheduled_cleanup', array( $this->id ) ); diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index 20054c194c..ebce202de3 100644 --- a/wp-admin/includes/import.php +++ b/wp-admin/includes/import.php @@ -103,8 +103,8 @@ function wp_import_handle_upload() { return $upload; } - // Construct the object array. - $object = array( + // Construct the attachment array. + $attachment = array( 'post_title' => wp_basename( $upload['file'] ), 'post_content' => $upload['url'], 'post_mime_type' => $upload['type'], @@ -114,7 +114,7 @@ function wp_import_handle_upload() { ); // Save the data. - $id = wp_insert_attachment( $object, $upload['file'] ); + $id = wp_insert_attachment( $attachment, $upload['file'] ); /* * Schedule a cleanup for one day from now in case of failed diff --git a/wp-includes/version.php b/wp-includes/version.php index 2027d9678d..a034be2b74 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta1-53182'; +$wp_version = '6.0-beta1-53183'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.