Changeset 46174 for trunk/src/wp-admin/includes/media.php
- Timestamp:
- 09/19/2019 01:25:14 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/media.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r46131 r46174 309 309 $name = wp_basename( $name, ".$ext" ); 310 310 311 $url = $file['url'];312 $type = $file['type'];313 $file = $file['file'];314 $title = sanitize_text_field( $name );315 $content = '';316 $excerpt = '';317 $ image_ref= false;311 $url = $file['url']; 312 $type = $file['type']; 313 $file = $file['file']; 314 $title = sanitize_text_field( $name ); 315 $content = ''; 316 $excerpt = ''; 317 $_ref = false; 318 318 319 319 if ( preg_match( '#^audio#', $type ) ) { … … 377 377 // Use image exif/iptc data for title and caption defaults if possible. 378 378 } elseif ( 0 === strpos( $type, 'image/' ) ) { 379 // Image file reference passed by the uploader.380 if ( ! empty( $_POST['_wp_temp_image_ref'] ) ) {381 $image_ref = preg_replace( '/[^a-zA-Z0-9_]/', '', $_POST['_wp_temp_image_ref'] );382 }383 384 379 $image_meta = wp_read_image_metadata( $file ); 385 380 … … 416 411 if ( ! is_wp_error( $attachment_id ) ) { 417 412 // If an image, keep the upload reference until all image sub-sizes are created. 418 if ( $image_ref) {419 set_transient( '_wp_temp_image_ref:' . $image_ref, $attachment_id, HOUR_IN_SECONDS);413 if ( ! empty( $_POST['_wp_temp_upload_ref'] ) && wp_attachment_is_image( $attachment_id ) ) { 414 $_ref = _wp_set_upload_ref( $_POST['_wp_temp_upload_ref'], $attachment_id ); 420 415 } 421 416 … … 426 421 // At this point the image is uploaded successfully even if there were specific errors or some sub-sizes were not created. 427 422 // The transient is not needed any more. 428 if ( $ image_ref ) {429 delete_transient( '_wp_temp_image_ref:' . $image_ref);423 if ( $_ref ) { 424 _wp_clear_upload_ref( $_POST['_wp_temp_upload_ref'] ); 430 425 } 431 426 }
Note: See TracChangeset
for help on using the changeset viewer.