Make WordPress Core

Ticket #25443: 25443-custom-header.diff

File 25443-custom-header.diff, 2.5 KB (added by gizburdt, 11 years ago)

custom-header.php inline docs

  • wp-admin/custom-header.php

     
    633633</table>
    634634<?php endif;
    635635
     636/**
     637 * Fires at the end of the custom header options form
     638 *
     639 * @since 3.1.0
     640 *
     641 */
    636642do_action( 'custom_header_options' );
    637643
    638644wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
     
    690696
    691697                        $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
    692698
     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                         */
    693707                        do_action('wp_create_file_in_uploads', $file, $attachment_id); // For replication
     708
    694709                        return $this->finished();
    695710                } elseif ( $width > $max_width ) {
    696711                        $oitar = $width / $max_width;
     
    698713                        if ( ! $image || is_wp_error( $image ) )
    699714                                wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
    700715
     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                         */
    701724                        $image = apply_filters('wp_create_file_in_uploads', $image, $attachment_id); // For replication
    702725
    703726                        $url = str_replace(basename($url), basename($image), $url);
     
    839862                if ( ! $cropped || is_wp_error( $cropped ) )
    840863                        wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
    841864
     865                // duplicate hook
    842866                $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication
    843867
    844868                $parent = get_post($attachment_id);
     
    870894
    871895                // cleanup
    872896                $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                         */
    874905                        @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
    876910                        @unlink( apply_filters( 'wp_delete_file', $original ) );
     911                }
    877912
    878913                return $this->finished();
    879914        }