Make WordPress Core


Ignore:
Timestamp:
11/09/2012 11:59:05 AM (12 years ago)
Author:
koopersmith
Message:

Integrate media with the custom header page. fixes #21820, see #21390.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-header.php

    r22470 r22505  
    173173        if ( ( 1 == $step || 3 == $step ) ) {
    174174            add_thickbox();
    175             wp_enqueue_script( 'media-upload' );
     175            wp_enqueue_media();
    176176            wp_enqueue_script( 'custom-header' );
    177177            if ( current_theme_supports( 'custom-header', 'header-text' ) )
     
    535535    </p>
    536536    <?php
    537         $image_library_url = get_upload_iframe_src( 'image', null, 'library' );
    538         $image_library_url = remove_query_arg( 'TB_iframe', $image_library_url );
    539         $image_library_url = add_query_arg( array( 'context' => 'custom-header', 'TB_iframe' => 1 ), $image_library_url );
     537        $modal_update_href = esc_url( add_query_arg( array(
     538            'page' => 'custom-header',
     539            'step' => 2,
     540            '_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'),
     541        ), admin_url('themes.php') ) );
    540542    ?>
    541543    <p>
    542544        <label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
    543         <a id="choose-from-library-link" class="button thickbox" href="<?php echo esc_url( $image_library_url ); ?>"><?php _e( 'Choose Image' ); ?></a>
     545        <a id="choose-from-library-link" class="button"
     546            data-update-link="<?php echo esc_attr( $modal_update_href ); ?>"
     547            data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>"
     548            data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></a>
    544549    </p>
    545550    </form>
     
    747752    <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
    748753    <?php
    749     if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) 
     754    if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
    750755        submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
    751756    ?>
     
    801806        if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
    802807            wp_die( __( 'Cheatin&#8217; uh?' ) );
    803            
     808
    804809        if ( $_POST['oitar'] > 1 ) {
    805810            $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
Note: See TracChangeset for help on using the changeset viewer.