Skip to content

Commit

Permalink
Update to WordPress 6.1.1. For more information, see https://wordpres…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantheon Automation committed Nov 15, 2022
1 parent ef3b99f commit 4c69c82
Show file tree
Hide file tree
Showing 68 changed files with 1,155 additions and 901 deletions.
33 changes: 32 additions & 1 deletion wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,37 @@
</nav>
</div>

<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.',
50
),
'6.1.1',
'50'
);
?>
<?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( '6.1.1' )
)
);
?>
</p>
</div>
</div>

<div class="about__section">
<div class="column">
<h2 class="aligncenter">
Expand Down Expand Up @@ -214,7 +245,7 @@
<p>
<?php
printf(
/* translators: %s: Link to "full site editing" themes on WordPress.org. */
/* translators: %s: Link to Block Themes on WordPress.org. */
__( 'The Themes Directory has <a href="%s">a filter for block themes</a>, and a pattern preview gives a better sense of what the theme might look like while exploring different themes and patterns.' ),
esc_url( __( 'https://wordpress.org/themes/tags/full-site-editing/' ) )
);
Expand Down
4 changes: 3 additions & 1 deletion wp-admin/includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* some setup was skipped. Make sure the admin message catalog is loaded since
* load_default_textdomain() will not have done so in this context.
*/
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
$admin_locale = get_locale();
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . $admin_locale . '.mo', $admin_locale );
unset( $admin_locale );
}

/** WordPress Administration Hooks */
Expand Down
10 changes: 5 additions & 5 deletions wp-admin/includes/class-wp-filesystem-ftpext.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,18 @@ public function delete( $file, $recursive = false, $type = false ) {
* Checks if a file or directory exists.
*
* @since 2.5.0
* @since 6.1.0 Uses WP_Filesystem_FTPext::is_dir() to check for directory existence
* and ftp_rawlist() to check for file existence.
*
* @param string $path Path to file or directory.
* @return bool Whether $path exists or not.
*/
public function exists( $path ) {
if ( $this->is_dir( $path ) ) {
return true;
$list = ftp_nlist( $this->link, $path );

if ( empty( $list ) && $this->is_dir( $path ) ) {
return true; // File is an empty directory.
}

return ! empty( ftp_rawlist( $this->link, $path ) );
return ! empty( $list ); // Empty list = no file, so invert.
}

/**
Expand Down
11 changes: 6 additions & 5 deletions wp-admin/includes/class-wp-filesystem-ftpsockets.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,19 @@ public function delete( $file, $recursive = false, $type = false ) {
* Checks if a file or directory exists.
*
* @since 2.5.0
* @since 6.1.0 Uses WP_Filesystem_ftpsockets::is_dir() to check for directory existence
* and file size to check for file existence.
*
* @param string $path Path to file or directory.
* @return bool Whether $path exists or not.
*/
public function exists( $path ) {
if ( $this->is_dir( $path ) ) {
return true;
$list = $this->ftp->nlist( $path );

if ( empty( $list ) && $this->is_dir( $path ) ) {
return true; // File is an empty directory.
}

return is_numeric( $this->size( $path ) );
return ! empty( $list ); // Empty list = no file, so invert.
// Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
}

/**
Expand Down
3 changes: 2 additions & 1 deletion wp-admin/includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ function get_theme_update_available( $theme ) {
* and 'Full Site Editing' features.
* @since 5.5.0 Added 'Wide Blocks' layout option.
* @since 5.8.1 Added 'Template Editing' feature.
* @since 6.1.1 Replaced 'Full Site Editing' feature name with 'Site Editor'.
*
* @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true.
* @return array Array of features keyed by category with translations keyed by slug.
Expand Down Expand Up @@ -331,7 +332,7 @@ function get_theme_feature_list( $api = true ) {
'featured-image-header' => __( 'Featured Image Header' ),
'featured-images' => __( 'Featured Images' ),
'footer-widgets' => __( 'Footer Widgets' ),
'full-site-editing' => __( 'Full Site Editing' ),
'full-site-editing' => __( 'Site Editor' ),
'full-width-template' => __( 'Full Width Template' ),
'post-formats' => __( 'Post Formats' ),
'sticky-post' => __( 'Sticky Post' ),
Expand Down
15 changes: 9 additions & 6 deletions wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@
'wp-includes/blocks/comments-query-loop/editor.min.css',
'wp-includes/blocks/comments-query-loop/editor-rtl.css',
'wp-includes/blocks/comments-query-loop/editor-rtl.min.css',
'wp-includes/blocks/comments-query-loop',
);

/**
Expand Down Expand Up @@ -1437,8 +1438,8 @@ function update_core( $from, $to ) {
// Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower.
_upgrade_440_force_deactivate_incompatible_plugins();

// Deactivate the Gutenberg plugin if its version is 11.8 or lower.
_upgrade_590_force_deactivate_incompatible_plugins();
// Deactivate incompatible plugins.
_upgrade_core_deactivate_incompatible_plugins();

// Upgrade DB with separate request.
/** This filter is documented in wp-admin/includes/update-core.php */
Expand Down Expand Up @@ -1637,14 +1638,16 @@ function _upgrade_440_force_deactivate_incompatible_plugins() {
/**
* @access private
* @ignore
* @since 5.9.0
* @since 5.8.0
* @since 5.9.0 The minimum compatible version of Gutenberg is 11.9.
* @since 6.1.1 The minimum compatible version of Gutenberg is 14.1.
*/
function _upgrade_590_force_deactivate_incompatible_plugins() {
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '11.9', '<' ) ) {
function _upgrade_core_deactivate_incompatible_plugins() {
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '14.1', '<' ) ) {
$deactivated_gutenberg['gutenberg'] = array(
'plugin_name' => 'Gutenberg',
'version_deactivated' => GUTENBERG_VERSION,
'version_compatible' => '11.9',
'version_compatible' => '14.1',
);
if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
$deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}

if ( ! ( current_theme_supports( 'block-template-parts' ) || wp_is_block_theme() ) ) {
wp_die( __( 'The theme you are currently using is not compatible with Full Site Editing.' ) );
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
}

$is_template_part_editor = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
Expand Down Expand Up @@ -101,7 +101,7 @@ static function( $classes ) {
}

$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_global_styles_post_id();
$active_theme = wp_get_theme()->get_stylesheet();
$active_theme = get_stylesheet();
$preload_paths = array(
array( '/wp/v2/media', 'OPTIONS' ),
'/wp/v2/types?context=view',
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ function get_allowed_block_types( $block_editor_context ) {
*/
function get_default_block_editor_settings() {
// Media settings.
$max_upload_size = wp_max_upload_size();
if ( ! $max_upload_size ) {
$max_upload_size = 0;

// wp_max_upload_size() can be expensive, so only call it when relevant for the current user.
$max_upload_size = 0;
if ( current_user_can( 'upload_files' ) ) {
$max_upload_size = wp_max_upload_size();
if ( ! $max_upload_size ) {
$max_upload_size = 0;
}
}

/** This filter is documented in wp-admin/includes/media.php */
Expand Down
64 changes: 33 additions & 31 deletions wp-includes/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ function wp_get_computed_fluid_typography_value( $args = array() ) {
* formula depending on available, valid values.
*
* @since 6.1.0
* @since 6.1.1 Adjusted rules for min and max font sizes.
*
* @param array $preset {
* Required. fontSizes preset value as seen in theme.json.
Expand Down Expand Up @@ -489,7 +490,6 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph
$default_maximum_viewport_width = '1600px';
$default_minimum_viewport_width = '768px';
$default_minimum_font_size_factor = 0.75;
$default_maximum_font_size_factor = 1.5;
$default_scale_factor = 1;
$default_minimum_font_size_limit = '14px';

Expand All @@ -508,52 +508,54 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph
// Font sizes.
$preferred_size = wp_get_typography_value_and_unit( $preset['size'] );

// Protect against unsupported units.
// Protects against unsupported units.
if ( empty( $preferred_size['unit'] ) ) {
return $preset['size'];
}

// If no fluid max font size is available, create one using max font size factor.
if ( ! $maximum_font_size_raw ) {
$maximum_font_size_raw = round( $preferred_size['value'] * $default_maximum_font_size_factor, 3 ) . $preferred_size['unit'];
}

// If no fluid min font size is available, create one using min font size factor.
if ( ! $minimum_font_size_raw ) {
$minimum_font_size_raw = round( $preferred_size['value'] * $default_minimum_font_size_factor, 3 ) . $preferred_size['unit'];
}

// Normalizes the minimum font size limit according to the incoming unit, so we can perform checks using it.
/*
* Normalizes the minimum font size limit according to the incoming unit,
* in order to perform comparative checks.
*/
$minimum_font_size_limit = wp_get_typography_value_and_unit(
$default_minimum_font_size_limit,
array(
'coerce_to' => $preferred_size['unit'],
)
);

if ( ! empty( $minimum_font_size_limit ) ) {
// Don't enforce minimum font size if a font size has explicitly set a min and max value.
if ( ! empty( $minimum_font_size_limit ) && ( ! $minimum_font_size_raw && ! $maximum_font_size_raw ) ) {
/*
* If a minimum size was not passed to this function
* and the user-defined font size is lower than $minimum_font_size_limit,
* then use the user-defined font size as the minimum font-size.
* do not calculate a fluid value.
*/
if ( ! isset( $fluid_font_size_settings['min'] ) && $preferred_size['value'] < $minimum_font_size_limit['value'] ) {
$minimum_font_size_raw = implode( '', $preferred_size );
if ( $preferred_size['value'] <= $minimum_font_size_limit['value'] ) {
return $preset['size'];
}
}

// If no fluid max font size is available use the incoming value.
if ( ! $maximum_font_size_raw ) {
$maximum_font_size_raw = $preferred_size['value'] . $preferred_size['unit'];
}

/*
* If no minimumFontSize is provided, create one using
* the given font size multiplied by the min font size scale factor.
*/
if ( ! $minimum_font_size_raw ) {
$calculated_minimum_font_size = round(
$preferred_size['value'] * $default_minimum_font_size_factor,
3
);

// Only use calculated min font size if it's > $minimum_font_size_limit value.
if ( ! empty( $minimum_font_size_limit ) && $calculated_minimum_font_size <= $minimum_font_size_limit['value'] ) {
$minimum_font_size_raw = $minimum_font_size_limit['value'] . $minimum_font_size_limit['unit'];
} else {
$minimum_font_size_parsed = wp_get_typography_value_and_unit(
$minimum_font_size_raw,
array(
'coerce_to' => $preferred_size['unit'],
)
);

/*
* If the passed or calculated minimum font size is lower than $minimum_font_size_limit
* use $minimum_font_size_limit instead.
*/
if ( ! empty( $minimum_font_size_parsed ) && $minimum_font_size_parsed['value'] < $minimum_font_size_limit['value'] ) {
$minimum_font_size_raw = implode( '', $minimum_font_size_limit );
}
$minimum_font_size_raw = $calculated_minimum_font_size . $preferred_size['unit'];
}
}

Expand Down
18 changes: 9 additions & 9 deletions wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ function _inject_theme_attribute_in_block_template_content( $template_content )
'core/template-part' === $block['blockName'] &&
! isset( $block['attrs']['theme'] )
) {
$block['attrs']['theme'] = wp_get_theme()->get_stylesheet();
$block['attrs']['theme'] = get_stylesheet();
$has_updated_content = true;
}
}
Expand Down Expand Up @@ -499,7 +499,7 @@ function _remove_theme_attribute_in_block_template_content( $template_content )
function _build_block_template_result_from_file( $template_file, $template_type ) {
$default_template_types = get_default_block_template_types();
$template_content = file_get_contents( $template_file['path'] );
$theme = wp_get_theme()->get_stylesheet();
$theme = get_stylesheet();

$template = new WP_Block_Template();
$template->id = $theme . '//' . $template_file['slug'];
Expand Down Expand Up @@ -637,7 +637,7 @@ function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy,
$args = wp_parse_args( $args, $default_args );
$terms_query = $term_query->query( $args );

if ( empty( $terms_query->terms ) ) {
if ( empty( $terms_query ) ) {
$template->title = sprintf(
/* translators: Custom template title in the Site Editor, referencing a taxonomy term that was not found. 1: Taxonomy singular name, 2: Term slug. */
__( 'Not found: %1$s (%2$s)' ),
Expand All @@ -647,7 +647,7 @@ function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy,
return false;
}

$term_title = $terms_query->terms[0]->name;
$term_title = $terms_query[0]->name;

$template->title = sprintf(
/* translators: Custom template title in the Site Editor. 1: Taxonomy singular name, 2: Term title. */
Expand All @@ -671,7 +671,7 @@ function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy,
$args = wp_parse_args( $args, $default_args );
$terms_with_same_title_query = $term_query->query( $args );

if ( count( $terms_with_same_title_query->terms ) > 1 ) {
if ( count( $terms_with_same_title_query ) > 1 ) {
$template->title = sprintf(
/* translators: Custom template title in the Site Editor. 1: Template title, 2: Term slug. */
__( '%1$s (%2$s)' ),
Expand Down Expand Up @@ -706,7 +706,7 @@ function _build_block_template_result_from_post( $post ) {

$theme = $terms[0]->name;
$template_file = _get_block_template_file( $post->post_type, $post->post_name );
$has_theme_file = wp_get_theme()->get_stylesheet() === $theme && null !== $template_file;
$has_theme_file = get_stylesheet() === $theme && null !== $template_file;

$origin = get_post_meta( $post->ID, 'origin', true );
$is_wp_suggestion = get_post_meta( $post->ID, 'is_wp_suggestion', true );
Expand Down Expand Up @@ -903,7 +903,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => wp_get_theme()->get_stylesheet(),
'terms' => get_stylesheet(),
),
),
);
Expand Down Expand Up @@ -969,7 +969,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
}

$is_not_custom = false === array_search(
wp_get_theme()->get_stylesheet() . '//' . $template_file['slug'],
get_stylesheet() . '//' . $template_file['slug'],
wp_list_pluck( $query_result, 'id' ),
true
);
Expand Down Expand Up @@ -1110,7 +1110,7 @@ function get_block_file_template( $id, $template_type = 'wp_template' ) {
}
list( $theme, $slug ) = $parts;

if ( wp_get_theme()->get_stylesheet() !== $theme ) {
if ( get_stylesheet() !== $theme ) {
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/block-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function _add_template_loader_filters() {
* @param string $template Path to the template. See locate_template().
* @param string $type Sanitized filename without extension.
* @param string[] $templates A list of template candidates, in descending order of priority.
* @return string The path to the Full Site Editing template canvas file, or the fallback PHP template.
* @return string The path to the Site Editor template canvas file, or the fallback PHP template.
*/
function locate_block_template( $template, $type, array $templates ) {
global $_wp_current_template_content;
Expand Down Expand Up @@ -145,7 +145,7 @@ function resolve_block_template( $template_type, $template_hierarchy, $fallback_

// Find all potential templates 'wp_template' post matching the hierarchy.
$query = array(
'theme' => wp_get_theme()->get_stylesheet(),
'theme' => get_stylesheet(),
'slug__in' => $slugs,
);
$templates = get_block_templates( $query );
Expand Down
Loading

0 comments on commit 4c69c82

Please sign in to comment.