Skip to content

Commit

Permalink
Merge branch 'WordPress:trunk' into 60180-wp_maybe_load_widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
pbearne authored Jan 9, 2024
2 parents 080596a + 52720ef commit 017e6f5
Show file tree
Hide file tree
Showing 61 changed files with 1,191 additions and 301 deletions.
1 change: 0 additions & 1 deletion .github/workflows/callable-test-core-build-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
node --version
curl --version
git --version
svn --version
- name: Install npm Dependencies
run: npm ci
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
env:
GUTENBERG_DIRECTORY: ${{ inputs.directory == 'build' && 'build' || 'src' }}/wp-content/plugins/gutenberg
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
NODE_OPTIONS: '--max-old-space-size=8192'

jobs:
# Verifies that installing npm dependencies and building the Gutenberg plugin works as expected.
Expand Down Expand Up @@ -69,7 +70,6 @@ jobs:
node --version
curl --version
git --version
svn --version
- name: Install Core Dependencies
run: npm ci
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ jobs:
npm --version
node --version
git --version
svn --version
- name: Install npm Dependencies
run: npm ci
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ jobs:
node --version
curl --version
git --version
svn --version
locale -a
- name: Install npm Dependencies
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/javascript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
npm --version
node --version
git --version
svn --version
- name: Install npm Dependencies
run: npm ci
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ jobs:
node --version
curl --version
git --version
svn --version
locale -a
- name: Install npm dependencies
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/phpunit-tests-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:
node --version
curl --version
git --version
svn --version
composer --version
locale -a
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ jobs:
node --version
curl --version
git --version
svn --version
composer --version
locale -a
Expand Down
4 changes: 2 additions & 2 deletions src/js/_enqueues/admin/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ jQuery( function($) {
}

/**
* When the dragging stopped make sure we return focus and do a sanity check on the height.
* When the dragging stopped make sure we return focus and do a confidence check on the height.
*/
function endDrag() {
var height, toolbarHeight;
Expand All @@ -1198,7 +1198,7 @@ jQuery( function($) {

$document.off( '.wp-editor-resize' );

// Sanity check: normalize height to stay within acceptable ranges.
// Confidence check: normalize height to stay within acceptable ranges.
if ( height && height > 50 && height < 5000 ) {
setUserSetting( 'ed_size', height );
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/_enqueues/vendor/tinymce/utils/form_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function getCSSSize(size) {
if (/^[0-9]+$/.test(size)) {
size += 'px';
}
// Sanity check, IE doesn't like broken values
// Confidence check, IE doesn't like broken values
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) {
return "";
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/_enqueues/wp/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ themes.view.Themes = wp.Backbone.View.extend({
// Find the next model within the collection.
nextModel = self.collection.at( self.collection.indexOf( model ) + 1 );

// Sanity check which also serves as a boundary test.
// Confidence check which also serves as a boundary test.
if ( nextModel !== undefined ) {

// We have a new theme...
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-pclzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ function privOptionDefaultThreshold(&$p_options)
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*PCLZIP_TEMPORARY_FILE_RATIO);


// ----- Sanity check : No threshold if value lower than 1M
// ----- Confidence check : No threshold if value lower than 1M
if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-plugin-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public function check_package( $source ) {
}

$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source );
if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation.
if ( ! is_dir( $working_directory ) ) { // Confidence check, if the above fails, let's not prevent installation.
return $source;
}

Expand Down
70 changes: 53 additions & 17 deletions src/wp-admin/includes/class-theme-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ public function upgrade( $theme, $args = array() ) {
* @since 3.0.0
* @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
*
* @global string $wp_version The WordPress version string.
*
* @param string[] $themes Array of the theme slugs.
* @param array $args {
* Optional. Other arguments for upgrading several themes at once. Default empty array.
Expand All @@ -381,6 +383,8 @@ public function upgrade( $theme, $args = array() ) {
* @return array[]|false An array of results, or false if unable to connect to the filesystem.
*/
public function bulk_upgrade( $themes, $args = array() ) {
global $wp_version;

$defaults = array(
'clear_update_cache' => true,
);
Expand Down Expand Up @@ -442,23 +446,55 @@ public function bulk_upgrade( $themes, $args = array() ) {
// Get the URL to the zip file.
$r = $current->response[ $theme ];

$result = $this->run(
array(
'package' => $r['package'],
'destination' => get_theme_root( $theme ),
'clear_destination' => true,
'clear_working' => true,
'is_multi' => true,
'hook_extra' => array(
'theme' => $theme,
'temp_backup' => array(
'slug' => $theme,
'src' => get_theme_root( $theme ),
'dir' => 'themes',
if ( isset( $r['requires'] ) && ! is_wp_version_compatible( $r['requires'] ) ) {
$result = new WP_Error(
'incompatible_wp_required_version',
sprintf(
/* translators: 1: Current WordPress version, 2: WordPress version required by the new theme version. */
__( 'Your WordPress version is %1$s, however the new theme version requires %2$s.' ),
$wp_version,
$r['requires']
)
);

$this->skin->before( $result );
$this->skin->error( $result );
$this->skin->after();
} elseif ( isset( $r['requires_php'] ) && ! is_php_version_compatible( $r['requires_php'] ) ) {
$result = new WP_Error(
'incompatible_php_required_version',
sprintf(
/* translators: 1: Current PHP version, 2: PHP version required by the new theme version. */
__( 'The PHP version on your server is %1$s, however the new theme version requires %2$s.' ),
PHP_VERSION,
$r['requires_php']
)
);

$this->skin->before( $result );
$this->skin->error( $result );
$this->skin->after();
} else {
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
$result = $this->run(
array(
'package' => $r['package'],
'destination' => get_theme_root( $theme ),
'clear_destination' => true,
'clear_working' => true,
'is_multi' => true,
'hook_extra' => array(
'theme' => $theme,
'temp_backup' => array(
'slug' => $theme,
'src' => get_theme_root( $theme ),
'dir' => 'themes',
),
),
),
)
);
)
);
remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
}

$results[ $theme ] = $result;

Expand Down Expand Up @@ -538,7 +574,7 @@ public function check_package( $source ) {

// Check that the folder contains a valid theme.
$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source );
if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation.
if ( ! is_dir( $working_directory ) ) { // Confidence check, if the above fails, let's not prevent installation.
return $source;
}

Expand Down
8 changes: 8 additions & 0 deletions src/wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,14 @@ public static function debug_data() {

// Conditionally add debug information for multisite setups.
if ( is_multisite() ) {
$site_id = get_current_blog_id();

$info['wp-core']['fields']['site_id'] = array(
'label' => __( 'Site ID' ),
'value' => $site_id,
'debug' => $site_id,
);

$network_query = new WP_Network_Query();
$network_ids = $network_query->query(
array(
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ function edit_post( $post_data = null ) {

$success = wp_update_post( $translated );

// If the save failed, see if we can sanity check the main fields and try again.
// If the save failed, see if we can confidence check the main fields and try again.
if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) {
$fields = array( 'post_title', 'post_content', 'post_excerpt' );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ function update_core( $from, $to ) {
*/
apply_filters( 'update_feedback', __( 'Verifying the unpacked files&#8230;' ) );

// Sanity check the unzipped distribution.
// Confidence check the unzipped distribution.
$distro = '';
$roots = array( '/wordpress/', '/wordpress-mu/' );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage Administration
*/

// Sanity check.
// Confidence check.
if ( false ) {
?>
<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentyten/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function twentyten_setup() {
*/
'width' => apply_filters( 'twentyten_header_image_width', 940 ),
/**
* Filters the Twenty Ten defaul header image height.
* Filters the Twenty Ten default header image height.
*
* @since Twenty Ten 1.0
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
// Get accessible colors for the defined background-color and hue.
colors = twentyTwentyColor( backgroundColor, accentHue );

// Sanity check.
// Confidence check.
if ( colors.getAccentColor() && 'function' === typeof colors.getAccentColor().toCSS ) {
// Update the value for this context.
value[ context ] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function twenty_twenty_one_print_first_instance_of_block( $block_name, $content
// Loop blocks.
foreach ( $blocks as $block ) {

// Sanity check.
// Confidence check.
if ( ! isset( $block['blockName'] ) ) {
continue;
}
Expand Down
24 changes: 22 additions & 2 deletions src/wp-includes/block-supports/background.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function wp_register_background_support( $block_type ) {
* it is also applied to non-server-rendered blocks.
*
* @since 6.4.0
* @since 6.5.0 Added support for `backgroundPosition` and `backgroundRepeat` output.
* @access private
*
* @param string $block_content Rendered block content.
Expand All @@ -64,9 +65,20 @@ function wp_render_background_support( $block_content, $block ) {
$background_image_url = isset( $block_attributes['style']['background']['backgroundImage']['url'] )
? $block_attributes['style']['background']['backgroundImage']['url']
: null;

if ( ! $background_image_source && ! $background_image_url ) {
return $block_content;
}

$background_size = isset( $block_attributes['style']['background']['backgroundSize'] )
? $block_attributes['style']['background']['backgroundSize']
: 'cover';
$background_position = isset( $block_attributes['style']['background']['backgroundPosition'] )
? $block_attributes['style']['background']['backgroundPosition']
: null;
$background_repeat = isset( $block_attributes['style']['background']['backgroundRepeat'] )
? $block_attributes['style']['background']['backgroundRepeat']
: null;

$background_block_styles = array();

Expand All @@ -76,8 +88,15 @@ function wp_render_background_support( $block_content, $block ) {
) {
// Set file based background URL.
$background_block_styles['backgroundImage']['url'] = $background_image_url;
// Only output the background size when an image url is set.
$background_block_styles['backgroundSize'] = $background_size;
// Only output the background size and repeat when an image url is set.
$background_block_styles['backgroundSize'] = $background_size;
$background_block_styles['backgroundRepeat'] = $background_repeat;
$background_block_styles['backgroundPosition'] = $background_position;

// If the background size is set to `contain` and no position is set, set the position to `center`.
if ( 'contain' === $background_size && ! isset( $background_position ) ) {
$background_block_styles['backgroundPosition'] = 'center';
}
}

$styles = wp_style_engine_get_styles( array( 'background' => $background_block_styles ) );
Expand All @@ -99,6 +118,7 @@ function wp_render_background_support( $block_content, $block ) {

$updated_style .= $styles['css'];
$tags->set_attribute( 'style', $updated_style );
$tags->add_class( 'has-background' );
}

return $tags->get_updated_html();
Expand Down
Loading

0 comments on commit 017e6f5

Please sign in to comment.