Ticket #25443: 25443-custom-header.diff
File 25443-custom-header.diff, 2.5 KB (added by , 11 years ago) |
---|
-
wp-admin/custom-header.php
633 633 </table> 634 634 <?php endif; 635 635 636 /** 637 * Fires at the end of the custom header options form 638 * 639 * @since 3.1.0 640 * 641 */ 636 642 do_action( 'custom_header_options' ); 637 643 638 644 wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> … … 690 696 691 697 $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); 692 698 699 /** 700 * Fires just before step of of custom header is finished 701 * 702 * @since 2.1.0 703 * @param string $file Path to the file 704 * @param int $attachment_id ID of the attachment 705 * 706 */ 693 707 do_action('wp_create_file_in_uploads', $file, $attachment_id); // For replication 708 694 709 return $this->finished(); 695 710 } elseif ( $width > $max_width ) { 696 711 $oitar = $width / $max_width; … … 698 713 if ( ! $image || is_wp_error( $image ) ) 699 714 wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); 700 715 716 /** 717 * Fires before creating a replication of the custom header file 718 * 719 * @since 2.1.0 720 * @param string $image Path to the file 721 * @param int $attachment_id ID of the attachment 722 * 723 */ 701 724 $image = apply_filters('wp_create_file_in_uploads', $image, $attachment_id); // For replication 702 725 703 726 $url = str_replace(basename($url), basename($image), $url); … … 839 862 if ( ! $cropped || is_wp_error( $cropped ) ) 840 863 wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); 841 864 865 // duplicate hook 842 866 $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication 843 867 844 868 $parent = get_post($attachment_id); … … 870 894 871 895 // cleanup 872 896 $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original ); 873 if ( file_exists( $medium ) ) 897 if ( file_exists( $medium ) ) { 898 /** 899 * Fires before deleting a file 900 * 901 * @since 2.1.0 902 * @param string $medium Path to the file 903 * 904 */ 874 905 @unlink( apply_filters( 'wp_delete_file', $medium ) ); 875 if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) 906 } 907 908 if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) { 909 // duplicate hook 876 910 @unlink( apply_filters( 'wp_delete_file', $original ) ); 911 } 877 912 878 913 return $this->finished(); 879 914 }