WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (23 months ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-header-image-control.php

    r41935 r42343  
    2828     */
    2929    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        );
    4042
    4143    }
     
    4951        $this->prepare_control();
    5052
    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        );
    6670
    6771        parent::enqueue();
     
    6973
    7074    /**
    71      *
    7275     * @global Custom_Image_Header $custom_image_header
    7376     */
     
    8285        // Process default headers and uploaded headers.
    8386        $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();
    8588        $this->uploaded_headers = $custom_image_header->get_uploaded_header_images();
    8689    }
     
    161164    public function render_content() {
    162165        $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' ) );
    165168        ?>
    166169        <div class="customize-control-content">
    167             <?php if ( current_theme_supports( 'custom-header', 'video' ) ) {
     170            <?php
     171            if ( current_theme_supports( 'custom-header', 'video' ) ) {
    168172                echo '<span class="customize-control-title">' . $this->label . '</span>';
    169             } ?>
     173            }
     174            ?>
    170175            <div class="customize-control-notifications-container"></div>
    171176            <p class="customizer-section-intro customize-control-description">
     
    175180                } elseif ( $width && $height ) {
    176181                    /* translators: %s: header size in pixels */
    177                     printf( __( 'Click &#8220;Add new image&#8221; to upload an image file from your computer. Your theme works best with an image with a header size of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
     182                    printf(
     183                        __( 'Click &#8220;Add new image&#8221; to upload an image file from your computer. Your theme works best with an image with a header size of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
    178184                        sprintf( '<strong>%s &times; %s</strong>', $width, $height )
    179185                    );
    180186                } elseif ( $width ) {
    181187                    /* translators: %s: header width in pixels */
    182                     printf( __( 'Click &#8220;Add new image&#8221; to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
     188                    printf(
     189                        __( 'Click &#8220;Add new image&#8221; to upload an image file from your computer. Your theme works best with an image with a header width of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
    183190                        sprintf( '<strong>%s</strong>', $width )
    184191                    );
    185192                } else {
    186193                    /* translators: %s: header height in pixels */
    187                     printf( __( 'Click &#8220;Add new image&#8221; to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
     194                    printf(
     195                        __( 'Click &#8220;Add new image&#8221; to upload an image file from your computer. Your theme works best with an image with a header height of %s pixels &#8212; you&#8217;ll be able to crop your image once you upload it for a perfect fit.' ),
    188196                        sprintf( '<strong>%s</strong>', $height )
    189197                    );
     
    201209            </div>
    202210            <div class="actions">
    203                 <?php if ( current_user_can( 'upload_files' ) ): ?>
     211                <?php if ( current_user_can( 'upload_files' ) ) : ?>
    204212                <button type="button"<?php echo $visibility; ?> class="button remove" aria-label="<?php esc_attr_e( 'Hide header image' ); ?>"><?php _e( 'Hide image' ); ?></button>
    205213                <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.