Make WordPress Core

Ticket #42394: 42394.2.diff

File 42394.2.diff, 4.6 KB (added by westonruter, 7 years ago)

Remove unused var

  • src/wp-admin/css/customize-controls.css

    diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css
    index b888f610bb..d7d538739d 100644
    body.trashing #publish-settings { 
    332332        margin-top: 10px;
    333333}
    334334
    335 .customize-control.customize-control-date_time .date-time-fields .date-input,
    336 .customize-control.customize-control-date_time .date-time-fields .date-time-separator {
    337         float: left;
    338         margin-right: 5px;
    339 }
    340335.customize-control.customize-control-date_time .date-time-fields .date-input.day {
    341336        margin-right: 0;
    342337}
    body.trashing #publish-settings { 
    361356        margin: 0;
    362357}
    363358
    364 .date-time-fields .date-time-separator {
    365         line-height: 2;
    366 }
    367 
    368359.date-time-fields .time-row {
    369360        margin-top: 12px;
    370361}
    371362
    372363.date-time-fields .date-timezone {
    373         float: left;
    374364        line-height: 2.2;
    375365        text-decoration: none;
    376366}
    body.adding-widget .add-new-widget:before, 
    28302820                width: 80px;
    28312821        }
    28322822
    2833         .date-time-fields .date-time-separator,
    28342823        .date-time-fields .date-timezone {
    28352824                line-height: 3.2;
    28362825        }
  • src/wp-includes/customize/class-wp-customize-date-time-control.php

    diff --git src/wp-includes/customize/class-wp-customize-date-time-control.php src/wp-includes/customize/class-wp-customize-date-time-control.php
    index d1e8d12500..c163ba1408 100644
    class WP_Customize_Date_Time_Control extends WP_Customize_Control { 
    9898        public function content_template() {
    9999                $data = array_merge( $this->json(), $this->get_month_choices() );
    100100                $timezone_info = $this->get_timezone_info();
     101
     102                $date_format = get_option( 'date_format' );
     103                foreach ( array( 'Y', 'y', 'o' ) as $year_token ) {
     104                        $date_format = preg_replace( '/(?<!\\\\)' . $year_token . '/', '%1$s', $date_format );
     105                }
     106                foreach ( array( 'F', 'm', 'M', 'n' ) as $month_token ) {
     107                        $date_format = preg_replace( '/(?<!\\\\)' . $month_token . '/', '%2$s', $date_format );
     108                }
     109                foreach ( array( 'j', 'd' ) as $day_token ) {
     110                        $date_format = preg_replace( '/(?<!\\\\)' . $day_token . '/', '%3$s', $date_format );
     111                }
    101112                ?>
    102113
    103114                <# _.defaults( data, <?php echo wp_json_encode( $data ); ?> ); #>
    class WP_Customize_Date_Time_Control extends WP_Customize_Control { 
    116127                        <fieldset class="day-row">
    117128                                <legend class="title-day {{ ! data.includeTime ? 'screen-reader-text' : '' }}"><?php esc_html_e( 'Date' ); ?></legend>
    118129                                <div class="day-fields clear">
     130                                        <?php ob_start(); ?>
    119131                                        <label for="{{ idPrefix }}date-time-month" class="screen-reader-text"><?php esc_html_e( 'Month' ); ?></label>
    120132                                        <select id="{{ idPrefix }}date-time-month" class="date-input month" data-component="month">
    121133                                                <# _.each( data.month_choices, function( choice ) {
    class WP_Customize_Date_Time_Control extends WP_Customize_Control { 
    129141                                                        </option>
    130142                                                <# } ); #>
    131143                                        </select>
     144                                        <?php $month_field = trim( ob_get_clean() ); ?>
     145
     146                                        <?php ob_start(); ?>
    132147                                        <label for="{{ idPrefix }}date-time-day" class="screen-reader-text"><?php esc_html_e( 'Day' ); ?></label>
    133148                                        <input id="{{ idPrefix }}date-time-day" type="number" size="2" autocomplete="off" class="date-input day" data-component="day" min="1" max="31" />
    134                                         <span class="time-special-char date-time-separator">,</span>
     149                                        <?php $day_field = trim( ob_get_clean() ); ?>
     150
     151                                        <?php ob_start(); ?>
    135152                                        <label for="{{ idPrefix }}date-time-year" class="screen-reader-text"><?php esc_html_e( 'Year' ); ?></label>
    136153                                        <input id="{{ idPrefix }}date-time-year" type="number" size="4" autocomplete="off" class="date-input year" data-component="year" min="{{ data.minYear }}" max="{{ data.maxYear }}">
     154                                        <?php $year_field = trim( ob_get_clean() ); ?>
     155
     156                                        <?php printf( $date_format, $year_field, $month_field, $day_field ); ?>
    137157                                </div>
    138158                        </fieldset>
    139159                        <# if ( data.includeTime ) { #>
    class WP_Customize_Date_Time_Control extends WP_Customize_Control { 
    144164                                                <# var maxHour = data.twelveHourFormat ? 12 : 23; #>
    145165                                                <# var minHour = data.twelveHourFormat ? 1 : 0; #>
    146166                                                <input id="{{ idPrefix }}date-time-hour" type="number" size="2" autocomplete="off" class="date-input hour" data-component="hour" min="{{ minHour }}" max="{{ maxHour }}">
    147                                                 <span class="time-special-char date-time-separator">:</span>
     167                                                :
    148168                                                <label for="{{ idPrefix }}date-time-minute" class="screen-reader-text"><?php esc_html_e( 'Minute' ); ?></label>
    149169                                                <input id="{{ idPrefix }}date-time-minute" type="number" size="2" autocomplete="off" class="date-input minute" data-component="minute" min="0" max="59">
    150170                                                <# if ( data.twelveHourFormat ) { #>