Changeset 21383 for trunk/wp-includes/class-wp-customize-control.php
- Timestamp:
- 08/01/2012 06:45:54 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-control.php
r21381 r21383 478 478 $this->add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) ); 479 479 $this->add_tab( 'uploaded', __('Uploaded'), array( $this, 'tab_uploaded' ) ); 480 481 // Early priority to occur before $this->manager->prepare_controls(); 482 add_action( 'customize_controls_init', array( $this, 'prepare_control' ), 5 ); 483 } 484 485 /** 486 * Prepares the control. 487 * 488 * If no tabs exist, removes the control from the manager. 489 * 490 * @since 3.4.1 491 */ 492 public function prepare_control() { 493 if ( ! $this->tabs ) 494 $this->manager->remove_control( $this->id ); 480 495 } 481 496 … … 681 696 */ 682 697 class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { 698 /** 699 * The processed default headers. 700 * @var array 701 */ 702 protected $default_headers; 703 704 /** 705 * The uploaded headers. 706 * @var array 707 */ 708 protected $uploaded_headers; 683 709 684 710 /** … … 710 736 ) ); 711 737 712 $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) ); 738 // Remove the upload tab. 739 $this->remove_tab( 'upload-new' ); 740 } 741 742 /** 743 * Prepares the control. 744 * 745 * If no tabs exist, removes the control from the manager. 746 * 747 * @since 3.4.1 748 */ 749 public function prepare_control() { 750 global $custom_image_header; 751 752 // Process default headers and uploaded headers. 753 $custom_image_header->process_default_headers(); 754 $this->default_headers = $custom_image_header->default_headers; 755 $this->uploaded_headers = get_uploaded_header_images(); 756 757 if ( $this->default_headers ) 758 $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) ); 759 760 if ( ! $this->uploaded_headers ) 761 $this->remove_tab( 'uploaded' ); 762 763 return parent::prepare_control(); 713 764 } 714 765 … … 743 794 */ 744 795 public function tab_uploaded() { 745 $headers = get_uploaded_header_images();746 747 796 ?><div class="uploaded-target"></div><?php 748 797 749 foreach ( $ headers as $choice => $header )798 foreach ( $this->uploaded_headers as $choice => $header ) 750 799 $this->print_header_image( $choice, $header ); 751 800 } … … 755 804 */ 756 805 public function tab_default_headers() { 757 global $custom_image_header; 758 $custom_image_header->process_default_headers(); 759 760 foreach ( $custom_image_header->default_headers as $choice => $header ) 806 foreach ( $this->default_headers as $choice => $header ) 761 807 $this->print_header_image( $choice, $header ); 762 808 }
Note: See TracChangeset
for help on using the changeset viewer.