Ticket #18060: 18060-0304.diff
File 18060-0304.diff, 1.3 KB (added by , 13 years ago) |
---|
-
wp-includes/class-wp-atom-server.php
old new 542 542 543 543 $url = $file['url']; 544 544 $file = $file['file']; 545 $title = $content = $slug; 545 546 546 547 do_action('wp_create_file_in_uploads', $file); // replicate 547 548 549 if ( $image_meta = @wp_read_image_metadata($file) ) { 550 if ( trim ( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) 551 $title = $image_meta['title']; 552 if ( trim( $image_meta['caption'] ) ) 553 $content = $image_meta['caption']; 554 } 555 548 556 // Construct the attachment array 549 557 $attachment = array( 550 'post_title' => $ slug,551 'post_content' => $ slug,558 'post_title' => $title, 559 'post_content' => $content, 552 560 'post_status' => 'attachment', 553 561 'post_parent' => 0, 554 562 'post_mime_type' => $type, … … 558 566 // Save the data 559 567 $postID = wp_insert_attachment($attachment, $file); 560 568 561 if ( !$postID)569 if ( is_wp_error( $postID ) ) { 562 570 $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); 571 } else { 572 wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $file ) ) ; 573 } 563 574 564 575 $output = $this->get_entry($postID, 'attachment'); 565 576