Ticket #21355: 21355-for-branch.diff
File 21355-for-branch.diff, 4.7 KB (added by , 11 years ago) |
---|
-
wp-includes/js/plupload/wp-plupload.dev.js
113 113 }); 114 114 }( this.dropzone, this.supports.dragdrop )); 115 115 116 this.browser.on( 'mouseenter', this.refresh ); 116 if ( this.browser ) { 117 this.browser.on( 'mouseenter', this.refresh ); 118 } else { 119 this.uploader.disableBrowse( true ); 120 // If HTML5 mode, hide the auto-created file container. 121 $('#' + this.uploader.id + '_html5_container').hide(); 122 } 117 123 118 124 this.uploader.bind( 'UploadProgress', this.progress ); 119 125 -
wp-includes/class-wp-customize-control.php
321 321 322 322 $this->add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) ); 323 323 $this->add_tab( 'uploaded', __('Uploaded'), array( $this, 'tab_uploaded' ) ); 324 325 // Early priority to occur before $this->manager->prepare_controls(); 326 add_action( 'customize_controls_init', array( $this, 'prepare_control' ), 5 ); 324 327 } 325 328 329 /** 330 * Prepares the control. 331 * 332 * If no tabs exist, removes the control from the manager. 333 * 334 * @since 3.4.2 335 */ 336 public function prepare_control() { 337 if ( ! $this->tabs ) 338 $this->manager->remove_control( $this->id ); 339 } 340 326 341 public function to_json() { 327 342 parent::to_json(); 328 343 $this->json['statuses'] = $this->statuses; … … 455 470 } 456 471 457 472 class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { 473 /** 474 * The processed default headers. 475 * @since 3.4.2 476 * @var array 477 */ 478 protected $default_headers; 479 480 /** 481 * The uploaded headers. 482 * @since 3.4.2 483 * @var array 484 */ 485 protected $uploaded_headers; 486 458 487 public function __construct( $manager ) { 459 488 parent::__construct( $manager, 'header_image', array( 460 489 'label' => __( 'Header Image' ), … … 474 503 ) 475 504 ) ); 476 505 477 $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) ); 506 // Remove the upload tab. 507 $this->remove_tab( 'upload-new' ); 478 508 } 479 509 510 /** 511 * Prepares the control. 512 * 513 * If no tabs exist, removes the control from the manager. 514 * 515 * @since 3.4.2 516 */ 517 public function prepare_control() { 518 global $custom_image_header; 519 520 // Process default headers and uploaded headers. 521 $custom_image_header->process_default_headers(); 522 $this->default_headers = $custom_image_header->default_headers; 523 $this->uploaded_headers = get_uploaded_header_images(); 524 525 if ( $this->default_headers ) 526 $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) ); 527 528 if ( ! $this->uploaded_headers ) 529 $this->remove_tab( 'uploaded' ); 530 531 return parent::prepare_control(); 532 } 533 480 534 public function print_header_image( $choice, $header ) { 481 535 $header['url'] = set_url_scheme( $header['url'] ); 482 536 $header['thumbnail_url'] = set_url_scheme( $header['thumbnail_url'] ); … … 498 552 } 499 553 500 554 public function tab_uploaded() { 501 $headers = get_uploaded_header_images();502 503 555 ?><div class="uploaded-target"></div><?php 504 556 505 foreach ( $ headers as $choice => $header )557 foreach ( $this->uploaded_headers as $choice => $header ) 506 558 $this->print_header_image( $choice, $header ); 507 559 } 508 560 509 561 public function tab_default_headers() { 510 global $custom_image_header; 511 $custom_image_header->process_default_headers(); 512 513 foreach ( $custom_image_header->default_headers as $choice => $header ) 562 foreach ( $this->default_headers as $choice => $header ) 514 563 $this->print_header_image( $choice, $header ); 515 564 } 516 565 } 566 No newline at end of file -
wp-admin/js/customize-controls.dev.js
220 220 }; 221 221 }); 222 222 223 // Select a tab224 this.selected = this.tabs[ panels.first().data('customizeTab') ];225 this.selected.both.addClass('library-selected');226 227 223 // Bind tab switch events 228 224 this.library.children('ul').on( 'click', 'li', function( event ) { 229 225 var id = $(this).data('customizeTab'), … … 255 251 this.tabs.uploaded.both.addClass('hidden'); 256 252 } 257 253 254 // Select a tab 255 panels.each( function() { 256 var tab = control.tabs[ $(this).data('customizeTab') ]; 257 258 // Select the first visible tab. 259 if ( ! tab.link.hasClass('hidden') ) { 260 control.selected = tab; 261 tab.both.addClass('library-selected'); 262 return false; 263 } 264 }); 265 258 266 this.dropdownInit(); 259 267 }, 260 268 success: function( attachment ) {