- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/customize/class-wp-customize-header-image-control.php
r41935 r42343 28 28 */ 29 29 public function __construct( $manager ) { 30 parent::__construct( $manager, 'header_image', array( 31 'label' => __( 'Header Image' ), 32 'settings' => array( 33 'default' => 'header_image', 34 'data' => 'header_image_data', 35 ), 36 'section' => 'header_image', 37 'removed' => 'remove-header', 38 'get_url' => 'get_header_image', 39 ) ); 30 parent::__construct( 31 $manager, 'header_image', array( 32 'label' => __( 'Header Image' ), 33 'settings' => array( 34 'default' => 'header_image', 35 'data' => 'header_image_data', 36 ), 37 'section' => 'header_image', 38 'removed' => 'remove-header', 39 'get_url' => 'get_header_image', 40 ) 41 ); 40 42 41 43 } … … 49 51 $this->prepare_control(); 50 52 51 wp_localize_script( 'customize-views', '_wpCustomizeHeader', array( 52 'data' => array( 53 'width' => absint( get_theme_support( 'custom-header', 'width' ) ), 54 'height' => absint( get_theme_support( 'custom-header', 'height' ) ), 55 'flex-width' => absint( get_theme_support( 'custom-header', 'flex-width' ) ), 56 'flex-height' => absint( get_theme_support( 'custom-header', 'flex-height' ) ), 57 'currentImgSrc' => $this->get_current_image_src(), 58 ), 59 'nonces' => array( 60 'add' => wp_create_nonce( 'header-add' ), 61 'remove' => wp_create_nonce( 'header-remove' ), 62 ), 63 'uploads' => $this->uploaded_headers, 64 'defaults' => $this->default_headers 65 ) ); 53 wp_localize_script( 54 'customize-views', '_wpCustomizeHeader', array( 55 'data' => array( 56 'width' => absint( get_theme_support( 'custom-header', 'width' ) ), 57 'height' => absint( get_theme_support( 'custom-header', 'height' ) ), 58 'flex-width' => absint( get_theme_support( 'custom-header', 'flex-width' ) ), 59 'flex-height' => absint( get_theme_support( 'custom-header', 'flex-height' ) ), 60 'currentImgSrc' => $this->get_current_image_src(), 61 ), 62 'nonces' => array( 63 'add' => wp_create_nonce( 'header-add' ), 64 'remove' => wp_create_nonce( 'header-remove' ), 65 ), 66 'uploads' => $this->uploaded_headers, 67 'defaults' => $this->default_headers, 68 ) 69 ); 66 70 67 71 parent::enqueue(); … … 69 73 70 74 /** 71 *72 75 * @global Custom_Image_Header $custom_image_header 73 76 */ … … 82 85 // Process default headers and uploaded headers. 83 86 $custom_image_header->process_default_headers(); 84 $this->default_headers = $custom_image_header->get_default_header_images();87 $this->default_headers = $custom_image_header->get_default_header_images(); 85 88 $this->uploaded_headers = $custom_image_header->get_uploaded_header_images(); 86 89 } … … 161 164 public function render_content() { 162 165 $visibility = $this->get_current_image_src() ? '' : ' style="display:none" '; 163 $width = absint( get_theme_support( 'custom-header', 'width' ) );164 $height = absint( get_theme_support( 'custom-header', 'height' ) );166 $width = absint( get_theme_support( 'custom-header', 'width' ) ); 167 $height = absint( get_theme_support( 'custom-header', 'height' ) ); 165 168 ?> 166 169 <div class="customize-control-content"> 167 <?php if ( current_theme_supports( 'custom-header', 'video' ) ) { 170 <?php 171 if ( current_theme_supports( 'custom-header', 'video' ) ) { 168 172 echo '<span class="customize-control-title">' . $this->label . '</span>'; 169 } ?> 173 } 174 ?> 170 175 <div class="customize-control-notifications-container"></div> 171 176 <p class="customizer-section-intro customize-control-description"> … … 175 180 } elseif ( $width && $height ) { 176 181 /* translators: %s: header size in pixels */ 177 printf( __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header size of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ), 182 printf( 183 __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header size of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ), 178 184 sprintf( '<strong>%s × %s</strong>', $width, $height ) 179 185 ); 180 186 } elseif ( $width ) { 181 187 /* translators: %s: header width in pixels */ 182 printf( __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ), 188 printf( 189 __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ), 183 190 sprintf( '<strong>%s</strong>', $width ) 184 191 ); 185 192 } else { 186 193 /* translators: %s: header height in pixels */ 187 printf( __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ), 194 printf( 195 __( 'Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels — you’ll be able to crop your image once you upload it for a perfect fit.' ), 188 196 sprintf( '<strong>%s</strong>', $height ) 189 197 ); … … 201 209 </div> 202 210 <div class="actions"> 203 <?php if ( current_user_can( 'upload_files' ) ) : ?>211 <?php if ( current_user_can( 'upload_files' ) ) : ?> 204 212 <button type="button"<?php echo $visibility; ?> class="button remove" aria-label="<?php esc_attr_e( 'Hide header image' ); ?>"><?php _e( 'Hide image' ); ?></button> 205 213 <button type="button" class="button new" id="header_image-button" aria-label="<?php esc_attr_e( 'Add new header image' ); ?>"><?php _e( 'Add new image' ); ?></button>
Note: See TracChangeset
for help on using the changeset viewer.