Skip to content

Commit

Permalink
Update to WordPress 5.9.3. For more information, see https://wordpres…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantheon Automation authored and John Spellman committed Apr 5, 2022
1 parent f9903f4 commit 3dd480d
Show file tree
Hide file tree
Showing 50 changed files with 224 additions and 85 deletions.
25 changes: 25 additions & 0 deletions wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@
<div class="about__section changelog">
<div class="column">
<h2><?php _e( 'Maintenance and Security Releases' ); ?></h2>
<p>
<?php
printf(
/* translators: 1: WordPress version number, 2: plural number of bugs. */
_n(
'<strong>Version %1$s</strong> addressed %2$s bug.',
'<strong>Version %1$s</strong> addressed %2$s bugs.',
19
),
'5.9.3',
number_format_i18n( 19 )
);
?>
<?php
printf(
/* translators: %s: HelpHub URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
sanitize_title( '5.9.3' )
)
);
?>
</p>
<p>
<?php
printf(
Expand Down
6 changes: 6 additions & 0 deletions wp-admin/css/customize-controls-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,12 @@ p.customize-section-description {
font-weight: 400;
}

#customize-notifications-area .notification-message button.switch-to-editor {
display: block;
margin-top: 6px;
font-weight: 400;
}

#customize-theme-controls .control-panel-themes > .accordion-section-title:after {
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/customize-controls-rtl.min.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions wp-admin/css/customize-controls.css
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,12 @@ p.customize-section-description {
font-weight: 400;
}

#customize-notifications-area .notification-message button.switch-to-editor {
display: block;
margin-top: 6px;
font-weight: 400;
}

#customize-theme-controls .control-panel-themes > .accordion-section-title:after {
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/customize-controls.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions wp-admin/customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
<ul></ul>
</div>
<div class="wp-full-overlay-sidebar-content" tabindex="-1">
<div id="customize-info" class="accordion-section customize-info">
<div id="customize-info" class="accordion-section customize-info" data-block-theme="<?php echo (int) wp_is_block_theme(); ?>">
<div class="accordion-section-title">
<span class="preview-notice">
<?php
Expand All @@ -235,7 +235,7 @@
<div class="customize-panel-description">
<p>
<?php
_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements.' );
_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
?>
</p>
<p>
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/edit-form-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ static function( $classes ) {

// Preload common data.
$preload_paths = array(
'/',
'/wp/v2/types?context=edit',
'/wp/v2/taxonomies?per_page=-1&context=edit',
'/wp/v2/taxonomies?context=edit',
'/wp/v2/themes?status=active',
add_query_arg( 'context', 'edit', $rest_path ),
sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
sprintf( '/wp/v2/users/me?post_type=%s&context=edit', $post_type ),
'/wp/v2/users/me',
array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
array( rest_get_route_for_post_type_items( 'wp_block' ), 'OPTIONS' ),
sprintf( '%s/autosaves?context=edit', $rest_path ),
'/wp/v2/settings',
);

block_editor_rest_api_preload( $preload_paths, $block_editor_context );
Expand Down
25 changes: 24 additions & 1 deletion wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3568,6 +3568,19 @@ function wp_ajax_query_themes() {

$update_php = network_admin_url( 'update.php?action=install-theme' );

$installed_themes = search_theme_directories();

if ( false === $installed_themes ) {
$installed_themes = array();
}

foreach ( $installed_themes as $theme_slug => $theme_data ) {
// Ignore child themes.
if ( str_contains( $theme_slug, '/' ) ) {
unset( $installed_themes[ $theme_slug ] );
}
}

foreach ( $api->themes as &$theme ) {
$theme->install_url = add_query_arg(
array(
Expand Down Expand Up @@ -3599,12 +3612,19 @@ function wp_ajax_query_themes() {
}
}

$is_theme_installed = array_key_exists( $theme->slug, $installed_themes );

// We only care about installed themes.
$theme->block_theme = $is_theme_installed && wp_get_theme( $theme->slug )->is_block_theme();

if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$customize_url = $theme->block_theme ? admin_url( 'site-editor.php' ) : wp_customize_url( $theme->slug );

$theme->customize_url = add_query_arg(
array(
'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
),
wp_customize_url( $theme->slug )
$customize_url
);
}

Expand Down Expand Up @@ -4139,6 +4159,9 @@ function wp_ajax_install_theme() {
}
}

$theme = wp_get_theme( $slug );
$status['blockTheme'] = $theme->is_block_theme();

if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$status['customizeUrl'] = add_query_arg(
array(
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/class-wp-filesystem-ssh2.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function __construct( $opt = '' ) {
$this->options['public_key'] = $opt['public_key'];
$this->options['private_key'] = $opt['private_key'];

$this->options['hostkey'] = array( 'hostkey' => 'ssh-rsa' );
$this->options['hostkey'] = array( 'hostkey' => 'ssh-rsa,ssh-ed25519' );

$this->keys = true;
} elseif ( empty( $opt['username'] ) ) {
Expand Down
31 changes: 31 additions & 0 deletions wp-admin/js/customize-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -8334,6 +8334,33 @@
history.replaceState( {}, document.title, urlParser.href );
}

/**
* Displays a Site Editor notification when a block theme is activated.
*
* @since 4.9.0
*
* @param {string} [notification] - A notification to display.
* @return {void}
*/
function addSiteEditorNotification( notification ) {
api.notifications.add( new api.Notification( 'site_editor_block_theme_notice', {
message: notification,
type: 'info',
dismissible: false,
render: function() {
var notification = api.Notification.prototype.render.call( this ),
button = notification.find( 'button.switch-to-editor' );

button.on( 'click', function( event ) {
event.preventDefault();
location.assign( button.data( 'action' ) );
} );

return notification;
}
} ) );
}

/**
* Dismiss autosave.
*
Expand Down Expand Up @@ -8408,6 +8435,10 @@
if ( api.settings.changeset.latestAutoDraftUuid || api.settings.changeset.hasAutosaveRevision ) {
addAutosaveRestoreNotification();
}
var shouldDisplayBlockThemeNotification = !! parseInt( $( '#customize-info' ).data( 'block-theme' ), 10 );
if (shouldDisplayBlockThemeNotification) {
addSiteEditorNotification( api.l10n.blockThemeNotification );
}
})();

// Check if preview url is valid and load the preview frame.
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/customize-controls.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions wp-admin/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,9 @@ themes.view.Theme = wp.Backbone.View.extend({
if ( _this.model.get( 'id' ) === response.slug ) {
_this.model.set( { 'installed': true } );
}
if ( response.blockTheme ) {
_this.model.set( { 'block_theme': true } );
}
} );

wp.updates.installTheme( {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/theme.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ static function( $classes ) {
$active_theme = wp_get_theme()->get_stylesheet();
$preload_paths = array(
array( '/wp/v2/media', 'OPTIONS' ),
'/',
'/wp/v2/types?context=edit',
'/wp/v2/types/wp_template?context=edit',
'/wp/v2/types/wp_template-part?context=edit',
Expand Down
11 changes: 7 additions & 4 deletions wp-admin/theme-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
$installed_themes = array();
}

foreach ( $installed_themes as $k => $v ) {
if ( false !== strpos( $k, '/' ) ) {
unset( $installed_themes[ $k ] );
foreach ( $installed_themes as $theme_slug => $theme_data ) {
// Ignore child themes.
if ( str_contains( $theme_slug, '/' ) ) {
unset( $installed_themes[ $theme_slug ] );
}
}

Expand Down Expand Up @@ -373,7 +374,9 @@
<# } #>
<# if ( data.customize_url ) { #>
<# if ( ! data.active ) { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
<# if ( ! data.block_theme ) { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
<# } #>
<# } else { #>
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a>
<# } #>
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-includes/block-supports/duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ function wp_render_duotone_support( $block_content, $block ) {
}

$filter_preset = array(
'slug' => uniqid(),
'slug' => wp_unique_id( sanitize_key( implode( '-', $block['attrs']['style']['color']['duotone'] ) . '-' ) ),
'colors' => $block['attrs']['style']['color']['duotone'],
);
$filter_property = wp_get_duotone_filter_property( $filter_preset );
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/block-supports/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function wp_render_elements_support( $block_content, $block ) {
return $block_content;
}

$class_name = 'wp-elements-' . uniqid();
$class_name = wp_unique_id( 'wp-elements-' );

if ( strpos( $link_color, 'var:preset|color|' ) !== false ) {
// Get the name from the string and add proper styles.
Expand Down
8 changes: 4 additions & 4 deletions wp-includes/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,18 @@ function wp_render_layout_support_flag( $block_content, $block ) {
$used_layout = $default_layout;
}

$id = uniqid();
$gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) );
$class_name = wp_unique_id( 'wp-container-' );
$gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) );
// Skip if gap value contains unsupported characters.
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
// because we only want to match against the value, not the CSS attribute.
$gap_value = preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ? null : $gap_value;
$style = wp_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support, $gap_value );
$style = wp_get_layout_style( ".$class_name", $used_layout, $has_block_gap_support, $gap_value );
// This assumes the hook only applies to blocks with a single wrapper.
// I think this is a reasonable limitation for that particular hook.
$content = preg_replace(
'/' . preg_quote( 'class="', '/' ) . '/',
'class="wp-container-' . $id . ' ',
'class="' . esc_attr( $class_name ) . ' ',
$block_content,
1
);
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function register_block_script_handle( $metadata, $field_name ) {
return false;
}
// Path needs to be normalized to work in Windows env.
$wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC );
$wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) );
$script_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $script_path ) );
$is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm );

Expand Down Expand Up @@ -145,7 +145,7 @@ function register_block_style_handle( $metadata, $field_name ) {
if ( empty( $metadata[ $field_name ] ) ) {
return false;
}
$wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC );
$wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) );
$is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm );
if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) {
return false;
Expand Down Expand Up @@ -239,7 +239,7 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
if ( ! is_array( $metadata ) || empty( $metadata['name'] ) ) {
return false;
}
$metadata['file'] = wp_normalize_path( $metadata_file );
$metadata['file'] = wp_normalize_path( realpath( $metadata_file ) );

/**
* Filters the metadata provided for registering a block type.
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/archives.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function render_block_core_archives( $attributes ) {

$class .= ' wp-block-archives-dropdown';

$dropdown_id = esc_attr( uniqid( 'wp-block-archives-' ) );
$dropdown_id = wp_unique_id( 'wp-block-archives-' );
$title = __( 'Archives' );

/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
Expand Down
12 changes: 7 additions & 5 deletions wp-includes/blocks/cover/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,20 @@
.wp-block-cover .has-background-dim:not([class*=-background-color]) {
background-color: #000;
}
.wp-block-cover-image .has-background-dim.has-background-gradient,
.wp-block-cover .has-background-dim.has-background-gradient {
background-color: transparent;
}
.wp-block-cover-image.has-background-dim::before,
.wp-block-cover-image .has-background-dim::before,
.wp-block-cover.has-background-dim::before,
.wp-block-cover .has-background-dim::before {
.wp-block-cover.has-background-dim::before {
content: "";
background-color: inherit;
}
.wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before,
.wp-block-cover-image .has-background-dim:not(.has-background-gradient)::before,
.wp-block-cover-image .wp-block-cover__background,
.wp-block-cover-image .wp-block-cover__gradient-background,
.wp-block-cover.has-background-dim:not(.has-background-gradient)::before,
.wp-block-cover .has-background-dim:not(.has-background-gradient)::before,
.wp-block-cover .wp-block-cover__background,
.wp-block-cover .wp-block-cover__gradient-background {
position: absolute;
top: 0;
Expand Down
Loading

0 comments on commit 3dd480d

Please sign in to comment.