Changeset 22505
- Timestamp:
- 11/09/2012 11:59:05 AM (12 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/custom-header.php
r22470 r22505 173 173 if ( ( 1 == $step || 3 == $step ) ) { 174 174 add_thickbox(); 175 wp_enqueue_ script( 'media-upload');175 wp_enqueue_media(); 176 176 wp_enqueue_script( 'custom-header' ); 177 177 if ( current_theme_supports( 'custom-header', 'header-text' ) ) … … 535 535 </p> 536 536 <?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') ) ); 540 542 ?> 541 543 <p> 542 544 <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> 544 549 </p> 545 550 </form> … … 747 752 <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?> 748 753 <?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' ) ) ) 750 755 submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false ); 751 756 ?> … … 801 806 if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) 802 807 wp_die( __( 'Cheatin’ uh?' ) ); 803 808 804 809 if ( $_POST['oitar'] > 1 ) { 805 810 $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; -
trunk/wp-admin/js/custom-header.js
r22504 r22505 1 1 (function($) { 2 // Fetch available headers and apply jQuery.masonry3 // once the images have loaded. 2 var frame; 3 4 4 $( function() { 5 // Fetch available headers and apply jQuery.masonry 6 // once the images have loaded. 5 7 var $headers = $('.available-headers'); 6 8 … … 10 12 }); 11 13 }); 14 15 // Build the choose from library frame. 16 $('#choose-from-library-link').click( function( event ) { 17 var $el = $(this); 18 event.preventDefault(); 19 20 frame = wp.media({ 21 title: $el.data('choose'), 22 library: { 23 type: 'image' 24 } 25 }); 26 27 frame.toolbar.on( 'activate:select', function() { 28 frame.toolbar.view().add({ 29 select: { 30 style: 'primary', 31 text: $el.data('update'), 32 33 click: function() { 34 var attachment = frame.state().get('selection').first(), 35 link = $el.data('updateLink'); 36 37 window.location = link + '&file=' + attachment.id; 38 } 39 } 40 }); 41 }); 42 43 frame.state('library'); 44 }); 12 45 }); 13 46 }(jQuery));
Note: See TracChangeset
for help on using the changeset viewer.