Make WordPress Core

Ticket #25443: 25443.diff

File 25443.diff, 2.6 KB (added by DrewAPicture, 11 years ago)
  • src/wp-admin/custom-header.php

     
    633633</table>
    634634<?php endif;
    635635
     636/**
     637 * Fires just before the submit button in the custom header options form.
     638 *
     639 * @since 3.1.0
     640 */
    636641do_action( 'custom_header_options' );
    637642
    638643wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
     
    690695
    691696                        $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
    692697
    693                         do_action('wp_create_file_in_uploads', $file, $attachment_id); // For replication
     698                        /**
     699                         * Fires after the header image is set or an error is returned.
     700                         *
     701                         * @since 2.1.0
     702                         *
     703                         * @param string $file          Path to the file.
     704                         * @param int    $attachment_id Attachment ID.
     705                         */
     706                        do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication
     707
    694708                        return $this->finished();
    695709                } elseif ( $width > $max_width ) {
    696710                        $oitar = $width / $max_width;
     
    698712                        if ( ! $image || is_wp_error( $image ) )
    699713                                wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
    700714
    701                         $image = apply_filters('wp_create_file_in_uploads', $image, $attachment_id); // For replication
     715                        //duplicate_hook
     716                        $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
    702717
    703718                        $url = str_replace(basename($url), basename($image), $url);
    704719                        $width = $width / $oitar;
     
    839854                if ( ! $cropped || is_wp_error( $cropped ) )
    840855                        wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
    841856
    842                 $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication
     857                //duplicate_hook
     858                $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
    843859
    844860                $parent = get_post($attachment_id);
    845861                $parent_url = $parent->guid;
     
    870886
    871887                // cleanup
    872888                $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
    873                 if ( file_exists( $medium ) )
     889                if ( file_exists( $medium ) ) {
     890                        //duplicate_hook
    874891                        @unlink( apply_filters( 'wp_delete_file', $medium ) );
    875                 if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) )
     892                }
     893
     894                if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) {
     895                        //duplicate_hook
    876896                        @unlink( apply_filters( 'wp_delete_file', $original ) );
     897                }
    877898
    878899                return $this->finished();
    879900        }