Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created November 2, 2017 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/65556ccc0014b2ea61f1dc9fe62f9cca to your computer and use it in GitHub Desktop.
Save westonruter/65556ccc0014b2ea61f1dc9fe62f9cca to your computer and use it in GitHub Desktop.
diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css
index b888f610bb..d7d538739d 100644
--- src/wp-admin/css/customize-controls.css
+++ src/wp-admin/css/customize-controls.css
@@ -332,11 +332,6 @@ body.trashing #publish-settings {
margin-top: 10px;
}
-.customize-control.customize-control-date_time .date-time-fields .date-input,
-.customize-control.customize-control-date_time .date-time-fields .date-time-separator {
- float: left;
- margin-right: 5px;
-}
.customize-control.customize-control-date_time .date-time-fields .date-input.day {
margin-right: 0;
}
@@ -361,16 +356,11 @@ body.trashing #publish-settings {
margin: 0;
}
-.date-time-fields .date-time-separator {
- line-height: 2;
-}
-
.date-time-fields .time-row {
margin-top: 12px;
}
.date-time-fields .date-timezone {
- float: left;
line-height: 2.2;
text-decoration: none;
}
@@ -2830,7 +2820,6 @@ body.adding-widget .add-new-widget:before,
width: 80px;
}
- .date-time-fields .date-time-separator,
.date-time-fields .date-timezone {
line-height: 3.2;
}
diff --git src/wp-admin/customize.php src/wp-admin/customize.php
index 7f9e5a9dc7..7ccc099c59 100644
--- src/wp-admin/customize.php
+++ src/wp-admin/customize.php
@@ -60,6 +60,38 @@ if ( $wp_customize->changeset_post_id() ) {
}
}
+$is_theme_switch_unavailable = (
+ ! $wp_customize->is_theme_active()
+ &&
+ ! $wp_customize->branching()
+ &&
+ $wp_customize->changeset_post_id()
+ &&
+ in_array(
+ get_post_status( $wp_customize->changeset_post_id() ),
+ array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ),
+ true
+ )
+);
+if ( $is_theme_switch_unavailable ) {
+ $message = sprintf(
+ /* translators: %s is URL to Customizer with the Publish Settings section auto-focused */
+ __( 'Because you have drafted or scheduled changes, live previewing other themes is currently disabled. Please <a href="%s">publish your changes</a>, or wait until they publish to preview new themes. ' ),
+ add_query_arg(
+ array(
+ 'autofocus[section]' => 'publish_settings',
+ 'return' => admin_url( 'themes.php' ),
+ ),
+ admin_url( 'customize.php' )
+ )
+ );
+
+ wp_die(
+ '<p>' . $message . '</p>',
+ 403
+ );
+}
+
wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
if ( ! empty( $url ) ) {
diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
index 7b2301a2a9..7f5952c895 100644
--- src/wp-admin/includes/misc.php
+++ src/wp-admin/includes/misc.php
@@ -333,7 +333,7 @@ function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) {
'file' => rawurlencode( $tree ),
'theme' => rawurlencode( $stylesheet ),
),
- admin_url( 'theme-editor.php' )
+ self_admin_url( 'theme-editor.php' )
);
?>
<li role="none" class="<?php echo esc_attr( $relative_file === $filename ? 'current-file' : '' ); ?>">
@@ -421,7 +421,7 @@ function wp_print_plugin_file_tree( $tree, $label = '', $level = 2, $size = 1, $
'file' => rawurlencode( $tree ),
'plugin' => rawurlencode( $plugin ),
),
- admin_url( 'plugin-editor.php' )
+ self_admin_url( 'plugin-editor.php' )
);
?>
<li role="none" class="<?php echo esc_attr( $file === $tree ? 'current-file' : '' ); ?>">
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 7fb87bc88e..bd48ebe652 100644
--- src/wp-admin/js/customize-controls.js
+++ src/wp-admin/js/customize-controls.js
@@ -2549,11 +2549,24 @@
* @returns {void}
*/
showDetails: function ( theme, callback ) {
- var section = this;
+ var section = this, panel = api.panel( 'themes' );
section.currentTheme = theme.id;
section.overlay.html( section.template( theme ) )
.fadeIn( 'fast' )
.focus();
+
+ function disableSwitchButtons() {
+ return ! panel.canSwitchTheme( theme.id );
+ }
+
+ // Temporary special function since supplying SFTP credentials does not work yet. See #42184.
+ function disableInstallButtons() {
+ return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded;
+ }
+
+ section.overlay.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );
+ section.overlay.find( 'button.theme-install' ).toggleClass( 'disabled', disableInstallButtons() );
+
section.$body.addClass( 'modal-open' );
section.containFocus( section.overlay );
section.updateLimits();
@@ -3030,6 +3043,21 @@
api.Panel.prototype.initialize.call( panel, id, options );
},
+ /**
+ * Determine whether a given theme can be switched to, or in general.
+ *
+ * @since 4.9.0
+ *
+ * @param {string} [slug] - Theme slug.
+ * @returns {boolean} Whether the theme can be switched to.
+ */
+ canSwitchTheme: function canSwitchTheme( slug ) {
+ if ( slug && slug === api.settings.theme.stylesheet ) {
+ return true;
+ }
+ return 'publish' === api.state( 'selectedChangesetStatus' ).get() && ( '' === api.state( 'changesetStatus' ).get() || 'auto-draft' === api.state( 'changesetStatus' ).get() );
+ },
+
/**
* Attach events.
*
@@ -3052,7 +3080,7 @@
}
function toggleDisabledNotifications() {
- if ( 'publish' === api.state( 'selectedChangesetStatus' ).get() ) {
+ if ( panel.canSwitchTheme() ) {
panel.notifications.remove( 'theme_switch_unavailable' );
} else {
panel.notifications.add( new api.Notification( 'theme_switch_unavailable', {
@@ -3063,6 +3091,7 @@
}
toggleDisabledNotifications();
api.state( 'selectedChangesetStatus' ).bind( toggleDisabledNotifications );
+ api.state( 'changesetStatus' ).bind( toggleDisabledNotifications );
// Collapse panel to customize the current theme.
panel.contentContainer.on( 'click', '.customize-theme', function() {
@@ -3173,7 +3202,7 @@
}
// Prevent loading a non-active theme preview when there is a drafted/scheduled changeset.
- if ( 'publish' !== api.state( 'selectedChangesetStatus' ).get() && slug !== api.settings.theme.stylesheet ) {
+ if ( panel.canSwitchTheme( slug ) ) {
deferred.reject({
errorCode: 'theme_switch_unavailable'
});
@@ -3266,10 +3295,10 @@
* @returns {jQuery.promise} Promise.
*/
loadThemePreview: function( themeId ) {
- var deferred = $.Deferred(), onceProcessingComplete, urlParser, queryParams;
+ var panel = this, deferred = $.Deferred(), onceProcessingComplete, urlParser, queryParams;
// Prevent loading a non-active theme preview when there is a drafted/scheduled changeset.
- if ( 'publish' !== api.state( 'selectedChangesetStatus' ).get() && themeId !== api.settings.theme.stylesheet ) {
+ if ( ! panel.canSwitchTheme( themeId ) ) {
return deferred.reject().promise();
}
@@ -5089,25 +5118,23 @@
* @since 4.2.0
*/
ready: function() {
- var control = this;
+ var control = this, panel = api.panel( 'themes' );
function disableSwitchButtons() {
- return 'publish' !== api.state( 'selectedChangesetStatus' ).get() && control.params.theme.id !== api.settings.theme.stylesheet;
+ return ! panel.canSwitchTheme( control.params.theme.id );
}
// Temporary special function since supplying SFTP credentials does not work yet. See #42184.
function disableInstallButtons() {
return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded;
}
- function updateButtons( container ) {
- var _container = container || control.container;
- _container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );
- _container.find( 'button.theme-install' ).toggleClass( 'disabled', disableInstallButtons() );
+ function updateButtons() {
+ control.container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );
+ control.container.find( 'button.theme-install' ).toggleClass( 'disabled', disableInstallButtons() );
}
- api.state( 'selectedChangesetStatus' ).bind( function() {
- updateButtons();
- });
+ api.state( 'selectedChangesetStatus' ).bind( updateButtons );
+ api.state( 'changesetStatus' ).bind( updateButtons );
updateButtons();
control.container.on( 'touchmove', '.theme', function() {
@@ -5134,7 +5161,6 @@
event.preventDefault(); // Keep this AFTER the key filter above
section = api.section( control.section() );
section.showDetails( control.params.theme, function() {
- updateButtons( section.overlay.find( '.theme-actions' ) );
// Temporary special function since supplying SFTP credentials does not work yet. See #42184.
if ( api.settings.theme._filesystemCredentialsNeeded ) {
@@ -8222,6 +8248,7 @@
// Set up initial notifications.
(function() {
+ var removedQueryParams = [];
/**
* Obtain the URL to restore the autosave.
@@ -8318,9 +8345,13 @@
if ( api.settings.changeset.autosaved ) {
api.state( 'saved' ).set( false );
- stripParamsFromLocation( [ 'customize_autosaved' ] ); // Remove param when restoring autosave revision.
- } else if ( ! api.settings.changeset.branching && 'auto-draft' === api.settings.changeset.status ) {
- stripParamsFromLocation( [ 'changeset_uuid' ] ); // Remove UUID when restoring autosave auto-draft.
+ removedQueryParams.push( 'customize_autosaved' );
+ }
+ if ( ! api.settings.changeset.branching && ( ! api.settings.changeset.status || 'auto-draft' === api.settings.changeset.status ) ) {
+ removedQueryParams.push( 'changeset_uuid' ); // Remove UUID when restoring autosave auto-draft.
+ }
+ if ( removedQueryParams.length > 0 ) {
+ stripParamsFromLocation( removedQueryParams );
}
if ( api.settings.changeset.latestAutoDraftUuid || api.settings.changeset.hasAutosaveRevision ) {
addAutosaveRestoreNotification();
diff --git src/wp-admin/theme-install.php src/wp-admin/theme-install.php
index 43f105f377..0ede57849e 100644
--- src/wp-admin/theme-install.php
+++ src/wp-admin/theme-install.php
@@ -123,6 +123,23 @@ get_current_screen()->set_help_sidebar(
include(ABSPATH . 'wp-admin/admin-header.php');
+$is_customize_preview_available = true;
+
+/** This filter is documented in wp-includes/class-wp-customize-manager.php */
+if ( ! apply_filters( 'customize_changeset_branching', false ) ) {
+ $is_customize_preview_available = count( get_posts( array(
+ 'post_type' => 'customize_changeset',
+ 'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ),
+ 'author' => 'any',
+ 'posts_per_page' => 1,
+ 'no_found_rows' => true,
+ 'cache_results' => true,
+ 'update_post_meta_cache' => false,
+ 'update_post_term_cache' => false,
+ 'lazy_load_term_meta' => false,
+ ) ) ) === 0;
+}
+
?>
<div class="wrap">
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
@@ -150,6 +167,20 @@ include(ABSPATH . 'wp-admin/admin-header.php');
<p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p>
</div>
+ <?php if ( ! $is_customize_preview_available ) : ?>
+ <div class="notice notice-info">
+ <p>
+ <?php
+ printf(
+ /* translators: %s is URL to Customizer with the Publish Settings section auto-focused */
+ __( 'Because you have drafted or scheduled changes, live previewing other themes is currently disabled. Please <a href="%s">publish your changes</a>, or wait until they publish to preview new themes. ' ),
+ add_query_arg( 'autofocus[section]', 'publish_settings', admin_url( 'customize.php' ) )
+ );
+ ?>
+ </p>
+ </div>
+ <?php endif; ?>
+
<div class="upload-theme">
<?php install_themes_upload(); ?>
</div>
@@ -277,7 +308,7 @@ if ( $tab ) {
<# if ( data.activate_url ) { #>
<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
<# } #>
- <# if ( data.customize_url ) { #>
+ <# if ( data.customize_url && <?php echo wp_json_encode( $is_customize_preview_available ); ?> ) { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
<# } else { #>
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
diff --git src/wp-admin/themes.php src/wp-admin/themes.php
index 9218983239..6ffa58659b 100644
--- src/wp-admin/themes.php
+++ src/wp-admin/themes.php
@@ -148,6 +148,24 @@ wp_enqueue_script( 'theme' );
wp_enqueue_script( 'updates' );
require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+$is_customize_preview_available = true;
+
+/** This filter is documented in wp-includes/class-wp-customize-manager.php */
+if ( ! apply_filters( 'customize_changeset_branching', false ) ) {
+ $is_customize_preview_available = count( get_posts( array(
+ 'post_type' => 'customize_changeset',
+ 'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ),
+ 'author' => 'any',
+ 'posts_per_page' => 1,
+ 'no_found_rows' => true,
+ 'cache_results' => true,
+ 'update_post_meta_cache' => false,
+ 'update_post_term_cache' => false,
+ 'lazy_load_term_meta' => false,
+ ) ) ) === 0;
+}
+
?>
<div class="wrap">
@@ -178,6 +196,22 @@ if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
<?php
endif;
+if ( ! $is_customize_preview_available ) :
+ ?>
+ <div class="notice notice-info">
+ <p>
+ <?php
+ printf(
+ /* translators: %s is URL to Customizer with the Publish Settings section auto-focused */
+ __( 'Because you have drafted or scheduled changes, live previewing other themes is currently disabled. Please <a href="%s">publish your changes</a>, or wait until they publish to preview new themes. ' ),
+ add_query_arg( 'autofocus[section]', 'publish_settings', admin_url( 'customize.php' ) )
+ );
+ ?>
+ </p>
+ </div>
+ <?php
+endif;
+
$ct = wp_get_theme();
if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
@@ -296,7 +330,7 @@ foreach ( $themes as $theme ) :
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
- <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
+ <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && $is_customize_preview_available ) { ?>
<a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
<?php } ?>
<?php } ?>
@@ -431,7 +465,9 @@ $can_install = current_user_can( 'install_themes' );
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
?>
<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
- <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
+ <?php if ( $is_customize_preview_available ) : ?>
+ <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
+ <?php endif; ?>
<# } #>
</div>
</div>
@@ -492,7 +528,9 @@ $can_install = current_user_can( 'install_themes' );
<# if ( data.actions.activate ) { #>
<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
<# } #>
- <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
+ <?php if ( $is_customize_preview_available ) : ?>
+ <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
+ <?php endif; ?>
</div>
<# if ( ! data.active && data.actions['delete'] ) { #>
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 607349b04a..762591893c 100644
--- src/wp-includes/class-wp-customize-manager.php
+++ src/wp-includes/class-wp-customize-manager.php
@@ -612,7 +612,7 @@ final class WP_Customize_Manager {
if ( empty( $this->_changeset_uuid ) ) {
$changeset_uuid = null;
- if ( ! $this->branching() && $this->is_theme_active() ) {
+ if ( ! $this->branching() ) {
$unpublished_changeset_posts = $this->get_changeset_posts( array(
'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ),
'exclude_restore_dismissed' => false,
@@ -782,11 +782,10 @@ final class WP_Customize_Manager {
*
* @since 4.9.0
*
- * @param bool $allow_branching Whether branching is allowed. If `false`, the default,
- * then only one saved changeset exists at a time.
- * @param WP_Customize_Manager $wp_customize Manager instance.
+ * @param bool $allow_branching Whether branching is allowed. If `false`, the default,
+ * then only one saved changeset exists at a time.
*/
- $this->branching = apply_filters( 'customize_changeset_branching', $this->branching, $this );
+ $this->branching = apply_filters( 'customize_changeset_branching', $this->branching );
return $this->branching;
}
diff --git src/wp-includes/class-wp-xmlrpc-server.php src/wp-includes/class-wp-xmlrpc-server.php
index c35498cd97..1b9f73cb85 100644
--- src/wp-includes/class-wp-xmlrpc-server.php
+++ src/wp-includes/class-wp-xmlrpc-server.php
@@ -3727,7 +3727,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! current_user_can( 'publish_posts' ) ) {
- return new IXR_Error( 403, __( 'Sorry, you are not allowed access to details about this site.' ) );
+ return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) );
}
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
@@ -3768,7 +3768,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
- return new IXR_Error( 403, __( 'Sorry, you are not allowed access to details of this post.' ) );
+ return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details of this post.' ) );
}
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
@@ -3808,7 +3808,7 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->error;
if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 403, __( 'Sorry, you are not allowed access to details about this site.' ) );
+ return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) );
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getPostStatusList' );
@@ -3840,7 +3840,7 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->error;
if ( !current_user_can( 'edit_pages' ) )
- return new IXR_Error( 403, __( 'Sorry, you are not allowed access to details about this site.' ) );
+ return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) );
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getPageStatusList' );
@@ -3872,7 +3872,7 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->error;
if ( !current_user_can( 'edit_pages' ) )
- return new IXR_Error( 403, __( 'Sorry, you are not allowed access to details about this site.' ) );
+ return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) );
$templates = get_page_templates();
$templates['Default'] = 'default';
@@ -4110,7 +4110,7 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->error;
if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 403, __( 'Sorry, you are not allowed access to details about this site.' ) );
+ return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) );
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getPostFormats' );
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
--- src/wp-includes/customize/class-wp-customize-date-time-control.php
+++ src/wp-includes/customize/class-wp-customize-date-time-control.php
@@ -98,6 +98,17 @@ class WP_Customize_Date_Time_Control extends WP_Customize_Control {
public function content_template() {
$data = array_merge( $this->json(), $this->get_month_choices() );
$timezone_info = $this->get_timezone_info();
+
+ $date_format = get_option( 'date_format' );
+ foreach ( array( 'Y', 'y', 'o' ) as $year_token ) {
+ $date_format = preg_replace( '/(?<!\\\\)' . $year_token . '/', '%1$s', $date_format );
+ }
+ foreach ( array( 'F', 'm', 'M', 'n' ) as $month_token ) {
+ $date_format = preg_replace( '/(?<!\\\\)' . $month_token . '/', '%2$s', $date_format );
+ }
+ foreach ( array( 'j', 'd' ) as $day_token ) {
+ $date_format = preg_replace( '/(?<!\\\\)' . $day_token . '/', '%3$s', $date_format );
+ }
?>
<# _.defaults( data, <?php echo wp_json_encode( $data ); ?> ); #>
@@ -116,6 +127,7 @@ class WP_Customize_Date_Time_Control extends WP_Customize_Control {
<fieldset class="day-row">
<legend class="title-day {{ ! data.includeTime ? 'screen-reader-text' : '' }}"><?php esc_html_e( 'Date' ); ?></legend>
<div class="day-fields clear">
+ <?php ob_start(); ?>
<label for="{{ idPrefix }}date-time-month" class="screen-reader-text"><?php esc_html_e( 'Month' ); ?></label>
<select id="{{ idPrefix }}date-time-month" class="date-input month" data-component="month">
<# _.each( data.month_choices, function( choice ) {
@@ -129,11 +141,19 @@ class WP_Customize_Date_Time_Control extends WP_Customize_Control {
</option>
<# } ); #>
</select>
+ <?php $month_field = trim( ob_get_clean() ); ?>
+
+ <?php ob_start(); ?>
<label for="{{ idPrefix }}date-time-day" class="screen-reader-text"><?php esc_html_e( 'Day' ); ?></label>
<input id="{{ idPrefix }}date-time-day" type="number" size="2" autocomplete="off" class="date-input day" data-component="day" min="1" max="31" />
- <span class="time-special-char date-time-separator">,</span>
+ <?php $day_field = trim( ob_get_clean() ); ?>
+
+ <?php ob_start(); ?>
<label for="{{ idPrefix }}date-time-year" class="screen-reader-text"><?php esc_html_e( 'Year' ); ?></label>
<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 }}">
+ <?php $year_field = trim( ob_get_clean() ); ?>
+
+ <?php printf( $date_format, $year_field, $month_field, $day_field ); ?>
</div>
</fieldset>
<# if ( data.includeTime ) { #>
@@ -144,7 +164,7 @@ class WP_Customize_Date_Time_Control extends WP_Customize_Control {
<# var maxHour = data.twelveHourFormat ? 12 : 23; #>
<# var minHour = data.twelveHourFormat ? 1 : 0; #>
<input id="{{ idPrefix }}date-time-hour" type="number" size="2" autocomplete="off" class="date-input hour" data-component="hour" min="{{ minHour }}" max="{{ maxHour }}">
- <span class="time-special-char date-time-separator">:</span>
+ :
<label for="{{ idPrefix }}date-time-minute" class="screen-reader-text"><?php esc_html_e( 'Minute' ); ?></label>
<input id="{{ idPrefix }}date-time-minute" type="number" size="2" autocomplete="off" class="date-input minute" data-component="minute" min="0" max="59">
<# if ( data.twelveHourFormat ) { #>
diff --git src/wp-includes/wp-db.php src/wp-includes/wp-db.php
index e7ec314e7b..04792d4db4 100644
--- src/wp-includes/wp-db.php
+++ src/wp-includes/wp-db.php
@@ -1946,7 +1946,7 @@ class wpdb {
// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
// Old WP installs may not have AUTH_SALT defined.
- $salt = defined( 'AUTH_SALT' ) ? AUTH_SALT : rand();
+ $salt = defined( 'AUTH_SALT' ) ? AUTH_SALT : (string) rand();
$placeholder = '{' . hash_hmac( $algo, uniqid( $salt, true ), $salt ) . '}';
}
diff --git tests/phpunit/tests/customize/manager.php tests/phpunit/tests/customize/manager.php
index 1152efd983..18f00afb1b 100644
--- tests/phpunit/tests/customize/manager.php
+++ tests/phpunit/tests/customize/manager.php
@@ -197,15 +197,6 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
) );
$this->assertNotContains( $wp_customize->changeset_uuid(), array( $uuid1, $uuid2 ) );
$this->assertEmpty( $wp_customize->changeset_post_id() );
-
- // Make sure existing changeset is not autoloaded in the case of previewing a theme switch.
- switch_theme( 'twentyseventeen' );
- $wp_customize = new WP_Customize_Manager( array(
- 'changeset_uuid' => false, // Cause UUID to be deferred.
- 'branching' => false,
- 'theme' => 'twentyfifteen',
- ) );
- $this->assertEmpty( $wp_customize->changeset_post_id() );
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment