Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years 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-content/themes/twentyseventeen/inc/custom-header.php

    r41780 r42343  
    2525     *     An array of custom-header support arguments.
    2626     *
    27      *     @type string $default-image          Default image of the header.
     27     *     @type string $default-image          Default image of the header.
    2828     *     @type string $default_text_color     Default color of the header text.
    2929     *     @type int    $width                  Width in pixels of the custom header image. Default 954.
     
    3131     *     @type string $wp-head-callback       Callback function used to styles the header image and text
    3232     *                                          displayed on the blog.
    33      *     @type string $flex-height            Flex support for height of header.
     33     *     @type string $flex-height            Flex support for height of header.
    3434     * }
    3535     */
    36     add_theme_support( 'custom-header', apply_filters( 'twentyseventeen_custom_header_args', array(
    37         'default-image'      => get_parent_theme_file_uri( '/assets/images/header.jpg' ),
    38         'width'              => 2000,
    39         'height'             => 1200,
    40         'flex-height'        => true,
    41         'video'              => true,
    42         'wp-head-callback'   => 'twentyseventeen_header_style',
    43     ) ) );
     36    add_theme_support(
     37        'custom-header', apply_filters(
     38            'twentyseventeen_custom_header_args', array(
     39                'default-image'    => get_parent_theme_file_uri( '/assets/images/header.jpg' ),
     40                'width'            => 2000,
     41                'height'           => 1200,
     42                'flex-height'      => true,
     43                'video'            => true,
     44                'wp-head-callback' => 'twentyseventeen_header_style',
     45            )
     46        )
     47    );
    4448
    45     register_default_headers( array(
    46         'default-image' => array(
    47             'url'           => '%s/assets/images/header.jpg',
    48             'thumbnail_url' => '%s/assets/images/header.jpg',
    49             'description'   => __( 'Default Header Image', 'twentyseventeen' ),
    50         ),
    51     ) );
     49    register_default_headers(
     50        array(
     51            'default-image' => array(
     52                'url'           => '%s/assets/images/header.jpg',
     53                'thumbnail_url' => '%s/assets/images/header.jpg',
     54                'description'   => __( 'Default Header Image', 'twentyseventeen' ),
     55            ),
     56        )
     57    );
    5258}
    5359add_action( 'after_setup_theme', 'twentyseventeen_custom_header_setup' );
    5460
    5561if ( ! function_exists( 'twentyseventeen_header_style' ) ) :
    56 /**
    57  * Styles the header image and text displayed on the blog.
    58  *
    59  * @see twentyseventeen_custom_header_setup().
    60  */
    61 function twentyseventeen_header_style() {
    62     $header_text_color = get_header_textcolor();
     62    /**
     63    * Styles the header image and text displayed on the blog.
     64    *
     65    * @see twentyseventeen_custom_header_setup().
     66    */
     67    function twentyseventeen_header_style() {
     68        $header_text_color = get_header_textcolor();
    6369
    64     // If no custom options for text are set, let's bail.
    65     // get_header_textcolor() options: add_theme_support( 'custom-header' ) is default, hide text (returns 'blank') or any hex value.
    66     if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
    67         return;
    68     }
     70        // If no custom options for text are set, let's bail.
     71        // get_header_textcolor() options: add_theme_support( 'custom-header' ) is default, hide text (returns 'blank') or any hex value.
     72        if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
     73            return;
     74        }
    6975
    70     // If we get this far, we have custom styles. Let's do this.
    71     ?>
    72     <style id="twentyseventeen-custom-header-styles" type="text/css">
    73     <?php
     76        // If we get this far, we have custom styles. Let's do this.
     77        ?>
     78        <style id="twentyseventeen-custom-header-styles" type="text/css">
     79        <?php
    7480        // Has the text been hidden?
    7581        if ( 'blank' === $header_text_color ) :
     
    107113    </style>
    108114    <?php
    109 }
     115    }
    110116endif; // End of twentyseventeen_header_style.
    111117
     
    117123 */
    118124function twentyseventeen_video_controls( $settings ) {
    119     $settings['l10n']['play'] = '<span class="screen-reader-text">' . __( 'Play background video', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'play' ) );
     125    $settings['l10n']['play']  = '<span class="screen-reader-text">' . __( 'Play background video', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'play' ) );
    120126    $settings['l10n']['pause'] = '<span class="screen-reader-text">' . __( 'Pause background video', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'pause' ) );
    121127    return $settings;
Note: See TracChangeset for help on using the changeset viewer.