';
+ $html .= sprintf(
/* translators: %s: Logout URL. */
__( 'Do you really want to log out?' ),
wp_logout_url( $redirect_to )
);
} else {
$html = __( 'The link you followed has expired.' );
+
if ( wp_get_referer() ) {
$wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
$wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
+
$html .= '
';
$html .= sprintf(
'%s',
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index deb83c2f0343e..571a2fd5f4bcf 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
@@ -2890,9 +2890,9 @@ public function get_collection_params() {
}
$query_params['slug'] = array(
- 'description' => __( 'Limit result set to posts with one or more specific slugs.' ),
- 'type' => 'array',
- 'items' => array(
+ 'description' => __( 'Limit result set to posts with one or more specific slugs.' ),
+ 'type' => 'array',
+ 'items' => array(
'type' => 'string',
),
);
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index fd1bf4b6fa93b..f22928dba1cda 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -3686,7 +3686,8 @@ function wp_add_editor_classic_theme_styles( $editor_settings ) {
if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
return $editor_settings;
}
- $suffix = wp_scripts_get_suffix();
+
+ $suffix = wp_scripts_get_suffix();
$classic_theme_styles = ABSPATH . WPINC . "/css/classic-themes$suffix.css";
// This follows the pattern of get_block_editor_theme_styles,
From 79492c62045c035fc983435919173f09a1426bfd Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 6 Nov 2022 14:46:14 +0000
Subject: [PATCH 0003/1431] Docs: Correct DocBlock formatting for
`wp_sitemaps_enabled` filter.
Follow-up to [48072], [48094], [48523].
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54755 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/sitemaps/class-wp-sitemaps.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps.php b/src/wp-includes/sitemaps/class-wp-sitemaps.php
index cd8d1e4dbc95f..85d3adddb4fdd 100644
--- a/src/wp-includes/sitemaps/class-wp-sitemaps.php
+++ b/src/wp-includes/sitemaps/class-wp-sitemaps.php
@@ -99,8 +99,8 @@ public function sitemaps_enabled() {
*
* @since 5.5.0
*
- * @param bool $is_enabled Whether XML Sitemaps are enabled or not. Defaults
- * to true for public sites.
+ * @param bool $is_enabled Whether XML Sitemaps are enabled or not.
+ * Defaults to true for public sites.
*/
return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled );
}
From 399bc757fc5efc390f0368466ea9d0e0d6e9dc40 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 6 Nov 2022 15:54:34 +0000
Subject: [PATCH 0004/1431] Tests: Remove a custom callback for checking action
call count in multisite tests.
Use `MockAction::get_call_count()` instead, for consistency with the rest of the test suite.
Follow-up to [24/tests], [99/tests], [1078/tests], [1089/tests], [29916], [30784], [30785], [33253].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54756 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/multisite/site.php | 107 ++++++------------
.../tests/multisite/updateBlogDetails.php | 19 +---
2 files changed, 40 insertions(+), 86 deletions(-)
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 86ad14ad52126..4192625e9f24f 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -412,14 +412,6 @@ public function test_wpmu_update_blogs_date() {
$this->assertEqualsWithDelta( $current_time, strtotime( $blog->last_updated ), 2, 'The dates should be equal' );
}
- /**
- * Provide a counter to determine that hooks are firing when intended.
- */
- public function action_counter_cb() {
- global $test_action_counter;
- $test_action_counter++;
- }
-
/**
* Test cached data for a site that does not exist and then again after it exists.
*
@@ -465,27 +457,24 @@ public function test_update_blog_status_invalid_status() {
}
public function test_update_blog_status_make_ham_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
update_blog_details( $blog_id, array( 'spam' => 1 ) );
- add_action( 'make_ham_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'make_ham_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'spam', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->spam );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'spam' stays the same.
update_blog_status( $blog_id, 'spam', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->spam );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'make_ham_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_content_from_spam_blog_is_not_available() {
@@ -519,189 +508,165 @@ public function test_content_from_spam_blog_is_not_available() {
}
public function test_update_blog_status_make_spam_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
- add_action( 'make_spam_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'make_spam_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'spam', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->spam );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'spam' stays the same.
update_blog_status( $blog_id, 'spam', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->spam );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'make_spam_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_archive_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
- add_action( 'archive_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'archive_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'archived', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->archived );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'archived' stays the same.
update_blog_status( $blog_id, 'archived', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->archived );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'archive_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_unarchive_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
update_blog_details( $blog_id, array( 'archived' => 1 ) );
- add_action( 'unarchive_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'unarchive_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'archived', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->archived );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'archived' stays the same.
update_blog_status( $blog_id, 'archived', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->archived );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'unarchive_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_make_delete_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
- add_action( 'make_delete_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'make_delete_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'deleted', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->deleted );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'deleted' stays the same.
update_blog_status( $blog_id, 'deleted', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->deleted );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'make_delete_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_make_undelete_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
update_blog_details( $blog_id, array( 'deleted' => 1 ) );
- add_action( 'make_undelete_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'make_undelete_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'deleted', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->deleted );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'deleted' stays the same.
update_blog_status( $blog_id, 'deleted', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->deleted );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'make_undelete_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_mature_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
- add_action( 'mature_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'mature_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'mature', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->mature );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'mature' stays the same.
update_blog_status( $blog_id, 'mature', 1 );
$blog = get_site( $blog_id );
$this->assertSame( '1', $blog->mature );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'mature_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_unmature_blog_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
update_blog_details( $blog_id, array( 'mature' => 1 ) );
- add_action( 'unmature_blog', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'unmature_blog', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'mature', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->mature );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'mature' stays the same.
update_blog_status( $blog_id, 'mature', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->mature );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'unmature_blog', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function test_update_blog_status_update_blog_public_action() {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
- add_action( 'update_blog_public', array( $this, 'action_counter_cb' ), 10 );
+ add_action( 'update_blog_public', array( $test_action_counter, 'action' ) );
update_blog_status( $blog_id, 'public', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->public );
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// The action should not fire if the status of 'mature' stays the same.
update_blog_status( $blog_id, 'public', 0 );
$blog = get_site( $blog_id );
$this->assertSame( '0', $blog->public );
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( 'update_blog_public', array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
/**
diff --git a/tests/phpunit/tests/multisite/updateBlogDetails.php b/tests/phpunit/tests/multisite/updateBlogDetails.php
index 80595ed99b977..1c7d19a2a5710 100644
--- a/tests/phpunit/tests/multisite/updateBlogDetails.php
+++ b/tests/phpunit/tests/multisite/updateBlogDetails.php
@@ -56,8 +56,7 @@ public function test_update_blog_details() {
* @dataProvider data_flag_hooks
*/
public function test_update_blog_details_flag_action( $flag, $flag_value, $hook ) {
- global $test_action_counter;
- $test_action_counter = 0;
+ $test_action_counter = new MockAction();
$blog_id = self::factory()->blog->create();
@@ -66,7 +65,7 @@ public function test_update_blog_details_flag_action( $flag, $flag_value, $hook
update_blog_details( $blog_id, array( $flag => '1' ) );
}
- add_action( $hook, array( $this, 'action_counter_cb' ), 10 );
+ add_action( $hook, array( $test_action_counter, 'action' ) );
update_blog_details( $blog_id, array( $flag => $flag_value ) );
$blog = get_site( $blog_id );
@@ -74,15 +73,13 @@ public function test_update_blog_details_flag_action( $flag, $flag_value, $hook
$this->assertSame( $flag_value, $blog->{$flag} );
// The hook attached to this flag should have fired once during update_blog_details().
- $this->assertSame( 1, $test_action_counter );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
// Update the site to the exact same flag value for this flag.
update_blog_details( $blog_id, array( $flag => $flag_value ) );
// The hook attached to this flag should not have fired again.
- $this->assertSame( 1, $test_action_counter );
-
- remove_action( $hook, array( $this, 'action_counter_cb' ), 10 );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
}
public function data_flag_hooks() {
@@ -98,14 +95,6 @@ public function data_flag_hooks() {
);
}
- /**
- * Provide a counter to determine that hooks are firing when intended.
- */
- public function action_counter_cb() {
- global $test_action_counter;
- $test_action_counter++;
- }
-
/**
* When the path for a site is updated with update_blog_details(), the final path
* should have a leading and trailing slash.
From 711dbb79934fb23302e7dbcbf8cbf4b3f53ee19b Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 6 Nov 2022 16:19:15 +0000
Subject: [PATCH 0005/1431] Tests: Move `update_blog_status()` tests to their
own file.
Reduce some of the clutter in `tests/multisite/site.php` and introduce `tests/multisite/updateBlogStatus.php`. Tests moved over are verbatim at this point.
Follow-up to [1078/tests], [29916], [30784], [30785], [33253].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54757 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/multisite/site.php | 229 -----------------
.../tests/multisite/updateBlogDetails.php | 1 +
.../tests/multisite/updateBlogStatus.php | 241 ++++++++++++++++++
3 files changed, 242 insertions(+), 229 deletions(-)
create mode 100644 tests/phpunit/tests/multisite/updateBlogStatus.php
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 4192625e9f24f..600bee38b438e 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -440,235 +440,6 @@ public function test_get_blog_details_when_site_does_not_exist() {
$this->assertEquals( $blog, wp_cache_get( $blog_id, 'blog-details' ) );
}
- /**
- * Updating a field returns the sme value that was passed.
- */
- public function test_update_blog_status() {
- $result = update_blog_status( 1, 'spam', 0 );
- $this->assertSame( 0, $result );
- }
-
- /**
- * Updating an invalid field returns the same value that was passed.
- */
- public function test_update_blog_status_invalid_status() {
- $result = update_blog_status( 1, 'doesnotexist', 'invalid' );
- $this->assertSame( 'invalid', $result );
- }
-
- public function test_update_blog_status_make_ham_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
- update_blog_details( $blog_id, array( 'spam' => 1 ) );
-
- add_action( 'make_ham_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'spam', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->spam );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'spam' stays the same.
- update_blog_status( $blog_id, 'spam', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->spam );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_content_from_spam_blog_is_not_available() {
- $spam_blog_id = self::factory()->blog->create();
- switch_to_blog( $spam_blog_id );
- $post_data = array(
- 'post_title' => 'Hello World!',
- 'post_content' => 'Hello world content',
- );
- $post_id = self::factory()->post->create( $post_data );
- $post = get_post( $post_id );
- $spam_permalink = site_url() . '/?p=' . $post->ID;
- $spam_embed_url = get_post_embed_url( $post_id );
-
- restore_current_blog();
- $this->assertNotEmpty( $spam_permalink );
- $this->assertSame( $post_data['post_title'], $post->post_title );
-
- update_blog_status( $spam_blog_id, 'spam', 1 );
-
- $post_id = self::factory()->post->create(
- array(
- 'post_content' => "\n $spam_permalink \n",
- )
- );
- $post = get_post( $post_id );
- $content = apply_filters( 'the_content', $post->post_content );
-
- $this->assertStringNotContainsString( $post_data['post_title'], $content );
- $this->assertStringNotContainsString( "src=\"{$spam_embed_url}#?", $content );
- }
-
- public function test_update_blog_status_make_spam_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
-
- add_action( 'make_spam_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'spam', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->spam );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'spam' stays the same.
- update_blog_status( $blog_id, 'spam', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->spam );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_archive_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
-
- add_action( 'archive_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'archived', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->archived );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'archived' stays the same.
- update_blog_status( $blog_id, 'archived', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->archived );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_unarchive_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
- update_blog_details( $blog_id, array( 'archived' => 1 ) );
-
- add_action( 'unarchive_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'archived', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->archived );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'archived' stays the same.
- update_blog_status( $blog_id, 'archived', 0 );
- $blog = get_site( $blog_id );
- $this->assertSame( '0', $blog->archived );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_make_delete_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
-
- add_action( 'make_delete_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'deleted', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->deleted );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'deleted' stays the same.
- update_blog_status( $blog_id, 'deleted', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->deleted );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_make_undelete_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
- update_blog_details( $blog_id, array( 'deleted' => 1 ) );
-
- add_action( 'make_undelete_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'deleted', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->deleted );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'deleted' stays the same.
- update_blog_status( $blog_id, 'deleted', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->deleted );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_mature_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
-
- add_action( 'mature_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'mature', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->mature );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'mature' stays the same.
- update_blog_status( $blog_id, 'mature', 1 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '1', $blog->mature );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_unmature_blog_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
- update_blog_details( $blog_id, array( 'mature' => 1 ) );
-
- add_action( 'unmature_blog', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'mature', 0 );
-
- $blog = get_site( $blog_id );
- $this->assertSame( '0', $blog->mature );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'mature' stays the same.
- update_blog_status( $blog_id, 'mature', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->mature );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
- public function test_update_blog_status_update_blog_public_action() {
- $test_action_counter = new MockAction();
-
- $blog_id = self::factory()->blog->create();
-
- add_action( 'update_blog_public', array( $test_action_counter, 'action' ) );
- update_blog_status( $blog_id, 'public', 0 );
-
- $blog = get_site( $blog_id );
- $this->assertSame( '0', $blog->public );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
-
- // The action should not fire if the status of 'mature' stays the same.
- update_blog_status( $blog_id, 'public', 0 );
- $blog = get_site( $blog_id );
-
- $this->assertSame( '0', $blog->public );
- $this->assertSame( 1, $test_action_counter->get_call_count() );
- }
-
/**
* @ticket 27952
*/
diff --git a/tests/phpunit/tests/multisite/updateBlogDetails.php b/tests/phpunit/tests/multisite/updateBlogDetails.php
index 1c7d19a2a5710..d3249a126165d 100644
--- a/tests/phpunit/tests/multisite/updateBlogDetails.php
+++ b/tests/phpunit/tests/multisite/updateBlogDetails.php
@@ -7,6 +7,7 @@
* @group multisite
*/
class Tests_Multisite_UpdateBlogDetails extends WP_UnitTestCase {
+
/**
* If `update_blog_details()` is called with any kind of empty arguments, it
* should return false.
diff --git a/tests/phpunit/tests/multisite/updateBlogStatus.php b/tests/phpunit/tests/multisite/updateBlogStatus.php
new file mode 100644
index 0000000000000..707b8fa66aee5
--- /dev/null
+++ b/tests/phpunit/tests/multisite/updateBlogStatus.php
@@ -0,0 +1,241 @@
+assertSame( 0, $result );
+ }
+
+ /**
+ * Updating an invalid field returns the same value that was passed.
+ */
+ public function test_update_blog_status_invalid_status() {
+ $result = update_blog_status( 1, 'doesnotexist', 'invalid' );
+ $this->assertSame( 'invalid', $result );
+ }
+
+ public function test_update_blog_status_make_ham_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+ update_blog_details( $blog_id, array( 'spam' => 1 ) );
+
+ add_action( 'make_ham_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'spam', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->spam );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'spam' stays the same.
+ update_blog_status( $blog_id, 'spam', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->spam );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_content_from_spam_blog_is_not_available() {
+ $spam_blog_id = self::factory()->blog->create();
+ switch_to_blog( $spam_blog_id );
+ $post_data = array(
+ 'post_title' => 'Hello World!',
+ 'post_content' => 'Hello world content',
+ );
+ $post_id = self::factory()->post->create( $post_data );
+ $post = get_post( $post_id );
+ $spam_permalink = site_url() . '/?p=' . $post->ID;
+ $spam_embed_url = get_post_embed_url( $post_id );
+
+ restore_current_blog();
+ $this->assertNotEmpty( $spam_permalink );
+ $this->assertSame( $post_data['post_title'], $post->post_title );
+
+ update_blog_status( $spam_blog_id, 'spam', 1 );
+
+ $post_id = self::factory()->post->create(
+ array(
+ 'post_content' => "\n $spam_permalink \n",
+ )
+ );
+ $post = get_post( $post_id );
+ $content = apply_filters( 'the_content', $post->post_content );
+
+ $this->assertStringNotContainsString( $post_data['post_title'], $content );
+ $this->assertStringNotContainsString( "src=\"{$spam_embed_url}#?", $content );
+ }
+
+ public function test_update_blog_status_make_spam_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+
+ add_action( 'make_spam_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'spam', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->spam );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'spam' stays the same.
+ update_blog_status( $blog_id, 'spam', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->spam );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_archive_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+
+ add_action( 'archive_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'archived', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->archived );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'archived' stays the same.
+ update_blog_status( $blog_id, 'archived', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->archived );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_unarchive_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+ update_blog_details( $blog_id, array( 'archived' => 1 ) );
+
+ add_action( 'unarchive_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'archived', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->archived );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'archived' stays the same.
+ update_blog_status( $blog_id, 'archived', 0 );
+ $blog = get_site( $blog_id );
+ $this->assertSame( '0', $blog->archived );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_make_delete_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+
+ add_action( 'make_delete_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'deleted', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'deleted' stays the same.
+ update_blog_status( $blog_id, 'deleted', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_make_undelete_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+ update_blog_details( $blog_id, array( 'deleted' => 1 ) );
+
+ add_action( 'make_undelete_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'deleted', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'deleted' stays the same.
+ update_blog_status( $blog_id, 'deleted', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->deleted );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_mature_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+
+ add_action( 'mature_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'mature', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->mature );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'mature' stays the same.
+ update_blog_status( $blog_id, 'mature', 1 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '1', $blog->mature );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_unmature_blog_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+ update_blog_details( $blog_id, array( 'mature' => 1 ) );
+
+ add_action( 'unmature_blog', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'mature', 0 );
+
+ $blog = get_site( $blog_id );
+ $this->assertSame( '0', $blog->mature );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'mature' stays the same.
+ update_blog_status( $blog_id, 'mature', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->mature );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+
+ public function test_update_blog_status_update_blog_public_action() {
+ $test_action_counter = new MockAction();
+
+ $blog_id = self::factory()->blog->create();
+
+ add_action( 'update_blog_public', array( $test_action_counter, 'action' ) );
+ update_blog_status( $blog_id, 'public', 0 );
+
+ $blog = get_site( $blog_id );
+ $this->assertSame( '0', $blog->public );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+
+ // The action should not fire if the status of 'mature' stays the same.
+ update_blog_status( $blog_id, 'public', 0 );
+ $blog = get_site( $blog_id );
+
+ $this->assertSame( '0', $blog->public );
+ $this->assertSame( 1, $test_action_counter->get_call_count() );
+ }
+ }
+
+endif;
From 473dfe51c723639e510808cd0d1511b2e067c8a9 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 7 Nov 2022 13:25:10 +0000
Subject: [PATCH 0006/1431] =?UTF-8?q?General:=20Use=20HTTPS=20for=20the=20?=
=?UTF-8?q?b2/caf=C3=A9log=20link=20in=20`readme.html`.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Follow-up to [691], [47285].
Props rajanpanchal2028.
Fixes #57018.
git-svn-id: https://develop.svn.wordpress.org/trunk@54758 602fd350-edb4-49c9-b593-d223f7449a82
---
src/readme.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/readme.html b/src/readme.html
index 0048b9efa39f9..72bc2afe4be14 100644
--- a/src/readme.html
+++ b/src/readme.html
@@ -88,7 +88,7 @@
Final Notes
Share the Love
WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better—you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgeable than yourself, or writing the author of a media article that overlooks us.
-
WordPress is the official continuation of b2/cafélog, which came from Michel V. The work has been continued by the WordPress developers. If you would like to support WordPress, please consider donating.
+
WordPress is the official continuation of b2/cafélog, which came from Michel V. The work has been continued by the WordPress developers. If you would like to support WordPress, please consider donating.
License
WordPress is free software, and is released under the terms of the GPL (GNU General Public License) version 2 or (at your option) any later version. See license.txt.
From c6e8353e369cae3be8bf6cc218972c0b7f65a1a9 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Mon, 7 Nov 2022 13:33:11 +0000
Subject: [PATCH 0007/1431] Docs: Replace HTTP links with HTTPS in
`class-json.php` docblocks.
Props haritpanchal.
Fixes #57017.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54759 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-json.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/class-json.php b/src/wp-includes/class-json.php
index 9eca6f4b578cf..d651dcdfb8861 100644
--- a/src/wp-includes/class-json.php
+++ b/src/wp-includes/class-json.php
@@ -54,8 +54,8 @@
* @author Brett Stimmerman
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php 305040 2010-11-02 23:19:03Z alan_k $
- * @license http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ * @license https://www.opensource.org/licenses/bsd-license.php
+ * @link https://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
/**
From ad31a2e4244fc72f9abc725b0c55c351edbe759e Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 7 Nov 2022 17:45:29 +0000
Subject: [PATCH 0008/1431] Tests: Combine duplicate `update_posts_count()`
tests.
This combines the newer test for `update_posts_count()` located in its own file with the pre-existing one from `tests/multisite/site.php`, which was essentially testing the same thing in a similar way.
Includes:
* Renaming the test class per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization naming conventions].
* Adjusting comments per the documentation standards.
* Updating `@covers` tags for accuracy.
* Removing unnecessary blog switching.
* Using `assertSame()` to check the value type.
Follow-up to [28835], [29667], [52207].
See #57023, #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54760 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/multisite/site.php | 12 ----
.../tests/multisite/updatePostsCount.php | 58 +++++++++----------
2 files changed, 26 insertions(+), 44 deletions(-)
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 600bee38b438e..990003cde9c48 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -440,18 +440,6 @@ public function test_get_blog_details_when_site_does_not_exist() {
$this->assertEquals( $blog, wp_cache_get( $blog_id, 'blog-details' ) );
}
- /**
- * @ticket 27952
- */
- public function test_posts_count() {
- self::factory()->post->create();
- $post2 = self::factory()->post->create();
- $this->assertSame( 2, get_site()->post_count );
-
- wp_delete_post( $post2 );
- $this->assertSame( 1, get_site()->post_count );
- }
-
/**
* @ticket 26410
*/
diff --git a/tests/phpunit/tests/multisite/updatePostsCount.php b/tests/phpunit/tests/multisite/updatePostsCount.php
index 2806aaedd5b41..850d9fff59474 100644
--- a/tests/phpunit/tests/multisite/updatePostsCount.php
+++ b/tests/phpunit/tests/multisite/updatePostsCount.php
@@ -2,54 +2,48 @@
if ( is_multisite() ) :
/**
- * Test update_posts_count() get called via filters of WP_Site in multisite.
+ * Test that update_posts_count() gets called via default filters on multisite.
*
* @group ms-site
* @group multisite
*
- * @covers ::_update_posts_count_on_delete
+ * @covers ::update_posts_count
*/
- class Tests_update_posts_count_on_delete extends WP_UnitTestCase {
+ class Tests_Multisite_UpdatePostsCount extends WP_UnitTestCase {
/**
- * Test that the posts count is updated correctly when a posts are added and deleted.
+ * Tests that posts count is updated correctly when posts are added or deleted.
+ *
+ * @ticket 27952
* @ticket 53443
+ *
+ * @covers ::_update_posts_count_on_transition_post_status
+ * @covers ::_update_posts_count_on_delete
*/
- public function test_update_posts_count_on_delete() {
+ public function test_update_posts_count() {
+ $original_post_count = (int) get_site()->post_count;
- $blog_id = self::factory()->blog->create();
- switch_to_blog( $blog_id );
+ $post_id = self::factory()->post->create();
- $current_post_count = (int) get_option( 'post_count' );
-
- $post_id = self::factory()->post->create(
- array(
- 'post_type' => 'post',
- 'post_author' => '1',
- 'post_date' => '2012-10-23 19:34:42',
- 'post_status' => 'publish',
- )
- );
-
- /**
- * Check that add_action( 'deleted_post', '_update_posts_count_on_delete' ) is called when a post is created.
- * Check that _update_posts_count_on_transition_post_status() is called on that filter which then calls
- * update_posts_count to update the count.
+ /*
+ * Check that posts count is updated when a post is created:
+ * add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
+ *
+ * Check that _update_posts_count_on_transition_post_status() is called on that filter,
+ * which then calls update_posts_count() to update the count.
*/
- $this->assertEquals( $current_post_count + 1, (int) get_option( 'post_count' ), 'post added' );
+ $this->assertSame( $original_post_count + 1, get_site()->post_count, 'Post count should be incremented by 1.' );
wp_delete_post( $post_id );
- /**
- * Check that add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 )
- * is called when a post is deleted.
- * Check that _update_posts_count_on_delete() is called on that filter which then calls update_posts_count
- * to update the count.
+ /*
+ * Check that posts count is updated when a post is deleted:
+ * add_action( 'deleted_post', '_update_posts_count_on_delete' );
+ *
+ * Check that _update_posts_count_on_delete() is called on that filter,
+ * which then calls update_posts_count() to update the count.
*/
- $this->assertEquals( $current_post_count, (int) get_option( 'post_count' ), 'post deleted' );
-
- restore_current_blog();
-
+ $this->assertSame( $original_post_count, get_site()->post_count, 'Post count should match the original count.' );
}
}
From 41fef2f8c98200654701d0ba839a15f817311eec Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Mon, 7 Nov 2022 20:21:07 +0000
Subject: [PATCH 0009/1431] Editor: Improve Archive template description.
This changeset improves the description of the Archive template in the Site Editor to make it more accurate.
Follow-up to [52331].
Props Chaton666, webaxones, mukesh27, audrasjb, SergeyBiryukov.
Fixes #57001.
git-svn-id: https://develop.svn.wordpress.org/trunk@54761 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-template-utils.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php
index d2795612edea0..802627873ef66 100644
--- a/src/wp-includes/block-template-utils.php
+++ b/src/wp-includes/block-template-utils.php
@@ -139,7 +139,7 @@ function get_default_block_template_types() {
),
'archive' => array(
'title' => _x( 'Archive', 'Template name' ),
- 'description' => __( 'Displays post categories, tags, and other archives.' ),
+ 'description' => __( 'Displays posts by a category, tag, author, or date.' ),
),
'author' => array(
'title' => _x( 'Author', 'Template name' ),
From be4f63f00fdcf02be9d677b5c63f9add375bd42c Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 7 Nov 2022 20:53:18 +0000
Subject: [PATCH 0010/1431] Tests: Restore blog switching in
`update_posts_count()` test.
The previous iteration of the test passed when run in isolation but failed when running the whole test suite.
Restoring the `switch_to_blog()` call allows the test to pass again pending a deeper investigation.
Follow-up to [54760].
See #57023.
git-svn-id: https://develop.svn.wordpress.org/trunk@54762 602fd350-edb4-49c9-b593-d223f7449a82
---
.../tests/multisite/updatePostsCount.php | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/tests/phpunit/tests/multisite/updatePostsCount.php b/tests/phpunit/tests/multisite/updatePostsCount.php
index 850d9fff59474..270ac60c49901 100644
--- a/tests/phpunit/tests/multisite/updatePostsCount.php
+++ b/tests/phpunit/tests/multisite/updatePostsCount.php
@@ -21,10 +21,21 @@ class Tests_Multisite_UpdatePostsCount extends WP_UnitTestCase {
* @covers ::_update_posts_count_on_delete
*/
public function test_update_posts_count() {
+ $blog_id = self::factory()->blog->create();
+ switch_to_blog( $blog_id );
+
$original_post_count = (int) get_site()->post_count;
$post_id = self::factory()->post->create();
+ $post_count_after_creating = get_site()->post_count;
+
+ wp_delete_post( $post_id );
+
+ $post_count_after_deleting = get_site()->post_count;
+
+ restore_current_blog();
+
/*
* Check that posts count is updated when a post is created:
* add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
@@ -32,9 +43,7 @@ public function test_update_posts_count() {
* Check that _update_posts_count_on_transition_post_status() is called on that filter,
* which then calls update_posts_count() to update the count.
*/
- $this->assertSame( $original_post_count + 1, get_site()->post_count, 'Post count should be incremented by 1.' );
-
- wp_delete_post( $post_id );
+ $this->assertSame( $original_post_count + 1, $post_count_after_creating, 'Post count should be incremented by 1.' );
/*
* Check that posts count is updated when a post is deleted:
@@ -43,7 +52,7 @@ public function test_update_posts_count() {
* Check that _update_posts_count_on_delete() is called on that filter,
* which then calls update_posts_count() to update the count.
*/
- $this->assertSame( $original_post_count, get_site()->post_count, 'Post count should match the original count.' );
+ $this->assertSame( $original_post_count, $post_count_after_deleting, 'Post count should match the original count.' );
}
}
From 057f2e64a5a51ccaae6b2c6cfff0da2ca362a042 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 8 Nov 2022 13:27:23 +0000
Subject: [PATCH 0011/1431] Docs: Document the usage of `$wpdb` global in
`WP_Date_Query` methods.
Follow-up to [25139], [29933], [38280], [38768].
Props upadalavipul.
Fixes #57033.
git-svn-id: https://develop.svn.wordpress.org/trunk@54765 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-date-query.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/wp-includes/class-wp-date-query.php b/src/wp-includes/class-wp-date-query.php
index 00a7554dea0b4..cf3bddc9ae369 100644
--- a/src/wp-includes/class-wp-date-query.php
+++ b/src/wp-includes/class-wp-date-query.php
@@ -473,6 +473,8 @@ public function validate_date_values( $date_query = array() ) {
*
* @since 3.7.0
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param string $column The user-supplied column name.
* @return string A validated column name value.
*/
@@ -699,6 +701,8 @@ protected function get_sql_for_subquery( $query ) {
*
* @since 4.1.0
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param array $query Date query clause.
* @param array $parent_query Parent query of the current date query.
* @return string[] {
@@ -961,6 +965,8 @@ public function build_mysql_datetime( $datetime, $default_to_max = false ) {
*
* @since 3.7.0
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param string $column The column to query against. Needs to be pre-validated!
* @param string $compare The comparison operator. Needs to be pre-validated!
* @param int|null $hour Optional. An hour value (0-23).
From 61f569e81a6eed7a5ad67747ba1559e10e7ce511 Mon Sep 17 00:00:00 2001
From: Timothy Jacobs
Date: Tue, 8 Nov 2022 17:29:48 +0000
Subject: [PATCH 0012/1431] Query: Don't attempt caching if running a
WP_User_Query before plugins_loaded.
In #55594 user meta caching was enabled by default when making a `WP_User_Query`. Previously, this was only enabled if a developer specifically queried for 'all_with_meta'
fields. User meta caching is implemented using a pluggable function, `cache_users`. If a plugin runs a `WP_User_Query` before pluggable functions have been defined, this
will now cause a fatal error.
In this commit, a `function_exists` check is introduced to avoid calling `cache_users` if it's not defined. Additionally, a `_doing_it_wrong` notice is issued if the
`WP_User_Query::query` method is called before the 'plugins_loaded' hook.
Props carazo, subrataemfluence, oakesjosh, spacedmonkey, obenland, SergeyBiryukov, peterwilsoncc.
Fixes #56952.
git-svn-id: https://develop.svn.wordpress.org/trunk@54766 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-user-query.php | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/class-wp-user-query.php b/src/wp-includes/class-wp-user-query.php
index 330882494e3b9..8fc1564bef01a 100644
--- a/src/wp-includes/class-wp-user-query.php
+++ b/src/wp-includes/class-wp-user-query.php
@@ -776,6 +776,18 @@ public function prepare_query( $query = array() ) {
public function query() {
global $wpdb;
+ if ( ! did_action( 'plugins_loaded' ) ) {
+ _doing_it_wrong(
+ 'WP_User_Query::query',
+ sprintf(
+ /* translators: %s: plugins_loaded */
+ __( 'User queries should not be run before the %s hook.' ),
+ 'plugins_loaded'
+ ),
+ '6.1.1'
+ );
+ }
+
$qv =& $this->query_vars;
/**
@@ -840,7 +852,9 @@ public function query() {
$result->id = $result->ID;
}
} elseif ( 'all_with_meta' === $qv['fields'] || 'all' === $qv['fields'] ) {
- cache_users( $this->results );
+ if ( function_exists( 'cache_users' ) ) {
+ cache_users( $this->results );
+ }
$r = array();
foreach ( $this->results as $userid ) {
From fba9680eda5865efcb258a6ed3aa05a94f83b886 Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Wed, 9 Nov 2022 00:26:41 +0000
Subject: [PATCH 0013/1431] Query: Bypass caching for filtered `SELECT`s.
Bypass caching within `WP_Query` when the `SELECT` clause has been modified via a filter. This prevents both cache key collisions and the returning of incomplete or unexpected results when the `SELECT` clause has been modified by an extender.
Props pypwalters, claytoncollie, johnwatkins0, TimothyBlynJacobs, costdev, spacedmonkey, peterwilsoncc.
Fixes #57012.
git-svn-id: https://develop.svn.wordpress.org/trunk@54768 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-query.php | 15 ++
tests/phpunit/tests/query/fieldsClause.php | 242 +++++++++++++++++++++
2 files changed, 257 insertions(+)
create mode 100644 tests/phpunit/tests/query/fieldsClause.php
diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
index 511c4a7eec81e..69efdf5e2adca 100644
--- a/src/wp-includes/class-wp-query.php
+++ b/src/wp-includes/class-wp-query.php
@@ -3103,8 +3103,23 @@ public function get_posts() {
* cannot be cached. Note the space before `RAND` in the string
* search, that to ensure against a collision with another
* function.
+ *
+ * If `$fields` has been modified by the `posts_fields`,
+ * `posts_fields_request`, `post_clauses` or `posts_clauses_request`
+ * filters, then caching is disabled to prevent caching collisions.
*/
$id_query_is_cacheable = ! str_contains( strtoupper( $orderby ), ' RAND(' );
+
+ $cachable_field_values = array(
+ "{$wpdb->posts}.*",
+ "{$wpdb->posts}.ID, {$wpdb->posts}.post_parent",
+ "{$wpdb->posts}.ID",
+ );
+
+ if ( ! in_array( $fields, $cachable_field_values, true ) ) {
+ $id_query_is_cacheable = false;
+ }
+
if ( $q['cache_results'] && $id_query_is_cacheable ) {
$new_request = str_replace( $fields, "{$wpdb->posts}.*", $this->request );
$cache_key = $this->generate_cache_key( $q, $new_request );
diff --git a/tests/phpunit/tests/query/fieldsClause.php b/tests/phpunit/tests/query/fieldsClause.php
new file mode 100644
index 0000000000000..4522923a8a76f
--- /dev/null
+++ b/tests/phpunit/tests/query/fieldsClause.php
@@ -0,0 +1,242 @@
+post->create_many( 5, array( 'post_type' => 'wptests_pt' ) );
+ }
+
+ public function set_up() {
+ parent::set_up();
+ /*
+ * Re-register the CPT for use within each test.
+ *
+ * Custom post types are deregistered by the default tear_down method
+ * so need to be re-registered for each test as WP_Query calls
+ * get_post_types().
+ */
+ register_post_type( 'wptests_pt' );
+ }
+
+ /**
+ * Tests limiting the WP_Query fields to the ID and parent sub-set.
+ *
+ * @ticket 57012
+ */
+ public function test_should_limit_fields_to_id_and_parent_subset() {
+ $query_args = array(
+ 'post_type' => 'wptests_pt',
+ 'fields' => 'id=>parent',
+ );
+
+ $q = new WP_Query( $query_args );
+
+ $expected = array();
+ foreach ( self::$post_ids as $post_id ) {
+ // Use array_shift to populate in the reverse order.
+ array_unshift(
+ $expected,
+ (object) array(
+ 'ID' => $post_id,
+ 'post_parent' => 0,
+ )
+ );
+ }
+
+ $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
+ $this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
+
+ // Test the second query's results match.
+ $q2 = new WP_Query( $query_args );
+ $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ }
+
+ /**
+ * Tests limiting the WP_Query fields to the IDs only.
+ *
+ * @ticket 57012
+ */
+ public function test_should_limit_fields_to_ids() {
+ $query_args = array(
+ 'post_type' => 'wptests_pt',
+ 'fields' => 'ids',
+ );
+
+ $q = new WP_Query( $query_args );
+
+ $expected = array_reverse( self::$post_ids );
+
+ $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
+ $this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
+
+ // Test the second query's results match.
+ $q2 = new WP_Query( $query_args );
+ $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ }
+
+ /**
+ * Tests querying all fields via WP_Query.
+ *
+ * @ticket 57012
+ */
+ public function test_should_query_all_fields() {
+ $query_args = array(
+ 'post_type' => 'wptests_pt',
+ 'fields' => 'all',
+ );
+
+ $q = new WP_Query( $query_args );
+
+ $expected = array_map( 'get_post', array_reverse( self::$post_ids ) );
+
+ $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
+ $this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
+
+ // Test the second query's results match.
+ $q2 = new WP_Query( $query_args );
+ $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ }
+
+ /**
+ * Tests adding fields to WP_Query via filters when requesting the ID and parent sub-set.
+ *
+ * @ticket 57012
+ */
+ public function test_should_include_filtered_values_in_addition_to_id_and_parent_subset() {
+ add_filter( 'posts_fields', array( $this, 'filter_posts_fields' ) );
+ add_filter( 'posts_clauses', array( $this, 'filter_posts_clauses' ) );
+
+ $query_args = array(
+ 'post_type' => 'wptests_pt',
+ 'fields' => 'id=>parent',
+ );
+
+ $q = new WP_Query( $query_args );
+
+ $expected = array();
+ foreach ( self::$post_ids as $post_id ) {
+ // Use array_shift to populate in the reverse order.
+ array_unshift(
+ $expected,
+ (object) array(
+ 'ID' => $post_id,
+ 'post_parent' => 0,
+ 'test_post_fields' => 1,
+ 'test_post_clauses' => 2,
+ )
+ );
+ }
+
+ $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
+ $this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
+
+ // Test the second query's results match.
+ $q2 = new WP_Query( $query_args );
+ $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ }
+
+ /**
+ * Tests adding fields to WP_Query via filters when requesting the ID field.
+ *
+ * @ticket 57012
+ */
+ public function test_should_include_filtered_values_in_addition_to_id() {
+ add_filter( 'posts_fields', array( $this, 'filter_posts_fields' ) );
+ add_filter( 'posts_clauses', array( $this, 'filter_posts_clauses' ) );
+
+ $query_args = array(
+ 'post_type' => 'wptests_pt',
+ 'fields' => 'ids',
+ );
+
+ $q = new WP_Query( $query_args );
+
+ // Fields => ID does not include the additional fields.
+ $expected = array_reverse( self::$post_ids );
+
+ $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
+ $this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
+
+ // Test the second query's results match.
+ $q2 = new WP_Query( $query_args );
+ $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ }
+
+ /**
+ * Tests adding fields to WP_Query via filters when requesting all fields.
+ *
+ * @ticket 57012
+ */
+ public function test_should_include_filtered_values() {
+ add_filter( 'posts_fields', array( $this, 'filter_posts_fields' ) );
+ add_filter( 'posts_clauses', array( $this, 'filter_posts_clauses' ) );
+
+ $query_args = array(
+ 'post_type' => 'wptests_pt',
+ 'fields' => 'all',
+ );
+
+ $q = new WP_Query( $query_args );
+
+ $expected = array_map( 'get_post', array_reverse( self::$post_ids ) );
+ foreach ( $expected as $post ) {
+ $post->test_post_fields = 1;
+ $post->test_post_clauses = 2;
+ }
+
+ $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
+ $this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
+
+ // Test the second query's results match.
+ $q2 = new WP_Query( $query_args );
+ $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ }
+
+ /**
+ * Filters the posts fields.
+ *
+ * @param string $fields The fields to SELECT.
+ * @return string The filtered fields.
+ */
+ function filter_posts_fields( $fields ) {
+ return "$fields, 1 as test_post_fields";
+ }
+
+ /**
+ * Filters the posts clauses.
+ *
+ * @param array $clauses The WP_Query database clauses.
+ * @return array The filtered database clauses.
+ */
+ function filter_posts_clauses( $clauses ) {
+ $clauses['fields'] .= ', 2 as test_post_clauses';
+ return $clauses;
+ }
+}
From b8bf29746ad71447b4e9d5cf7458e269c6e25a8b Mon Sep 17 00:00:00 2001
From: Felix Arntz
Date: Wed, 9 Nov 2022 00:28:33 +0000
Subject: [PATCH 0014/1431] Editor: Improve frontend performance for
`get_default_block_editor_settings()`.
The `wp_max_upload_size()` function can be expensive to call, especially for large sites or multisites. For the frontend usage of `get_default_block_editor_settings()` knowing the allowed upload size is typically unnecessary.
This changeset adds a condition so that `wp_max_upload_size()` is only called if the current user can actually `upload_files`. It keeps the data present when it is actually needed while avoiding the execution overhead when it is not needed.
Props janthiel, Clorith, flixos90, spacedmonkey.
Fixes #56815.
git-svn-id: https://develop.svn.wordpress.org/trunk@54769 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-editor.php | 11 ++++++++---
tests/phpunit/tests/blocks/editor.php | 25 +++++++++++++++++++++++++
2 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php
index 1c67e6cc7af27..901ba21a3f282 100644
--- a/src/wp-includes/block-editor.php
+++ b/src/wp-includes/block-editor.php
@@ -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 */
diff --git a/tests/phpunit/tests/blocks/editor.php b/tests/phpunit/tests/blocks/editor.php
index 53b8d96956379..076b3026fa0ea 100644
--- a/tests/phpunit/tests/blocks/editor.php
+++ b/tests/phpunit/tests/blocks/editor.php
@@ -301,6 +301,31 @@ public function test_get_default_block_editor_settings() {
$this->assertTrue( $settings['__unstableGalleryWithImageBlocks'] );
}
+ /**
+ * @ticket 56815
+ */
+ public function test_get_default_block_editor_settings_max_upload_file_size() {
+ // Force the return value of wp_max_upload_size() to be 500.
+ add_filter(
+ 'upload_size_limit',
+ function() {
+ return 500;
+ }
+ );
+
+ // Expect 0 when user is not allowed to upload (as wp_max_upload_size() should not be called).
+ $settings = get_default_block_editor_settings();
+ $this->assertSame( 0, $settings['maxUploadFileSize'] );
+
+ // Set up an administrator, as they can upload files.
+ $administrator = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ wp_set_current_user( $administrator );
+
+ // Expect the above 500 as the user is now allowed to upload.
+ $settings = get_default_block_editor_settings();
+ $this->assertSame( 500, $settings['maxUploadFileSize'] );
+ }
+
/**
* @ticket 53397
*/
From 6903cfd82288ba43d0f4e67f91c8aabb6eb66250 Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Wed, 9 Nov 2022 00:38:14 +0000
Subject: [PATCH 0015/1431] Themes: Improve `WP_Query` call getting global
styles.
Change `orderby` clause used within `WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles` to `date` to match the `WP_Query` documentation for the parameter.
Props miguelaxcar, johnbillion, JeffPaul, spacedmonkey, mxbclang, mukesh27.
Fixes #56900.
git-svn-id: https://develop.svn.wordpress.org/trunk@54770 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json-resolver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php
index ee153eb657abe..cf14486f6770d 100644
--- a/src/wp-includes/class-wp-theme-json-resolver.php
+++ b/src/wp-includes/class-wp-theme-json-resolver.php
@@ -408,7 +408,7 @@ public static function get_user_data_from_wp_global_styles( $theme, $create_post
$stylesheet = $theme->get_stylesheet();
$args = array(
'posts_per_page' => 1,
- 'orderby' => 'post_date',
+ 'orderby' => 'date',
'order' => 'desc',
'post_type' => $post_type_filter,
'post_status' => $post_status_filter,
From 4edede48ebc80089b8d1699e3402298d07cd042e Mon Sep 17 00:00:00 2001
From: peterwilsoncc
Date: Wed, 9 Nov 2022 00:57:02 +0000
Subject: [PATCH 0016/1431] Query: Prevent ID only queries erroring when
starting the loop.
Ensure only full post objects are passed to `update_post_author_caches()` when called within `WP_Query::the_post()`. This prevents an error when starting the Loop for Queries initiated with a subset of fields or IDs only.
Props konyoldeath, dd32, lozula, TimothyBlynJacobs, spacedmonkey, mxbclang, peterwilsoncc.
Fixes #56948.
git-svn-id: https://develop.svn.wordpress.org/trunk@54771 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-query.php | 10 +++-
src/wp-includes/post.php | 9 ++++
tests/phpunit/tests/query/cacheResults.php | 61 ++++++++++++++++++++++
3 files changed, 79 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
index 69efdf5e2adca..1e695bd0525a0 100644
--- a/src/wp-includes/class-wp-query.php
+++ b/src/wp-includes/class-wp-query.php
@@ -3586,7 +3586,15 @@ public function the_post() {
global $post;
if ( ! $this->in_the_loop ) {
- update_post_author_caches( $this->posts );
+ // Only prime the post cache for queries limited to the ID field.
+ $post_ids = array_filter( $this->posts, 'is_numeric' );
+ // Exclude any falsey values, such as 0.
+ $post_ids = array_filter( $post_ids );
+ if ( $post_ids ) {
+ _prime_post_caches( $post_ids, $this->query_vars['update_post_term_cache'], $this->query_vars['update_post_meta_cache'] );
+ }
+ $post_objects = array_map( 'get_post', $this->posts );
+ update_post_author_caches( $post_objects );
}
$this->in_the_loop = true;
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index d7e7bfec990a1..6a7c637831328 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -7461,6 +7461,15 @@ function update_post_caches( &$posts, $post_type = 'post', $update_term_cache =
* @param WP_Post[] $posts Array of post objects.
*/
function update_post_author_caches( $posts ) {
+ /*
+ * cache_users() is a pluggable function so is not available prior
+ * to the `plugins_loaded` hook firing. This is to ensure against
+ * fatal errors when the function is not available.
+ */
+ if ( ! function_exists( 'cache_users' ) ) {
+ return;
+ }
+
$author_ids = wp_list_pluck( $posts, 'post_author' );
$author_ids = array_map( 'absint', $author_ids );
$author_ids = array_unique( array_filter( $author_ids ) );
diff --git a/tests/phpunit/tests/query/cacheResults.php b/tests/phpunit/tests/query/cacheResults.php
index d133dd862c2ba..6e2dde1f0f0b9 100644
--- a/tests/phpunit/tests/query/cacheResults.php
+++ b/tests/phpunit/tests/query/cacheResults.php
@@ -1210,4 +1210,65 @@ public function data_query_cache_with_empty_result_set() {
array( 'id=>parent', 'id=>parent' ),
);
}
+
+ /**
+ * Ensure starting the loop warms the author cache.
+ *
+ * @since 6.1.1
+ * @ticket 56948
+ *
+ * @covers WP_Query::the_post
+ *
+ * @dataProvider data_author_cache_warmed_by_the_loop
+ *
+ * @param string $fields Query fields.
+ */
+ public function test_author_cache_warmed_by_the_loop( $fields ) {
+ // Update post author for the parent post.
+ self::factory()->post->update_object( self::$pages[0], array( 'post_author' => self::$author_id ) );
+
+ self::factory()->post->create(
+ array(
+ 'post_author' => self::$author_id,
+ 'post_parent' => self::$pages[0],
+ 'post_type' => 'page',
+ )
+ );
+
+ $query_1 = new WP_Query(
+ array(
+ 'post_type' => 'page',
+ 'fields' => $fields,
+ 'author' => self::$author_id,
+ )
+ );
+
+ // Start the loop.
+ $start_loop_queries = get_num_queries();
+ $query_1->the_post();
+ $num_loop_queries = get_num_queries() - $start_loop_queries;
+ $this->assertSame( 2, $num_loop_queries, 'Unexpected number of queries while initializing the loop.' );
+
+ $start_author_queries = get_num_queries();
+ get_user_by( 'ID', self::$author_id );
+ $num_author_queries = get_num_queries() - $start_author_queries;
+ $this->assertSame( 0, $num_author_queries, 'Author cache is not warmed by the loop.' );
+ }
+
+ /**
+ * Data provider for test_author_cache_warmed_by_the_loop
+ *
+ * @return array[]
+ */
+ public function data_author_cache_warmed_by_the_loop() {
+ return array(
+ 'fields: empty' => array( '' ),
+ 'fields: all' => array( 'all' ),
+ 'fields: ids' => array( 'ids' ),
+ /*
+ * `id=>parent` is untested pending the resolution of an existing bug.
+ * See https://core.trac.wordpress.org/ticket/56992
+ */
+ );
+ }
}
From bbf1a34454d468ad4b9f0143741ec505c78d0cd6 Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Wed, 9 Nov 2022 04:06:47 +0000
Subject: [PATCH 0017/1431] Themes: Re-order valid link pseudo classes.
Re-order the link pseudo classes to follow the long term LoVe (F)HA rule when set via `theme.json`.
In order that the CSS cascade behaves in a predictable manner, it's recommended that the selectors follow the order `:visited`, `:focus`/`:hover`, `:active`. As order affects the specificity, this ensures the interaction states override the visited states. CSS specificity is really quite beautiful, although complex.
Props mikachan, sabernhardt, davidbaumwald, mukesh27, Mamaduka, desrosj.
Fixes #56928.
git-svn-id: https://develop.svn.wordpress.org/trunk@54774 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json.php | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php
index 555898370f863..d0fcdeb52a3c6 100644
--- a/src/wp-includes/class-wp-theme-json.php
+++ b/src/wp-includes/class-wp-theme-json.php
@@ -394,13 +394,18 @@ class WP_Theme_JSON {
/**
* Defines which pseudo selectors are enabled for which elements.
*
+ * The order of the selectors should be: visited, hover, focus, active.
+ * This is to ensure that 'visited' has the lowest specificity
+ * and the other selectors can always overwrite it.
+ *
+ * See https://core.trac.wordpress.org/ticket/56928.
* Note: this will affect both top-level and block-level elements.
*
* @since 6.1.0
*/
const VALID_ELEMENT_PSEUDO_SELECTORS = array(
- 'link' => array( ':hover', ':focus', ':active', ':visited' ),
- 'button' => array( ':hover', ':focus', ':active', ':visited' ),
+ 'link' => array( ':visited', ':hover', ':focus', ':active' ),
+ 'button' => array( ':visited', ':hover', ':focus', ':active' ),
);
/**
From dec912b680a3187683b5caf4259a1f5e1f294d94 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 9 Nov 2022 09:17:16 +0000
Subject: [PATCH 0018/1431] Docs: Replace HTTP links with HTTPS in
`class-pop3.php` docblocks and JS vendor readme file.
Props rajeshraval786, hiren1094.
See #57017, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54775 602fd350-edb4-49c9-b593-d223f7449a82
---
src/js/_enqueues/vendor/README.md | 2 +-
src/wp-includes/class-pop3.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/js/_enqueues/vendor/README.md b/src/js/_enqueues/vendor/README.md
index 41503296ab0a5..4764f0b808e94 100644
--- a/src/js/_enqueues/vendor/README.md
+++ b/src/js/_enqueues/vendor/README.md
@@ -11,7 +11,7 @@ In this directory you'll find vendor JavaScript packages that cannot be installe
- mediaelement: https://github.com/mediaelement/mediaelement
- plupload: https://github.com/moxiecode/plupload
- swfupload: https://github.com/WordPress/secure-swfupload
-- thickbox: http://codylindley.com/thickbox/
+- thickbox: https://codylindley.com/thickbox/
- tinymce: https://www.tiny.cloud/get-tiny/self-hosted/
- Download "TinyMCE Dev Package". This package is needed because it includes
the `compat3x` plugin.
diff --git a/src/wp-includes/class-pop3.php b/src/wp-includes/class-pop3.php
index 3c89fe50669d8..767b74391298e 100644
--- a/src/wp-includes/class-pop3.php
+++ b/src/wp-includes/class-pop3.php
@@ -11,7 +11,7 @@
* POP3 class
*
* @copyright 1999-2011 The SquirrelMail Project Team
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @license https://opensource.org/licenses/gpl-license.php GNU Public License
* @package plugins
* @subpackage mail_fetch
*/
From 74fb46b54dcc416937cdd3ecc43d78fafe850346 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 9 Nov 2022 09:49:51 +0000
Subject: [PATCH 0019/1431] Docs: Fix `block_editor_rest_api_preload()`
parameter type.
This changeset fixes the `$preload_paths` parameter type for `block_editor_rest_api_preload()` and related hooks. This parameter expects an array of strings OR an array where the path is the first element (index 0) of this array.
Props chouby.
Fixes #56810.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54776 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-editor.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php
index 901ba21a3f282..7af9f2a90062a 100644
--- a/src/wp-includes/block-editor.php
+++ b/src/wp-includes/block-editor.php
@@ -571,7 +571,7 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
*
- * @param string[] $preload_paths List of paths to preload.
+ * @param (string|string[])[] $preload_paths List of paths to preload.
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
*/
function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) {
@@ -582,7 +582,7 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
*
* @since 5.8.0
*
- * @param string[] $preload_paths Array of paths to preload.
+ * @param (string|string[])[] $preload_paths Array of paths to preload.
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
*/
$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );
@@ -598,8 +598,8 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
* @since 5.0.0
* @deprecated 5.8.0 Use the {@see 'block_editor_rest_api_preload_paths'} filter instead.
*
- * @param string[] $preload_paths Array of paths to preload.
- * @param WP_Post $selected_post Post being edited.
+ * @param (string|string[])[] $preload_paths Array of paths to preload.
+ * @param WP_Post $selected_post Post being edited.
*/
$preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' );
}
From 3d5454875ba02936d20ef5fc67d5cb55d7eefebe Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Wed, 9 Nov 2022 10:25:54 +0000
Subject: [PATCH 0020/1431] Coding Standards: Use consistent spelling for
"cacheable" in `WP_Query::get_posts()`.
Follow-up to [53941], [54768].
See #57012.
git-svn-id: https://develop.svn.wordpress.org/trunk@54777 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-query.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
index 1e695bd0525a0..1a9baa21cac77 100644
--- a/src/wp-includes/class-wp-query.php
+++ b/src/wp-includes/class-wp-query.php
@@ -3110,13 +3110,13 @@ public function get_posts() {
*/
$id_query_is_cacheable = ! str_contains( strtoupper( $orderby ), ' RAND(' );
- $cachable_field_values = array(
+ $cacheable_field_values = array(
"{$wpdb->posts}.*",
"{$wpdb->posts}.ID, {$wpdb->posts}.post_parent",
"{$wpdb->posts}.ID",
);
- if ( ! in_array( $fields, $cachable_field_values, true ) ) {
+ if ( ! in_array( $fields, $cacheable_field_values, true ) ) {
$id_query_is_cacheable = false;
}
From 19d5bd0787c9daf1d8a67bf5c0a3e997abf1f89a Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Thu, 10 Nov 2022 00:44:10 +0000
Subject: [PATCH 0021/1431] Posts, Post Types: Revert `get_page_by_title()`'s
use of `WP_Query`.
Revert to legacy database query in `get_pages_by_title()`. Due to the lack of `orderby` clause in the previous database query, it is not possible to gain consistent results by converting the function to a `WP_Query` wrapper.
Reverts [54271, 54242, 54234].
Props Bjorn2404, 10upsimon, dilipbheda, mukesh27, spacedmonkey, TimothyBlynJacobs, rjasdfiii, stentibbing, pbiron, pento.
Fixes #57039, #56991.
See #57041.
git-svn-id: https://develop.svn.wordpress.org/trunk@54782 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/post.php | 49 ++-
tests/phpunit/tests/post/getPageByTitle.php | 340 --------------------
2 files changed, 33 insertions(+), 356 deletions(-)
delete mode 100644 tests/phpunit/tests/post/getPageByTitle.php
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 6a7c637831328..381ee526b48a2 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -5766,6 +5766,8 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
* @since 2.1.0
* @since 3.0.0 The `$post_type` parameter was added.
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param string $page_title Page title.
* @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
* correspond to a WP_Post object, an associative array, or a numeric array,
@@ -5774,25 +5776,40 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
* @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
*/
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
- $args = array(
- 'title' => $page_title,
- 'post_type' => $post_type,
- 'post_status' => get_post_stati(),
- 'posts_per_page' => 1,
- 'update_post_term_cache' => false,
- 'update_post_meta_cache' => false,
- 'no_found_rows' => true,
- 'orderby' => 'post_date ID',
- 'order' => 'ASC',
- );
- $query = new WP_Query( $args );
- $pages = $query->posts;
+ global $wpdb;
- if ( empty( $pages ) ) {
- return null;
+ if ( is_array( $post_type ) ) {
+ $post_type = esc_sql( $post_type );
+ $post_type_in_string = "'" . implode( "','", $post_type ) . "'";
+ $sql = $wpdb->prepare(
+ "
+ SELECT ID
+ FROM $wpdb->posts
+ WHERE post_title = %s
+ AND post_type IN ($post_type_in_string)
+ ",
+ $page_title
+ );
+ } else {
+ $sql = $wpdb->prepare(
+ "
+ SELECT ID
+ FROM $wpdb->posts
+ WHERE post_title = %s
+ AND post_type = %s
+ ",
+ $page_title,
+ $post_type
+ );
}
- return get_post( $pages[0], $output );
+ $page = $wpdb->get_var( $sql );
+
+ if ( $page ) {
+ return get_post( $page, $output );
+ }
+
+ return null;
}
/**
diff --git a/tests/phpunit/tests/post/getPageByTitle.php b/tests/phpunit/tests/post/getPageByTitle.php
deleted file mode 100644
index 1c94987d5ff20..0000000000000
--- a/tests/phpunit/tests/post/getPageByTitle.php
+++ /dev/null
@@ -1,340 +0,0 @@
-post->create_many(
- 2,
- array(
- 'post_type' => 'page',
- )
- );
-
- // Fill the database with some attachments.
- $factory->post->create_many(
- 2,
- array(
- 'post_type' => 'attachment',
- )
- );
-
- // Fill the database with some test post types.
- register_post_type( 'wptests_pt' );
- $factory->post->create_many(
- 2,
- array(
- 'post_type' => 'wptests_pt',
- )
- );
- }
-
- /**
- * @ticket 36905
- */
- public function test_get_page_by_title_priority() {
- $attachment = self::factory()->post->create_and_get(
- array(
- 'post_title' => 'some-other-page',
- 'post_type' => 'attachment',
- )
- );
- $page = self::factory()->post->create_and_get(
- array(
- 'post_title' => 'some-page',
- 'post_type' => 'page',
- )
- );
-
- $this->assertEquals( $page, get_page_by_title( 'some-page' ), 'should return a post of the requested type before returning an attachment.' );
-
- $this->assertEquals( $attachment, get_page_by_title( 'some-other-page', OBJECT, 'attachment' ), "will still select an attachment when a post of the requested type doesn't exist." );
- }
-
- /**
- * @ticket 36905
- */
- public function test_should_match_top_level_page() {
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- )
- );
-
- $found = get_page_by_title( 'foo' );
-
- $this->assertSame( $page, $found->ID );
- }
-
- /**
- * @ticket 36905
- * @ticket 56609
- */
- public function test_should_be_case_insensitive_match() {
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'Foo',
- )
- );
-
- $found = get_page_by_title( 'foo' );
-
- $this->assertSame( $page, $found->ID );
- }
-
- /**
- * Test the oldest published post is matched first.
- *
- * Per the docs: in case of more than one post having the same title,
- * it will check the oldest publication date, not the smallest ID.
- *
- * @ticket 36905
- * @ticket 56609
- */
- public function test_should_match_oldest_published_date_when_titles_match() {
- self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- )
- );
-
- $old_page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- 'post_date' => '1984-01-11 05:00:00',
- )
- );
-
- $found = get_page_by_title( 'foo' );
-
- $this->assertSame( $old_page, $found->ID );
- }
-
- /**
- * @ticket 36905
- */
- public function test_inherit() {
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- 'post_status' => 'inherit',
- )
- );
-
- $found = get_page_by_title( 'foo' );
-
- $this->assertSame( $page, $found->ID );
- }
-
- /**
- * @ticket 36905
- */
- public function test_should_obey_post_type() {
- register_post_type( 'wptests_pt' );
-
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'wptests_pt',
- 'post_title' => 'foo',
- )
- );
-
- $found = get_page_by_title( 'foo' );
- $this->assertNull( $found, 'Should return null, as post type does not match' );
-
- $found = get_page_by_title( 'foo', OBJECT, 'wptests_pt' );
- $this->assertSame( $page, $found->ID, 'Should return find post, as post type does do match' );
- }
-
-
- /**
- * @ticket 36905
- */
- public function test_should_hit_cache() {
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- )
- );
-
- // Prime cache.
- $found = get_page_by_title( 'foo' );
- $this->assertSame( $page, $found->ID, 'Should return find page.' );
-
- $num_queries = get_num_queries();
-
- $found = get_page_by_title( 'foo' );
- $this->assertSame( $page, $found->ID, 'Should return find page on second run.' );
- $this->assertSame( $num_queries, get_num_queries(), 'Should not result in another database query.' );
- }
-
- /**
- * @ticket 36905
- */
- public function test_bad_title_should_be_cached() {
- // Prime cache.
- $found = get_page_by_title( 'foo' );
- $this->assertNull( $found, 'Should return not find a page.' );
-
- $num_queries = get_num_queries();
-
- $found = get_page_by_title( 'foo' );
- $this->assertNull( $found, 'Should return not find a page on second run.' );
- $this->assertSame( $num_queries, get_num_queries(), 'Should not result in another database query.' );
- }
-
- /**
- * @ticket 36905
- */
- public function test_bad_title_served_from_cache_should_not_fall_back_on_current_post() {
- global $post;
-
- // Fake the global.
- $post = self::factory()->post->create_and_get();
-
- // Prime cache.
- $found = get_page_by_title( 'foo' );
- $this->assertNull( $found, 'Should return not find a page.' );
-
- $num_queries = get_num_queries();
-
- $found = get_page_by_title( 'foo' );
- $this->assertNull( $found, 'Should return not find a page on second run.' );
- $this->assertSame( $num_queries, get_num_queries(), 'Should not result in another database query.' );
- }
-
- /**
- * @ticket 36905
- */
- public function test_cache_should_not_match_post_in_different_post_type_with_same_title() {
- register_post_type( 'wptests_pt' );
-
- $p1 = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- )
- );
-
- $p2 = self::factory()->post->create(
- array(
- 'post_type' => 'wptests_pt',
- 'post_title' => 'foo',
- )
- );
-
- // Prime cache for the page.
- $found = get_page_by_title( 'foo' );
- $this->assertSame( $p1, $found->ID, 'Should find a page.' );
-
- $num_queries = get_num_queries();
-
- $found = get_page_by_title( 'foo', OBJECT, 'wptests_pt' );
- $this->assertSame( $p2, $found->ID, 'Should find a post with post type wptests_pt.' );
- ++$num_queries;
- $this->assertSame( $num_queries, get_num_queries(), 'Should result in another database query.' );
- }
-
- /**
- * @ticket 36905
- */
- public function test_cache_should_be_invalidated_when_post_title_is_edited() {
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- )
- );
-
- // Prime cache.
- $found = get_page_by_title( 'foo' );
- $this->assertSame( $page, $found->ID, 'Should find a page.' );
-
- wp_update_post(
- array(
- 'ID' => $page,
- 'post_title' => 'bar',
- )
- );
-
- $num_queries = get_num_queries();
-
- $found = get_page_by_title( 'bar' );
- $this->assertSame( $page, $found->ID, 'Should find a page with the new title.' );
- ++$num_queries;
- $this->assertSame( $num_queries, get_num_queries(), 'Should result in another database query.' );
- }
-
- /**
- * @ticket 36905
- */
- public function test_output_param_should_be_obeyed_for_cached_value() {
- $page = self::factory()->post->create(
- array(
- 'post_type' => 'page',
- 'post_title' => 'foo',
- )
- );
-
- // Prime cache.
- $found = get_page_by_title( 'foo' );
-
- $num_queries = get_num_queries();
- $this->assertSame( $page, $found->ID, 'Should find a page.' );
-
- $object = get_page_by_title( 'foo', OBJECT );
- $this->assertIsObject( $object, 'Should be an object.' );
- $this->assertSame( $page, $object->ID, 'Should match post id.' );
- $this->assertSame( $num_queries, get_num_queries(), 'Should not result in another database query.' );
-
- $array_n = get_page_by_title( 'foo', ARRAY_N );
- ++$num_queries; // Add one database query for loading of post metadata.
- $this->assertIsArray( $array_n, 'Should be numbric array.' );
- $this->assertSame( $page, $array_n[0], 'Should match post id.' );
- $this->assertSame( $num_queries, get_num_queries(), 'Should not result in another database query.' );
-
- $array_a = get_page_by_title( 'foo', ARRAY_A );
- $this->assertIsArray( $array_a, 'Should be associative array.' );
- $this->assertSame( $page, $array_a['ID'], 'Should match post id.' );
- $this->assertSame( $num_queries, get_num_queries(), 'Should not result in another database query.' );
- }
-
- /**
- * Ensure get_page_by_title() only runs the query once.
- *
- * @ticket 56721
- * @covers ::get_page_by_title
- */
- public function test_should_not_run_query_more_than_once() {
- $page = self::factory()->post->create_and_get(
- array(
- 'post_title' => 'some-page',
- 'post_type' => 'page',
- )
- );
-
- // Use the `pre_get_posts` hook to ensure the query is only run once.
- $ma = new MockAction();
- add_action( 'pre_get_posts', array( $ma, 'action' ) );
-
- get_page_by_title( 'some-page' );
- $this->assertSame( 1, $ma->get_call_count(), 'Query does not run exactly once.' );
- }
-}
From b9304148f17278dbe9a4199a1143b083188f0d61 Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Thu, 10 Nov 2022 02:59:56 +0000
Subject: [PATCH 0022/1431] Canonical: Protect against error for term not
exists queries.
Prevent term `NOT EXISTS` queries causing `redirect_canonical()` to throw a fatal error in PHP 8 and above, or a warning in earlier versions.
This ensures the `tax_query`'s `terms` property both exists and is countable before attempting to count it.
Props codesdnc, SergeyBiryukov, kadamwhite, costdev, miguelaxcar.
Fixes #55955.
git-svn-id: https://develop.svn.wordpress.org/trunk@54785 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/canonical.php | 4 +++-
tests/phpunit/tests/canonical.php | 27 +++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
index 9404ed6ea5d24..5e8efb0bae644 100644
--- a/src/wp-includes/canonical.php
+++ b/src/wp-includes/canonical.php
@@ -331,7 +331,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
$term_count = 0;
foreach ( $wp_query->tax_query->queried_terms as $tax_query ) {
- $term_count += count( $tax_query['terms'] );
+ if ( isset( $tax_query['terms'] ) && is_countable( $tax_query['terms'] ) ) {
+ $term_count += count( $tax_query['terms'] );
+ }
}
$obj = $wp_query->get_queried_object();
diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php
index 63e5c4078bb51..6d16402112c21 100644
--- a/tests/phpunit/tests/canonical.php
+++ b/tests/phpunit/tests/canonical.php
@@ -375,4 +375,31 @@ public function test_utf8_query_keys_canonical() {
delete_option( 'page_on_front' );
}
+
+ /**
+ * Ensure NOT EXISTS queries do not trigger not-countable or undefined array key errors.
+ *
+ * @ticket 55955
+ */
+ public function test_feed_canonical_with_not_exists_query() {
+ // Set a NOT EXISTS tax_query on the global query.
+ $global_query = $GLOBALS['wp_query'];
+ $GLOBALS['wp_query'] = new WP_Query(
+ array(
+ 'post_type' => 'post',
+ 'tax_query' => array(
+ array(
+ 'taxonomy' => 'post_format',
+ 'operator' => 'NOT EXISTS',
+ ),
+ ),
+ )
+ );
+
+ $url = redirect_canonical( get_term_feed_link( self::$terms['/category/parent/'] ), false );
+ // Restore original global.
+ $GLOBALS['wp_query'] = $global_query;
+
+ $this->assertNull( $url );
+ }
}
From 2e375d47908ab85633cbe001ae7fa23d0b5fab6e Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 10 Nov 2022 09:38:58 +0000
Subject: [PATCH 0023/1431] Text Changes: Replace "Full site editing" with
"Site Editor".
This changeset replaces the various occurrences of "Full site editing" with "Site Editor" as it is the new official name of the feature.
For more background about this change, see https://make.wordpress.org/updates/2022/11/04/site-editor-a-more-user-friendly-name/.
Props audrasjb, peterwilsoncc, poena.
Fixes #57026.
git-svn-id: https://develop.svn.wordpress.org/trunk@54786 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/about.php | 2 +-
src/wp-admin/includes/theme.php | 3 ++-
src/wp-admin/site-editor.php | 2 +-
src/wp-content/themes/twentytwentytwo/readme.txt | 2 +-
src/wp-content/themes/twentytwentytwo/style.css | 2 +-
src/wp-includes/block-template.php | 2 +-
src/wp-includes/script-loader.php | 2 +-
7 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/wp-admin/about.php b/src/wp-admin/about.php
index 87e321d00b41b..4fff85d2a34b5 100644
--- a/src/wp-admin/about.php
+++ b/src/wp-admin/about.php
@@ -214,7 +214,7 @@
a filter for block themes, 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/' ) )
);
diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php
index 020927a154960..3d88d94178f0a 100644
--- a/src/wp-admin/includes/theme.php
+++ b/src/wp-admin/includes/theme.php
@@ -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.2.0 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.
@@ -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' ),
diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php
index 64ed4b9c27cad..d2880b0a4f271 100644
--- a/src/wp-admin/site-editor.php
+++ b/src/wp-admin/site-editor.php
@@ -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'] );
diff --git a/src/wp-content/themes/twentytwentytwo/readme.txt b/src/wp-content/themes/twentytwentytwo/readme.txt
index 20663b579f56c..72f079badfbbd 100644
--- a/src/wp-content/themes/twentytwentytwo/readme.txt
+++ b/src/wp-content/themes/twentytwentytwo/readme.txt
@@ -11,7 +11,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
Built on a solidly designed foundation, Twenty Twenty-Two embraces the idea that everyone deserves a truly unique website. The theme’s subtle styles are inspired by the diversity and versatility of birds: its typography is lightweight yet strong, its color palette is drawn from nature, and its layout elements sit gently on the page.
-The true richness of Twenty Twenty-Two lies in its opportunity for customization. The theme is built to take advantage of the Full Site Editing features introduced in WordPress 5.9, which means that colors, typography, and the layout of every single page on your site can be customized to suit your vision. It also includes dozens of block patterns, opening the door to a wide range of professionally designed layouts in just a few clicks.
+The true richness of Twenty Twenty-Two lies in its opportunity for customization. The theme is built to take advantage of the Site Editor features introduced in WordPress 5.9, which means that colors, typography, and the layout of every single page on your site can be customized to suit your vision. It also includes dozens of block patterns, opening the door to a wide range of professionally designed layouts in just a few clicks.
Whether you’re building a single-page website, a blog, a business website, or a portfolio, Twenty Twenty-Two will help you create a site that is uniquely yours.
diff --git a/src/wp-content/themes/twentytwentytwo/style.css b/src/wp-content/themes/twentytwentytwo/style.css
index 0f46424d18c3a..f611fad6c141a 100644
--- a/src/wp-content/themes/twentytwentytwo/style.css
+++ b/src/wp-content/themes/twentytwentytwo/style.css
@@ -3,7 +3,7 @@ Theme Name: Twenty Twenty-Two
Theme URI: https://wordpress.org/themes/twentytwentytwo/
Author: the WordPress team
Author URI: https://wordpress.org/
-Description: Built on a solidly designed foundation, Twenty Twenty-Two embraces the idea that everyone deserves a truly unique website. The theme’s subtle styles are inspired by the diversity and versatility of birds: its typography is lightweight yet strong, its color palette is drawn from nature, and its layout elements sit gently on the page. The true richness of Twenty Twenty-Two lies in its opportunity for customization. The theme is built to take advantage of the Full Site Editing features introduced in WordPress 5.9, which means that colors, typography, and the layout of every single page on your site can be customized to suit your vision. It also includes dozens of block patterns, opening the door to a wide range of professionally designed layouts in just a few clicks. Whether you’re building a single-page website, a blog, a business website, or a portfolio, Twenty Twenty-Two will help you create a site that is uniquely yours.
+Description: Built on a solidly designed foundation, Twenty Twenty-Two embraces the idea that everyone deserves a truly unique website. The theme’s subtle styles are inspired by the diversity and versatility of birds: its typography is lightweight yet strong, its color palette is drawn from nature, and its layout elements sit gently on the page. The true richness of Twenty Twenty-Two lies in its opportunity for customization. The theme is built to take advantage of the Site Editor features introduced in WordPress 5.9, which means that colors, typography, and the layout of every single page on your site can be customized to suit your vision. It also includes dozens of block patterns, opening the door to a wide range of professionally designed layouts in just a few clicks. Whether you’re building a single-page website, a blog, a business website, or a portfolio, Twenty Twenty-Two will help you create a site that is uniquely yours.
Requires at least: 5.9
Tested up to: 6.1
Requires PHP: 5.6
diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php
index 0aa571117e899..38d8e2b729773 100644
--- a/src/wp-includes/block-template.php
+++ b/src/wp-includes/block-template.php
@@ -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;
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index f22928dba1cda..956d4338efbd9 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -1287,7 +1287,7 @@ function wp_default_scripts( $scripts ) {
'invalidValue' => __( 'Invalid value.' ),
'blockThemeNotification' => sprintf(
/* translators: 1: Link to Site Editor documentation on HelpHub, 2: HTML button. */
- __( 'Hurray! Your theme supports Full Site Editing with blocks. Tell me more. %2$s' ),
+ __( 'Hurray! Your theme supports Site Editing with blocks. Tell me more. %2$s' ),
__( 'https://wordpress.org/support/article/site-editor/' ),
sprintf(
'',
From 27760044b352e03d9d8d09f12a99272184094406 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 10 Nov 2022 11:31:15 +0000
Subject: [PATCH 0024/1431] Text Changes: Remove capitalization on "site
editing".
Follow-up to [54786].
Props ocean90.
See #57026.
git-svn-id: https://develop.svn.wordpress.org/trunk@54787 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/script-loader.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 956d4338efbd9..27defd0659460 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -1287,7 +1287,7 @@ function wp_default_scripts( $scripts ) {
'invalidValue' => __( 'Invalid value.' ),
'blockThemeNotification' => sprintf(
/* translators: 1: Link to Site Editor documentation on HelpHub, 2: HTML button. */
- __( 'Hurray! Your theme supports Site Editing with blocks. Tell me more. %2$s' ),
+ __( 'Hurray! Your theme supports site editing with blocks. Tell me more. %2$s' ),
__( 'https://wordpress.org/support/article/site-editor/' ),
sprintf(
'',
From 7dc6546df9e39c32cee7e0c4e78d44030625e33c Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 10 Nov 2022 12:08:49 +0000
Subject: [PATCH 0025/1431] Text Changes: Update `@since` mentions for [54786]
changes.
This updates the `@since` mention of `get_theme_feature_list()` as this changeset is going to be backported to 6.1.1.
Follow-up to [54786].
See #57026.
git-svn-id: https://develop.svn.wordpress.org/trunk@54788 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/theme.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php
index 3d88d94178f0a..6fe18cdff1f2e 100644
--- a/src/wp-admin/includes/theme.php
+++ b/src/wp-admin/includes/theme.php
@@ -299,7 +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.2.0 Replaced 'Full Site Editing' feature name with 'Site Editor'.
+ * @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.
From 551c3d6619b7e88742911ca2dd3aed77a71cb0dc Mon Sep 17 00:00:00 2001
From: Tonya Mork
Date: Thu, 10 Nov 2022 12:20:48 +0000
Subject: [PATCH 0026/1431] Update/Install: Deactivate Gutenberg plugin version
older than 14.1.
Resolves a fatal error due to `get_template_hierarchy()` due to incompatible older Gutenberg versions.
[54269] introduced this new function for 6.1. The function was introduced in Gutenberg 13.9.0. However, it was not guarded to protect the plugin from when the function was loaded in Core. Gutenberg 14.1.0 added the `function_exists()` guard to protect the plugin from the fatal error.
Minimum compatible version:
This commit changes the Gutenberg minimum compatible version number to 14.1. For versions older than 14.1, the plugin will deactivate when upgrading Core to 6.1 or newer.
Function rename:
Past commits renamed the upgrade function by changing Core's version number. This commit renames the function to be generic, i.e. `_upgrade_core_deactivate_incompatible_plugins()` and adopts the `@since [reason]` strategy to track historical changes to the function.
Follow-up to [54269], [52199], [52166], [52165], [51180].
Props namithjawahar, hellofromTonya, azaozz, desrosj, ironprogrammer.
Fixes #56985.
git-svn-id: https://develop.svn.wordpress.org/trunk@54789 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/update-core.php | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index af7ae29d7238a..85a4f48332fd4 100644
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -1437,8 +1437,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 */
@@ -1637,14 +1637,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() );
From 302ba4f45f96490f5947f324228f20e0cbe28583 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 10 Nov 2022 13:05:57 +0000
Subject: [PATCH 0027/1431] Tests: Correct the test for
`get_blogaddress_by_id()` with a non-existing ID.
Due to auto-increment, when running various test groups or classes separately, in this case running all of the tests under `phpunit/tests/multisite/` by including the `--filter Tests_Multisite` parameter, it is entirely possible for the blog ID 42 to actually exist, making the test's assumption incorrect.
By using `PHP_INT_MAX` instead, we can avoid a collision with a fixture of another test.
Follow-up to [31157].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54791 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/multisite/site.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 990003cde9c48..6507fbbf22de3 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -687,10 +687,10 @@ public function test_get_blogaddress_by_id_with_valid_id() {
}
/**
- * Tests returning the appropriate response for a invalid id given.
+ * Tests returning an empty string for a non-existing ID.
*/
public function test_get_blogaddress_by_id_with_invalid_id() {
- $blogaddress = get_blogaddress_by_id( 42 );
+ $blogaddress = get_blogaddress_by_id( PHP_INT_MAX );
$this->assertSame( '', $blogaddress );
}
From e180b742cef7b5624d9f99a7e049304c51c494b7 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 10 Nov 2022 17:14:43 +0000
Subject: [PATCH 0028/1431] Docs: Improve globals documentation in
`unregister_taxonomy()` and `wp_term_is_shared()`.
Props upadalavipul, mukesh27.
Fixes #57058.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54794 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/taxonomy.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 1dfcf4d9c5278..be19a141486d2 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -558,7 +558,6 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
*
* @since 4.5.0
*
- * @global WP $wp Current WordPress environment instance.
* @global WP_Taxonomy[] $wp_taxonomies List of taxonomies.
*
* @param string $taxonomy Taxonomy name.
@@ -4522,6 +4521,8 @@ function wp_get_split_term( $old_term_id, $taxonomy ) {
*
* @since 4.4.0
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param int $term_id Term ID.
* @return bool Returns false if a term is not shared between multiple taxonomies or
* if splitting shared taxonomy terms is finished.
From 1ab43acf4b50b406c48caf43e366cf95afea911c Mon Sep 17 00:00:00 2001
From: Dominik Schilling
Date: Thu, 10 Nov 2022 19:38:20 +0000
Subject: [PATCH 0029/1431] I18N: Always pass `$locale` to `load_textdomain()`.
In [53874] the optional `$locale` parameter was added to `load_textdomain()`. While most `load_textdomain()` calls in core were were updated, some were missed. Passing the original locale avoids the need to call `determine_locale()` by `load_textdomain()` which is used as a fallback.
Props ocean90, swissspidy, desrosj.
See #57060.
git-svn-id: https://develop.svn.wordpress.org/trunk@54797 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/admin.php | 4 +++-
src/wp-includes/functions.php | 2 +-
src/wp-includes/load.php | 4 ++--
.../endpoints/class-wp-rest-site-health-controller.php | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/wp-admin/includes/admin.php b/src/wp-admin/includes/admin.php
index c2c1890ec864c..ce2ec0c68b855 100644
--- a/src/wp-admin/includes/admin.php
+++ b/src/wp-admin/includes/admin.php
@@ -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 */
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 8e14894f8b079..a38c78ccacae0 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -6351,7 +6351,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
$locale_loaded = $locale ? $locale : get_locale();
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo';
unload_textdomain( 'continents-cities' );
- load_textdomain( 'continents-cities', $mofile );
+ load_textdomain( 'continents-cities', $mofile, $locale_loaded );
$mo_loaded = true;
}
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index 4986603e9ea77..bb0db65b942b8 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -1392,9 +1392,9 @@ function wp_load_translations_early() {
foreach ( $locales as $locale ) {
foreach ( $locations as $location ) {
if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
- load_textdomain( 'default', $location . '/' . $locale . '.mo' );
+ load_textdomain( 'default', $location . '/' . $locale . '.mo', $locale );
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) {
- load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
+ load_textdomain( 'default', $location . '/admin-' . $locale . '.mo', $locale );
}
break 2;
}
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php
index 954165b825866..43e6676eff0ea 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php
@@ -336,7 +336,7 @@ protected function load_admin_textdomain() {
// Accounts for inner REST API requests in the admin.
if ( ! is_admin() ) {
$locale = determine_locale();
- load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
+ load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
}
}
From 8368eef8e00e3f9ab8a2bf2ca7093b07e05040b5 Mon Sep 17 00:00:00 2001
From: Felix Arntz
Date: Thu, 10 Nov 2022 22:14:53 +0000
Subject: [PATCH 0030/1431] Editor: Avoid running certain logic around
`theme.json` parsing unnecessarily for classic themes.
Here's what it does:
* Do not load and parse `theme-i18n.json` schema if the theme does not have a `theme.json` file.
* Fix the variable caching layer around the theme's `theme.json` parsing so that a parent's theme `theme.json` is cached as well.
* Do not run a `WP_Query` for global styles for a user when the theme does not have a `theme.json`.
In a basic WordPress setup, this changeset improves `wp_head` execution time for classic themes by 10%, and overall response time for both block themes and classic themes by 4%. This may seem like a small win, but 4% reduced overall response time is actually quite a bit for one change, and it is worth mentioning that this is just one of several other little performance tweaks which are being worked on to improve performance of `theme.json` parsing further.
Props flixos90, manuilov, oandregal, peterwilsoncc, spacedmonkey.
Fixes #56945.
git-svn-id: https://develop.svn.wordpress.org/trunk@54799 602fd350-edb4-49c9-b593-d223f7449a82
---
.../class-wp-theme-json-resolver.php | 54 ++++++----
src/wp-includes/class-wp-theme-json.php | 3 +-
.../tests/theme/wpThemeJsonResolver.php | 98 ++++++++++++++-----
3 files changed, 112 insertions(+), 43 deletions(-)
diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php
index cf14486f6770d..c166283af30f1 100644
--- a/src/wp-includes/class-wp-theme-json-resolver.php
+++ b/src/wp-includes/class-wp-theme-json-resolver.php
@@ -246,8 +246,13 @@ public static function get_theme_data( $deprecated = array(), $options = array()
$options = wp_parse_args( $options, array( 'with_supports' => true ) );
if ( null === static::$theme || ! static::has_same_registered_blocks( 'theme' ) ) {
- $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) );
- $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) );
+ $theme_json_file = static::get_file_path_from_theme( 'theme.json' );
+ if ( '' !== $theme_json_file ) {
+ $theme_json_data = static::read_json_file( $theme_json_file );
+ $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) );
+ } else {
+ $theme_json_data = array();
+ }
/**
* Filters the data provided by the theme for global styles and settings.
@@ -259,20 +264,23 @@ public static function get_theme_data( $deprecated = array(), $options = array()
$theme_json = apply_filters( 'wp_theme_json_data_theme', new WP_Theme_JSON_Data( $theme_json_data, 'theme' ) );
$theme_json_data = $theme_json->get_data();
static::$theme = new WP_Theme_JSON( $theme_json_data );
- }
-
- if ( wp_get_theme()->parent() ) {
- // Get parent theme.json.
- $parent_theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json', true ) );
- $parent_theme_json_data = static::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) );
- $parent_theme = new WP_Theme_JSON( $parent_theme_json_data );
- /*
- * Merge the child theme.json into the parent theme.json.
- * The child theme takes precedence over the parent.
- */
- $parent_theme->merge( static::$theme );
- static::$theme = $parent_theme;
+ if ( wp_get_theme()->parent() ) {
+ // Get parent theme.json.
+ $parent_theme_json_file = static::get_file_path_from_theme( 'theme.json', true );
+ if ( '' !== $parent_theme_json_file ) {
+ $parent_theme_json_data = static::read_json_file( $parent_theme_json_file );
+ $parent_theme_json_data = static::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) );
+ $parent_theme = new WP_Theme_JSON( $parent_theme_json_data );
+
+ /*
+ * Merge the child theme.json into the parent theme.json.
+ * The child theme takes precedence over the parent.
+ */
+ $parent_theme->merge( static::$theme );
+ static::$theme = $parent_theme;
+ }
+ }
}
if ( ! $options['with_supports'] ) {
@@ -403,6 +411,18 @@ public static function get_user_data_from_wp_global_styles( $theme, $create_post
if ( ! $theme instanceof WP_Theme ) {
$theme = wp_get_theme();
}
+
+ /*
+ * Bail early if the theme does not support a theme.json.
+ *
+ * Since WP_Theme_JSON_Resolver::theme_has_support() only supports the active
+ * theme, the extra condition for whether $theme is the active theme is
+ * present here.
+ */
+ if ( $theme->get_stylesheet() === get_stylesheet() && ! static::theme_has_support() ) {
+ return array();
+ }
+
$user_cpt = array();
$post_type_filter = 'wp_global_styles';
$stylesheet = $theme->get_stylesheet();
@@ -582,8 +602,8 @@ public static function get_user_global_styles_post_id() {
public static function theme_has_support() {
if ( ! isset( static::$theme_has_support ) ) {
static::$theme_has_support = (
- is_readable( static::get_file_path_from_theme( 'theme.json' ) ) ||
- is_readable( static::get_file_path_from_theme( 'theme.json', true ) )
+ static::get_file_path_from_theme( 'theme.json' ) !== '' ||
+ static::get_file_path_from_theme( 'theme.json', true ) !== ''
);
}
diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php
index d0fcdeb52a3c6..df5bd20d84917 100644
--- a/src/wp-includes/class-wp-theme-json.php
+++ b/src/wp-includes/class-wp-theme-json.php
@@ -2939,7 +2939,8 @@ public function get_data() {
public function set_spacing_sizes() {
$spacing_scale = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'spacingScale' ), array() );
- if ( ! is_numeric( $spacing_scale['steps'] )
+ if ( ! isset( $spacing_scale['steps'] )
+ || ! is_numeric( $spacing_scale['steps'] )
|| ! isset( $spacing_scale['mediumStep'] )
|| ! isset( $spacing_scale['unit'] )
|| ! isset( $spacing_scale['operator'] )
diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
index 524fade2d8f85..1cbc519255cf4 100644
--- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php
+++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
@@ -33,13 +33,6 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
*/
private $orig_theme_dir;
- /**
- * Queries.
- *
- * @var array
- */
- private $queries = array();
-
/**
* WP_Theme_JSON_Resolver::$blocks_cache property.
*
@@ -105,7 +98,7 @@ public function set_up() {
add_filter( 'theme_root', array( $this, 'filter_set_theme_root' ) );
add_filter( 'stylesheet_root', array( $this, 'filter_set_theme_root' ) );
add_filter( 'template_root', array( $this, 'filter_set_theme_root' ) );
- $this->queries = array();
+
// Clear caches.
wp_clean_themes_cache();
unset( $GLOBALS['wp_themes'] );
@@ -129,13 +122,6 @@ public function filter_set_locale_to_polish() {
return 'pl_PL';
}
- function filter_db_query( $query ) {
- if ( preg_match( '#post_type = \'wp_global_styles\'#', $query ) ) {
- $this->queries[] = $query;
- }
- return $query;
- }
-
/**
* @ticket 52991
* @ticket 54336
@@ -634,17 +620,26 @@ function test_merges_child_theme_json_into_parent_theme_json() {
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries() {
+ // Switch to a theme that does have support.
+ switch_theme( 'block-theme' );
wp_set_current_user( self::$administrator_id );
$theme = wp_get_theme();
WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
- add_filter( 'query', array( $this, 'filter_db_query' ) );
- $query_count = count( $this->queries );
+ $global_styles_query_count = 0;
+ add_filter(
+ 'query',
+ function( $query ) use ( &$global_styles_query_count ) {
+ if ( preg_match( '#post_type = \'wp_global_styles\'#', $query ) ) {
+ $global_styles_query_count++;
+ }
+ return $query;
+ }
+ );
for ( $i = 0; $i < 3; $i++ ) {
WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
WP_Theme_JSON_Resolver::clean_cached_data();
}
- $query_count = count( $this->queries ) - $query_count;
- $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type prior to creation.' );
+ $this->assertSame( 0, $global_styles_query_count, 'Unexpected SQL queries detected for the wp_global_style post type prior to creation.' );
$user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
$this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' );
@@ -652,40 +647,64 @@ function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries(
$user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme, true );
$this->assertNotEmpty( $user_cpt, 'User CPT is expected not to be empty.' );
- $query_count = count( $this->queries );
+ $global_styles_query_count = 0;
for ( $i = 0; $i < 3; $i ++ ) {
$new_user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
WP_Theme_JSON_Resolver::clean_cached_data();
$this->assertSameSets( $user_cpt, $new_user_cpt, "User CPTs do not match on run {$i}." );
}
- $query_count = count( $this->queries ) - $query_count;
- $this->assertSame( 1, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type after creation.' );
+ $this->assertSame( 1, $global_styles_query_count, 'Unexpected SQL queries detected for the wp_global_style post type after creation.' );
}
/**
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_not_use_uncached_queries_for_logged_out_users() {
+ // Switch to a theme that does have support.
+ switch_theme( 'block-theme' );
$theme = wp_get_theme();
WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
- add_filter( 'query', array( $this, 'filter_db_query' ) );
- $query_count = count( $this->queries );
+ $query_count = get_num_queries();
for ( $i = 0; $i < 3; $i++ ) {
WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
WP_Theme_JSON_Resolver::clean_cached_data();
}
- $query_count = count( $this->queries ) - $query_count;
+ $query_count = get_num_queries() - $query_count;
$this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type prior to creation.' );
$user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
$this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' );
}
+ /**
+ * @ticket 56945
+ * @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
+ */
+ function test_get_user_data_from_wp_global_styles_does_not_run_for_theme_without_support() {
+ // The 'default' theme does not support theme.json.
+ switch_theme( 'default' );
+ wp_set_current_user( self::$administrator_id );
+ $theme = wp_get_theme();
+
+ $start_queries = get_num_queries();
+
+ // When theme.json is not supported, the method should not run a query and always return an empty result.
+ $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
+ $this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' );
+ $this->assertSame( 0, get_num_queries() - $start_queries, 'Unexpected SQL query detected for theme without theme.json support.' );
+
+ $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme, true );
+ $this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' );
+ $this->assertSame( 0, get_num_queries() - $start_queries, 'Unexpected SQL query detected for theme without theme.json support.' );
+ }
+
/**
* @ticket 55392
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_does_exist() {
+ // Switch to a theme that does have support.
+ switch_theme( 'block-theme' );
$theme = wp_get_theme();
$post1 = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme, true );
$this->assertIsArray( $post1 );
@@ -701,6 +720,8 @@ function test_get_user_data_from_wp_global_styles_does_exist() {
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_create_post() {
+ // Switch to a theme that does have support.
+ switch_theme( 'block-theme' );
$theme = wp_get_theme( 'testing' );
$post1 = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
$this->assertIsArray( $post1 );
@@ -718,6 +739,8 @@ function test_get_user_data_from_wp_global_styles_create_post() {
* @covers WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles
*/
function test_get_user_data_from_wp_global_styles_filter_state() {
+ // Switch to a theme that does have support.
+ switch_theme( 'block-theme' );
$theme = wp_get_theme( 'foo' );
$post1 = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme, true, array( 'publish' ) );
$this->assertIsArray( $post1 );
@@ -749,4 +772,29 @@ function test_get_theme_data_theme_supports_overrides_theme_json() {
$line_height = $current_settings['typography']['lineHeight'];
$this->assertTrue( $line_height, 'lineHeight setting after add_theme_support() should be true.' );
}
+
+ /**
+ * @ticket 56945
+ * @covers WP_Theme_JSON_Resolver::get_theme_data
+ */
+ function test_get_theme_data_does_not_parse_theme_json_if_not_present() {
+ // The 'default' theme does not support theme.json.
+ switch_theme( 'default' );
+
+ $theme_json_resolver = new WP_Theme_JSON_Resolver();
+
+ // Force-unset $i18n_schema property to "unload" translation schema.
+ $property = new ReflectionProperty( $theme_json_resolver, 'i18n_schema' );
+ $property->setAccessible( true );
+ $property->setValue( null );
+
+ // A completely empty theme.json data set still has the 'version' key when parsed.
+ $empty_theme_json = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA );
+
+ // Call using 'with_supports' set to false, so that the method only considers theme.json.
+ $theme_data = $theme_json_resolver->get_theme_data( array(), array( 'with_supports' => false ) );
+ $this->assertInstanceOf( 'WP_Theme_JSON', $theme_data, 'Theme data should be an instance of WP_Theme_JSON.' );
+ $this->assertSame( $empty_theme_json, $theme_data->get_raw_data(), 'Theme data should be empty without theme support.' );
+ $this->assertNull( $property->getValue(), 'Theme i18n schema should not have been loaded without theme support.' );
+ }
}
From ac84f67ee4be248b73c31b92006adecfe14dc2e3 Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Fri, 11 Nov 2022 00:04:58 +0000
Subject: [PATCH 0031/1431] Menus: Apply `menu-item-has-children` class in
sub-menus.
Ensure the `menu-item-has-children` class is added to sub-menu items when `wp_nav_menu()` is called with the `depth` parameter specified to a non-zero value.
Follow up to [54478].
Props davidvongries, fpodhorsky, hellofromTonya, innovext, larsmqller, LeonidasMilossis, mattkeys, mukesh27, nuvoPoint, ocean90, outrankjames, petitphp, SergeyBiryukov, sippis, webmandesign.
Fixes #56946.
See #28620.
git-svn-id: https://develop.svn.wordpress.org/trunk@54801 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/nav-menu-template.php | 14 +++----
tests/phpunit/tests/menu/wp-nav-menu.php | 47 ++++++++++++++++++++----
2 files changed, 47 insertions(+), 14 deletions(-)
diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
index df478a5fa4f61..0673bf36ed44f 100644
--- a/src/wp-includes/nav-menu-template.php
+++ b/src/wp-includes/nav-menu-template.php
@@ -204,14 +204,14 @@ function wp_nav_menu( $args = array() ) {
if ( $menu_item->menu_item_parent ) {
$menu_items_with_children[ $menu_item->menu_item_parent ] = 1;
}
+ }
- // Calculate the depth of each menu item with children
- foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) {
- $menu_item_parent = $menu_items_tree[ $menu_item_key ];
- while ( $menu_item_parent ) {
- $menu_item_depth = $menu_item_depth + 1;
- $menu_item_parent = $menu_items_tree[ $menu_item_parent ];
- }
+ // Calculate the depth of each menu item with children.
+ foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) {
+ $menu_item_parent = $menu_items_tree[ $menu_item_key ];
+ while ( $menu_item_parent ) {
+ $menu_item_depth = $menu_item_depth + 1;
+ $menu_item_parent = $menu_items_tree[ $menu_item_parent ];
}
}
diff --git a/tests/phpunit/tests/menu/wp-nav-menu.php b/tests/phpunit/tests/menu/wp-nav-menu.php
index 60a523bfd1710..a077766567bc3 100644
--- a/tests/phpunit/tests/menu/wp-nav-menu.php
+++ b/tests/phpunit/tests/menu/wp-nav-menu.php
@@ -11,6 +11,7 @@ class Tests_Menu_wpNavMenu extends WP_UnitTestCase {
static $lvl0_menu_item = 0;
static $lvl1_menu_item = 0;
static $lvl2_menu_item = 0;
+ static $lvl3_menu_item = 0;
public static function set_up_before_class() {
parent::set_up_before_class();
@@ -53,6 +54,18 @@ public static function set_up_before_class() {
)
);
+ // Create lvl3 menu item.
+ self::$lvl3_menu_item = wp_update_nav_menu_item(
+ self::$menu_id,
+ 0,
+ array(
+ 'menu-item-title' => 'Lvl3 menu item',
+ 'menu-item-url' => '#',
+ 'menu-item-parent-id' => self::$lvl2_menu_item,
+ 'menu-item-status' => 'publish',
+ )
+ );
+
/*
* This filter is used to prevent reusing a menu item ID more that once.
* It caused the tests to fail after the first one since the IDs are missing
@@ -81,6 +94,7 @@ public static function tear_down_after_class() {
* when displaying the menu without specifying a custom depth.
*
* @ticket 28620
+ * @ticket 56946
*/
public function test_wp_nav_menu_should_have_has_children_class_without_custom_depth() {
@@ -112,11 +126,20 @@ public function test_wp_nav_menu_should_have_has_children_class_without_custom_d
$this->assertStringContainsString(
sprintf(
- '
',
+ '
',
self::$lvl2_menu_item
),
$menu_html,
- 'Level 2 should be present in the HTML output and not have the `menu-item-has-children` class since it has no children.'
+ 'Level 2 should be present in the HTML output and have the `menu-item-has-children` class.'
+ );
+
+ $this->assertStringContainsString(
+ sprintf(
+ '
',
+ self::$lvl3_menu_item
+ ),
+ $menu_html,
+ 'Level 3 should be present in the HTML output and not have the `menu-item-has-children` class since it has no children.'
);
}
@@ -125,6 +148,7 @@ public function test_wp_nav_menu_should_have_has_children_class_without_custom_d
* `menu-item-has-children` even if it's the case when displaying the full menu.
*
* @ticket 28620
+ * @ticket 56946
*/
public function test_wp_nav_menu_should_not_have_has_children_class_with_custom_depth() {
@@ -132,7 +156,7 @@ public function test_wp_nav_menu_should_not_have_has_children_class_with_custom_
$menu_html = wp_nav_menu(
array(
'menu' => self::$menu_id,
- 'depth' => 2,
+ 'depth' => 3,
'echo' => false,
)
);
@@ -148,20 +172,29 @@ public function test_wp_nav_menu_should_not_have_has_children_class_with_custom_
$this->assertStringContainsString(
sprintf(
- '
',
+ '
',
self::$lvl1_menu_item
),
$menu_html,
- 'Level 1 should be present in the HTML output and not have the `menu-item-has-children` class since it is the last item to be rendered.'
+ 'Level 1 should be present in the HTML output and have the `menu-item-has-children` class.'
+ );
+
+ $this->assertStringContainsString(
+ sprintf(
+ '
',
+ self::$lvl2_menu_item
+ ),
+ $menu_html,
+ 'Level 2 should be present in the HTML output and not have the `menu-item-has-children` class since it is the last item to be rendered.'
);
$this->assertStringNotContainsString(
sprintf(
'
Date: Fri, 11 Nov 2022 00:59:20 +0000
Subject: [PATCH 0032/1431] Media: Prevent decoding attribute corrupting JSON
data.
Workaround `wp_img_tag_add_decoding_attr()` potentially breaking JavaScript and JSON data by limiting the addition of the decoding attribute to image tags using unescaped double quoted attributes `src` attributes.
Props rodricus, TimothyBlynJacobs, joelmadigan, mw108, adamsilverstein, flixos90, desrosj, mukesh27.
Fixes #56969.
git-svn-id: https://develop.svn.wordpress.org/trunk@54802 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/media.php | 6 ++++++
tests/phpunit/tests/media.php | 22 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index bfd71cdcb3b81..804a34f6accf1 100644
--- a/src/wp-includes/media.php
+++ b/src/wp-includes/media.php
@@ -1962,6 +1962,12 @@ function wp_img_tag_add_loading_attr( $image, $context ) {
* @return string Converted `img` tag with `decoding` attribute added.
*/
function wp_img_tag_add_decoding_attr( $image, $context ) {
+ // Only apply the decoding attribute to images that have a src attribute that
+ // starts with a double quote, ensuring escaped JSON is also excluded.
+ if ( false === strpos( $image, ' src="' ) ) {
+ return $image;
+ }
+
/**
* Filters the `decoding` attribute value to add to an image. Default `async`.
*
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index 0d5ac7586369b..4d5ba64e29838 100644
--- a/tests/phpunit/tests/media.php
+++ b/tests/phpunit/tests/media.php
@@ -3162,6 +3162,28 @@ public function test_wp_img_tag_add_loading_attr_opt_out() {
$this->assertStringNotContainsString( ' loading=', $img );
}
+ /**
+ * Test that decoding="async" is not applied to img tags with single quotes.
+ *
+ * @ticket 56969
+ */
+ public function test_wp_img_tag_add_decoding_attr_with_single_quotes() {
+ $img = "";
+ $img = wp_img_tag_add_decoding_attr( $img, 'test' );
+ $this->assertStringNotContainsString( ' decoding="async"', $img );
+ }
+
+ /**
+ * Test that decoding="async" is not applied to img tags inside JSON.
+ *
+ * @ticket 56969
+ */
+ public function test_decoding_async_not_applied_to_json() {
+ $content = '{"image": ""}';
+ $content = wp_filter_content_tags( $content );
+ $this->assertStringNotContainsString( ' decoding="async"', $content );
+ }
+
/**
* @ticket 50756
*/
From e4832fb198684617b2e61d413b010df601859747 Mon Sep 17 00:00:00 2001
From: Peter Wilson
Date: Fri, 11 Nov 2022 01:25:30 +0000
Subject: [PATCH 0033/1431] I18N: Initialize textdomain registry in
`wp_load_translations_early()`.
Initialize `WP_Textdomain_Registry` in `wp_load_translations_early()`. This ensures the global `$wp_textdomain_registry` is set up prior to loading the translations.
Props azurseisme, TimothyBlynJacobs, costdev, ocean90, flixos90, swissspidy.
Fixes #57051.
git-svn-id: https://develop.svn.wordpress.org/trunk@54803 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/load.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index bb0db65b942b8..3cf4b0d2077d5 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -1321,10 +1321,11 @@ function get_current_network_id() {
* @since 3.4.0
* @access private
*
+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
* @global WP_Locale $wp_locale WordPress date and time locale object.
*/
function wp_load_translations_early() {
- global $wp_locale;
+ global $wp_locale, $wp_textdomain_registry;
static $loaded = false;
if ( $loaded ) {
@@ -1342,6 +1343,7 @@ function wp_load_translations_early() {
// Translation and localization.
require_once ABSPATH . WPINC . '/pomo/mo.php';
require_once ABSPATH . WPINC . '/l10n.php';
+ require_once ABSPATH . WPINC . '/class-wp-textdomain-registry.php';
require_once ABSPATH . WPINC . '/class-wp-locale.php';
require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
@@ -1351,6 +1353,10 @@ function wp_load_translations_early() {
$locales = array();
$locations = array();
+ if ( ! $wp_textdomain_registry instanceof WP_Textdomain_Registry ) {
+ $wp_textdomain_registry = new WP_Textdomain_Registry();
+ }
+
while ( true ) {
if ( defined( 'WPLANG' ) ) {
if ( '' === WPLANG ) {
From 23a646a25a49278d5de65bd80bada569b6ea88cb Mon Sep 17 00:00:00 2001
From: Felix Arntz
Date: Fri, 11 Nov 2022 01:48:05 +0000
Subject: [PATCH 0034/1431] Editor: Improve performance of `WP_Theme_JSON`
class by reducing usage of expensive array functions.
In many scenarios array functions are more expensive than using simpler `for` or `foreach` loops.
This changeset results in roughly 4% faster `wp_head` execution time for both block themes and classic themes. While this may seem like a small win, it is a worthwhile enhancement and only one part of several other little performance tweaks which are being worked on to improve performance of `theme.json` parsing further.
Props aristath, desrosj, jrf, spacedmonkey.
Fixes #56974.
See #57067.
git-svn-id: https://develop.svn.wordpress.org/trunk@54804 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json.php | 121 ++++++++++++++++------
tests/phpunit/tests/theme/wpThemeJson.php | 3 +-
2 files changed, 92 insertions(+), 32 deletions(-)
diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php
index df5bd20d84917..d93b4eea67351 100644
--- a/src/wp-includes/class-wp-theme-json.php
+++ b/src/wp-includes/class-wp-theme-json.php
@@ -461,6 +461,8 @@ class WP_Theme_JSON {
public static function get_element_class_name( $element ) {
$class_name = '';
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
if ( array_key_exists( $element, static::__EXPERIMENTAL_ELEMENT_CLASS_NAMES ) ) {
$class_name = static::__EXPERIMENTAL_ELEMENT_CLASS_NAMES[ $element ];
}
@@ -519,7 +521,10 @@ public function __construct( $theme_json = array(), $origin = 'theme' ) {
$nodes = static::get_setting_nodes( $this->theme_json );
foreach ( $nodes as $node ) {
foreach ( static::PRESETS_METADATA as $preset_metadata ) {
- $path = array_merge( $node['path'], $preset_metadata['path'] );
+ $path = $node['path'];
+ foreach ( $preset_metadata['path'] as $subpath ) {
+ $path[] = $subpath;
+ }
$preset = _wp_array_get( $this->theme_json, $path, null );
if ( null !== $preset ) {
// If the preset is not already keyed by origin.
@@ -608,6 +613,7 @@ protected static function sanitize( $input, $valid_block_names, $valid_element_n
*/
$styles_non_top_level = static::VALID_STYLES;
foreach ( array_keys( $styles_non_top_level ) as $section ) {
+ // array_key_exists() needs to be used instead of isset() because the value can be null.
if ( array_key_exists( $section, $styles_non_top_level ) && is_array( $styles_non_top_level[ $section ] ) ) {
foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) {
if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) {
@@ -631,6 +637,8 @@ protected static function sanitize( $input, $valid_block_names, $valid_element_n
foreach ( $valid_element_names as $element ) {
$schema_styles_elements[ $element ] = $styles_non_top_level;
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
if ( array_key_exists( $element, static::VALID_ELEMENT_PSEUDO_SELECTORS ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element ] as $pseudo_selector ) {
$schema_styles_elements[ $element ][ $pseudo_selector ] = $styles_non_top_level;
@@ -1273,8 +1281,12 @@ protected function get_css_variables( $nodes, $origins ) {
$selector = $metadata['selector'];
- $node = _wp_array_get( $this->theme_json, $metadata['path'], array() );
- $declarations = array_merge( static::compute_preset_vars( $node, $origins ), static::compute_theme_vars( $node ) );
+ $node = _wp_array_get( $this->theme_json, $metadata['path'], array() );
+ $declarations = static::compute_preset_vars( $node, $origins );
+ $theme_vars_declarations = static::compute_theme_vars( $node );
+ foreach ( $theme_vars_declarations as $theme_vars_declaration ) {
+ $declarations[] = $theme_vars_declaration;
+ }
$stylesheet .= static::to_ruleset( $selector, $declarations );
}
@@ -1601,11 +1613,11 @@ protected static function flatten_tree( $tree, $prefix = '', $token = '--' ) {
);
if ( is_array( $value ) ) {
- $new_prefix = $new_key . $token;
- $result = array_merge(
- $result,
- static::flatten_tree( $value, $new_prefix, $token )
- );
+ $new_prefix = $new_key . $token;
+ $flattened_subtree = static::flatten_tree( $value, $new_prefix, $token );
+ foreach ( $flattened_subtree as $subtree_key => $subtree_value ) {
+ $result[ $subtree_key ] = $subtree_value;
+ }
} else {
$result[ $new_key ] = $value;
}
@@ -1667,6 +1679,8 @@ protected static function compute_style_properties( $styles, $settings = array()
if ( is_array( $value_path ) ) {
$path_string = implode( '.', $value_path );
if (
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
array_key_exists( $path_string, static::PROTECTED_PROPERTIES ) &&
_wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null
) {
@@ -1742,7 +1756,7 @@ protected static function get_property_value( $styles, $path, $theme_json = null
* where the values is an array with a "ref" key, pointing to a path.
* For example: { "ref": "style.color.background" } => "#fff".
*/
- if ( is_array( $value ) && array_key_exists( 'ref', $value ) ) {
+ if ( is_array( $value ) && isset( $value['ref'] ) ) {
$value_path = explode( '.', $value['ref'] );
$ref_value = _wp_array_get( $theme_json, $value_path );
// Only use the ref value if we find anything.
@@ -1750,7 +1764,7 @@ protected static function get_property_value( $styles, $path, $theme_json = null
$value = $ref_value;
}
- if ( is_array( $ref_value ) && array_key_exists( 'ref', $ref_value ) ) {
+ if ( is_array( $ref_value ) && isset( $ref_value['ref'] ) ) {
$path_string = json_encode( $path );
$ref_value_string = json_encode( $ref_value );
_doing_it_wrong(
@@ -1886,6 +1900,8 @@ protected static function get_style_nodes( $theme_json, $selectors = array() ) {
);
// Handle any pseudo selectors for the element.
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
if ( array_key_exists( $element, static::VALID_ELEMENT_PSEUDO_SELECTORS ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element ] as $pseudo_selector ) {
@@ -1905,7 +1921,10 @@ protected static function get_style_nodes( $theme_json, $selectors = array() ) {
return $nodes;
}
- $nodes = array_merge( $nodes, static::get_block_nodes( $theme_json ) );
+ $block_nodes = static::get_block_nodes( $theme_json );
+ foreach ( $block_nodes as $block_node ) {
+ $nodes[] = $block_node;
+ }
/**
* Filters the list of style nodes with metadata.
@@ -1982,6 +2001,8 @@ private static function get_block_nodes( $theme_json ) {
);
// Handle any pseudo selectors for the element.
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
if ( array_key_exists( $element, static::VALID_ELEMENT_PSEUDO_SELECTORS ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element ] as $pseudo_selector ) {
if ( isset( $theme_json['styles']['blocks'][ $name ]['elements'][ $element ][ $pseudo_selector ] ) ) {
@@ -2035,7 +2056,9 @@ public function get_styles_for_block( $block_metadata ) {
// the feature selector. This may occur when multiple block
// support features use the same custom selector.
if ( isset( $feature_declarations[ $feature_selector ] ) ) {
- $feature_declarations[ $feature_selector ] = array_merge( $feature_declarations[ $feature_selector ], $new_feature_declarations );
+ foreach ( $new_feature_declarations as $new_feature_declaration ) {
+ $feature_declarations[ $feature_selector ][] = $feature_declaration;
+ }
} else {
$feature_declarations[ $feature_selector ] = $new_feature_declarations;
}
@@ -2059,6 +2082,8 @@ public function get_styles_for_block( $block_metadata ) {
$element_pseudo_allowed = array();
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
if ( array_key_exists( $current_element, static::VALID_ELEMENT_PSEUDO_SELECTORS ) ) {
$element_pseudo_allowed = static::VALID_ELEMENT_PSEUDO_SELECTORS[ $current_element ];
}
@@ -2084,6 +2109,8 @@ function( $pseudo_selector ) use ( $selector ) {
* Otherwise just compute the styles for the default selector as normal.
*/
if ( $pseudo_selector && isset( $node[ $pseudo_selector ] ) &&
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
array_key_exists( $current_element, static::VALID_ELEMENT_PSEUDO_SELECTORS )
&& in_array( $pseudo_selector, static::VALID_ELEMENT_PSEUDO_SELECTORS[ $current_element ], true )
) {
@@ -2283,11 +2310,11 @@ public function merge( $incoming ) {
$nodes = static::get_setting_nodes( $incoming_data );
$slugs_global = static::get_default_slugs( $this->theme_json, array( 'settings' ) );
foreach ( $nodes as $node ) {
- $slugs_node = static::get_default_slugs( $this->theme_json, $node['path'] );
- $slugs = array_merge_recursive( $slugs_global, $slugs_node );
-
// Replace the spacing.units.
- $path = array_merge( $node['path'], array( 'spacing', 'units' ) );
+ $path = $node['path'];
+ $path[] = 'spacing';
+ $path[] = 'units';
+
$content = _wp_array_get( $incoming_data, $path, null );
if ( isset( $content ) ) {
_wp_array_set( $this->theme_json, $path, $content );
@@ -2298,19 +2325,25 @@ public function merge( $incoming ) {
$override_preset = ! static::get_metadata_boolean( $this->theme_json['settings'], $preset['prevent_override'], true );
foreach ( static::VALID_ORIGINS as $origin ) {
- $base_path = array_merge( $node['path'], $preset['path'] );
- $path = array_merge( $base_path, array( $origin ) );
- $content = _wp_array_get( $incoming_data, $path, null );
+ $base_path = $node['path'];
+ foreach ( $preset['path'] as $leaf ) {
+ $base_path[] = $leaf;
+ }
+
+ $path = $base_path;
+ $path[] = $origin;
+
+ $content = _wp_array_get( $incoming_data, $path, null );
if ( ! isset( $content ) ) {
continue;
}
if ( 'theme' === $origin && $preset['use_default_names'] ) {
- foreach ( $content as &$item ) {
- if ( ! array_key_exists( 'name', $item ) ) {
+ foreach ( $content as $key => $item ) {
+ if ( ! isset( $item['name'] ) ) {
$name = static::get_name_from_defaults( $item['slug'], $base_path );
if ( null !== $name ) {
- $item['name'] = $name;
+ $content[ $key ]['name'] = $name;
}
}
}
@@ -2322,6 +2355,9 @@ public function merge( $incoming ) {
) {
_wp_array_set( $this->theme_json, $path, $content );
} else {
+ $slugs_node = static::get_default_slugs( $this->theme_json, $node['path'] );
+ $slugs = array_merge_recursive( $slugs_global, $slugs_node );
+
$slugs_for_preset = _wp_array_get( $slugs, $preset['path'], array() );
$content = static::filter_slugs( $content, $slugs_for_preset );
_wp_array_set( $this->theme_json, $path, $content );
@@ -2434,7 +2470,12 @@ protected static function get_default_slugs( $data, $node_path ) {
$slugs = array();
foreach ( static::PRESETS_METADATA as $metadata ) {
- $path = array_merge( $node_path, $metadata['path'], array( 'default' ) );
+ $path = $node_path;
+ foreach ( $metadata['path'] as $leaf ) {
+ $path[] = $leaf;
+ }
+ $path[] = 'default';
+
$preset = _wp_array_get( $data, $path, null );
if ( ! isset( $preset ) ) {
continue;
@@ -2463,7 +2504,8 @@ protected static function get_default_slugs( $data, $node_path ) {
* @return string|null
*/
protected function get_name_from_defaults( $slug, $base_path ) {
- $path = array_merge( $base_path, array( 'default' ) );
+ $path = $base_path;
+ $path[] = 'default';
$default_content = _wp_array_get( $this->theme_json, $path, null );
if ( ! $default_content ) {
return null;
@@ -2539,6 +2581,8 @@ public static function remove_insecure_properties( $theme_json ) {
* $output is stripped of pseudo selectors. Re-add and process them
* or insecure styles here.
*/
+ // TODO: Replace array_key_exists() with isset() check once WordPress drops
+ // support for PHP 5.6. See https://core.trac.wordpress.org/ticket/57067.
if ( array_key_exists( $current_element, static::VALID_ELEMENT_PSEUDO_SELECTORS ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $current_element ] as $pseudo_selector ) {
if ( isset( $input[ $pseudo_selector ] ) ) {
@@ -2593,8 +2637,9 @@ protected static function remove_insecure_settings( $input ) {
$output = array();
foreach ( static::PRESETS_METADATA as $preset_metadata ) {
foreach ( static::VALID_ORIGINS as $origin ) {
- $path_with_origin = array_merge( $preset_metadata['path'], array( $origin ) );
- $presets = _wp_array_get( $input, $path_with_origin, null );
+ $path_with_origin = $preset_metadata['path'];
+ $path_with_origin[] = $origin;
+ $presets = _wp_array_get( $input, $path_with_origin, null );
if ( null === $presets ) {
continue;
}
@@ -2839,7 +2884,10 @@ public function get_data() {
*/
foreach ( $nodes as $node ) {
foreach ( static::PRESETS_METADATA as $preset_metadata ) {
- $path = array_merge( $node['path'], $preset_metadata['path'] );
+ $path = $node['path'];
+ foreach ( $preset_metadata['path'] as $preset_metadata_path ) {
+ $path[] = $preset_metadata_path;
+ }
$preset = _wp_array_get( $output, $path, null );
if ( null === $preset ) {
continue;
@@ -2873,7 +2921,10 @@ public function get_data() {
foreach ( $nodes as $node ) {
$all_opt_ins_are_set = true;
foreach ( static::APPEARANCE_TOOLS_OPT_INS as $opt_in_path ) {
- $full_path = array_merge( $node['path'], $opt_in_path );
+ $full_path = $node['path'];
+ foreach ( $opt_in_path as $opt_in_path_item ) {
+ $full_path[] = $opt_in_path_item;
+ }
// Use "unset prop" as a marker instead of "null" because
// "null" can be a valid value for some props (e.g. blockGap).
$opt_in_value = _wp_array_get( $output, $full_path, 'unset prop' );
@@ -2884,9 +2935,14 @@ public function get_data() {
}
if ( $all_opt_ins_are_set ) {
- _wp_array_set( $output, array_merge( $node['path'], array( 'appearanceTools' ) ), true );
+ $node_path_with_appearance_tools = $node['path'];
+ $node_path_with_appearance_tools[] = 'appearanceTools';
+ _wp_array_set( $output, $node_path_with_appearance_tools, true );
foreach ( static::APPEARANCE_TOOLS_OPT_INS as $opt_in_path ) {
- $full_path = array_merge( $node['path'], $opt_in_path );
+ $full_path = $node['path'];
+ foreach ( $opt_in_path as $opt_in_path_item ) {
+ $full_path[] = $opt_in_path_item;
+ }
// Use "unset prop" as a marker instead of "null" because
// "null" can be a valid value for some props (e.g. blockGap).
$opt_in_value = _wp_array_get( $output, $full_path, 'unset prop' );
@@ -3037,7 +3093,10 @@ public function set_spacing_sizes() {
$slug += 10;
}
- $spacing_sizes = array_merge( $below_sizes, $above_sizes );
+ $spacing_sizes = $below_sizes;
+ foreach ( $above_sizes as $above_sizes_item ) {
+ $spacing_sizes[] = $above_sizes_item;
+ }
// If there are 7 or less steps in the scale revert to numbers for labels instead of t-shirt sizes.
if ( $spacing_scale['steps'] <= 7 ) {
diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php
index 56b1bec0e138c..c4241ba79d324 100644
--- a/tests/phpunit/tests/theme/wpThemeJson.php
+++ b/tests/phpunit/tests/theme/wpThemeJson.php
@@ -9,8 +9,9 @@
* @since 5.8.0
*
* @group themes
+ *
+ * @covers WP_Theme_JSON
*/
-
class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
/**
From 4a827498eaf6daa66d406d0bbaa743acef0f2978 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 11 Nov 2022 12:37:10 +0000
Subject: [PATCH 0035/1431] Coding Standards: Declare `$wp_taxonomies` global
at the top of `unregister_taxonomy()`.
This brings some consistency with how the global is declared in other taxonomy functions.
Follow-up to [36243], [38747], [54794].
See #57058.
git-svn-id: https://develop.svn.wordpress.org/trunk@54810 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/taxonomy.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index be19a141486d2..5b70968185c10 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -564,6 +564,8 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
* @return true|WP_Error True on success, WP_Error on failure or if the taxonomy doesn't exist.
*/
function unregister_taxonomy( $taxonomy ) {
+ global $wp_taxonomies;
+
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
@@ -575,8 +577,6 @@ function unregister_taxonomy( $taxonomy ) {
return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) );
}
- global $wp_taxonomies;
-
$taxonomy_object->remove_rewrite_rules();
$taxonomy_object->remove_hooks();
From c3cd95732e2efcaa1eebaf262d2452fa5a938913 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 11 Nov 2022 12:44:54 +0000
Subject: [PATCH 0036/1431] Editor: Update block editor packages to the latest
patch releases.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This updates the block editor related npm dependencies to their latest patch versions ahead of WordPress 6.1.1.
For a full list of what’s included in this update, see https://github.com/WordPress/gutenberg/compare/432ed388f8d0614f9de775738b24b0ea96664715...6566f5fe9ece6ad5ae550349d3b1f0944a011040.
Props aaronrobertshaw, ntsekouras, bernhard-reiter, ramonopoly, isabel_brison, andrewserong, get_dave, scruffian, andraganescu, talldanwp, mciampini, noisysocks, cbravobernal, bph, tyxla, ellatrix, czapla, mcsf, ironprogrammer, wildworks, peterwilsoncc, mamaduka, mikachan, spacedmonkey, cybr, youknowriad, alexstine, aristath, kevin940726, ndiego, 0mirka00, poena, joen, ryankienstra, desrosj, vtad, nithins53, audrasjb, kacper3355, sabernhardt.
Fixes #57038, #56818, #56955, #56923.
git-svn-id: https://develop.svn.wordpress.org/trunk@54811 602fd350-edb4-49c9-b593-d223f7449a82
---
package-lock.json | 308 +++++++++---------
package.json | 34 +-
.../assets/script-loader-packages.min.php | 2 +-
.../blocks/post-featured-image.php | 29 +-
src/wp-includes/blocks/template-part.php | 5 +
5 files changed, 188 insertions(+), 190 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 39fe8f31d0eb2..afddb69f0edff 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1402,22 +1402,22 @@
"dev": true
},
"@emotion/babel-plugin": {
- "version": "11.10.2",
- "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.10.2.tgz",
- "integrity": "sha512-xNQ57njWTFVfPAc3cjfuaPdsgLp5QOSuRsj9MA6ndEhH/AzuZM86qIQzt6rq+aGBwj3n5/TkLmU5lhAfdRmogA==",
+ "version": "11.10.5",
+ "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.10.5.tgz",
+ "integrity": "sha512-xE7/hyLHJac7D2Ve9dKroBBZqBT7WuPQmWcq7HSGb84sUuP4mlOWoB8dvVfD9yk5DHkU1m6RW7xSoDtnQHNQeA==",
"requires": {
"@babel/helper-module-imports": "^7.16.7",
"@babel/plugin-syntax-jsx": "^7.17.12",
"@babel/runtime": "^7.18.3",
"@emotion/hash": "^0.9.0",
"@emotion/memoize": "^0.8.0",
- "@emotion/serialize": "^1.1.0",
+ "@emotion/serialize": "^1.1.1",
"babel-plugin-macros": "^3.1.0",
"convert-source-map": "^1.5.0",
"escape-string-regexp": "^4.0.0",
"find-root": "^1.1.0",
"source-map": "^0.5.7",
- "stylis": "4.0.13"
+ "stylis": "4.1.3"
},
"dependencies": {
"escape-string-regexp": {
@@ -1428,26 +1428,26 @@
}
},
"@emotion/cache": {
- "version": "11.10.3",
- "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.10.3.tgz",
- "integrity": "sha512-Psmp/7ovAa8appWh3g51goxu/z3iVms7JXOreq136D8Bbn6dYraPnmL6mdM8GThEx9vwSn92Fz+mGSjBzN8UPQ==",
+ "version": "11.10.5",
+ "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.10.5.tgz",
+ "integrity": "sha512-dGYHWyzTdmK+f2+EnIGBpkz1lKc4Zbj2KHd4cX3Wi8/OWr5pKslNjc3yABKH4adRGCvSX4VDC0i04mrrq0aiRA==",
"requires": {
"@emotion/memoize": "^0.8.0",
- "@emotion/sheet": "^1.2.0",
+ "@emotion/sheet": "^1.2.1",
"@emotion/utils": "^1.2.0",
"@emotion/weak-memoize": "^0.3.0",
- "stylis": "4.0.13"
+ "stylis": "4.1.3"
}
},
"@emotion/css": {
- "version": "11.10.0",
- "resolved": "https://registry.npmjs.org/@emotion/css/-/css-11.10.0.tgz",
- "integrity": "sha512-dH9f+kSCucc8ilMg0MUA1AemabcyzYpe5EKX24F528PJjD7HyIY/VBNJHxfUdc8l400h2ncAjR6yEDu+DBj2cg==",
- "requires": {
- "@emotion/babel-plugin": "^11.10.0",
- "@emotion/cache": "^11.10.0",
- "@emotion/serialize": "^1.1.0",
- "@emotion/sheet": "^1.2.0",
+ "version": "11.10.5",
+ "resolved": "https://registry.npmjs.org/@emotion/css/-/css-11.10.5.tgz",
+ "integrity": "sha512-maJy0wG82hWsiwfJpc3WrYsyVwUbdu+sdIseKUB+/OLjB8zgc3tqkT6eO0Yt0AhIkJwGGnmMY/xmQwEAgQ4JHA==",
+ "requires": {
+ "@emotion/babel-plugin": "^11.10.5",
+ "@emotion/cache": "^11.10.5",
+ "@emotion/serialize": "^1.1.1",
+ "@emotion/sheet": "^1.2.1",
"@emotion/utils": "^1.2.0"
}
},
@@ -1470,14 +1470,14 @@
"integrity": "sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA=="
},
"@emotion/react": {
- "version": "11.10.4",
- "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.4.tgz",
- "integrity": "sha512-j0AkMpr6BL8gldJZ6XQsQ8DnS9TxEQu1R+OGmDZiWjBAJtCcbt0tS3I/YffoqHXxH6MjgI7KdMbYKw3MEiU9eA==",
+ "version": "11.10.5",
+ "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.5.tgz",
+ "integrity": "sha512-TZs6235tCJ/7iF6/rvTaOH4oxQg2gMAcdHemjwLKIjKz4rRuYe1HJ2TQJKnAcRAfOUDdU8XoDadCe1rl72iv8A==",
"requires": {
"@babel/runtime": "^7.18.3",
- "@emotion/babel-plugin": "^11.10.0",
- "@emotion/cache": "^11.10.0",
- "@emotion/serialize": "^1.1.0",
+ "@emotion/babel-plugin": "^11.10.5",
+ "@emotion/cache": "^11.10.5",
+ "@emotion/serialize": "^1.1.1",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.0",
"@emotion/utils": "^1.2.0",
"@emotion/weak-memoize": "^0.3.0",
@@ -1485,9 +1485,9 @@
}
},
"@emotion/serialize": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.0.tgz",
- "integrity": "sha512-F1ZZZW51T/fx+wKbVlwsfchr5q97iW8brAnXmsskz4d0hVB4O3M/SiA3SaeH06x02lSNzkkQv+n3AX3kCXKSFA==",
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.1.tgz",
+ "integrity": "sha512-Zl/0LFggN7+L1liljxXdsVSVlg6E/Z/olVWpfxUTxOAmi8NU7YoeWeLfi1RmnB2TATHoaWwIBRoL+FvAJiTUQA==",
"requires": {
"@emotion/hash": "^0.9.0",
"@emotion/memoize": "^0.8.0",
@@ -1497,19 +1497,19 @@
}
},
"@emotion/sheet": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.0.tgz",
- "integrity": "sha512-OiTkRgpxescko+M51tZsMq7Puu/KP55wMT8BgpcXVG2hqXc0Vo0mfymJ/Uj24Hp0i083ji/o0aLddh08UEjq8w=="
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.1.tgz",
+ "integrity": "sha512-zxRBwl93sHMsOj4zs+OslQKg/uhF38MB+OMKoCrVuS0nyTkqnau+BM3WGEoOptg9Oz45T/aIGs1qbVAsEFo3nA=="
},
"@emotion/styled": {
- "version": "11.10.4",
- "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.10.4.tgz",
- "integrity": "sha512-pRl4R8Ez3UXvOPfc2bzIoV8u9P97UedgHS4FPX594ntwEuAMA114wlaHvOK24HB48uqfXiGlYIZYCxVJ1R1ttQ==",
+ "version": "11.10.5",
+ "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.10.5.tgz",
+ "integrity": "sha512-8EP6dD7dMkdku2foLoruPCNkRevzdcBaY6q0l0OsbyJK+x8D9HWjX27ARiSIKNF634hY9Zdoedh8bJCiva8yZw==",
"requires": {
"@babel/runtime": "^7.18.3",
- "@emotion/babel-plugin": "^11.10.0",
+ "@emotion/babel-plugin": "^11.10.5",
"@emotion/is-prop-valid": "^1.2.0",
- "@emotion/serialize": "^1.1.0",
+ "@emotion/serialize": "^1.1.1",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.0",
"@emotion/utils": "^1.2.0"
}
@@ -1632,9 +1632,9 @@
"integrity": "sha512-bO37brCPfteXQfFY0DyNDGB3+IMe4j150KFQcgJ5aBP295p9nBGeHEs/p0czrRbtlHq4Px/yoPXO/+dOCcF4uA=="
},
"@floating-ui/dom": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.0.3.tgz",
- "integrity": "sha512-6H1kwjkOZKabApNtXRiYHvMmYJToJ1DV7rQ3xc/WJpOABhQIOJJOdz2AOejj8X+gcybaFmBpisVTZxBZAM3V0w==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.0.4.tgz",
+ "integrity": "sha512-maYJRv+sAXTy4K9mzdv0JPyNW5YPVHrqtY90tEdI6XNpuLOP26Ci2pfwPsKBA/Wh4Z3FX5sUrtUFTdMYj9v+ug==",
"requires": {
"@floating-ui/core": "^1.0.1"
}
@@ -3692,16 +3692,16 @@
}
},
"@use-gesture/core": {
- "version": "10.2.20",
- "resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.2.20.tgz",
- "integrity": "sha512-4lFhHc8so4yIHkBEs641DnEsBxPyhJ5GEjB4PURFDH4p/FcZriH6w99knZgI63zN/MBFfylMyb8+PDuj6RIXKQ=="
+ "version": "10.2.22",
+ "resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.2.22.tgz",
+ "integrity": "sha512-Ek0JZFYfk+hicLmoG094gm3YOuDMBNckHb988e59YOZoAkETT8dQSzT+g3QkSHSiP1m5wFXAGPSgxvOuwvGKHQ=="
},
"@use-gesture/react": {
- "version": "10.2.20",
- "resolved": "https://registry.npmjs.org/@use-gesture/react/-/react-10.2.20.tgz",
- "integrity": "sha512-KnJq9ZSqprWA6uNhWTUHZqTCh+rfa0j8ehTzqeBhktUPrmTj7yVOBvEQ/vSFU/7d72cGgWSsJ0f5T6GQCHXnvg==",
+ "version": "10.2.22",
+ "resolved": "https://registry.npmjs.org/@use-gesture/react/-/react-10.2.22.tgz",
+ "integrity": "sha512-ECo7ig16SxBE06ENIURO1woKEB6TC8qY3a0rugJjQ2f1o0Tj28xS/eYNyJuqzQB5YT0q5IrF7ZFpbx1p/5ohYA==",
"requires": {
- "@use-gesture/core": "10.2.20"
+ "@use-gesture/core": "10.2.22"
}
},
"@webassemblyjs/ast": {
@@ -4021,21 +4021,21 @@
}
},
"@wordpress/block-directory": {
- "version": "3.15.10",
- "resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.15.10.tgz",
- "integrity": "sha512-sqBO77tsmNau8gwabieBTj89L2/f5SqjZus3OS+FlT/YPq8tlwnYLHEguObuKAIseLR97aWLnA5aGP+TQX8wfQ==",
+ "version": "3.15.11",
+ "resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.15.11.tgz",
+ "integrity": "sha512-KiQrYfxkiLrrQJgRaw1C32a9vXbNEZorEd0KuEVRZs4LYtNOKj/Je1low4Tvj77lh870Q38SiOCMWgtqtRtRJA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
- "@wordpress/block-editor": "^10.0.9",
+ "@wordpress/block-editor": "^10.0.10",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
- "@wordpress/edit-post": "^6.14.10",
- "@wordpress/editor": "^12.16.9",
+ "@wordpress/edit-post": "^6.14.11",
+ "@wordpress/editor": "^12.16.10",
"@wordpress/element": "^4.15.1",
"@wordpress/hooks": "^3.17.1",
"@wordpress/html-entities": "^3.17.1",
@@ -4049,9 +4049,9 @@
}
},
"@wordpress/block-editor": {
- "version": "10.0.9",
- "resolved": "https://registry.npmjs.org/@wordpress/block-editor/-/block-editor-10.0.9.tgz",
- "integrity": "sha512-XlE7623gvMTulB87hcxNkVmRHcZVSMOOksDdrmZFvkBvgBrfg3cj7efXpINAkuWYSXpr2UUIeYoUFpGE5PijyA==",
+ "version": "10.0.10",
+ "resolved": "https://registry.npmjs.org/@wordpress/block-editor/-/block-editor-10.0.10.tgz",
+ "integrity": "sha512-U1X+wmpAQcJ1Bc7Lq/EghOQERhdgGIw7SfDLbjNg28/H06a4lg8ntYb9gTuney7dRTz90iAPeqggZpTPN20p1A==",
"requires": {
"@babel/runtime": "^7.16.0",
"@react-spring/web": "^9.4.5",
@@ -4059,7 +4059,7 @@
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/blob": "^3.17.1",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/data": "^7.1.3",
"@wordpress/date": "^4.17.1",
@@ -4095,18 +4095,18 @@
}
},
"@wordpress/block-library": {
- "version": "7.14.10",
- "resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-7.14.10.tgz",
- "integrity": "sha512-9iSpOiLX6yHPkwueZcTqdl1YIu8pYMxbaZGAGTMkzDJc0hAFXPNxEtFBxWDuyTOe6b9cIt6QFsfKo3XyvmOJsQ==",
+ "version": "7.14.11",
+ "resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-7.14.11.tgz",
+ "integrity": "sha512-BiLDYp1snS+FCzNWJJEjMxNjKlhLTRQgKzNUwiK/UIQr/5Drif6GNPsNOiFs3ha5kKZli7l4CyFHiZE99PNiJA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/autop": "^3.17.1",
"@wordpress/blob": "^3.17.1",
- "@wordpress/block-editor": "^10.0.9",
+ "@wordpress/block-editor": "^10.0.10",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
@@ -4121,9 +4121,9 @@
"@wordpress/keycodes": "^3.17.1",
"@wordpress/notices": "^3.17.3",
"@wordpress/primitives": "^3.15.1",
- "@wordpress/reusable-blocks": "^3.15.9",
+ "@wordpress/reusable-blocks": "^3.15.10",
"@wordpress/rich-text": "^5.15.3",
- "@wordpress/server-side-render": "^3.15.6",
+ "@wordpress/server-side-render": "^3.15.7",
"@wordpress/url": "^3.18.1",
"@wordpress/viewport": "^4.15.3",
"change-case": "^4.1.2",
@@ -4194,9 +4194,9 @@
"dev": true
},
"@wordpress/components": {
- "version": "21.0.6",
- "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-21.0.6.tgz",
- "integrity": "sha512-Cjinf0kzhicmY0r9GYsRwaPqhuBuSC7nACl5y1CTaiHXAQO6EzElW5QcgFsFX4HwHd0Y13u5NVRY2PgC4uzIpw==",
+ "version": "21.0.7",
+ "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-21.0.7.tgz",
+ "integrity": "sha512-SRiOrKZMwi546qS8K6CctHwVqRkdEGZRXBG67U4xQjtMkGy+4mrbXvs4LTpF/2FwYzk+kQN5X185XsjXliwxEA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@emotion/cache": "^11.7.1",
@@ -4300,15 +4300,15 @@
}
},
"@wordpress/customize-widgets": {
- "version": "3.14.10",
- "resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-3.14.10.tgz",
- "integrity": "sha512-/mgg7OU78A2xjojxAq38Qbv82eIk0rjp95cuz1xUBBQs49O6PLuAIH8hbNpSJ39ijK17cHhTsibBwZeSopROrw==",
+ "version": "3.14.11",
+ "resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-3.14.11.tgz",
+ "integrity": "sha512-aJ/++NFDjirmTF0zAbOzfKSeX+6sMK0vjv07Pjis4gztRJ4P+lfYaj/aUCjQz/OhJwaw1jyQNx3FxcbS3L/iLg==",
"requires": {
"@babel/runtime": "^7.16.0",
- "@wordpress/block-editor": "^10.0.9",
- "@wordpress/block-library": "^7.14.10",
+ "@wordpress/block-editor": "^10.0.10",
+ "@wordpress/block-library": "^7.14.11",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
@@ -4317,13 +4317,13 @@
"@wordpress/hooks": "^3.17.1",
"@wordpress/i18n": "^4.17.1",
"@wordpress/icons": "^9.8.1",
- "@wordpress/interface": "^4.16.6",
+ "@wordpress/interface": "^4.16.7",
"@wordpress/is-shallow-equal": "^4.17.1",
"@wordpress/keyboard-shortcuts": "^3.15.3",
"@wordpress/keycodes": "^3.17.1",
"@wordpress/media-utils": "^4.8.1",
- "@wordpress/preferences": "^2.9.6",
- "@wordpress/widgets": "^2.15.9",
+ "@wordpress/preferences": "^2.9.7",
+ "@wordpress/widgets": "^2.15.10",
"classnames": "^2.3.1",
"lodash": "^4.17.21"
}
@@ -4451,33 +4451,33 @@
}
},
"@wordpress/edit-post": {
- "version": "6.14.10",
- "resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-6.14.10.tgz",
- "integrity": "sha512-NDeeaLtSzWLxyzVSEOxcdbz/tDiQVu+TbctMa36W2k7oC4nB/S5dWjAvSq/DMeJkdR8KFqX2IK164WfQq5Z8aQ==",
+ "version": "6.14.11",
+ "resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-6.14.11.tgz",
+ "integrity": "sha512-ZqNPUlCRBRd4rUYExTVDmaIX/J0yAwaZybtcfSWPacrNnq40xrv16wrLFNZAFn5oCTrKAkuTWWjsjuQhEbw8yg==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
- "@wordpress/block-editor": "^10.0.9",
- "@wordpress/block-library": "^7.14.10",
+ "@wordpress/block-editor": "^10.0.10",
+ "@wordpress/block-library": "^7.14.11",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
"@wordpress/deprecated": "^3.17.1",
- "@wordpress/editor": "^12.16.9",
+ "@wordpress/editor": "^12.16.10",
"@wordpress/element": "^4.15.1",
"@wordpress/hooks": "^3.17.1",
"@wordpress/i18n": "^4.17.1",
"@wordpress/icons": "^9.8.1",
- "@wordpress/interface": "^4.16.6",
+ "@wordpress/interface": "^4.16.7",
"@wordpress/keyboard-shortcuts": "^3.15.3",
"@wordpress/keycodes": "^3.17.1",
"@wordpress/media-utils": "^4.8.1",
"@wordpress/notices": "^3.17.3",
"@wordpress/plugins": "^4.15.2",
- "@wordpress/preferences": "^2.9.6",
+ "@wordpress/preferences": "^2.9.7",
"@wordpress/url": "^3.18.1",
"@wordpress/viewport": "^4.15.3",
"@wordpress/warning": "^2.17.1",
@@ -4488,35 +4488,35 @@
}
},
"@wordpress/edit-site": {
- "version": "4.14.12",
- "resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-4.14.12.tgz",
- "integrity": "sha512-VBxf6oAjJ942l7ivEJTYFRdTzUjfY2kKYkJJRXQQtJZRsTGXXPT0bSc928ZFkubQi0sfspj6RwZPVFa4RY8QDw==",
+ "version": "4.14.13",
+ "resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-4.14.13.tgz",
+ "integrity": "sha512-A5mmwIOSVgiJ1QoCHfnO+ehECoI4gW/g0/GDCpvxbEiHLhexKh3aNDwsy2izO990IoAd1h55hYPYAUBxNX8a+w==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
- "@wordpress/block-editor": "^10.0.9",
- "@wordpress/block-library": "^7.14.10",
+ "@wordpress/block-editor": "^10.0.10",
+ "@wordpress/block-library": "^7.14.11",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
"@wordpress/deprecated": "^3.17.1",
- "@wordpress/editor": "^12.16.9",
+ "@wordpress/editor": "^12.16.10",
"@wordpress/element": "^4.15.1",
"@wordpress/hooks": "^3.17.1",
"@wordpress/html-entities": "^3.17.1",
"@wordpress/i18n": "^4.17.1",
"@wordpress/icons": "^9.8.1",
- "@wordpress/interface": "^4.16.6",
+ "@wordpress/interface": "^4.16.7",
"@wordpress/keyboard-shortcuts": "^3.15.3",
"@wordpress/keycodes": "^3.17.1",
"@wordpress/media-utils": "^4.8.1",
"@wordpress/notices": "^3.17.3",
"@wordpress/plugins": "^4.15.2",
- "@wordpress/preferences": "^2.9.6",
- "@wordpress/reusable-blocks": "^3.15.9",
+ "@wordpress/preferences": "^2.9.7",
+ "@wordpress/reusable-blocks": "^3.15.10",
"@wordpress/style-engine": "^1.0.3",
"@wordpress/url": "^3.18.1",
"@wordpress/viewport": "^4.15.3",
@@ -4529,16 +4529,16 @@
}
},
"@wordpress/edit-widgets": {
- "version": "4.14.10",
- "resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-4.14.10.tgz",
- "integrity": "sha512-cTbnnoffiVivg/F+esX899z2XfDynDXC7lfj8WdOfYd/W4YbBAz37mRqUM/q5Y45xsgqgaQiYqtfbqzJ7eNJ1g==",
+ "version": "4.14.11",
+ "resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-4.14.11.tgz",
+ "integrity": "sha512-5nb583zlv/YZCbIfEkV7gTk+UddZNDGr1C4B/7EWAjNhQAg3/dv3eqD0N/WYTYLxBAUI3O2heO0i85/AiGqUKg==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/api-fetch": "^6.14.1",
- "@wordpress/block-editor": "^10.0.9",
- "@wordpress/block-library": "^7.14.10",
+ "@wordpress/block-editor": "^10.0.10",
+ "@wordpress/block-library": "^7.14.11",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
@@ -4548,31 +4548,31 @@
"@wordpress/hooks": "^3.17.1",
"@wordpress/i18n": "^4.17.1",
"@wordpress/icons": "^9.8.1",
- "@wordpress/interface": "^4.16.6",
+ "@wordpress/interface": "^4.16.7",
"@wordpress/keyboard-shortcuts": "^3.15.3",
"@wordpress/keycodes": "^3.17.1",
"@wordpress/media-utils": "^4.8.1",
"@wordpress/notices": "^3.17.3",
"@wordpress/plugins": "^4.15.2",
- "@wordpress/preferences": "^2.9.6",
- "@wordpress/reusable-blocks": "^3.15.9",
+ "@wordpress/preferences": "^2.9.7",
+ "@wordpress/reusable-blocks": "^3.15.10",
"@wordpress/url": "^3.18.1",
- "@wordpress/widgets": "^2.15.9",
+ "@wordpress/widgets": "^2.15.10",
"classnames": "^2.3.1"
}
},
"@wordpress/editor": {
- "version": "12.16.9",
- "resolved": "https://registry.npmjs.org/@wordpress/editor/-/editor-12.16.9.tgz",
- "integrity": "sha512-F/eqenJYg/vmJSpVkj+Y9DeuYVf6FPORt5vH754xMv8+Ir9FWMiCYg0o7tzFGvboFDHMqhAeFGXjX3CjjXe49w==",
+ "version": "12.16.10",
+ "resolved": "https://registry.npmjs.org/@wordpress/editor/-/editor-12.16.10.tgz",
+ "integrity": "sha512-qRC4TR+sPOAXV0zlx1XST9VsLwAOOWnXBYeFHbveU5sGZVY4/iCiEAHJ1ukLp3dbKtsLKG4tbsukl07kXc7zBQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/blob": "^3.17.1",
- "@wordpress/block-editor": "^10.0.9",
+ "@wordpress/block-editor": "^10.0.10",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
@@ -4587,10 +4587,10 @@
"@wordpress/keycodes": "^3.17.1",
"@wordpress/media-utils": "^4.8.1",
"@wordpress/notices": "^3.17.3",
- "@wordpress/preferences": "^2.9.6",
- "@wordpress/reusable-blocks": "^3.15.9",
+ "@wordpress/preferences": "^2.9.7",
+ "@wordpress/reusable-blocks": "^3.15.10",
"@wordpress/rich-text": "^5.15.3",
- "@wordpress/server-side-render": "^3.15.6",
+ "@wordpress/server-side-render": "^3.15.7",
"@wordpress/url": "^3.18.1",
"@wordpress/wordcount": "^3.17.1",
"classnames": "^2.3.1",
@@ -4748,14 +4748,14 @@
}
},
"@wordpress/format-library": {
- "version": "3.15.9",
- "resolved": "https://registry.npmjs.org/@wordpress/format-library/-/format-library-3.15.9.tgz",
- "integrity": "sha512-Jy56Lpye2c+tRxb1goQLsyJ1SPPYJPNn+6RXbcfvsyNKdAGpVijVWkSIm8R0ACChcht6Uol5SAZS9bv0BComQA==",
+ "version": "3.15.10",
+ "resolved": "https://registry.npmjs.org/@wordpress/format-library/-/format-library-3.15.10.tgz",
+ "integrity": "sha512-145Hdgxx1YuR2Vj78dX4VoUbZ0pvhzwgCYgtFSoy4D7wB5BjZUwWpCO3HLUdCNfq0Yq6/4TlsiCiurgVsfkRpQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
- "@wordpress/block-editor": "^10.0.9",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/block-editor": "^10.0.10",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/data": "^7.1.3",
"@wordpress/element": "^4.15.1",
@@ -4806,13 +4806,13 @@
}
},
"@wordpress/interface": {
- "version": "4.16.6",
- "resolved": "https://registry.npmjs.org/@wordpress/interface/-/interface-4.16.6.tgz",
- "integrity": "sha512-CZx/sNE8iQE0N5eybzNRUSgEyPXyu4XF0t5BwHr4FsES1J9VDIFrA3njkIAa5qboRSijrPfUZMaxdhQ9qcoWXw==",
+ "version": "4.16.7",
+ "resolved": "https://registry.npmjs.org/@wordpress/interface/-/interface-4.16.7.tgz",
+ "integrity": "sha512-VGnAAzJXL21Auasixqz2JfO4Mne/kSly3gLrMGG9KO6AUScBjHgii9YB4Arsz9oMaqom+KboO4jp/VLCL1+SoA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/data": "^7.1.3",
"@wordpress/deprecated": "^3.17.1",
@@ -4820,7 +4820,7 @@
"@wordpress/i18n": "^4.17.1",
"@wordpress/icons": "^9.8.1",
"@wordpress/plugins": "^4.15.2",
- "@wordpress/preferences": "^2.9.6",
+ "@wordpress/preferences": "^2.9.7",
"@wordpress/viewport": "^4.15.3",
"classnames": "^2.3.1"
}
@@ -4880,13 +4880,13 @@
}
},
"@wordpress/list-reusable-blocks": {
- "version": "3.15.6",
- "resolved": "https://registry.npmjs.org/@wordpress/list-reusable-blocks/-/list-reusable-blocks-3.15.6.tgz",
- "integrity": "sha512-Do7iQP2sUbhevxgawctvCs8Vc35QEHs9CqKrLeeMfWoZ/1F6x0vg89N2C44P7xfC/QYo7ODim3H/KOecJIrNSg==",
+ "version": "3.15.7",
+ "resolved": "https://registry.npmjs.org/@wordpress/list-reusable-blocks/-/list-reusable-blocks-3.15.7.tgz",
+ "integrity": "sha512-YxNGwMVyVL9tdzPVTlkvyPym2uwsCKZzDZyw8efOAkHcA07+b4KctTSsWYHH53czkJegHaAt6zX2VPbrRAHeCg==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/api-fetch": "^6.14.1",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/element": "^4.15.1",
"@wordpress/i18n": "^4.17.1",
@@ -4922,12 +4922,12 @@
"dev": true
},
"@wordpress/nux": {
- "version": "5.15.6",
- "resolved": "https://registry.npmjs.org/@wordpress/nux/-/nux-5.15.6.tgz",
- "integrity": "sha512-bk+s8qudRwFXkkJOzrnLDSpb8ITaU5sfp1pckukNfQbl6/KIA35VQwQgp6IFiNJ39eIqwxFovloUpNm3aTix/A==",
+ "version": "5.15.7",
+ "resolved": "https://registry.npmjs.org/@wordpress/nux/-/nux-5.15.7.tgz",
+ "integrity": "sha512-8slrY+EfeR/qvVtV3X43tyk9sXi+RtCUQNNn6EQRNWFAgi2TLQZR9QOI0fNbqUHW7By39Jf3tGPZZLzBLeHbaw==",
"requires": {
"@babel/runtime": "^7.16.0",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/data": "^7.1.3",
"@wordpress/deprecated": "^3.17.1",
@@ -5007,13 +5007,13 @@
}
},
"@wordpress/preferences": {
- "version": "2.9.6",
- "resolved": "https://registry.npmjs.org/@wordpress/preferences/-/preferences-2.9.6.tgz",
- "integrity": "sha512-6lDMW9/F/w8IxyUhShEadcExJtjOHIDl10yfd/+kbFhfAlCkGexdg0Vn3A+/qmdk2B2IKdrB7jpubZYCkkxeTQ==",
+ "version": "2.9.7",
+ "resolved": "https://registry.npmjs.org/@wordpress/preferences/-/preferences-2.9.7.tgz",
+ "integrity": "sha512-DEcX6IjYbFO7/DU2LjNYM7Q51EOX0pKWrFkyqQhEht8dIxUrSiVSkNk/5Y1Pum/j5Dhjq85f4wKOPcrI/PNLog==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/data": "^7.1.3",
"@wordpress/i18n": "^4.17.1",
"@wordpress/icons": "^9.8.1",
@@ -5073,13 +5073,13 @@
}
},
"@wordpress/reusable-blocks": {
- "version": "3.15.9",
- "resolved": "https://registry.npmjs.org/@wordpress/reusable-blocks/-/reusable-blocks-3.15.9.tgz",
- "integrity": "sha512-5YQlTQ3IaCtO39d6nqz6zTX7BXc1OS9zeejpkvIW6IIJ+9HchYWVyQ0Rm3ECRTlmxY0ctkj7SOodvtLWx1FLng==",
+ "version": "3.15.10",
+ "resolved": "https://registry.npmjs.org/@wordpress/reusable-blocks/-/reusable-blocks-3.15.10.tgz",
+ "integrity": "sha512-biMo8OBPre9dLQMFZAbJmutyb7QXtYjjiUxy664gNS3uykUEOo0l90tMxbQHIi79hgZsP5towFqdvTYaZ4I2LA==",
"requires": {
- "@wordpress/block-editor": "^10.0.9",
+ "@wordpress/block-editor": "^10.0.10",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
"@wordpress/element": "^4.15.1",
@@ -5859,14 +5859,14 @@
}
},
"@wordpress/server-side-render": {
- "version": "3.15.6",
- "resolved": "https://registry.npmjs.org/@wordpress/server-side-render/-/server-side-render-3.15.6.tgz",
- "integrity": "sha512-5yrrcpFNFwRLt6WCkjX5NgDNEOtrHiZadyvD4P0SuxkHmvr+pmpPEbwq0yvlD444n9F5AeMAlbCe9TE5oCpZDg==",
+ "version": "3.15.7",
+ "resolved": "https://registry.npmjs.org/@wordpress/server-side-render/-/server-side-render-3.15.7.tgz",
+ "integrity": "sha512-oeSg1tK+0f3sc9gOzAQzHX1y7akbv1OVPJvJx7RrBy4N4iCXVGJUIqv6XancMshIj+5lQKFobItfYhETGY2GuA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/data": "^7.1.3",
"@wordpress/deprecated": "^3.17.1",
@@ -5938,15 +5938,15 @@
"integrity": "sha512-Ursa3UgwUoatO5XNkPw3a+JM5t/7r0x+fMAYCC4IlBjnC4iWK4H3pPqC0NwkScUOtRKI9K6FBuEB86rlCid4yw=="
},
"@wordpress/widgets": {
- "version": "2.15.9",
- "resolved": "https://registry.npmjs.org/@wordpress/widgets/-/widgets-2.15.9.tgz",
- "integrity": "sha512-pKEG8maGGk1p1LqjiFxG9+eD97PHpEJiiLgyH+hQ2jREgi8Jw9x8FPl/fdV8KIqOR/ZR06C46azHWIO2BTK10g==",
+ "version": "2.15.10",
+ "resolved": "https://registry.npmjs.org/@wordpress/widgets/-/widgets-2.15.10.tgz",
+ "integrity": "sha512-2RSFIBje0D2sbPBmIjzCS9j5lHWWetvcZmozRCXIMrZqB713vdqxZxLwXWUvKt43Sgu9pWYioQ+Zs/FIt6MUhA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/api-fetch": "^6.14.1",
- "@wordpress/block-editor": "^10.0.9",
+ "@wordpress/block-editor": "^10.0.10",
"@wordpress/blocks": "^11.16.4",
- "@wordpress/components": "^21.0.6",
+ "@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
@@ -22096,9 +22096,9 @@
}
},
"react-easy-crop": {
- "version": "4.6.1",
- "resolved": "https://registry.npmjs.org/react-easy-crop/-/react-easy-crop-4.6.1.tgz",
- "integrity": "sha512-/3Y7fScuNosFyKGVEotI6Jef1s4nSZLeeeMM38ubexWHRhyvZJAsmqoXoEj5WPvmM6/Ugy32SymJQwVa4t3S9w==",
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/react-easy-crop/-/react-easy-crop-4.6.2.tgz",
+ "integrity": "sha512-qTGU3TWPwdAdNJsbM0OLbDx+Vjes9vWOnm1AUBiVp4GOzZacBQbUzVE9jYprFoWRrJZSn3GEwnxk0YhLAvdiYQ==",
"requires": {
"normalize-wheel": "^1.0.1",
"tslib": "2.0.1"
@@ -24984,9 +24984,9 @@
}
},
"stylis": {
- "version": "4.0.13",
- "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.13.tgz",
- "integrity": "sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag=="
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz",
+ "integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA=="
},
"supports-color": {
"version": "5.5.0",
diff --git a/package.json b/package.json
index 49f37be39eef9..f4b00a3e3ddc8 100644
--- a/package.json
+++ b/package.json
@@ -81,56 +81,56 @@
"@wordpress/api-fetch": "6.14.1",
"@wordpress/autop": "3.17.1",
"@wordpress/blob": "3.17.1",
- "@wordpress/block-directory": "3.15.10",
- "@wordpress/block-editor": "10.0.9",
- "@wordpress/block-library": "7.14.10",
+ "@wordpress/block-directory": "3.15.11",
+ "@wordpress/block-editor": "10.0.10",
+ "@wordpress/block-library": "7.14.11",
"@wordpress/block-serialization-default-parser": "4.17.1",
"@wordpress/blocks": "11.16.4",
- "@wordpress/components": "21.0.6",
+ "@wordpress/components": "21.0.7",
"@wordpress/compose": "5.15.2",
"@wordpress/core-data": "5.0.4",
- "@wordpress/customize-widgets": "3.14.10",
+ "@wordpress/customize-widgets": "3.14.11",
"@wordpress/data": "7.1.3",
"@wordpress/data-controls": "2.17.3",
"@wordpress/date": "4.17.1",
"@wordpress/deprecated": "3.17.1",
"@wordpress/dom": "3.17.2",
"@wordpress/dom-ready": "3.17.1",
- "@wordpress/edit-post": "6.14.10",
- "@wordpress/edit-site": "4.14.12",
- "@wordpress/edit-widgets": "4.14.10",
- "@wordpress/editor": "12.16.9",
+ "@wordpress/edit-post": "6.14.11",
+ "@wordpress/edit-site": "4.14.13",
+ "@wordpress/edit-widgets": "4.14.11",
+ "@wordpress/editor": "12.16.10",
"@wordpress/element": "4.15.1",
"@wordpress/escape-html": "2.17.1",
- "@wordpress/format-library": "3.15.9",
+ "@wordpress/format-library": "3.15.10",
"@wordpress/hooks": "3.17.1",
"@wordpress/html-entities": "3.17.1",
"@wordpress/i18n": "4.17.1",
"@wordpress/icons": "9.8.1",
- "@wordpress/interface": "4.16.6",
+ "@wordpress/interface": "4.16.7",
"@wordpress/is-shallow-equal": "4.17.1",
"@wordpress/keyboard-shortcuts": "3.15.3",
"@wordpress/keycodes": "3.17.1",
- "@wordpress/list-reusable-blocks": "3.15.6",
+ "@wordpress/list-reusable-blocks": "3.15.7",
"@wordpress/media-utils": "4.8.1",
"@wordpress/notices": "3.17.3",
- "@wordpress/nux": "5.15.6",
+ "@wordpress/nux": "5.15.7",
"@wordpress/plugins": "4.15.2",
- "@wordpress/preferences": "2.9.6",
+ "@wordpress/preferences": "2.9.7",
"@wordpress/preferences-persistence": "1.9.1",
"@wordpress/primitives": "3.15.1",
"@wordpress/priority-queue": "2.17.2",
"@wordpress/redux-routine": "4.17.1",
- "@wordpress/reusable-blocks": "3.15.9",
+ "@wordpress/reusable-blocks": "3.15.10",
"@wordpress/rich-text": "5.15.3",
- "@wordpress/server-side-render": "3.15.6",
+ "@wordpress/server-side-render": "3.15.7",
"@wordpress/shortcode": "3.17.1",
"@wordpress/style-engine": "1.0.3",
"@wordpress/token-list": "2.17.1",
"@wordpress/url": "3.18.1",
"@wordpress/viewport": "4.15.3",
"@wordpress/warning": "2.17.1",
- "@wordpress/widgets": "2.15.9",
+ "@wordpress/widgets": "2.15.10",
"@wordpress/wordcount": "3.17.1",
"backbone": "1.4.1",
"clipboard": "2.0.11",
diff --git a/src/wp-includes/assets/script-loader-packages.min.php b/src/wp-includes/assets/script-loader-packages.min.php
index ee29f479925b6..d66e0fd1d34bb 100644
--- a/src/wp-includes/assets/script-loader-packages.min.php
+++ b/src/wp-includes/assets/script-loader-packages.min.php
@@ -1 +1 @@
- array('dependencies' => array('wp-dom-ready', 'wp-i18n', 'wp-polyfill'), 'version' => 'ecce20f002eda4c19664'), 'annotations.min.js' => array('dependencies' => array('wp-data', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'wp-rich-text'), 'version' => '1720fc5d5c76f53a1740'), 'api-fetch.min.js' => array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'bc0029ca2c943aec5311'), 'autop.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '43197d709df445ccf849'), 'blob.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'a078f260190acf405764'), 'block-directory.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '000a47d4ebe2ceac3593'), 'block-editor.min.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-shortcode', 'wp-style-engine', 'wp-token-list', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'd39738cb7c1202964677'), 'block-library.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-reusable-blocks', 'wp-rich-text', 'wp-server-side-render', 'wp-url', 'wp-viewport'), 'version' => 'e005fd256a910edf8c87'), 'block-serialization-default-parser.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'eb2cdc8cd7a7975d49d9'), 'blocks.min.js' => array('dependencies' => array('lodash', 'wp-autop', 'wp-blob', 'wp-block-serialization-default-parser', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-shortcode'), 'version' => '69022aed79bfd45b3b1d'), 'components.min.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-compose', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-warning'), 'version' => '57b49a5bb19d1f1d566a'), 'compose.min.js' => array('dependencies' => array('lodash', 'react', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-priority-queue'), 'version' => '37228270687b2a94e518'), 'core-data.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-blocks', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-url'), 'version' => 'd8d458b31912f858bcdf'), 'customize-widgets.min.js' => array('dependencies' => array('lodash', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-widgets'), 'version' => '1fddf6d27e5c3aeddd54'), 'data.min.js' => array('dependencies' => array('lodash', 'react', 'wp-compose', 'wp-deprecated', 'wp-element', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-priority-queue', 'wp-redux-routine'), 'version' => 'd8cf5b24f99c64ae47d6'), 'data-controls.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-data', 'wp-deprecated', 'wp-polyfill'), 'version' => 'e10d473d392daa8501e8'), 'date.min.js' => array('dependencies' => array('moment', 'wp-deprecated', 'wp-polyfill'), 'version' => 'ce7daf24092d87ff18be'), 'deprecated.min.js' => array('dependencies' => array('wp-hooks', 'wp-polyfill'), 'version' => '6c963cb9494ba26b77eb'), 'dom.min.js' => array('dependencies' => array('wp-deprecated', 'wp-polyfill'), 'version' => '133a042fbbef48f38107'), 'dom-ready.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '392bdd43726760d1f3ca'), 'edit-post.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-url', 'wp-viewport', 'wp-warning'), 'version' => '2baffbeec6cbe5171dee'), 'edit-site.min.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-reusable-blocks', 'wp-style-engine', 'wp-url', 'wp-viewport'), 'version' => 'c987f9377a6156968875'), 'edit-widgets.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-reusable-blocks', 'wp-url', 'wp-viewport', 'wp-widgets'), 'version' => 'f920c6385e705b28f823'), 'editor.min.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-reusable-blocks', 'wp-rich-text', 'wp-server-side-render', 'wp-url', 'wp-wordcount'), 'version' => 'c9102d37531f38da0681'), 'element.min.js' => array('dependencies' => array('react', 'react-dom', 'wp-escape-html', 'wp-polyfill'), 'version' => '47162ff4492c7ec4956b'), 'escape-html.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '03e27a7b6ae14f7afaa6'), 'format-library.min.js' => array('dependencies' => array('wp-a11y', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '57876a359eac66da202b'), 'hooks.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '4169d3cf8e8d95a3d6d5'), 'html-entities.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '36a4a255da7dd2e1bf8e'), 'i18n.min.js' => array('dependencies' => array('wp-hooks', 'wp-polyfill'), 'version' => '9e794f35a71bb98672ae'), 'is-shallow-equal.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '20c2b06ecf04afb14fee'), 'keyboard-shortcuts.min.js' => array('dependencies' => array('wp-data', 'wp-element', 'wp-keycodes', 'wp-polyfill'), 'version' => 'b696c16720133edfc065'), 'keycodes.min.js' => array('dependencies' => array('lodash', 'wp-i18n', 'wp-polyfill'), 'version' => '6e0aadc0106bd8aadc89'), 'list-reusable-blocks.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'f97bc9cc3a1cd21b8c8e'), 'media-utils.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-blob', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '17f6455b0630582352a4'), 'notices.min.js' => array('dependencies' => array('wp-data', 'wp-polyfill'), 'version' => '9c1575b7a31659f45a45'), 'nux.min.js' => array('dependencies' => array('wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '038c48e26a91639ae8ab'), 'plugins.min.js' => array('dependencies' => array('wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill', 'wp-primitives'), 'version' => '0d1b90278bae7df6ecf9'), 'preferences.min.js' => array('dependencies' => array('wp-a11y', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '5e6c91c252c0e040f379'), 'preferences-persistence.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-polyfill'), 'version' => 'c5543628aa7ff5bd5be4'), 'primitives.min.js' => array('dependencies' => array('wp-element', 'wp-polyfill'), 'version' => 'ae0bece54c0487c976b1'), 'priority-queue.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '99e325da95c5a35c7dc2'), 'redux-routine.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'c9ea6c0df793258797e6'), 'reusable-blocks.min.js' => array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '3fb4b31e589a583a362e'), 'rich-text.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-keycodes', 'wp-polyfill'), 'version' => 'c704284bebe26cf1dd51'), 'server-side-render.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'ba8027ee85d65ae23ec7'), 'shortcode.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '7539044b04e6bca57f2e'), 'style-engine.min.js' => array('dependencies' => array('lodash', 'wp-polyfill'), 'version' => '10341d6e6decffab850e'), 'token-list.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'f2cf0bb3ae80de227e43'), 'url.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'bb0ef862199bcae73aa7'), 'viewport.min.js' => array('dependencies' => array('lodash', 'wp-compose', 'wp-data', 'wp-element', 'wp-polyfill'), 'version' => 'a9868d184d07e4c94fe4'), 'warning.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '4acee5fc2fd9a24cefc2'), 'widgets.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-polyfill', 'wp-primitives'), 'version' => 'ec7c547bc8a579c6061e'), 'wordcount.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'feb9569307aec24292f2'));
+ array('dependencies' => array('wp-dom-ready', 'wp-i18n', 'wp-polyfill'), 'version' => 'ecce20f002eda4c19664'), 'annotations.min.js' => array('dependencies' => array('wp-data', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'wp-rich-text'), 'version' => '1720fc5d5c76f53a1740'), 'api-fetch.min.js' => array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'bc0029ca2c943aec5311'), 'autop.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '43197d709df445ccf849'), 'blob.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'a078f260190acf405764'), 'block-directory.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '000a47d4ebe2ceac3593'), 'block-editor.min.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-shortcode', 'wp-style-engine', 'wp-token-list', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '0c7c9b9a74ceb717d6eb'), 'block-library.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-reusable-blocks', 'wp-rich-text', 'wp-server-side-render', 'wp-url', 'wp-viewport'), 'version' => '8adfaccd027d4d509d5e'), 'block-serialization-default-parser.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'eb2cdc8cd7a7975d49d9'), 'blocks.min.js' => array('dependencies' => array('lodash', 'wp-autop', 'wp-blob', 'wp-block-serialization-default-parser', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-shortcode'), 'version' => '69022aed79bfd45b3b1d'), 'components.min.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-compose', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-warning'), 'version' => '4b876f1ff2e5c93b8fb1'), 'compose.min.js' => array('dependencies' => array('lodash', 'react', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-priority-queue'), 'version' => '37228270687b2a94e518'), 'core-data.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-blocks', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-url'), 'version' => 'd8d458b31912f858bcdf'), 'customize-widgets.min.js' => array('dependencies' => array('lodash', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-widgets'), 'version' => '1fddf6d27e5c3aeddd54'), 'data.min.js' => array('dependencies' => array('lodash', 'react', 'wp-compose', 'wp-deprecated', 'wp-element', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-priority-queue', 'wp-redux-routine'), 'version' => 'd8cf5b24f99c64ae47d6'), 'data-controls.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-data', 'wp-deprecated', 'wp-polyfill'), 'version' => 'e10d473d392daa8501e8'), 'date.min.js' => array('dependencies' => array('moment', 'wp-deprecated', 'wp-polyfill'), 'version' => 'ce7daf24092d87ff18be'), 'deprecated.min.js' => array('dependencies' => array('wp-hooks', 'wp-polyfill'), 'version' => '6c963cb9494ba26b77eb'), 'dom.min.js' => array('dependencies' => array('wp-deprecated', 'wp-polyfill'), 'version' => '133a042fbbef48f38107'), 'dom-ready.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '392bdd43726760d1f3ca'), 'edit-post.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-url', 'wp-viewport', 'wp-warning'), 'version' => '2baffbeec6cbe5171dee'), 'edit-site.min.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-reusable-blocks', 'wp-style-engine', 'wp-url', 'wp-viewport'), 'version' => '3ab3e2570a5c4c270c72'), 'edit-widgets.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-reusable-blocks', 'wp-url', 'wp-viewport', 'wp-widgets'), 'version' => 'f920c6385e705b28f823'), 'editor.min.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-polyfill', 'wp-preferences', 'wp-primitives', 'wp-reusable-blocks', 'wp-rich-text', 'wp-server-side-render', 'wp-url', 'wp-wordcount'), 'version' => 'c9102d37531f38da0681'), 'element.min.js' => array('dependencies' => array('react', 'react-dom', 'wp-escape-html', 'wp-polyfill'), 'version' => '47162ff4492c7ec4956b'), 'escape-html.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '03e27a7b6ae14f7afaa6'), 'format-library.min.js' => array('dependencies' => array('wp-a11y', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '57876a359eac66da202b'), 'hooks.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '4169d3cf8e8d95a3d6d5'), 'html-entities.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '36a4a255da7dd2e1bf8e'), 'i18n.min.js' => array('dependencies' => array('wp-hooks', 'wp-polyfill'), 'version' => '9e794f35a71bb98672ae'), 'is-shallow-equal.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '20c2b06ecf04afb14fee'), 'keyboard-shortcuts.min.js' => array('dependencies' => array('wp-data', 'wp-element', 'wp-keycodes', 'wp-polyfill'), 'version' => 'b696c16720133edfc065'), 'keycodes.min.js' => array('dependencies' => array('lodash', 'wp-i18n', 'wp-polyfill'), 'version' => '6e0aadc0106bd8aadc89'), 'list-reusable-blocks.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'f97bc9cc3a1cd21b8c8e'), 'media-utils.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-blob', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '17f6455b0630582352a4'), 'notices.min.js' => array('dependencies' => array('wp-data', 'wp-polyfill'), 'version' => '9c1575b7a31659f45a45'), 'nux.min.js' => array('dependencies' => array('wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '038c48e26a91639ae8ab'), 'plugins.min.js' => array('dependencies' => array('wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill', 'wp-primitives'), 'version' => '0d1b90278bae7df6ecf9'), 'preferences.min.js' => array('dependencies' => array('wp-a11y', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '5e6c91c252c0e040f379'), 'preferences-persistence.min.js' => array('dependencies' => array('wp-api-fetch', 'wp-polyfill'), 'version' => 'c5543628aa7ff5bd5be4'), 'primitives.min.js' => array('dependencies' => array('wp-element', 'wp-polyfill'), 'version' => 'ae0bece54c0487c976b1'), 'priority-queue.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '99e325da95c5a35c7dc2'), 'redux-routine.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'c9ea6c0df793258797e6'), 'reusable-blocks.min.js' => array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '3fb4b31e589a583a362e'), 'rich-text.min.js' => array('dependencies' => array('lodash', 'wp-a11y', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-keycodes', 'wp-polyfill'), 'version' => 'c704284bebe26cf1dd51'), 'server-side-render.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'ba8027ee85d65ae23ec7'), 'shortcode.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '7539044b04e6bca57f2e'), 'style-engine.min.js' => array('dependencies' => array('lodash', 'wp-polyfill'), 'version' => '10341d6e6decffab850e'), 'token-list.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'f2cf0bb3ae80de227e43'), 'url.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'bb0ef862199bcae73aa7'), 'viewport.min.js' => array('dependencies' => array('lodash', 'wp-compose', 'wp-data', 'wp-element', 'wp-polyfill'), 'version' => 'a9868d184d07e4c94fe4'), 'warning.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => '4acee5fc2fd9a24cefc2'), 'widgets.min.js' => array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-polyfill', 'wp-primitives'), 'version' => 'ec7c547bc8a579c6061e'), 'wordcount.min.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'feb9569307aec24292f2'));
diff --git a/src/wp-includes/blocks/post-featured-image.php b/src/wp-includes/blocks/post-featured-image.php
index 495c8ec534a41..40a7f41cd78ac 100644
--- a/src/wp-includes/blocks/post-featured-image.php
+++ b/src/wp-includes/blocks/post-featured-image.php
@@ -29,11 +29,18 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
$attr['alt'] = $post_title;
}
+ if ( ! empty( $attributes['height'] ) ) {
+ $extra_styles = "height:{$attributes['height']};";
+ if ( ! empty( $attributes['scale'] ) ) {
+ $extra_styles .= "object-fit:{$attributes['scale']};";
+ }
+ $attr['style'] = empty( $attr['style'] ) ? $extra_styles : $attr['style'] . $extra_styles;
+ }
+
$featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
if ( ! $featured_image ) {
return '';
}
- $wrapper_attributes = get_block_wrapper_attributes();
if ( $is_link ) {
$link_target = $attributes['linkTarget'];
$rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
@@ -49,23 +56,9 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
$featured_image = $featured_image . $overlay_markup;
}
- $has_width = ! empty( $attributes['width'] );
- $has_height = ! empty( $attributes['height'] );
- if ( ! $has_height && ! $has_width ) {
- return "";
- }
-
- if ( $has_width ) {
- $wrapper_attributes = get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
- }
-
- if ( $has_height ) {
- $image_styles = "height:{$attributes['height']};";
- if ( ! empty( $attributes['scale'] ) ) {
- $image_styles .= "object-fit:{$attributes['scale']};";
- }
- $featured_image = str_replace( ' "width:{$attributes['width']};" ) );
return "";
}
diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php
index 838210480ca28..bef49341d7bb5 100644
--- a/src/wp-includes/blocks/template-part.php
+++ b/src/wp-includes/blocks/template-part.php
@@ -193,6 +193,11 @@ function build_template_part_block_instance_variations() {
if ( wp_installing() ) {
return array();
}
+
+ if ( ! current_theme_supports( 'block-templates' ) && ! current_theme_supports( 'block-template-parts' ) ) {
+ return array();
+ }
+
$variations = array();
$template_parts = get_block_templates(
array(
From 9001cce4e04597ccbada2289d337085a56624e57 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 11 Nov 2022 15:26:59 +0000
Subject: [PATCH 0037/1431] Formatting: Check that both `normalizer_*`
functions exist in `remove_accents()`.
This applies to:
* `normalizer_is_normalized()`
* `normalizer_normalize()`
Includes removing the `Normalizer::FORM_C` constant as a parameter, since it is the default value for both functions and does not need to be explicitly passed. This avoids a fatal error if a plugin includes polyfill for any of the functions but the `Normalizer` class has a different namespace, for example when using the Symfony polyfill.
Follow-up to [53754].
Props hellofromTonya, costdev, desrosj, mukesh27, zodiac1978, jchambo, gisgeo, SergeyBiryukov.
Fixes #56980.
git-svn-id: https://develop.svn.wordpress.org/trunk@54813 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/formatting.php | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index a8780b9c2afe2..1b70b762d689c 100644
--- a/src/wp-includes/formatting.php
+++ b/src/wp-includes/formatting.php
@@ -1601,9 +1601,11 @@ function remove_accents( $string, $locale = '' ) {
// Unicode sequence normalization from NFD (Normalization Form Decomposed)
// to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
- if ( function_exists( 'normalizer_normalize' ) ) {
- if ( ! normalizer_is_normalized( $string, Normalizer::FORM_C ) ) {
- $string = normalizer_normalize( $string, Normalizer::FORM_C );
+ if ( function_exists( 'normalizer_is_normalized' )
+ && function_exists( 'normalizer_normalize' )
+ ) {
+ if ( ! normalizer_is_normalized( $string ) ) {
+ $string = normalizer_normalize( $string );
}
}
From 61ddb267ba870ac5affab994c1b2ace9c76aab14 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 11 Nov 2022 15:53:19 +0000
Subject: [PATCH 0038/1431] Filesystem: Return FTP/FTP Sockets `exists()`
methods to a previous state.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This partially reverts [53860] and [53862], which refactored the `exists()` method to rely on `ftp_rawlist()` instead of `ftp_nlist()`.
[53860] makes a similar attempt to the ones made in [33648] and [34733] (which were also reverted in [35944]). Being compliant with the specifications while continuing to work without issue for all FTP servers continues seem impossible. These little ghosts are the ones we’re scared of the most.
Props jsh4, afragen, costdev, pkolenbr, SergeyBiryukov, dd32, peterwilsoncc, gamecreature, desrosj.
Fixes #56966.
See #51170, #28013.
git-svn-id: https://develop.svn.wordpress.org/trunk@54815 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/class-wp-filesystem-ftpext.php | 10 +++++-----
.../includes/class-wp-filesystem-ftpsockets.php | 11 ++++++-----
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php
index c3bb635809b92..296a5d2970b06 100644
--- a/src/wp-admin/includes/class-wp-filesystem-ftpext.php
+++ b/src/wp-admin/includes/class-wp-filesystem-ftpext.php
@@ -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.
}
/**
diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
index f88166c2093f8..192abc5ec4e7d 100644
--- a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
+++ b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
@@ -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.
}
/**
From 5e8c53a031f634e2ee243b2c73f8eaad5bca2c78 Mon Sep 17 00:00:00 2001
From: Jonny Harris
Date: Fri, 11 Nov 2022 16:24:47 +0000
Subject: [PATCH 0039/1431] Themes: Reduce usage of `wp_get_theme` function.
Calling the `wp_get_theme` function creates a instance of the `WP_Theme` class. This can be a performance issue, if all you need is one property of the class instance. This change replaces the usage of `wp_get_theme()->get_stylesheet()` with `get_stylesheet()` to improve performance.
Props spacedmonkey, flixos90, peterwilsoncc, desrosj.
Fixes #57057.
git-svn-id: https://develop.svn.wordpress.org/trunk@54817 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/site-editor.php | 2 +-
src/wp-includes/block-template-utils.php | 12 ++++++------
src/wp-includes/block-template.php | 2 +-
src/wp-includes/blocks/template-part.php | 2 +-
src/wp-includes/class-wp-theme-json-resolver.php | 9 +++++----
.../class-wp-rest-global-styles-controller.php | 4 ++--
.../endpoints/class-wp-rest-templates-controller.php | 2 +-
src/wp-includes/theme-templates.php | 4 ++--
8 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php
index d2880b0a4f271..a8b43b52af768 100644
--- a/src/wp-admin/site-editor.php
+++ b/src/wp-admin/site-editor.php
@@ -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',
diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php
index 802627873ef66..8ecb9dfe55753 100644
--- a/src/wp-includes/block-template-utils.php
+++ b/src/wp-includes/block-template-utils.php
@@ -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;
}
}
@@ -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'];
@@ -710,7 +710,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 );
@@ -907,7 +907,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(),
),
),
);
@@ -973,7 +973,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
);
@@ -1114,7 +1114,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 );
}
diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php
index 38d8e2b729773..19f3b5fb140ec 100644
--- a/src/wp-includes/block-template.php
+++ b/src/wp-includes/block-template.php
@@ -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 );
diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php
index bef49341d7bb5..3837a0a17d96f 100644
--- a/src/wp-includes/blocks/template-part.php
+++ b/src/wp-includes/blocks/template-part.php
@@ -22,7 +22,7 @@ function render_block_core_template_part( $attributes ) {
if (
isset( $attributes['slug'] ) &&
isset( $attributes['theme'] ) &&
- wp_get_theme()->get_stylesheet() === $attributes['theme']
+ get_stylesheet() === $attributes['theme']
) {
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
$template_part_query = new WP_Query(
diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php
index c166283af30f1..40bc7ab98aa87 100644
--- a/src/wp-includes/class-wp-theme-json-resolver.php
+++ b/src/wp-includes/class-wp-theme-json-resolver.php
@@ -243,13 +243,14 @@ public static function get_theme_data( $deprecated = array(), $options = array()
_deprecated_argument( __METHOD__, '5.9.0' );
}
- $options = wp_parse_args( $options, array( 'with_supports' => true ) );
+ $options = wp_parse_args( $options, array( 'with_supports' => true ) );
if ( null === static::$theme || ! static::has_same_registered_blocks( 'theme' ) ) {
$theme_json_file = static::get_file_path_from_theme( 'theme.json' );
+ $wp_theme = wp_get_theme();
if ( '' !== $theme_json_file ) {
$theme_json_data = static::read_json_file( $theme_json_file );
- $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) );
+ $theme_json_data = static::translate( $theme_json_data, $wp_theme->get( 'TextDomain' ) );
} else {
$theme_json_data = array();
}
@@ -265,12 +266,12 @@ public static function get_theme_data( $deprecated = array(), $options = array()
$theme_json_data = $theme_json->get_data();
static::$theme = new WP_Theme_JSON( $theme_json_data );
- if ( wp_get_theme()->parent() ) {
+ if ( $wp_theme->parent() ) {
// Get parent theme.json.
$parent_theme_json_file = static::get_file_path_from_theme( 'theme.json', true );
if ( '' !== $parent_theme_json_file ) {
$parent_theme_json_data = static::read_json_file( $parent_theme_json_file );
- $parent_theme_json_data = static::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) );
+ $parent_theme_json_data = static::translate( $parent_theme_json_data, $wp_theme->parent()->get( 'TextDomain' ) );
$parent_theme = new WP_Theme_JSON( $parent_theme_json_data );
/*
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
index f1a9d2482a3eb..9ce931398f383 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
@@ -564,7 +564,7 @@ public function get_theme_item_permissions_check( $request ) {
* @return WP_REST_Response|WP_Error
*/
public function get_theme_item( $request ) {
- if ( wp_get_theme()->get_stylesheet() !== $request['stylesheet'] ) {
+ if ( get_stylesheet() !== $request['stylesheet'] ) {
// This endpoint only supports the active theme for now.
return new WP_Error(
'rest_theme_not_found',
@@ -638,7 +638,7 @@ public function get_theme_items_permissions_check( $request ) { // phpcs:ignore
* @return WP_REST_Response|WP_Error
*/
public function get_theme_items( $request ) {
- if ( wp_get_theme()->get_stylesheet() !== $request['stylesheet'] ) {
+ if ( get_stylesheet() !== $request['stylesheet'] ) {
// This endpoint only supports the active theme for now.
return new WP_Error(
'rest_theme_not_found',
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
index 8f70cda9f1296..49e5c8d829a2f 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
@@ -528,7 +528,7 @@ protected function prepare_item_for_database( $request ) {
$changes->post_type = $this->post_type;
$changes->post_status = 'publish';
$changes->tax_input = array(
- 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : wp_get_theme()->get_stylesheet(),
+ 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : get_stylesheet(),
);
} elseif ( 'custom' !== $template->source ) {
$changes->post_name = $template->slug;
diff --git a/src/wp-includes/theme-templates.php b/src/wp-includes/theme-templates.php
index 16bd5e2d77212..7ef010eea5ffd 100644
--- a/src/wp-includes/theme-templates.php
+++ b/src/wp-includes/theme-templates.php
@@ -27,7 +27,7 @@ function wp_set_unique_slug_on_create_template_part( $post_id ) {
$terms = get_the_terms( $post_id, 'wp_theme' );
if ( ! is_array( $terms ) || ! count( $terms ) ) {
- wp_set_post_terms( $post_id, wp_get_theme()->get_stylesheet(), 'wp_theme' );
+ wp_set_post_terms( $post_id, get_stylesheet(), 'wp_theme' );
}
}
@@ -60,7 +60,7 @@ function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID
* in the case of new entities since is too early in the process to have been saved
* to the entity. So for now we use the currently activated theme for creation.
*/
- $theme = wp_get_theme()->get_stylesheet();
+ $theme = get_stylesheet();
$terms = get_the_terms( $post_ID, 'wp_theme' );
if ( $terms && ! is_wp_error( $terms ) ) {
$theme = $terms[0]->name;
From bb6b296647e5f165809b82595e7d8bbed57f4c5d Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 11 Nov 2022 16:32:51 +0000
Subject: [PATCH 0040/1431] Themes: Revert one instance of `wp_get_theme()`
from [54817].
Since this specific call to `wp_get_theme()` is found within `wp-includes/blocks`, this change will need to be made upstream in the Gutenberg repository.
See #57057.
git-svn-id: https://develop.svn.wordpress.org/trunk@54819 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/blocks/template-part.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php
index 3837a0a17d96f..bef49341d7bb5 100644
--- a/src/wp-includes/blocks/template-part.php
+++ b/src/wp-includes/blocks/template-part.php
@@ -22,7 +22,7 @@ function render_block_core_template_part( $attributes ) {
if (
isset( $attributes['slug'] ) &&
isset( $attributes['theme'] ) &&
- get_stylesheet() === $attributes['theme']
+ wp_get_theme()->get_stylesheet() === $attributes['theme']
) {
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
$template_part_query = new WP_Query(
From 368587707d621f1b9fee6edea452bcdda6003ff6 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 11 Nov 2022 17:09:11 +0000
Subject: [PATCH 0041/1431] Editor: Correctly style separator blocks when only
a `background-color` is defined.
When separator blocks are configured using only a `background-color`, they are shown correctly within the editor but not on the front end.
This changes `WP_Theme_JSON` to detect this scenario and move the `background-color` value to just `color` when both `color` and `border-color` are missing.
Props cbravobernal, flixos90, davidbaumwald, hellofromTonya, desrosj, andrewserong, czapla, glendaviesnz, wildworks.
Fixes #56903.
git-svn-id: https://develop.svn.wordpress.org/trunk@54821 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json.php | 43 +++++++++++
tests/phpunit/tests/theme/wpThemeJson.php | 92 +++++++++++++++++++++++
2 files changed, 135 insertions(+)
diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php
index d93b4eea67351..8f93f5cda9f05 100644
--- a/src/wp-includes/class-wp-theme-json.php
+++ b/src/wp-includes/class-wp-theme-json.php
@@ -1949,6 +1949,44 @@ public function get_styles_block_nodes() {
return static::get_block_nodes( $this->theme_json );
}
+ /**
+ * Returns a filtered declarations array if there is a separator block with only a background
+ * style defined in theme.json by adding a color attribute to reflect the changes in the front.
+ *
+ * @since 6.1.1
+ *
+ * @param array $declarations List of declarations.
+ * @return array $declarations List of declarations filtered.
+ */
+ private static function update_separator_declarations( $declarations ) {
+ $background_color = '';
+ $border_color_matches = false;
+ $text_color_matches = false;
+
+ foreach ( $declarations as $declaration ) {
+ if ( 'background-color' === $declaration['name'] && ! $background_color && isset( $declaration['value'] ) ) {
+ $background_color = $declaration['value'];
+ } elseif ( 'border-color' === $declaration['name'] ) {
+ $border_color_matches = true;
+ } elseif ( 'color' === $declaration['name'] ) {
+ $text_color_matches = true;
+ }
+
+ if ( $background_color && $border_color_matches && $text_color_matches ) {
+ break;
+ }
+ }
+
+ if ( $background_color && ! $border_color_matches && ! $text_color_matches ) {
+ $declarations[] = array(
+ 'name' => 'color',
+ 'value' => $background_color,
+ );
+ }
+
+ return $declarations;
+ }
+
/**
* An internal method to get the block nodes from a theme.json file.
*
@@ -2133,6 +2171,11 @@ function( $pseudo_selector ) use ( $selector ) {
}
}
+ // Update declarations if there are separators with only background color defined.
+ if ( '.wp-block-separator' === $selector ) {
+ $declarations = static::update_separator_declarations( $declarations );
+ }
+
// 2. Generate and append the rules that use the general selector.
$block_rules .= static::to_ruleset( $selector, $declarations );
diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php
index c4241ba79d324..913a9601ca953 100644
--- a/tests/phpunit/tests/theme/wpThemeJson.php
+++ b/tests/phpunit/tests/theme/wpThemeJson.php
@@ -3998,4 +3998,96 @@ function data_set_spacing_sizes_when_invalid() {
),
);
}
+
+ /**
+ * Tests the core separator block outbut based on various provided settings.
+ *
+ * @ticket 56903
+ *
+ * @dataProvider data_update_separator_declarations
+ *
+ * @param array $separator_block_settings Example separator block settings from the data provider.
+ * @param array $expected_output Expected output from data provider.
+ */
+ public function test_update_separator_declarations( $separator_block_settings, $expected_output ) {
+ // If only background is defined, test that includes border-color to the style so it is applied on the front end.
+ $theme_json = new WP_Theme_JSON(
+ array(
+ 'version' => WP_Theme_JSON::LATEST_SCHEMA,
+ 'styles' => array(
+ 'blocks' => array(
+ 'core/separator' => $separator_block_settings,
+ ),
+ ),
+ ),
+ 'default'
+ );
+
+ $stylesheet = $theme_json->get_stylesheet( array( 'styles' ) );
+
+ $this->assertSame( $expected_output, $stylesheet );
+ }
+
+ /**
+ * Data provider for separator declaration tests.
+ *
+ * @return array
+ */
+ function data_update_separator_declarations() {
+ return array(
+ // If only background is defined, test that includes border-color to the style so it is applied on the front end.
+ 'only background' => array(
+ array(
+ 'color' => array(
+ 'background' => 'blue',
+ ),
+ ),
+ 'expected_output' => 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-block-separator{background-color: blue;color: blue;}',
+ ),
+ // If background and text are defined, do not include border-color, as text color is enough.
+ 'background and text, no border-color' => array(
+ array(
+ 'color' => array(
+ 'background' => 'blue',
+ 'text' => 'red',
+ ),
+ ),
+ 'expected_output' => 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-block-separator{background-color: blue;color: red;}',
+ ),
+ // If only text is defined, do not include border-color, as by itself is enough.
+ 'only text' => array(
+ array(
+ 'color' => array(
+ 'text' => 'red',
+ ),
+ ),
+ 'expected_output' => 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-block-separator{color: red;}',
+ ),
+ // If background, text, and border-color are defined, include everything, CSS specifity will decide which to apply.
+ 'background, text, and border-color' => array(
+ array(
+ 'color' => array(
+ 'background' => 'blue',
+ 'text' => 'red',
+ ),
+ 'border' => array(
+ 'color' => 'pink',
+ ),
+ ),
+ 'expected_output' => 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-block-separator{background-color: blue;border-color: pink;color: red;}',
+ ),
+ // If background and border color are defined, include everything, CSS specifity will decide which to apply.
+ 'background, text, and border-color' => array(
+ array(
+ 'color' => array(
+ 'background' => 'blue',
+ ),
+ 'border' => array(
+ 'color' => 'pink',
+ ),
+ ),
+ 'expected_output' => 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-block-separator{background-color: blue;border-color: pink;}',
+ ),
+ );
+ }
}
From 49949cea2c4b64ab08370a0bc1a5ea699a6bb18c Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 11 Nov 2022 17:46:05 +0000
Subject: [PATCH 0042/1431] Editor: Improve how `min`/`max` font sizes are
calculated for fluid typography.
- Where no fluid max values are set (e.g., single or custom font size values), the "size" value will act as the maximum value in a `clamp()` function.
- In the absence of any fluid `min`/`max` values, the lower bound rule of `>16px` will be enforced. This applies to custom values from the editor or single-value `theme.json` styles. Font sizes below this will not be clamped.
- In a preset, if a `fluid.min` value has been specified, the lower bound rule of `>16px` won't be enforced on this value. Presets with a fluid object therefore, give precedence to theme author's values.
- In a preset, if there is NOT a `fluid.max` but there is `fluid.min`, use the incoming "size" value as the `max`.
- In a preset, if there is NOT a `fluid.min` but there is a `fluid.max`, use `size * min_size_factor` as the `min`. The lower bound rule of `>16px` is enforced here, because the block editor is computing the `min` value. This is consistent with the way minimum sizes are calculated for single or custom values.
Props ramonopoly, mamaduka, andrewserong, aristath, joen, desrosj.
Fixes #57075.
git-svn-id: https://develop.svn.wordpress.org/trunk@54823 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-supports/typography.php | 64 ++++----
.../tests/block-supports/typography.php | 139 +++++++++---------
2 files changed, 100 insertions(+), 103 deletions(-)
diff --git a/src/wp-includes/block-supports/typography.php b/src/wp-includes/block-supports/typography.php
index 2a1d90f55efea..c571d88b1d6f5 100644
--- a/src/wp-includes/block-supports/typography.php
+++ b/src/wp-includes/block-supports/typography.php
@@ -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.
@@ -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';
@@ -508,22 +508,15 @@ 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(
@@ -531,29 +524,38 @@ function wp_get_typography_font_size_value( $preset, $should_use_fluid_typograph
)
);
- 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'];
}
}
diff --git a/tests/phpunit/tests/block-supports/typography.php b/tests/phpunit/tests/block-supports/typography.php
index fb97de4deb6eb..b9d16fbdf488e 100644
--- a/tests/phpunit/tests/block-supports/typography.php
+++ b/tests/phpunit/tests/block-supports/typography.php
@@ -292,6 +292,7 @@ function test_should_generate_classname_for_font_family() {
* Tests generating font size values, including fluid formulae, from fontSizes preset.
*
* @ticket 56467
+ * @ticket 57065
*
* @covers ::wp_get_typography_font_size_value
*
@@ -320,7 +321,7 @@ function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_
*/
public function data_generate_font_size_preset_fixtures() {
return array(
- 'default_return_value' => array(
+ 'returns value when fluid typography is deactivated' => array(
'font_size_preset' => array(
'size' => '28px',
),
@@ -328,7 +329,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => '28px',
),
- 'size: int 0' => array(
+ 'returns value where font size is 0' => array(
'font_size_preset' => array(
'size' => 0,
),
@@ -336,7 +337,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => 0,
),
- 'size: string 0' => array(
+ "returns value where font size is '0'" => array(
'font_size_preset' => array(
'size' => '0',
),
@@ -344,7 +345,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => '0',
),
- 'default_return_value_when_size_is_undefined' => array(
+ 'returns value where `size` is `null`' => array(
'font_size_preset' => array(
'size' => null,
),
@@ -352,7 +353,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => null,
),
- 'default_return_value_when_fluid_is_false' => array(
+ 'returns value when fluid is `false`' => array(
'font_size_preset' => array(
'size' => '28px',
'fluid' => false,
@@ -361,7 +362,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => '28px',
),
- 'default_return_value_when_value_is_already_clamped' => array(
+ 'returns already clamped value' => array(
'font_size_preset' => array(
'size' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
'fluid' => false,
@@ -370,7 +371,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
),
- 'default_return_value_with_unsupported_unit' => array(
+ 'returns value with unsupported unit' => array(
'font_size_preset' => array(
'size' => '1000%',
'fluid' => false,
@@ -379,57 +380,65 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => '1000%',
),
- 'return_fluid_value' => array(
+ 'returns clamp value with rem min and max units' => array(
'font_size_preset' => array(
'size' => '1.75rem',
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(1.313rem, 1.313rem + ((1vw - 0.48rem) * 2.523), 2.625rem)',
+ 'expected_output' => 'clamp(1.313rem, 1.313rem + ((1vw - 0.48rem) * 0.84), 1.75rem)',
),
- 'return_fluid_value_with_floats_with_units' => array(
- 'font_size_preset' => array(
+ 'returns clamp value with em min and max units' => array(
+ 'font_size' => array(
+ 'size' => '1.75em',
+ ),
+ 'should_use_fluid_typography' => true,
+ 'expected_output' => 'clamp(1.313em, 1.313rem + ((1vw - 0.48em) * 0.84), 1.75em)',
+ ),
+
+ 'returns clamp value for floats' => array(
+ 'font_size' => array(
'size' => '100.175px',
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(75.131px, 4.696rem + ((1vw - 7.68px) * 9.03), 150.263px)',
+ 'expected_output' => 'clamp(75.131px, 4.696rem + ((1vw - 7.68px) * 3.01), 100.175px)',
),
- 'return_fluid_value_with_integer_coerced_to_px' => array(
+ 'coerces integer to `px` and returns clamp value' => array(
'font_size_preset' => array(
'size' => 33,
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(24.75px, 1.547rem + ((1vw - 7.68px) * 2.975), 49.5px)',
+ 'expected_output' => 'clamp(24.75px, 1.547rem + ((1vw - 7.68px) * 0.992), 33px)',
),
- 'return_fluid_value_with_float_coerced_to_px' => array(
+ 'coerces float to `px` and returns clamp value' => array(
'font_size_preset' => array(
'size' => 100.23,
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(75.173px, 4.698rem + ((1vw - 7.68px) * 9.035), 150.345px)',
+ 'expected_output' => 'clamp(75.173px, 4.698rem + ((1vw - 7.68px) * 3.012), 100.23px)',
),
- 'return_default_fluid_values_with_empty_fluid_array' => array(
+ 'returns clamp value when `fluid` is empty array' => array(
'font_size_preset' => array(
'size' => '28px',
'fluid' => array(),
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
+ 'expected_output' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
),
- 'return_default_fluid_values_with_null_value' => array(
+ 'returns clamp value when `fluid` is `null`' => array(
'font_size_preset' => array(
'size' => '28px',
'fluid' => null,
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
+ 'expected_output' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
),
- 'return_clamped_value_if_min_font_size_is_greater_than_max' => array(
+ 'returns clamp value if min font size is greater than max' => array(
'font_size_preset' => array(
'size' => '3rem',
'fluid' => array(
@@ -441,7 +450,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => 'clamp(5rem, 5rem + ((1vw - 0.48rem) * -5.769), 32px)',
),
- 'return_size_with_invalid_fluid_units' => array(
+ 'returns value with invalid min/max fluid units' => array(
'font_size_preset' => array(
'size' => '10em',
'fluid' => array(
@@ -453,15 +462,23 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => '10em',
),
- 'return_clamped_size_where_no_min_is_given_and_less_than_default_min_size' => array(
+ 'returns value when size is < lower bounds and no fluid min/max set' => array(
'font_size_preset' => array(
'size' => '3px',
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(3px, 0.188rem + ((1vw - 7.68px) * 0.18), 4.5px)',
+ 'expected_output' => '3px',
),
- 'return_fluid_clamp_value_with_different_min_max_units' => array(
+ 'returns value when size is equal to lower bounds and no fluid min/max set' => array(
+ 'font_size' => array(
+ 'size' => '14px',
+ ),
+ 'should_use_fluid_typography' => true,
+ 'expected_output' => '14px',
+ ),
+
+ 'returns clamp value with different min max units' => array(
'font_size_preset' => array(
'size' => '28px',
'fluid' => array(
@@ -473,7 +490,7 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => 'clamp(20px, 1.25rem + ((1vw - 7.68px) * 93.75), 50rem)',
),
- 'return_clamp_value_with_default_fluid_max_value' => array(
+ 'returns clamp value where no fluid max size is set' => array(
'font_size_preset' => array(
'size' => '28px',
'fluid' => array(
@@ -481,10 +498,10 @@ public function data_generate_font_size_preset_fixtures() {
),
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(2.6rem, 2.6rem + ((1vw - 0.48rem) * 0.048), 42px)',
+ 'expected_output' => 'clamp(2.6rem, 2.6rem + ((1vw - 0.48rem) * -1.635), 28px)',
),
- 'default_return_clamp_value_with_default_fluid_min_value' => array(
+ 'returns clamp value where no fluid min size is set' => array(
'font_size_preset' => array(
'size' => '28px',
'fluid' => array(
@@ -495,65 +512,41 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 7.091), 80px)',
),
- 'should_adjust_computed_min_in_px_to_min_limit' => array(
- 'font_size_preset' => array(
- 'size' => '14px',
- ),
- 'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(14px, 0.875rem + ((1vw - 7.68px) * 0.841), 21px)',
- ),
-
- 'should_adjust_computed_min_in_rem_to_min_limit' => array(
- 'font_size_preset' => array(
- 'size' => '1.1rem',
- ),
- 'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 1.49), 1.65rem)',
- ),
-
- 'default_return_clamp_value_with_replaced_fluid_min_value_in_em' => array(
+ 'should not apply lower bound test when fluid values are set' => array(
'font_size_preset' => array(
- 'size' => '1.1em',
- ),
- 'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(0.875em, 0.875rem + ((1vw - 0.48em) * 1.49), 1.65em)',
- ),
-
- 'should_adjust_fluid_min_value_in_px_to_min_limit' => array(
- 'font_size_preset' => array(
- 'size' => '20px',
+ 'size' => '1.5rem',
'fluid' => array(
- 'min' => '12px',
+ 'min' => '0.5rem',
+ 'max' => '5rem',
),
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(14px, 0.875rem + ((1vw - 7.68px) * 1.923), 30px)',
+ 'expected_output' => 'clamp(0.5rem, 0.5rem + ((1vw - 0.48rem) * 8.654), 5rem)',
),
- 'should_adjust_fluid_min_value_in_rem_to_min_limit' => array(
- 'font_size_preset' => array(
- 'size' => '1.5rem',
+ 'should not apply lower bound test when only fluid min is set' => array(
+ 'font_size' => array(
+ 'size' => '20px',
'fluid' => array(
- 'min' => '0.5rem',
+ 'min' => '12px',
),
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 2.644), 2.25rem)',
+ 'expected_output' => 'clamp(12px, 0.75rem + ((1vw - 7.68px) * 0.962), 20px)',
),
- 'should_adjust_fluid_min_value_but_honor_max_value' => array(
- 'font_size_preset' => array(
- 'size' => '1.5rem',
+ 'should not apply lower bound test when only fluid max is set' => array(
+ 'font_size' => array(
+ 'size' => '0.875rem',
'fluid' => array(
- 'min' => '0.5rem',
- 'max' => '5rem',
+ 'max' => '20rem',
),
),
'should_use_fluid_typography' => true,
- 'expected_output' => 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 7.933), 5rem)',
+ 'expected_output' => 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 36.779), 20rem)',
),
- 'should_return_fluid_value_when_min_and_max_font_sizes_are_equal' => array(
+ 'returns clamp value when min and max font sizes are equal' => array(
'font_size_preset' => array(
'size' => '4rem',
'fluid' => array(
@@ -573,6 +566,7 @@ public function data_generate_font_size_preset_fixtures() {
* when "settings.typography.fluid" is set to true.
*
* @ticket 56467
+ * @ticket 57065
*
* @covers ::wp_register_typography_support
*
@@ -637,7 +631,7 @@ public function data_generate_block_supports_font_size_fixtures() {
'return_value_with_fluid_typography' => array(
'font_size_value' => '50px',
'should_use_fluid_typography' => true,
- 'expected_output' => 'font-size:clamp(37.5px, 2.344rem + ((1vw - 7.68px) * 4.507), 75px);',
+ 'expected_output' => 'font-size:clamp(37.5px, 2.344rem + ((1vw - 7.68px) * 1.502), 50px);',
),
);
}
@@ -648,6 +642,7 @@ public function data_generate_block_supports_font_size_fixtures() {
* and the correct block content is generated.
*
* @ticket 56467
+ * @ticket 57065
*
* @dataProvider data_generate_replace_inline_font_styles_with_fluid_values_fixtures
*
@@ -695,7 +690,7 @@ public function data_generate_replace_inline_font_styles_with_fluid_values_fixtu
'block_content' => '
",
),
);
}
From d90013cdeb7832972f84648459bb3f9de4364e25 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 11 Nov 2022 17:49:28 +0000
Subject: [PATCH 0043/1431] Coding Standards: Apply spacing changes after
`composer format`.
Follow up to [54817].
See #57057.
git-svn-id: https://develop.svn.wordpress.org/trunk@54824 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json-resolver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php
index 40bc7ab98aa87..b1f15897b1af5 100644
--- a/src/wp-includes/class-wp-theme-json-resolver.php
+++ b/src/wp-includes/class-wp-theme-json-resolver.php
@@ -243,7 +243,7 @@ public static function get_theme_data( $deprecated = array(), $options = array()
_deprecated_argument( __METHOD__, '5.9.0' );
}
- $options = wp_parse_args( $options, array( 'with_supports' => true ) );
+ $options = wp_parse_args( $options, array( 'with_supports' => true ) );
if ( null === static::$theme || ! static::has_same_registered_blocks( 'theme' ) ) {
$theme_json_file = static::get_file_path_from_theme( 'theme.json' );
From 55cddb2ac98eb9f9534e6890bac9bb90e8a9f4a0 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sat, 12 Nov 2022 14:49:25 +0000
Subject: [PATCH 0044/1431] Tests: Resolve `WP_Query` test failures on MariaDB
due to indeterminate sort order.
[54768] added a few tests to verify that caching within `WP_Query` is bypassed when the `SELECT` clause has been modified via a filter, to avoid cache key collisions and the returning of incomplete or unexpected results.
However, creating several posts with the same date/time fields can result in inconsistent sort ordering between MySQL and MariaDB, as each engine refines the order further using a different index.
This commit aims to stabilize the tests by using `assertEqualSets()` instead of `assertEquals()`, since testing the order is out of their scope. Includes removing `array_unshift()` and `array_reverse()` calls as no longer needed.
This resolves a few test failures on MariaDB along the lines of:
{{{
Tests_Query_FieldsClause::test_should_limit_fields_to_id_and_parent_subset
Posts property for first query is not of expected form.
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
0 => stdClass Object (
- 'ID' => 36019
+ 'ID' => 36015
'post_parent' => 0
)
1 => stdClass Object (
- 'ID' => 36018
+ 'ID' => 36016
'post_parent' => 0
)
2 => stdClass Object (...)
3 => stdClass Object (
- 'ID' => 36016
+ 'ID' => 36018
'post_parent' => 0
)
4 => stdClass Object (
- 'ID' => 36015
+ 'ID' => 36019
'post_parent' => 0
)
)
/tmp/wp-test-runner/tests/phpunit/tests/query/fieldsClause.php:67
/tmp/wp-test-runner/phpunit-5.7.phar:598
}}}
Follow-up to [54768].
Props peterwilsoncc, SergeyBiryukov.
See #57012.
git-svn-id: https://develop.svn.wordpress.org/trunk@54829 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/query/fieldsClause.php | 62 ++++++++++------------
1 file changed, 27 insertions(+), 35 deletions(-)
diff --git a/tests/phpunit/tests/query/fieldsClause.php b/tests/phpunit/tests/query/fieldsClause.php
index 4522923a8a76f..d873857a65eee 100644
--- a/tests/phpunit/tests/query/fieldsClause.php
+++ b/tests/phpunit/tests/query/fieldsClause.php
@@ -54,23 +54,19 @@ public function test_should_limit_fields_to_id_and_parent_subset() {
$expected = array();
foreach ( self::$post_ids as $post_id ) {
- // Use array_shift to populate in the reverse order.
- array_unshift(
- $expected,
- (object) array(
- 'ID' => $post_id,
- 'post_parent' => 0,
- )
+ $expected[] = (object) array(
+ 'ID' => $post_id,
+ 'post_parent' => 0,
);
}
- $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertEqualSets( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
$this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
$this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
// Test the second query's results match.
$q2 = new WP_Query( $query_args );
- $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ $this->assertEqualSets( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
}
/**
@@ -86,15 +82,15 @@ public function test_should_limit_fields_to_ids() {
$q = new WP_Query( $query_args );
- $expected = array_reverse( self::$post_ids );
+ $expected = self::$post_ids;
- $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertEqualSets( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
$this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
$this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
// Test the second query's results match.
$q2 = new WP_Query( $query_args );
- $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ $this->assertEqualSets( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
}
/**
@@ -110,15 +106,15 @@ public function test_should_query_all_fields() {
$q = new WP_Query( $query_args );
- $expected = array_map( 'get_post', array_reverse( self::$post_ids ) );
+ $expected = array_map( 'get_post', self::$post_ids );
- $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertEqualSets( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
$this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
$this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
// Test the second query's results match.
$q2 = new WP_Query( $query_args );
- $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ $this->assertEqualSets( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
}
/**
@@ -139,25 +135,21 @@ public function test_should_include_filtered_values_in_addition_to_id_and_parent
$expected = array();
foreach ( self::$post_ids as $post_id ) {
- // Use array_shift to populate in the reverse order.
- array_unshift(
- $expected,
- (object) array(
- 'ID' => $post_id,
- 'post_parent' => 0,
- 'test_post_fields' => 1,
- 'test_post_clauses' => 2,
- )
+ $expected[] = (object) array(
+ 'ID' => $post_id,
+ 'post_parent' => 0,
+ 'test_post_fields' => '1',
+ 'test_post_clauses' => '2',
);
}
- $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertEqualSets( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
$this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
$this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
// Test the second query's results match.
$q2 = new WP_Query( $query_args );
- $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ $this->assertEqualSets( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
}
/**
@@ -176,16 +168,16 @@ public function test_should_include_filtered_values_in_addition_to_id() {
$q = new WP_Query( $query_args );
- // Fields => ID does not include the additional fields.
- $expected = array_reverse( self::$post_ids );
+ // `fields => ids` does not include the additional fields.
+ $expected = self::$post_ids;
- $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertEqualSets( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
$this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
$this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
// Test the second query's results match.
$q2 = new WP_Query( $query_args );
- $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ $this->assertEqualSets( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
}
/**
@@ -204,19 +196,19 @@ public function test_should_include_filtered_values() {
$q = new WP_Query( $query_args );
- $expected = array_map( 'get_post', array_reverse( self::$post_ids ) );
+ $expected = array_map( 'get_post', self::$post_ids );
foreach ( $expected as $post ) {
- $post->test_post_fields = 1;
- $post->test_post_clauses = 2;
+ $post->test_post_fields = '1';
+ $post->test_post_clauses = '2';
}
- $this->assertEquals( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
+ $this->assertEqualSets( $expected, $q->posts, 'Posts property for first query is not of expected form.' );
$this->assertSame( 5, $q->found_posts, 'Number of found posts is not five.' );
$this->assertEquals( 1, $q->max_num_pages, 'Number of found pages is not one.' );
// Test the second query's results match.
$q2 = new WP_Query( $query_args );
- $this->assertEquals( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
+ $this->assertEqualSets( $expected, $q2->posts, 'Posts property for second query is not in the expected form.' );
}
/**
From 12a079e69b17540ad386dd50d7d73f60bc317451 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 13 Nov 2022 13:49:16 +0000
Subject: [PATCH 0045/1431] Docs: Document the usage of globals in some
functions.
This affects:
* `the_block_editor_meta_boxes()`
* `wp_generate_block_templates_export_file()`
* `WP_oEmbed_Controller::get_proxy_item()`
Follow-up to [44131], [48135], [51151], [53129].
Props krunal265.
Fixes #57082.
git-svn-id: https://develop.svn.wordpress.org/trunk@54831 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/post.php | 4 ++++
src/wp-includes/block-template-utils.php | 5 ++++-
src/wp-includes/class-wp-oembed-controller.php | 6 +++---
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
index 8db8861c42c08..65b36c4836878 100644
--- a/src/wp-admin/includes/post.php
+++ b/src/wp-admin/includes/post.php
@@ -2210,6 +2210,10 @@ function get_block_editor_server_block_settings() {
* Renders the meta boxes forms.
*
* @since 5.0.0
+ *
+ * @global WP_Post $post Global post object.
+ * @global WP_Screen $current_screen WordPress current screen object.
+ * @global array $wp_meta_boxes
*/
function the_block_editor_meta_boxes() {
global $post, $current_screen, $wp_meta_boxes;
diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php
index 8ecb9dfe55753..b1a3172fbb51f 100644
--- a/src/wp-includes/block-template-utils.php
+++ b/src/wp-includes/block-template-utils.php
@@ -1200,9 +1200,13 @@ function wp_is_theme_directory_ignored( $path ) {
* @since 5.9.0
* @since 6.0.0 Adds the whole theme to the export archive.
*
+ * @global string $wp_version The WordPress version string.
+ *
* @return WP_Error|string Path of the ZIP file or error on failure.
*/
function wp_generate_block_templates_export_file() {
+ global $wp_version;
+
if ( ! class_exists( 'ZipArchive' ) ) {
return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) );
}
@@ -1270,7 +1274,6 @@ function wp_generate_block_templates_export_file() {
$theme_json_raw = $tree->get_data();
// If a version is defined, add a schema.
if ( $theme_json_raw['version'] ) {
- global $wp_version;
$theme_json_version = 'wp/' . substr( $wp_version, 0, 3 );
$schema = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' );
$theme_json_raw = array_merge( $schema, $theme_json_raw );
diff --git a/src/wp-includes/class-wp-oembed-controller.php b/src/wp-includes/class-wp-oembed-controller.php
index 22fceb54a9aa1..a36fff987d0fe 100644
--- a/src/wp-includes/class-wp-oembed-controller.php
+++ b/src/wp-includes/class-wp-oembed-controller.php
@@ -160,13 +160,14 @@ public function get_proxy_item_permissions_check() {
* @since 4.8.0
*
* @see WP_oEmbed::get_html()
- * @global WP_Embed $wp_embed
+ * @global WP_Embed $wp_embed
+ * @global WP_Scripts $wp_scripts
*
* @param WP_REST_Request $request Full data about the request.
* @return object|WP_Error oEmbed response data or WP_Error on failure.
*/
public function get_proxy_item( $request ) {
- global $wp_embed;
+ global $wp_embed, $wp_scripts;
$args = $request->get_params();
@@ -204,7 +205,6 @@ public function get_proxy_item( $request ) {
$html = $wp_embed->get_embed_handler_html( $args, $url );
if ( $html ) {
- global $wp_scripts;
// Check if any scripts were enqueued by the shortcode, and include them in the response.
$enqueued_scripts = array();
From efb7e7b56348d1e9b8a2da7a08a996917a38e553 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 13 Nov 2022 22:29:39 +0000
Subject: [PATCH 0046/1431] Networks and Sites: Replace "N/A" with "Not
applicable" in `choose_primary_blog()`
This changeset replaces "N/A" with "Not applicable" in the `choose_primary_blog()` function. It also makes the text string translatable.
Props kowsar89, SergeyBiryukov, audrasjb, mukesh27.
Fixes #57040.
git-svn-id: https://develop.svn.wordpress.org/trunk@54832 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/ms.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php
index 741d02e9c9b86..dc6a145549847 100644
--- a/src/wp-admin/includes/ms.php
+++ b/src/wp-admin/includes/ms.php
@@ -783,7 +783,7 @@ function choose_primary_blog() {
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
}
} else {
- echo 'N/A';
+ _e( 'Not available' );
}
?>
From f404ff34c0ce1b9fab35635f6b92f299a1442c7f Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 13 Nov 2022 23:17:47 +0000
Subject: [PATCH 0047/1431] Docs: Various docblock fixes in Multisite
administration functions.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54833 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/ms.php | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php
index dc6a145549847..8b98c229db652 100644
--- a/src/wp-admin/includes/ms.php
+++ b/src/wp-admin/includes/ms.php
@@ -8,7 +8,7 @@
*/
/**
- * Determine if uploaded file exceeds space quota.
+ * Determines whether uploaded file exceeds space quota.
*
* @since 3.0.0
*
@@ -53,7 +53,7 @@ function check_upload_size( $file ) {
}
/**
- * Delete a site.
+ * Deletes a site.
*
* @since 3.0.0
* @since 5.1.0 Use wp_delete_site() internally to delete the site row from the database.
@@ -130,7 +130,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
}
/**
- * Delete a user from the network and remove from all sites.
+ * Deletes a user from the network and remove from all sites.
*
* @since 3.0.0
*
@@ -139,7 +139,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $id The user ID.
- * @return bool True if the user was deleted, otherwise false.
+ * @return bool True if the user was deleted, false otherwise.
*/
function wpmu_delete_user( $id ) {
global $wpdb;
@@ -213,7 +213,7 @@ function wpmu_delete_user( $id ) {
}
/**
- * Check whether a site has used its allotted upload space.
+ * Checks whether a site has used its allotted upload space.
*
* @since MU (3.0.0)
*
@@ -269,12 +269,12 @@ function display_space_usage() {
}
/**
- * Get the remaining upload space for this site.
+ * Gets the remaining upload space for this site.
*
* @since MU (3.0.0)
*
- * @param int $size Current max size in bytes
- * @return int Max size in bytes
+ * @param int $size Current max size in bytes.
+ * @return int Max size in bytes.
*/
function fix_import_form_size( $size ) {
if ( upload_is_user_over_quota( false ) ) {
@@ -793,7 +793,7 @@ function choose_primary_blog() {
}
/**
- * Whether or not we can edit this network from this page.
+ * Determines whether or not this network from this page can be edited.
*
* By default editing of network is restricted to the Network Admin for that `$network_id`.
* This function allows for this to be overridden.
@@ -801,7 +801,7 @@ function choose_primary_blog() {
* @since 3.1.0
*
* @param int $network_id The network ID to check.
- * @return bool True if network can be edited, otherwise false.
+ * @return bool True if network can be edited, false otherwise.
*/
function can_edit_network( $network_id ) {
if ( get_current_network_id() === (int) $network_id ) {
@@ -822,7 +822,7 @@ function can_edit_network( $network_id ) {
}
/**
- * Thickbox image paths for Network Admin.
+ * Prints thickbox image paths for Network Admin.
*
* @since 3.1.0
*
@@ -981,7 +981,7 @@ function confirm_delete_users( $users ) {
}
/**
- * Print JavaScript in the header on the Network Settings screen.
+ * Prints JavaScript in the header on the Network Settings screen.
*
* @since 4.1.0
*/
From 7e1913c551671abd13f0eccba0540553f408d47b Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 14 Nov 2022 11:48:18 +0000
Subject: [PATCH 0048/1431] Administration: Add missing escaping for a few
strings used as HTML attributes.
Follow-up to [47209], [50997], [51006].
Props kowsar89, riccardodicurti, audrasjb, krupalpanchal, SergeyBiryukov.
Fixes #57093.
git-svn-id: https://develop.svn.wordpress.org/trunk@54834 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/nav-menu.php | 2 +-
src/wp-admin/nav-menus.php | 2 +-
src/wp-admin/widgets-form.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
index ad8b04cff6017..0e09d31148ef3 100644
--- a/src/wp-admin/includes/nav-menu.php
+++ b/src/wp-admin/includes/nav-menu.php
@@ -524,7 +524,7 @@ function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) {
';
}
get_current_screen()->set_help_sidebar(
From e67535d8dcae4292d4351de91e0ad1f442e4e9af Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Mon, 14 Nov 2022 21:55:33 +0000
Subject: [PATCH 0053/1431] Text Changes: Improve the wording of the email sent
to confirm site deletion.
Props NekoJonez, SergeyBiryukov, mukesh27, audrasjb.
See #56921.
git-svn-id: https://develop.svn.wordpress.org/trunk@54840 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/ms-delete-site.php | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/wp-admin/ms-delete-site.php b/src/wp-admin/ms-delete-site.php
index 77246a4db7bea..be66975f567f0 100644
--- a/src/wp-admin/ms-delete-site.php
+++ b/src/wp-admin/ms-delete-site.php
@@ -65,11 +65,10 @@
be asked to confirm again so only click this link if you are absolutely certain:
###URL_DELETE###
-If you delete your site, please consider opening a new site here
-some time in the future! (But remember your current site and username
-are gone forever.)
+If you delete your site, please consider opening a new site here some time in
+the future! (But remember that your current site and username are gone forever.)
-Thanks for using the site,
+Thank you for using the site,
All at ###SITENAME###
###SITEURL###"
);
From 2ea31b1bf0b3ba72c641163d7fd7628ca7e697bf Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 15 Nov 2022 00:17:03 +0000
Subject: [PATCH 0054/1431] Docs: Correct type for the `$post` parameter of the
`{$adjacent}_post_link` filter.
The parameter was documented as `WP_Post`, but it contains the value of `get_adjacent_post()`, which returns an empty string if there is no corresponding post, so the correct type is `WP_Post|string`.
Follow-up to [11243], [16951], [28111], [32606].
Props apermo, audrasjb.
Fixes #57047.
git-svn-id: https://develop.svn.wordpress.org/trunk@54841 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/link-template.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index de9988be1f319..533a7daf6cd1b 100644
--- a/src/wp-includes/link-template.php
+++ b/src/wp-includes/link-template.php
@@ -2318,11 +2318,11 @@ function get_adjacent_post_link( $format, $link, $in_same_term = false, $exclude
* @since 2.6.0
* @since 4.2.0 Added the `$adjacent` parameter.
*
- * @param string $output The adjacent post link.
- * @param string $format Link anchor format.
- * @param string $link Link permalink format.
- * @param WP_Post $post The adjacent post.
- * @param string $adjacent Whether the post is previous or next.
+ * @param string $output The adjacent post link.
+ * @param string $format Link anchor format.
+ * @param string $link Link permalink format.
+ * @param WP_Post|string $post The adjacent post. Empty string if no corresponding post exists.
+ * @param string $adjacent Whether the post is previous or next.
*/
return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
}
From cd798b66a703d9fdaa7ea080b7b0c684b4167201 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 15 Nov 2022 00:32:04 +0000
Subject: [PATCH 0055/1431] Docs: Minor DocBlock edits for
`get_adjacent_post()` and related functions.
This aims to better match the line wrapping recommendations of the documentation standards.
Follow-up to [16951], [28111], [32606], [37254].
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54842 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/link-template.php | 164 ++++++++++++++++++------------
1 file changed, 100 insertions(+), 64 deletions(-)
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 533a7daf6cd1b..25de7c79e3aa3 100644
--- a/src/wp-includes/link-template.php
+++ b/src/wp-includes/link-template.php
@@ -1752,11 +1752,13 @@ function get_edit_user_link( $user_id = null ) {
*
* @since 1.5.0
*
- * @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no
- * corresponding post exists.
+ * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
+ * Empty string if no corresponding post exists.
*/
function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
@@ -1767,11 +1769,13 @@ function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxono
*
* @since 1.5.0
*
- * @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no
- * corresponding post exists.
+ * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
+ * Empty string if no corresponding post exists.
*/
function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
@@ -1786,12 +1790,15 @@ function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy =
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty string.
- * @param bool $previous Optional. Whether to retrieve previous post. Default true
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no
- * corresponding post exists.
+ * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty string.
+ * @param bool $previous Optional. Whether to retrieve previous post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
+ * Empty string if no corresponding post exists.
*/
function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
global $wpdb;
@@ -1919,7 +1926,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
*
* @param string $join The JOIN clause in the SQL.
- * @param bool $in_same_term Whether post should be in a same taxonomy term.
+ * @param bool $in_same_term Whether post should be in the same taxonomy term.
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
* @param WP_Post $post WP_Post object.
@@ -1941,7 +1948,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
*
* @param string $where The `WHERE` clause in the SQL.
- * @param bool $in_same_term Whether post should be in a same taxonomy term.
+ * @param bool $in_same_term Whether post should be in the same taxonomy term.
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
* @param WP_Post $post WP_Post object.
@@ -2001,10 +2008,13 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* @since 2.8.0
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param bool $previous Optional. Whether to display link to previous or next post. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param bool $previous Optional. Whether to display link to previous or next post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string|void The adjacent post relational link URL.
*/
function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
@@ -2065,9 +2075,11 @@ function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $
* @since 2.8.0
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
@@ -2100,9 +2112,11 @@ function adjacent_posts_rel_link_wp_head() {
* @see get_adjacent_post_rel_link()
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
@@ -2116,9 +2130,11 @@ function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded
* @see get_adjacent_post_rel_link()
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
@@ -2128,17 +2144,18 @@ function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded
* Retrieves the boundary post.
*
* Boundary being either the first or last post by publish date within the constraints specified
- * by $in_same_term or $excluded_terms.
+ * by `$in_same_term` or `$excluded_terms`.
*
* @since 2.8.0
*
- * @param bool $in_same_term Optional. Whether returned post should be in a same taxonomy term.
+ * @param bool $in_same_term Optional. Whether returned post should be in the same taxonomy term.
* Default false.
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
* Default empty.
- * @param bool $start Optional. Whether to retrieve first or last post. Default true
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return null|array Array containing the boundary post object if successful, null otherwise.
+ * @param bool $start Optional. Whether to retrieve first or last post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return array|null Array containing the boundary post object if successful, null otherwise.
*/
function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
$post = get_post();
@@ -2198,9 +2215,11 @@ function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start
*
* @param string $format Optional. Link anchor format. Default '« %link'.
* @param string $link Optional. Link permalink format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string The link URL of the previous post in relation to the current post.
*/
function get_previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
@@ -2216,9 +2235,11 @@ function get_previous_post_link( $format = '« %link', $link = '%title', $i
*
* @param string $format Optional. Link anchor format. Default '« %link'.
* @param string $link Optional. Link permalink format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
@@ -2231,9 +2252,11 @@ function previous_post_link( $format = '« %link', $link = '%title', $in_sa
*
* @param string $format Optional. Link anchor format. Default '« %link'.
* @param string $link Optional. Link permalink format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string The link URL of the next post in relation to the current post.
*/
function get_next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
@@ -2248,10 +2271,12 @@ function get_next_post_link( $format = '%link »', $link = '%title', $in_sa
* @see get_next_post_link()
*
* @param string $format Optional. Link anchor format. Default '« %link'.
- * @param string $link Optional. Link permalink format. Default '%title'
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param string $link Optional. Link permalink format. Default '%title'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
@@ -2266,10 +2291,13 @@ function next_post_link( $format = '%link »', $link = '%title', $in_same_t
*
* @param string $format Link anchor format.
* @param string $link Link permalink format.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs. Default empty.
- * @param bool $previous Optional. Whether to display link to previous or next post. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs.
+ * Default empty.
+ * @param bool $previous Optional. Whether to display link to previous or next post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string The link URL of the previous or next post in relation to the current post.
*/
function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
@@ -2336,10 +2364,13 @@ function get_adjacent_post_link( $format, $link, $in_same_term = false, $exclude
*
* @param string $format Link anchor format.
* @param string $link Link permalink format.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs. Default empty.
- * @param bool $previous Optional. Whether to display link to previous or next post. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs.
+ * Default empty.
+ * @param bool $previous Optional. Whether to display link to previous or next post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
@@ -2353,8 +2384,8 @@ function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_te
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param int $pagenum Optional. Page number. Default 1.
- * @param bool $escape Optional. Whether to escape the URL for display, with esc_url(). Defaults to true.
- * Otherwise, prepares the URL with sanitize_url().
+ * @param bool $escape Optional. Whether to escape the URL for display, with esc_url().
+ * If set to false, prepares the URL with sanitize_url(). Default true.
* @return string The link URL for the given page number.
*/
function get_pagenum_link( $pagenum = 1, $escape = true ) {
@@ -2683,12 +2714,17 @@ function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
* @param array $args {
* Optional. Default post navigation arguments. Default empty array.
*
- * @type string $prev_text Anchor text to display in the previous post link. Default '%title'.
- * @type string $next_text Anchor text to display in the next post link. Default '%title'.
- * @type bool $in_same_term Whether link should be in a same taxonomy term. Default false.
- * @type int[]|string $excluded_terms Array or comma-separated list of excluded term IDs. Default empty.
+ * @type string $prev_text Anchor text to display in the previous post link.
+ * Default '%title'.
+ * @type string $next_text Anchor text to display in the next post link.
+ * Default '%title'.
+ * @type bool $in_same_term Whether link should be in the same taxonomy term.
+ * Default false.
+ * @type int[]|string $excluded_terms Array or comma-separated list of excluded term IDs.
+ * Default empty.
* @type string $taxonomy Taxonomy, if `$in_same_term` is true. Default 'category'.
- * @type string $screen_reader_text Screen reader text for the nav element. Default 'Post navigation'.
+ * @type string $screen_reader_text Screen reader text for the nav element.
+ * Default 'Post navigation'.
* @type string $aria_label ARIA label text for the nav element. Default 'Posts'.
* @type string $class Custom class for the nav element. Default 'post-navigation'.
* }
From 0cb8475c0d07d23893b1d73d755eda5f12024585 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Wed, 16 Nov 2022 13:49:41 +0000
Subject: [PATCH 0056/1431] Docs: Split the "main part" comment in
`wp-login.php` into two lines.
This aims to better match the multi-line comment format of the documentation standards.
Follow-up to [6643], [52945], [53313].
Props sabernhardt, NekoJonez.
Fixes #56843.
git-svn-id: https://develop.svn.wordpress.org/trunk@54848 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-login.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/wp-login.php b/src/wp-login.php
index 4c9de9503c7e0..f79385530cf30 100644
--- a/src/wp-login.php
+++ b/src/wp-login.php
@@ -425,7 +425,9 @@ function wp_login_viewport_meta() {
}
/*
- * Main part: check the request and redirect or display a form based on the current action.
+ * Main part.
+ *
+ * Check the request and redirect or display a form based on the current action.
*/
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login';
From 3016d486fc0f9e599efb6282f3874031cac67fd6 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Wed, 16 Nov 2022 15:41:03 +0000
Subject: [PATCH 0057/1431] Upgrade/Install: Remove bundled theme files from
`$_old_files`.
Because themes are updated independently of Core updates, any deleted files from bundled themes should not be included in the `$_old_files` list.
Any file included in this list is deleted on update, which could cause problems for sites with a given theme active if the removed files were required in earlier versions of that theme and that theme is not updated at the same time.
Props desrosj, costdev, SergeyBiryukov.
Fixes #56936.
git-svn-id: https://develop.svn.wordpress.org/trunk@54849 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/update-core.php | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index 22b32012b6a1b..20a73901496da 100644
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -10,6 +10,8 @@
/**
* Stores files to be deleted.
*
+ * Bundled theme files should not be included in this list.
+ *
* @since 2.7.0
*
* @global array $_old_files
@@ -843,11 +845,7 @@
'wp-includes/blocks/tag-cloud/editor.min.css',
'wp-includes/blocks/tag-cloud/editor-rtl.css',
'wp-includes/blocks/tag-cloud/editor-rtl.min.css',
- // 6.0
- 'wp-content/themes/twentytwentytwo/assets/fonts/LICENSE.md',
// 6.1
- 'wp-content/themes/twentytwentyone/assets/sass/05-blocks/spacer/_style.scss',
- 'wp-content/themes/twentytwentyone/assets/sass/05-blocks/spacer',
'wp-includes/blocks/post-comments.php',
'wp-includes/blocks/post-comments/block.json',
'wp-includes/blocks/post-comments/editor.css',
From 66706c996cb551f2d67ca6aafd688c838ff034e8 Mon Sep 17 00:00:00 2001
From: Jorge Costa
Date: Wed, 16 Nov 2022 16:34:29 +0000
Subject: [PATCH 0058/1431] Add: Documentation for postTypes pattern property.
This commit documents the postTypes property part of the block pattern registration added in WordPress/gutenberg#41791, and meanwhile backported into core.
Props mcsf, ntsekouras.
git-svn-id: https://develop.svn.wordpress.org/trunk@54850 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-block-patterns-registry.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/wp-includes/class-wp-block-patterns-registry.php b/src/wp-includes/class-wp-block-patterns-registry.php
index bfbc651341acf..a11c99d8c8de1 100644
--- a/src/wp-includes/class-wp-block-patterns-registry.php
+++ b/src/wp-includes/class-wp-block-patterns-registry.php
@@ -68,6 +68,10 @@ final class WP_Block_Patterns_Registry {
* Certain blocks support further specificity besides the block name
* (e.g. for `core/template-part` you can specify areas
* like `core/template-part/header` or `core/template-part/footer`).
+ * @type array $postTypes An array of post types that the pattern is restricted to be used with.
+ * The pattern will only be available when editing one of the post types
+ * passed on the array. For all the other post types not part of the array
+ * the pattern is not available at all.
* @type array $keywords Optional. A list of aliases or keywords that help users discover the
* pattern while searching.
* }
From 7fbcfef25c90435653e2f9f79f68679a794665b2 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Wed, 16 Nov 2022 19:32:57 +0000
Subject: [PATCH 0059/1431] Build/Test Tools: Various minor GitHub Action
improvements.
This applies several types of improvements to GitHub Action workflows:
- Updates to inline documentation to ensure accuracy.
- Removal of repetitive or unnecessary debug logging.
- Reorganization of some steps to have configuration steps towards the beginning of jobs.
- Step name updates for consistency across workflows.
Props desrosj, jrf.
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54851 602fd350-edb4-49c9-b593-d223f7449a82
---
.github/workflows/coding-standards.yml | 33 +++++-----------
.github/workflows/end-to-end-tests.yml | 29 +++++---------
.github/workflows/javascript-tests.yml | 18 +++------
.github/workflows/php-compatibility.yml | 8 +---
.github/workflows/phpunit-tests.yml | 28 +++++++------
.../workflows/test-and-zip-default-themes.yml | 8 ++--
.github/workflows/test-coverage.yml | 39 +++++++------------
.github/workflows/test-npm.yml | 36 ++++++++---------
8 files changed, 76 insertions(+), 123 deletions(-)
diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml
index 6a249a93b4ceb..6a7bcf896bdaa 100644
--- a/.github/workflows/coding-standards.yml
+++ b/.github/workflows/coding-standards.yml
@@ -48,14 +48,15 @@ jobs:
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
- # - Logs debug information.
# - Configures caching for PHPCS scans.
- # - Installs Composer dependencies (use cache if possible).
+ # - Installs Composer dependencies.
# - Make Composer packages available globally.
- # - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase with warnings suppressed.
+ # - Generate a report for displaying issues as pull request annotations.
# - Runs PHPCS on the `tests` directory without warnings suppressed.
+ # - Generate a report for displaying `test` directory issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
+
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
@@ -73,11 +74,6 @@ jobs:
coverage: none
tools: composer, cs2pr
- - name: Log debug information
- run: |
- php --version
- composer --version
-
# This date is used to ensure that the PHPCS cache is cleared at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
- name: "Get last Monday's date"
@@ -98,9 +94,6 @@ jobs:
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- - name: Log PHPCS debug information
- run: phpcs -i
-
- name: Run PHPCS on all Core files
id: phpcs-core
run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
@@ -126,10 +119,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # - Logs updated debug information.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Run the WordPress JSHint checks.
# - Ensures version-controlled files are not modified or deleted.
jshint:
@@ -144,14 +136,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Log debug information
- run: |
- npm --version
- node --version
- git --version
- svn --version
-
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
@@ -161,8 +146,10 @@ jobs:
run: |
npm --version
node --version
+ git --version
+ svn --version
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Run JSHint
diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml
index 1d642ff422fff..661ec67dcd12c 100644
--- a/.github/workflows/end-to-end-tests.yml
+++ b/.github/workflows/end-to-end-tests.yml
@@ -35,12 +35,11 @@ jobs:
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Starts the WordPress Docker container.
- # - Logs general debug information.
# - Logs the running Docker containers.
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
# - Install WordPress within the Docker container.
@@ -61,6 +60,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
npm --version
@@ -68,17 +73,9 @@ jobs:
curl --version
git --version
svn --version
- php --version
- php -i
locale -a
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Build WordPress
@@ -88,14 +85,6 @@ jobs:
run: |
npm run env:start
- - name: General debug information
- run: |
- npm --version
- node --version
- curl --version
- git --version
- svn --version
-
- name: Log running Docker containers
run: docker ps -a
diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml
index 2eeeb9a805443..a64dc43c37c23 100644
--- a/.github/workflows/javascript-tests.yml
+++ b/.github/workflows/javascript-tests.yml
@@ -43,10 +43,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # - Logs updated debug information.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Run the WordPress QUnit tests.
# - Ensures version-controlled files are not modified or deleted.
test-js:
@@ -59,14 +58,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Log debug information
- run: |
- npm --version
- node --version
- git --version
- svn --version
-
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
@@ -76,8 +68,10 @@ jobs:
run: |
npm --version
node --version
+ git --version
+ svn --version
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Run QUnit tests
diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml
index 411da95db252c..22b72821a25f1 100644
--- a/.github/workflows/php-compatibility.yml
+++ b/.github/workflows/php-compatibility.yml
@@ -46,10 +46,10 @@ jobs:
# - Sets up PHP.
# - Logs debug information.
# - Configures caching for PHP compatibility scans.
- # - Installs Composer dependencies (use cache if possible).
+ # - Installs Composer dependencies.
# - Make Composer packages available globally.
- # - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
+ # - Generate a report for displaying issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
php-compatibility:
name: Check PHP compatibility
@@ -70,7 +70,6 @@ jobs:
- name: Log debug information
run: |
- php --version
composer --version
# This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
@@ -93,9 +92,6 @@ jobs:
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- - name: Log PHPCS debug information
- run: phpcs -i
-
- name: Run PHP compatibility tests
id: phpcs
run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml
diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml
index c2276ca035729..52b7413fdfcd1 100644
--- a/.github/workflows/phpunit-tests.yml
+++ b/.github/workflows/phpunit-tests.yml
@@ -36,22 +36,20 @@ jobs:
#
# Performs the following steps:
# - Sets environment variables.
- # - Sets up the environment variables needed for testing with memcached (if desired).
- # - Installs Node.js.
+ # - Checks out the repository.
+ # - Sets up Node.js.
+ # - Logs general debug information about the runner.
# - Installs npm dependencies
# - Configures caching for Composer.
# - Installs Composer dependencies.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
- # - Logs general debug information about the runner.
# - Logs the running Docker containers.
- # - Logs debug information from inside the WordPress Docker container.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests.
# - Ensures version-controlled files are not modified or deleted.
# - Checks out the WordPress Test reporter repository.
- # - Reconnect the directory to the Git repository.
# - Submit the test results to the WordPress.org host test results.
test-php:
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
@@ -108,13 +106,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- - name: Install Dependencies
+ - name: General debug information
+ run: |
+ npm --version
+ node --version
+ curl --version
+ git --version
+ svn --version
+
+ - name: Install npm dependencies
run: npm ci
# This date is used to ensure that the Composer cache is refreshed at least once every week.
@@ -155,14 +161,6 @@ jobs:
run: |
npm run env:start
- - name: General debug information
- run: |
- npm --version
- node --version
- curl --version
- git --version
- svn --version
-
- name: Log running Docker containers
run: docker ps -a
diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml
index 9c6cb3a6da312..f24efb4536170 100644
--- a/.github/workflows/test-and-zip-default-themes.yml
+++ b/.github/workflows/test-and-zip-default-themes.yml
@@ -49,9 +49,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
- # - Installs Node.js (only when theme has a build process)
- # - Installs npm dependencies (only when theme has a build process)
- # - Runs the theme build script (only when theme has a build process)
+ # - Sets up Node.js.
+ # - Installs npm dependencies.
+ # - Runs the theme build script.
# - Ensures version-controlled files are not modified or deleted.
test-build-scripts:
name: Test ${{ matrix.theme }} build script
@@ -77,7 +77,7 @@ jobs:
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml
index f91647baa0988..6fc2c8da8b196 100644
--- a/.github/workflows/test-coverage.yml
+++ b/.github/workflows/test-coverage.yml
@@ -32,26 +32,25 @@ env:
LOCAL_PHP_MEMCACHED: ${{ false }}
jobs:
- # Sets up WordPress for testing or development use.
+ # Runs the PHPUnit tests for WordPress.
#
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
- # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
- # - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Sets up Node.js.
+ # - Logs general debug information about the runner.
+ # - Installs npm dependencies
+ # - Configures caching for Composer.
+ # - Installs Composer dependencies.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
- # - Logs debug general information.
# - Logs the running Docker containers.
- # - Logs WordPress Docker container debug information.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests as a single site.
# - Ensures version-controlled files are not modified or deleted.
# - Upload the single site code coverage report to Codecov.io.
- # - Run the PHPUnit tests as a multisite.
+ # - Run the PHPUnit tests as a multisite installation.
# - Ensures version-controlled files are not modified or deleted.
# - Upload the multisite code coverage report to Codecov.io.
test-coverage-report:
@@ -73,6 +72,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
echo "$GITHUB_REF"
@@ -82,17 +87,9 @@ jobs:
curl --version
git --version
svn --version
- php --version
- php -i
locale -a
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
# This date is used to ensure that the Composer cache is refreshed at least once every week.
@@ -129,14 +126,6 @@ jobs:
run: |
npm run env:start
- - name: General debug information
- run: |
- npm --version
- node --version
- curl --version
- git --version
- svn --version
-
- name: Log running Docker containers
run: docker ps -a
diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml
index 7f38dd7794997..0120ef885323d 100644
--- a/.github/workflows/test-npm.yml
+++ b/.github/workflows/test-npm.yml
@@ -41,9 +41,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
# - Ensures version-controlled files are not modified or deleted.
@@ -64,6 +64,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
npm --version
@@ -72,13 +78,7 @@ jobs:
git --version
svn --version
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Build WordPress in /src
@@ -106,9 +106,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
# - Ensures version-controlled files are not modified or deleted.
@@ -124,6 +124,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
npm --version
@@ -132,13 +138,7 @@ jobs:
git --version
svn --version
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Build WordPress in /src
From 4e72f78c75819470cb8f6d5d5d16f9ef8c9a7a0c Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Wed, 16 Nov 2022 20:55:34 +0000
Subject: [PATCH 0060/1431] Build/Test Tools: Add additional details why MacOS
jobs are separate.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This adds additional inline context as to why the MacOS job is separate from the Windows and Ubuntu ones in the Test npm workflow.
While it is preferable to combine all of these to avoid repeated code, there is currently no way to determine the runner’s OS within the `if` workflow key.
MacOS jobs use GitHub Action minutes at by a multiple of 10. Being more strict about when to run these jobs ensures minutes are not unintentionally consumed within private forks and mirrors.
See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details.
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54852 602fd350-edb4-49c9-b593-d223f7449a82
---
.github/workflows/test-npm.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml
index 0120ef885323d..59b8adcaef0a9 100644
--- a/.github/workflows/test-npm.yml
+++ b/.github/workflows/test-npm.yml
@@ -104,6 +104,10 @@ jobs:
# This is separate from the job above in order to use stricter conditions about when to run.
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
#
+ # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
+ # currently no way to determine the OS being used on a given job.
+ # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
+ #
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
From bb698718c837e842cf86b583cdad7da687d92b6d Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 17 Nov 2022 16:56:04 +0000
Subject: [PATCH 0061/1431] Docs: Fix typo in the
`WP_Theme_JSON::PRESETS_METADATA` constant description.
Follow-up to [53129].
Props kebbet, mukesh27.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54853 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php
index 8f93f5cda9f05..77711a283c51c 100644
--- a/src/wp-includes/class-wp-theme-json.php
+++ b/src/wp-includes/class-wp-theme-json.php
@@ -114,7 +114,7 @@ class WP_Theme_JSON {
* @since 5.9.0 Added the `color.duotone` and `typography.fontFamilies` presets,
* `use_default_names` preset key, and simplified the metadata structure.
* @since 6.0.0 Replaced `override` with `prevent_override` and updated the
- * `prevent_overried` value for `color.duotone` to use `color.defaultDuotone`.
+ * `prevent_override` value for `color.duotone` to use `color.defaultDuotone`.
* @var array
*/
const PRESETS_METADATA = array(
@@ -412,7 +412,7 @@ class WP_Theme_JSON {
* The valid elements that can be found under styles.
*
* @since 5.8.0
- * @since 6.1.0 Added `heading`, `button`. and `caption` elements.
+ * @since 6.1.0 Added `heading`, `button`, and `caption` elements.
* @var string[]
*/
const ELEMENTS = array(
From a71d7373ad6ce0a8f252717832f42aebc3e08854 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 17 Nov 2022 17:05:21 +0000
Subject: [PATCH 0062/1431] Docs: Update `wp_count_posts` and
`wp_count_attachments` filter descriptions.
This aims to match the wording generally used for other filters as per the documentation standards.
Follow-up to [25554], [25578], [25579], [53456].
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54854 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/post.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 381ee526b48a2..70e05f9f7342c 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -3057,7 +3057,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
wp_cache_set( $cache_key, $counts, 'counts' );
/**
- * Modifies returned post counts by status for the current post type.
+ * Filters the post counts by status for the current post type.
*
* @since 3.7.0
*
@@ -3109,7 +3109,7 @@ function wp_count_attachments( $mime_type = '' ) {
}
/**
- * Modifies returned attachment counts by mime type.
+ * Filters the attachment counts by mime type.
*
* @since 3.7.0
*
From acbbee8a1199f9ce70f1d3bbcc9cb80e32047e6c Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 17 Nov 2022 18:13:47 +0000
Subject: [PATCH 0063/1431] Docs: Update various DocBlocks and inline comments
per the documentation standards.
Includes minor formatting edits for consistency.
Follow-up to [53/tests], [12179], [12946], [35288], [37884], [38810], [38928], [46596], [48131], [52955], [53548], [53813], [53873], [54118], [54316], [54420], [54421], [54803].
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54855 602fd350-edb4-49c9-b593-d223f7449a82
---
src/js/_enqueues/lib/nav-menu.js | 4 +-
src/wp-includes/class-wp-list-util.php | 7 ++-
src/wp-includes/compat.php | 2 +-
src/wp-includes/functions.php | 11 ++--
src/wp-includes/l10n.php | 15 ++---
src/wp-includes/load.php | 4 +-
src/wp-includes/post.php | 7 +--
.../rest-api/class-wp-rest-server.php | 6 +-
.../class-wp-rest-posts-controller.php | 20 ++++---
.../providers/class-wp-sitemaps-posts.php | 2 +-
src/wp-includes/taxonomy.php | 4 +-
src/wp-includes/theme.php | 2 +-
tests/phpunit/includes/utils.php | 4 +-
tests/phpunit/tests/functions/sizeFormat.php | 22 ++++----
tests/phpunit/tests/functions/wpListSort.php | 4 +-
tests/phpunit/tests/functions/wpListUtil.php | 15 +++--
.../phpunit/tests/functions/wpNonceField.php | 55 +++++++++----------
.../tests/functions/wpRefererField.php | 3 +-
.../tests/rest-api/rest-posts-controller.php | 2 +
tests/phpunit/tests/theme/wpThemeJson.php | 2 +-
20 files changed, 99 insertions(+), 92 deletions(-)
diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js
index 10b1330a8d4a3..9877f7821770c 100644
--- a/src/js/_enqueues/lib/nav-menu.js
+++ b/src/js/_enqueues/lib/nav-menu.js
@@ -1557,14 +1557,14 @@
});
});
- // Show bulk action
+ // Show bulk action.
$( document ).on( 'menu-item-added', function() {
if ( ! $( '.bulk-actions' ).is( ':visible' ) ) {
$( '.bulk-actions' ).show();
}
} );
- // Hide bulk action
+ // Hide bulk action.
$( document ).on( 'menu-removing-item', function( e, el ) {
var menuElement = $( el ).parents( '#menu-to-edit' );
if ( menuElement.find( 'li' ).length === 1 && $( '.bulk-actions' ).is( ':visible' ) ) {
diff --git a/src/wp-includes/class-wp-list-util.php b/src/wp-includes/class-wp-list-util.php
index a2ccfb541259f..3648cd89f5b1c 100644
--- a/src/wp-includes/class-wp-list-util.php
+++ b/src/wp-includes/class-wp-list-util.php
@@ -207,9 +207,10 @@ public function pluck( $field, $index_key = null ) {
* @since 4.7.0
*
* @param string|array $orderby Optional. Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby
- * is a string.
+ * of multiple orderby fields as `$orderby => $order`.
+ * Default empty array.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
* @return array The sorted array.
*/
diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
index 60e8c0772b1d0..31112336c6b76 100644
--- a/src/wp-includes/compat.php
+++ b/src/wp-includes/compat.php
@@ -156,7 +156,7 @@ function mb_strlen( $string, $encoding = null ) {
/**
* Internal compat function to mimic mb_strlen().
*
- * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
+ * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
* For `$encoding === UTF-8`, the `$str` input is expected to be a valid UTF-8 byte
* sequence. The behavior of this function for invalid inputs is undefined.
*
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index a38c78ccacae0..716be80980c49 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -934,7 +934,7 @@ function do_enclose( $content, $post ) {
* @since 4.4.0
*
* @param string[] $post_links An array of enclosure links.
- * @param int $post_ID Post ID.
+ * @param int $post_id Post ID.
*/
$post_links = apply_filters( 'enclosure_links', $post_links, $post->ID );
@@ -3330,7 +3330,7 @@ function wp_get_mime_types() {
* @since 3.5.0
*
* @param string[] $wp_get_mime_types Mime types keyed by the file extension regex
- * corresponding to those types.
+ * corresponding to those types.
*/
return apply_filters(
'mime_types',
@@ -5200,9 +5200,10 @@ function wp_list_pluck( $list, $field, $index_key = null ) {
*
* @param array $list An array of objects or arrays to sort.
* @param string|array $orderby Optional. Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby
- * is a string.
+ * of multiple orderby fields as `$orderby => $order`.
+ * Default empty array.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
* @return array The sorted array.
*/
diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php
index c5148a02e8c67..40c653fdbe5ca 100644
--- a/src/wp-includes/l10n.php
+++ b/src/wp-includes/l10n.php
@@ -176,7 +176,7 @@ function determine_locale() {
* *Note:* Don't use translate() directly, use __() or related functions.
*
* @since 2.2.0
- * @since 5.5.0 Introduced gettext-{$domain} filter.
+ * @since 5.5.0 Introduced `gettext-{$domain}` filter.
*
* @param string $text Text to translate.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
@@ -242,7 +242,7 @@ function before_last_bar( $string ) {
* *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions.
*
* @since 2.8.0
- * @since 5.5.0 Introduced gettext_with_context-{$domain} filter.
+ * @since 5.5.0 Introduced `gettext_with_context-{$domain}` filter.
*
* @param string $text Text to translate.
* @param string $context Context information for the translators.
@@ -463,7 +463,7 @@ function esc_html_x( $text, $context, $domain = 'default' ) {
* printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );
*
* @since 2.8.0
- * @since 5.5.0 Introduced ngettext-{$domain} filter.
+ * @since 5.5.0 Introduced `ngettext-{$domain}` filter.
*
* @param string $single The text to be used if the number is singular.
* @param string $plural The text to be used if the number is plural.
@@ -521,7 +521,7 @@ function _n( $single, $plural, $number, $domain = 'default' ) {
* printf( _nx( '%s group', '%s groups', $animals, 'group of animals', 'text-domain' ), number_format_i18n( $animals ) );
*
* @since 2.8.0
- * @since 5.5.0 Introduced ngettext_with_context-{$domain} filter.
+ * @since 5.5.0 Introduced `ngettext_with_context-{$domain}` filter.
*
* @param string $single The text to be used if the number is singular.
* @param string $plural The text to be used if the number is plural.
@@ -1022,9 +1022,9 @@ function load_theme_textdomain( $domain, $path = false ) {
}
/**
- * Loads the child themes translated strings.
+ * Loads the child theme's translated strings.
*
- * If the current locale exists as a .mo file in the child themes
+ * If the current locale exists as a .mo file in the child theme's
* root directory, it will be included in the translated strings by the $domain.
*
* The .mo files must be named based on the locale exactly.
@@ -1361,7 +1361,8 @@ function translate_user_role( $name, $domain = 'default' ) {
*
* @param string $dir A directory to search for language files.
* Default WP_LANG_DIR.
- * @return string[] An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
+ * @return string[] An array of language codes or an empty array if no languages are present.
+ * Language codes are formed by stripping the .mo extension from the language file names.
*/
function get_available_languages( $dir = null ) {
$languages = array();
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index 3cf4b0d2077d5..52453802c02c3 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -1322,10 +1322,10 @@ function get_current_network_id() {
* @access private
*
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
- * @global WP_Locale $wp_locale WordPress date and time locale object.
+ * @global WP_Locale $wp_locale WordPress date and time locale object.
*/
function wp_load_translations_early() {
- global $wp_locale, $wp_textdomain_registry;
+ global $wp_textdomain_registry, $wp_locale;
static $loaded = false;
if ( $loaded ) {
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 70e05f9f7342c..185d2d5a08c55 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -1547,9 +1547,8 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' )
*
* @global array $wp_post_types List of post types.
*
- * @param string $post_type Post type key. Must not exceed 20 characters and may
- * only contain lowercase alphanumeric characters, dashes,
- * and underscores. See sanitize_key().
+ * @param string $post_type Post type key. Must not exceed 20 characters and may only contain
+ * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key().
* @param array|string $args {
* Array or string of arguments for registering a post type.
*
@@ -4198,7 +4197,7 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) {
$post_name = $check_name;
- } else { // new post, or slug has changed.
+ } else { // New post, or slug has changed.
$post_name = sanitize_title( $post_name );
}
}
diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
index 1690a00eb877d..0770c97a4a6b4 100644
--- a/src/wp-includes/rest-api/class-wp-rest-server.php
+++ b/src/wp-includes/rest-api/class-wp-rest-server.php
@@ -553,7 +553,7 @@ public function serve_request( $path = null ) {
* Converts a response to data to send.
*
* @since 4.4.0
- * @since 5.4.0 The $embed parameter can now contain a list of link relations to include.
+ * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param WP_REST_Response $response Response object.
* @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links.
@@ -677,7 +677,7 @@ public static function get_compact_response_links( $response ) {
* Embeds the links from the data into the request.
*
* @since 4.4.0
- * @since 5.4.0 The $embed parameter can now contain a list of link relations to include.
+ * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param array $data Data from the request.
* @param bool|string[] $embed Whether to embed all links or a filtered list of link relations.
@@ -759,7 +759,7 @@ protected function embed_links( $data, $embed = true ) {
* data instead.
*
* @since 4.4.0
- * @since 6.0.0 The $embed parameter can now contain a list of link relations to include
+ * @since 6.0.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param WP_REST_Response $response Response object.
* @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links.
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 571a2fd5f4bcf..94e067dfb3280 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
@@ -659,11 +659,9 @@ public function create_item( $request ) {
&& in_array( $prepared_post->post_status, array( 'draft', 'pending' ), true )
) {
/*
- * `wp_unique_post_slug()` returns the same
- * slug for 'draft' or 'pending' posts.
+ * `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts.
*
- * To ensure that a unique slug is generated,
- * pass the post data with the 'publish' status.
+ * To ensure that a unique slug is generated, pass the post data with the 'publish' status.
*/
$prepared_post->post_name = wp_unique_post_slug(
$prepared_post->post_name,
@@ -862,15 +860,19 @@ public function update_item( $request ) {
}
/*
- * `wp_unique_post_slug()` returns the same
- * slug for 'draft' or 'pending' posts.
+ * `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts.
*
- * To ensure that a unique slug is generated,
- * pass the post data with the 'publish' status.
+ * To ensure that a unique slug is generated, pass the post data with the 'publish' status.
*/
if ( ! empty( $post->post_name ) && in_array( $post_status, array( 'draft', 'pending' ), true ) ) {
$post_parent = ! empty( $post->post_parent ) ? $post->post_parent : 0;
- $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, 'publish', $post->post_type, $post_parent );
+ $post->post_name = wp_unique_post_slug(
+ $post->post_name,
+ $post->ID,
+ 'publish',
+ $post->post_type,
+ $post_parent
+ );
}
// Convert the post object to an array, otherwise wp_update_post() will expect non-escaped input.
diff --git a/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php b/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
index a54547877126b..dff85a70e12c5 100644
--- a/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
+++ b/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
@@ -221,7 +221,7 @@ protected function get_posts_query_args( $post_type ) {
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
- 'ignore_sticky_posts' => true, // sticky posts will still appear, but they won't be moved to the front.
+ 'ignore_sticky_posts' => true, // Sticky posts will still appear, but they won't be moved to the front.
),
$post_type
);
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 5b70968185c10..ac73242b5c9bc 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -390,8 +390,8 @@ function is_taxonomy_hierarchical( $taxonomy ) {
*
* @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies.
*
- * @param string $taxonomy Taxonomy key, must not exceed 32 characters and may only contain lowercase alphanumeric
- * characters, dashes, and underscores. See sanitize_key().
+ * @param string $taxonomy Taxonomy key. Must not exceed 32 characters and may only contain
+ * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key().
* @param array|string $object_type Object type or array of object types with which the taxonomy should be associated.
* @param array|string $args {
* Optional. Array or query string of arguments for registering a taxonomy.
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index 6eab6fcc00023..61d5c13284a10 100644
--- a/src/wp-includes/theme.php
+++ b/src/wp-includes/theme.php
@@ -3567,7 +3567,7 @@ function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_p
remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) );
$wp_customize->register_controls();
- /** This filter is documented in /wp-includes/class-wp-customize-manager.php */
+ /** This filter is documented in wp-includes/class-wp-customize-manager.php */
do_action( 'customize_register', $wp_customize );
}
$wp_customize->_publish_changeset_values( $changeset_post->ID );
diff --git a/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php
index 16b331b6a67aa..1b839878b5c0a 100644
--- a/tests/phpunit/includes/utils.php
+++ b/tests/phpunit/includes/utils.php
@@ -459,12 +459,12 @@ function gen_tests_array( $name, $array ) {
}
/**
- * Use to create objects by yourself
+ * Use to create objects by yourself.
*/
class MockClass extends stdClass {}
/**
- * Drops all tables from the WordPress database
+ * Drops all tables from the WordPress database.
*/
function drop_tables() {
global $wpdb;
diff --git a/tests/phpunit/tests/functions/sizeFormat.php b/tests/phpunit/tests/functions/sizeFormat.php
index 1337bb39c8087..72c383ff95da0 100644
--- a/tests/phpunit/tests/functions/sizeFormat.php
+++ b/tests/phpunit/tests/functions/sizeFormat.php
@@ -14,58 +14,58 @@ class Tests_Functions_SizeFormat extends WP_UnitTestCase {
public function _data_size_format() {
return array(
- // Invalid values
+ // Invalid values.
array( array(), 0, false ),
array( 'baba', 0, false ),
array( '', 0, false ),
array( '-1', 0, false ),
array( -1, 0, false ),
- // Bytes
+ // Bytes.
array( 0, 0, '0 B' ),
array( 1, 0, '1 B' ),
array( 1023, 0, '1,023 B' ),
- // Kilobytes
+ // Kilobytes.
array( KB_IN_BYTES, 0, '1 KB' ),
array( KB_IN_BYTES, 2, '1.00 KB' ),
array( 2.5 * KB_IN_BYTES, 0, '3 KB' ),
array( 2.5 * KB_IN_BYTES, 2, '2.50 KB' ),
array( 10 * KB_IN_BYTES, 0, '10 KB' ),
- // Megabytes
+ // Megabytes.
array( (string) 1024 * KB_IN_BYTES, 2, '1.00 MB' ),
array( MB_IN_BYTES, 0, '1 MB' ),
array( 2.5 * MB_IN_BYTES, 0, '3 MB' ),
array( 2.5 * MB_IN_BYTES, 2, '2.50 MB' ),
- // Gigabytes
+ // Gigabytes.
array( (string) 1024 * MB_IN_BYTES, 2, '1.00 GB' ),
array( GB_IN_BYTES, 0, '1 GB' ),
array( 2.5 * GB_IN_BYTES, 0, '3 GB' ),
array( 2.5 * GB_IN_BYTES, 2, '2.50 GB' ),
- // Terabytes
+ // Terabytes.
array( (string) 1024 * GB_IN_BYTES, 2, '1.00 TB' ),
array( TB_IN_BYTES, 0, '1 TB' ),
array( 2.5 * TB_IN_BYTES, 0, '3 TB' ),
array( 2.5 * TB_IN_BYTES, 2, '2.50 TB' ),
- // Petabytes
+ // Petabytes.
array( (string) 1024 * TB_IN_BYTES, 2, '1.00 PB' ),
array( PB_IN_BYTES, 0, '1 PB' ),
array( 2.5 * PB_IN_BYTES, 0, '3 PB' ),
array( 2.5 * PB_IN_BYTES, 2, '2.50 PB' ),
- // Exabytes
+ // Exabytes.
array( (string) 1024 * PB_IN_BYTES, 2, '1.00 EB' ),
array( EB_IN_BYTES, 0, '1 EB' ),
array( 2.5 * EB_IN_BYTES, 0, '3 EB' ),
array( 2.5 * EB_IN_BYTES, 2, '2.50 EB' ),
- // Zettabytes
+ // Zettabytes.
array( (string) 1024 * EB_IN_BYTES, 2, '1.00 ZB' ),
array( ZB_IN_BYTES, 0, '1 ZB' ),
array( 2.5 * ZB_IN_BYTES, 0, '3 ZB' ),
array( 2.5 * ZB_IN_BYTES, 2, '2.50 ZB' ),
- // Yottabytes
+ // Yottabytes.
array( (string) 1024 * ZB_IN_BYTES, 2, '1.00 YB' ),
array( YB_IN_BYTES, 0, '1 YB' ),
array( 2.5 * YB_IN_BYTES, 0, '3 YB' ),
array( 2.5 * YB_IN_BYTES, 2, '2.50 YB' ),
- // Edge values
+ // Edge values.
array( TB_IN_BYTES + ( TB_IN_BYTES / 2 ) + MB_IN_BYTES, 1, '1.5 TB' ),
array( TB_IN_BYTES - MB_IN_BYTES - KB_IN_BYTES, 3, '1,023.999 GB' ),
);
diff --git a/tests/phpunit/tests/functions/wpListSort.php b/tests/phpunit/tests/functions/wpListSort.php
index 7159af4937687..e493cd23219b5 100644
--- a/tests/phpunit/tests/functions/wpListSort.php
+++ b/tests/phpunit/tests/functions/wpListSort.php
@@ -12,7 +12,7 @@ class Tests_Functions_wpListSort extends WP_UnitTestCase {
* @dataProvider data_test_wp_list_sort
*
* @param string|array $orderby Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
+ * of multiple orderby fields as `$orderby => $order`.
* @param string $order Either 'ASC' or 'DESC'.
*/
public function test_wp_list_sort( $list, $orderby, $order, $expected ) {
@@ -337,7 +337,7 @@ public function data_test_wp_list_sort() {
* @dataProvider data_test_wp_list_sort_preserve_keys
*
* @param string|array $orderby Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
+ * of multiple orderby fields as `$orderby => $order`.
* @param string $order Either 'ASC' or 'DESC'.
*/
public function test_wp_list_sort_preserve_keys( $list, $orderby, $order, $expected ) {
diff --git a/tests/phpunit/tests/functions/wpListUtil.php b/tests/phpunit/tests/functions/wpListUtil.php
index e27831fc560a6..f455c94936d65 100644
--- a/tests/phpunit/tests/functions/wpListUtil.php
+++ b/tests/phpunit/tests/functions/wpListUtil.php
@@ -64,7 +64,8 @@ public function test_wp_list_util_get_output() {
* @param array $target_array The array to create the list from.
* @param string $target_key The key to pluck.
* @param array $expected The expected array.
- * @param string $index_key Optional. Field from the element to use as keys for the new array. Default null.
+ * @param string $index_key Optional. Field from the element to use as keys for the new array.
+ * Default null.
*/
public function test_wp_list_util_pluck( $target_array, $target_key, $expected, $index_key = null ) {
$util = new WP_List_Util( $target_array );
@@ -156,9 +157,11 @@ public function test_wp_list_util_sort_simple() {
*
* @param array $expected The expected array.
* @param array $target_array The array to create a list from.
- * @param array $orderby Optional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order.
+ * @param array $orderby Optional. Either the field name to order by or an array
+ * of multiple orderby fields as `$orderby => $order`.
* Default empty array.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string. Default 'ASC'.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
*/
public function test_wp_list_util_sort( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
@@ -955,9 +958,11 @@ public function data_wp_list_util_sort_object_arrays() {
*
* @param array $expected The expected array.
* @param array $target_array The array to create a list from.
- * @param array $orderby Optional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order.
+ * @param array $orderby Optional. Either the field name to order by or an array
+ * of multiple orderby fields as `$orderby => $order`.
* Default empty array.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string. Default 'ASC'.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
*/
public function test_wp_list_util_sort_php_7_or_greater( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
diff --git a/tests/phpunit/tests/functions/wpNonceField.php b/tests/phpunit/tests/functions/wpNonceField.php
index ec2c68727d33b..2596402bb5089 100644
--- a/tests/phpunit/tests/functions/wpNonceField.php
+++ b/tests/phpunit/tests/functions/wpNonceField.php
@@ -14,7 +14,6 @@ class Tests_Functions_wpNonceField extends WP_UnitTestCase {
* @ticket 55578
*/
public function test_wp_nonce_field() {
-
wp_nonce_field();
$this->expectOutputRegex( '#^$#' );
}
@@ -24,14 +23,13 @@ public function test_wp_nonce_field() {
*
* @dataProvider data_wp_nonce_field
*
- * @param int|string $action Action name.
- * @param string $name Nonce name.
- * @param bool $referer Whether to set the referer field fior validation.
- * @param string $expected_reg_exp The expected regular expression.
+ * @param int|string $action Action name.
+ * @param string $name Nonce name.
+ * @param bool $referer Whether to set the referer field for validation.
+ * @param string $expected_regexp The expected regular expression.
*/
- public function test_wp_nonce_field_return( $action, $name, $referer, $expected_reg_exp ) {
-
- $this->assertMatchesRegularExpression( $expected_reg_exp, wp_nonce_field( $action, $name, $referer, false ) );
+ public function test_wp_nonce_field_return( $action, $name, $referer, $expected_regexp ) {
+ $this->assertMatchesRegularExpression( $expected_regexp, wp_nonce_field( $action, $name, $referer, false ) );
}
/**
@@ -40,37 +38,36 @@ public function test_wp_nonce_field_return( $action, $name, $referer, $expected_
* @return array
*/
public function data_wp_nonce_field() {
-
return array(
'default' => array(
- 'action' => - 1,
- 'name' => '_wpnonce',
- 'referer' => true,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => '_wpnonce',
+ 'referer' => true,
+ 'expected_regexp' => '#^$#',
),
'nonce_name' => array(
- 'action' => - 1,
- 'name' => 'nonce_name',
- 'referer' => true,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => 'nonce_name',
+ 'referer' => true,
+ 'expected_regexp' => '#^$#',
),
'action_name' => array(
- 'action' => 'action_name',
- 'name' => '_wpnonce',
- 'referer' => true,
- 'expected_reg_exp' => '#^$#',
+ 'action' => 'action_name',
+ 'name' => '_wpnonce',
+ 'referer' => true,
+ 'expected_regexp' => '#^$#',
),
'no_referer' => array(
- 'action' => - 1,
- 'name' => '_wpnonce',
- 'referer' => false,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => '_wpnonce',
+ 'referer' => false,
+ 'expected_regexp' => '#^$#',
),
'& in name' => array(
- 'action' => - 1,
- 'name' => 'a&b',
- 'referer' => false,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => 'a&b',
+ 'referer' => false,
+ 'expected_regexp' => '#^$#',
),
);
}
diff --git a/tests/phpunit/tests/functions/wpRefererField.php b/tests/phpunit/tests/functions/wpRefererField.php
index 6442e7a0b9ad9..ca72d078f0922 100644
--- a/tests/phpunit/tests/functions/wpRefererField.php
+++ b/tests/phpunit/tests/functions/wpRefererField.php
@@ -14,8 +14,8 @@ class Tests_Functions_wpRefererField extends WP_UnitTestCase {
* @ticket 55578
*/
public function test_wp_referer_field() {
-
$_SERVER['REQUEST_URI'] = '/test/';
+
wp_referer_field();
$this->expectOutputString( '' );
}
@@ -24,7 +24,6 @@ public function test_wp_referer_field() {
* @ticket 55578
*/
public function test_wp_referer_field_return() {
-
$_SERVER['REQUEST_URI'] = '/test/';
$this->assertSame( '', wp_referer_field( false ) );
diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
index b2a5512fbab63..4b66145d801b8 100644
--- a/tests/phpunit/tests/rest-api/rest-posts-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php
@@ -1529,6 +1529,7 @@ public function test_get_items_not_sticky_with_exclude_no_sticky_posts() {
/**
* @ticket 55592
+ *
* @covers WP_REST_Posts_Controller::get_items
* @covers ::update_post_thumbnail_cache
*/
@@ -1566,6 +1567,7 @@ public function test_get_items_primes_thumbnail_cache_for_featured_media() {
/**
* @ticket 55593
+ *
* @covers WP_REST_Posts_Controller::get_items
* @covers ::update_post_parent_caches
*/
diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php
index 913a9601ca953..5a5a21a87769f 100644
--- a/tests/phpunit/tests/theme/wpThemeJson.php
+++ b/tests/phpunit/tests/theme/wpThemeJson.php
@@ -3026,7 +3026,7 @@ public function test_get_element_class_name_invalid() {
}
/**
- * Testing that dynamic properties in theme.json return the value they refrence,
+ * Testing that dynamic properties in theme.json return the value they reference,
* e.g. array( 'ref' => 'styles.color.background' ) => "#ffffff".
*
* @ticket 56467
From 4b5931521b27f536c2734214c91ac7f6383965e0 Mon Sep 17 00:00:00 2001
From: Jonathan Desrosiers
Date: Fri, 18 Nov 2022 14:50:52 +0000
Subject: [PATCH 0064/1431] Build/Test Tools: Improve how Composer dependencies
are installed.
To improve how Composer dependencies are installed and managed within GitHub Actions, the `ramsey/composer-install` third-party action is now used consistently throughout all workflows.
Previously, some workflows manually ran `composer` commands while others already used `ramsey/composer-install`.
The `ramsey/composer-install` action manages caching dependencies across workflow runs internally, which is something that was manually handled before this change.
Props jrf, desrosj.
Fixes #53841.
git-svn-id: https://develop.svn.wordpress.org/trunk@54856 602fd350-edb4-49c9-b593-d223f7449a82
---
.github/workflows/coding-standards.yml | 7 +--
.github/workflows/php-compatibility.yml | 6 ++-
.github/workflows/phpunit-tests.yml | 63 +++++++++++--------------
.github/workflows/test-coverage.yml | 58 +++++++++++------------
4 files changed, 63 insertions(+), 71 deletions(-)
diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml
index 6a7bcf896bdaa..067442009dba2 100644
--- a/.github/workflows/coding-standards.yml
+++ b/.github/workflows/coding-standards.yml
@@ -56,7 +56,6 @@ jobs:
# - Runs PHPCS on the `tests` directory without warnings suppressed.
# - Generate a report for displaying `test` directory issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
-
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
@@ -72,7 +71,7 @@ jobs:
with:
php-version: '7.4'
coverage: none
- tools: composer, cs2pr
+ tools: cs2pr
# This date is used to ensure that the PHPCS cache is cleared at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
@@ -86,10 +85,12 @@ jobs:
path: .cache/phpcs.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
- composer-options: "--no-progress --no-ansi"
+ custom-cache-suffix: ${{ steps.get-date.outputs.date }}
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml
index 22b72821a25f1..fce29378b431d 100644
--- a/.github/workflows/php-compatibility.yml
+++ b/.github/workflows/php-compatibility.yml
@@ -66,7 +66,7 @@ jobs:
with:
php-version: '7.4'
coverage: none
- tools: composer, cs2pr
+ tools: cs2pr
- name: Log debug information
run: |
@@ -84,10 +84,12 @@ jobs:
path: .cache/phpcompat.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
- composer-options: "--no-progress --no-ansi"
+ custom-cache-suffix: ${{ steps.get-date.outputs.date }}
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml
index 52b7413fdfcd1..92ca0766ff08b 100644
--- a/.github/workflows/phpunit-tests.yml
+++ b/.github/workflows/phpunit-tests.yml
@@ -38,10 +38,10 @@ jobs:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
- # - Logs general debug information about the runner.
- # - Installs npm dependencies
- # - Configures caching for Composer.
+ # - Sets up PHP.
# - Installs Composer dependencies.
+ # - Installs npm dependencies
+ # - Logs general debug information about the runner.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
# - Logs the running Docker containers.
@@ -112,6 +112,29 @@ jobs:
node-version-file: '.nvmrc'
cache: npm
+ ##
+ # This allows Composer dependencies to be installed using a single step.
+ #
+ # Since the tests are currently run within the Docker containers where the PHP version varies,
+ # the same PHP version needs to be configured for the action runner machine so that the correct
+ # dependency versions are installed and cached.
+ ##
+ - name: Set up PHP
+ uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0
+ with:
+ php-version: '${{ matrix.php }}'
+ coverage: none
+
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
+ - name: Install Composer dependencies
+ uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
+ with:
+ custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
+
+ - name: Install npm dependencies
+ run: npm ci
+
- name: General debug information
run: |
npm --version
@@ -119,38 +142,8 @@ jobs:
curl --version
git --version
svn --version
-
- - name: Install npm dependencies
- run: npm ci
-
- # This date is used to ensure that the Composer cache is refreshed at least once every week.
- # http://man7.org/linux/man-pages/man1/date.1.html
- - name: "Get last Monday's date"
- id: get-date
- run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
-
- - name: Get Composer cache directory
- id: composer-cache
- run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
-
- - name: Cache Composer dependencies
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
- env:
- cache-name: cache-composer-dependencies
- with:
- path: ${{ steps.composer-cache.outputs.composer_dir }}
- key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
-
- - name: Install Composer dependencies
- run: |
- docker-compose run --rm php composer --version
-
- # Install using `composer update` as there is no `composer.lock` file.
- if [ ${{ env.LOCAL_PHP }} == '8.2-fpm' ]; then
- docker-compose run --rm php composer update --ignore-platform-req=php+
- else
- docker-compose run --rm php composer update
- fi
+ composer --version
+ locale -a
- name: Docker debug information
run: |
diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml
index 6fc2c8da8b196..e07a7560a2ba3 100644
--- a/.github/workflows/test-coverage.yml
+++ b/.github/workflows/test-coverage.yml
@@ -38,10 +38,10 @@ jobs:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
- # - Logs general debug information about the runner.
- # - Installs npm dependencies
- # - Configures caching for Composer.
+ # - Sets up PHP.
# - Installs Composer dependencies.
+ # - Installs npm dependencies
+ # - Logs general debug information about the runner.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
# - Logs the running Docker containers.
@@ -78,6 +78,29 @@ jobs:
node-version-file: '.nvmrc'
cache: npm
+ ##
+ # This allows Composer dependencies to be installed using a single step.
+ #
+ # Since the tests are currently run within the Docker containers where the PHP version varies,
+ # the same PHP version needs to be configured for the action runner machine so that the correct
+ # dependency versions are installed and cached.
+ ##
+ - name: Set up PHP
+ uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0
+ with:
+ php-version: '7.4'
+ coverage: none
+
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
+ - name: Install Composer dependencies
+ uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
+ with:
+ custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
+
+ - name: Install npm Dependencies
+ run: npm ci
+
- name: Log debug information
run: |
echo "$GITHUB_REF"
@@ -87,36 +110,9 @@ jobs:
curl --version
git --version
svn --version
+ composer --version
locale -a
- - name: Install npm Dependencies
- run: npm ci
-
- # This date is used to ensure that the Composer cache is refreshed at least once every week.
- # http://man7.org/linux/man-pages/man1/date.1.html
- - name: "Get last Monday's date"
- id: get-date
- run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
-
- - name: Get Composer cache directory
- id: composer-cache
- run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
-
- - name: Cache Composer dependencies
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
- env:
- cache-name: cache-composer-dependencies
- with:
- path: ${{ steps.composer-cache.outputs.composer_dir }}
- key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
-
- - name: Install Composer dependencies
- run: |
- docker-compose run --rm php composer --version
-
- # Install using `composer update` as there is no `composer.lock` file.
- docker-compose run --rm php composer update
-
- name: Docker debug information
run: |
docker -v
From 868709a4e7b1971825c85bc4b575173250420afd Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 18 Nov 2022 15:19:07 +0000
Subject: [PATCH 0065/1431] Users: Add missing escaping on the Add New User
screen.
While the `$type` and `$label` variables are set to values that do not currently require escaping, this may change in the future, so it is preferable to add the escaping as a defensive coding measure.
Follow-up to [16294], [29030].
Props monzuralam, rudlinkon, hztyfoon, peterwilsoncc.
Fixes #57133.
git-svn-id: https://develop.svn.wordpress.org/trunk@54857 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/user-new.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-admin/user-new.php b/src/wp-admin/user-new.php
index 7b0287545f929..9edd7f067f884 100644
--- a/src/wp-admin/user-new.php
+++ b/src/wp-admin/user-new.php
@@ -442,8 +442,8 @@
-
-
+
+
From cfd09a412765e072b842e3216605c577f667d462 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sat, 19 Nov 2022 15:40:11 +0000
Subject: [PATCH 0066/1431] Coding Standards: Fix WPCS issues in
`wp-admin/install-helper.php`.
This commit adds inline comments instructing PHPCS to ignore some lines for database queries. An explanation is provided with each instruction.
This resolves a few WPCS warnings along the lines of:
{{{
Use placeholders and $wpdb->prepare(); found interpolated variable $table_name at "DESC $table_name"
}}}
Follow-up to [236], [265], [5778].
Props jipmoors, costdev, jrf, SergeyBiryukov.
Fixes #43761.
git-svn-id: https://develop.svn.wordpress.org/trunk@54858 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/install-helper.php | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/wp-admin/install-helper.php b/src/wp-admin/install-helper.php
index 733321c13ee76..e07b3d8eddb83 100644
--- a/src/wp-admin/install-helper.php
+++ b/src/wp-admin/install-helper.php
@@ -59,6 +59,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
}
// Didn't find it, so try to create it.
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $create_ddl );
// We cannot directly tell that whether this succeeded!
@@ -88,6 +89,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
global $wpdb;
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return true;
@@ -95,9 +97,11 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
}
// Didn't find it, so try to create it.
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $create_ddl );
// We cannot directly tell that whether this succeeded!
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return true;
@@ -123,13 +127,16 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
global $wpdb;
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
// Found it, so try to drop it.
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $drop_ddl );
// We cannot directly tell that whether this succeeded!
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return false;
@@ -174,7 +181,9 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default_value = null, $extra = null ) {
global $wpdb;
- $diffs = 0;
+ $diffs = 0;
+
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
$results = $wpdb->get_results( "DESC $table_name" );
foreach ( $results as $row ) {
From d2f420493d87465c323190892d4e7a6e4c6070a7 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 20 Nov 2022 14:08:38 +0000
Subject: [PATCH 0067/1431] Docs: Fix typo and improve DocBlock formatting in
`wp-admin/install-helper.php`.
Follow-up to [236], [265], [8645], [30542].
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54859 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/install-helper.php | 40 +++++++++++++++++----------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/wp-admin/install-helper.php b/src/wp-admin/install-helper.php
index e07b3d8eddb83..d9aaaba58f932 100644
--- a/src/wp-admin/install-helper.php
+++ b/src/wp-admin/install-helper.php
@@ -1,28 +1,30 @@
comments, 'comment_author', 'tinytext' ) ) {
* echo "ok\n";
* }
*
- * $error_count = 0;
- * $tablename = $wpdb->links;
* // Check the column.
* if ( ! check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
* $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
* $q = $wpdb->query( $ddl );
* }
*
+ * $error_count = 0;
+ * $tablename = $wpdb->links;
+ *
* if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
* $res .= $tablename . ' - ok ';
* } else {
@@ -62,7 +64,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $create_ddl );
- // We cannot directly tell that whether this succeeded!
+ // We cannot directly tell whether this succeeded!
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
if ( $table === $table_name ) {
return true;
@@ -100,7 +102,7 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $create_ddl );
- // We cannot directly tell that whether this succeeded!
+ // We cannot directly tell whether this succeeded!
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
@@ -135,7 +137,7 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $drop_ddl );
- // We cannot directly tell that whether this succeeded!
+ // We cannot directly tell whether this succeeded!
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
@@ -154,16 +156,16 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
*
* Uses the SQL DESC for retrieving the table info for the column. It will help
* understand the parameters, if you do more research on what column information
- * is returned by the SQL statement. Pass in null to skip checking that
- * criteria.
- *
- * Column names returned from DESC table are case sensitive and are listed:
- * Field
- * Type
- * Null
- * Key
- * Default
- * Extra
+ * is returned by the SQL statement. Pass in null to skip checking that criteria.
+ *
+ * Column names returned from DESC table are case sensitive and are as listed:
+ *
+ * - Field
+ * - Type
+ * - Null
+ * - Key
+ * - Default
+ * - Extra
*
* @since 1.0.0
*
From 239a6c33ec5fef9416655c36225b064b987c31cc Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 21 Nov 2022 16:48:33 +0000
Subject: [PATCH 0068/1431] Site Editor: Show correct theme per template or
template part.
Child themes inherit templates and template parts from the parent theme. In Site Editor, the "Added by" column for a template defaults to displaying the child theme, even though it is inherited from the parent, creating confusion as to where the actual templates are located.
This commit ensures that the parent theme is correctly displayed in that scenario.
Follow-up to [51003], [52062].
Props ptahdunbar, WoutPitje, petaryoast, costdev, poena, audrasjb, SergeyBiryukov.
Fixes #55437.
git-svn-id: https://develop.svn.wordpress.org/trunk@54860 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-template-utils.php | 2 +-
tests/phpunit/tests/block-template-utils.php | 42 ++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php
index b1a3172fbb51f..f4958050c6593 100644
--- a/src/wp-includes/block-template-utils.php
+++ b/src/wp-includes/block-template-utils.php
@@ -503,7 +503,7 @@ function _build_block_template_result_from_file( $template_file, $template_type
$template = new WP_Block_Template();
$template->id = $theme . '//' . $template_file['slug'];
- $template->theme = $theme;
+ $template->theme = ! empty( $template_file['theme'] ) ? $template_file['theme'] : $theme;
$template->content = _inject_theme_attribute_in_block_template_content( $template_content );
$template->slug = $template_file['slug'];
$template->source = 'theme';
diff --git a/tests/phpunit/tests/block-template-utils.php b/tests/phpunit/tests/block-template-utils.php
index 440dbc15d929b..a77f7e9d81821 100644
--- a/tests/phpunit/tests/block-template-utils.php
+++ b/tests/phpunit/tests/block-template-utils.php
@@ -123,6 +123,25 @@ public function test_build_block_template_result_from_post() {
$this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
}
+ /**
+ * Tests that _build_block_template_result_from_post() returns the correct theme
+ * for the template when a child theme is active.
+ *
+ * @ticket 55437
+ *
+ * @covers ::_build_block_template_result_from_post
+ */
+ function test_build_block_template_result_from_post_with_child_theme() {
+ switch_theme( 'block-theme-child' );
+
+ $template = _build_block_template_result_from_post(
+ self::$template_post,
+ 'wp_template'
+ );
+
+ $this->assertSame( self::TEST_THEME, $template->theme );
+ }
+
function test_build_block_template_result_from_file() {
$template = _build_block_template_result_from_file(
array(
@@ -161,6 +180,29 @@ function test_build_block_template_result_from_file() {
$this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
}
+ /**
+ * Tests that _build_block_template_result_from_file() returns the correct theme
+ * for the template when a child theme is active.
+ *
+ * @ticket 55437
+ *
+ * @covers ::_build_block_template_result_from_file
+ */
+ function test_build_block_template_result_from_file_with_child_theme() {
+ switch_theme( 'block-theme-child' );
+
+ $template = _build_block_template_result_from_file(
+ array(
+ 'slug' => 'single',
+ 'path' => __DIR__ . '/../data/templates/template.html',
+ 'theme' => self::TEST_THEME,
+ ),
+ 'wp_template'
+ );
+
+ $this->assertSame( self::TEST_THEME, $template->theme );
+ }
+
function test_inject_theme_attribute_in_block_template_content() {
$theme = get_stylesheet();
$content_without_theme_attribute = '';
From e507aee79fb0c2e7f42f0461c8b84e91524cf46c Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 22 Nov 2022 15:02:26 +0000
Subject: [PATCH 0069/1431] Tests: Move `wp_filesize()` tests to their own
file.
This aims to make the tests more discoverable and easier to expand.
Includes splitting the `wp_filesize` and `pre_wp_filesize` filter tests into a separate test case.
Follow-up to [52837], [52932], [54402].
Props pbearne, spacedmonkey, SergeyBiryukov.
See #57171.
git-svn-id: https://develop.svn.wordpress.org/trunk@54861 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions.php | 35 -------------
tests/phpunit/tests/functions/wpFilesize.php | 53 ++++++++++++++++++++
2 files changed, 53 insertions(+), 35 deletions(-)
create mode 100644 tests/phpunit/tests/functions/wpFilesize.php
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index ea7488a5d95f3..7f855e110f3d1 100644
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -2065,41 +2065,6 @@ public function test_wp_get_default_extension_for_mime_type() {
$this->assertFalse( wp_get_default_extension_for_mime_type( null ), 'false not returned when null as mime type supplied' );
}
- /**
- * @ticket 49412
- * @covers ::wp_filesize
- */
- function test_wp_filesize_with_nonexistent_file() {
- $file = 'nonexistent/file.jpg';
- $this->assertSame( 0, wp_filesize( $file ) );
- }
-
- /**
- * @ticket 49412
- * @covers ::wp_filesize
- */
- function test_wp_filesize() {
- $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
-
- $this->assertSame( filesize( $file ), wp_filesize( $file ) );
-
- $filter = function() {
- return 999;
- };
-
- add_filter( 'wp_filesize', $filter );
-
- $this->assertSame( 999, wp_filesize( $file ) );
-
- $pre_filter = function() {
- return 111;
- };
-
- add_filter( 'pre_wp_filesize', $pre_filter );
-
- $this->assertSame( 111, wp_filesize( $file ) );
- }
-
/**
* @ticket 55505
* @covers ::wp_recursive_ksort
diff --git a/tests/phpunit/tests/functions/wpFilesize.php b/tests/phpunit/tests/functions/wpFilesize.php
new file mode 100644
index 0000000000000..f65aa908724b4
--- /dev/null
+++ b/tests/phpunit/tests/functions/wpFilesize.php
@@ -0,0 +1,53 @@
+assertSame( filesize( $file ), wp_filesize( $file ) );
+ }
+
+ /**
+ * @ticket 49412
+ */
+ function test_wp_filesize_filters() {
+ $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
+
+ add_filter(
+ 'wp_filesize',
+ static function() {
+ return 999;
+ }
+ );
+
+ $this->assertSame( 999, wp_filesize( $file ) );
+
+ add_filter(
+ 'pre_wp_filesize',
+ static function() {
+ return 111;
+ }
+ );
+
+ $this->assertSame( 111, wp_filesize( $file ) );
+ }
+
+ /**
+ * @ticket 49412
+ */
+ function test_wp_filesize_with_nonexistent_file() {
+ $file = 'nonexistent/file.jpg';
+
+ $this->assertSame( 0, wp_filesize( $file ) );
+ }
+}
From 9ed27339b19eb07aa01bcb7e593be2e11f928f1e Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 22 Nov 2022 15:09:33 +0000
Subject: [PATCH 0070/1431] Tests: Add a `public` visibility to `wp_filesize()`
tests.
Follow-up to [52010], [52837], [52932], [54861].
See #57171.
git-svn-id: https://develop.svn.wordpress.org/trunk@54862 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions/wpFilesize.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/phpunit/tests/functions/wpFilesize.php b/tests/phpunit/tests/functions/wpFilesize.php
index f65aa908724b4..f0e510ddc5943 100644
--- a/tests/phpunit/tests/functions/wpFilesize.php
+++ b/tests/phpunit/tests/functions/wpFilesize.php
@@ -11,7 +11,7 @@ class Tests_Functions_wpFilesize extends WP_UnitTestCase {
/**
* @ticket 49412
*/
- function test_wp_filesize() {
+ public function test_wp_filesize() {
$file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
$this->assertSame( filesize( $file ), wp_filesize( $file ) );
@@ -20,7 +20,7 @@ function test_wp_filesize() {
/**
* @ticket 49412
*/
- function test_wp_filesize_filters() {
+ public function test_wp_filesize_filters() {
$file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
add_filter(
@@ -45,7 +45,7 @@ static function() {
/**
* @ticket 49412
*/
- function test_wp_filesize_with_nonexistent_file() {
+ public function test_wp_filesize_with_nonexistent_file() {
$file = 'nonexistent/file.jpg';
$this->assertSame( 0, wp_filesize( $file ) );
From ea651b1fc19eb560ee87dd6cb2e64c522713ed3c Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 22 Nov 2022 19:43:25 +0000
Subject: [PATCH 0071/1431] =?UTF-8?q?Tests:=20Add=20unit=20tests=20for=20a?=
=?UTF-8?q?ttachment=E2=80=99s=20file=20size=20being=20included=20in=20met?=
=?UTF-8?q?adata.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
These tests ensure that `wp_generate_attachment_metadata()` stores the file size of all newly uploaded attachments under the `filesize` array key. The tests were initially supposed to be committed with [52837].
Follow-up to [52837], [52932], [54861].
Props spacedmonkey, johnwatkins0, mitogh, adamsilverstein, pbearne, SergeyBiryukov.
Fixes #57171.
git-svn-id: https://develop.svn.wordpress.org/trunk@54863 602fd350-edb4-49c9-b593-d223f7449a82
---
.../media/wpGenerateAttachmentMetadata.php | 89 +++++++++++++++++++
.../tests/media/wpImageTagAddDecodingAttr.php | 2 +-
2 files changed, 90 insertions(+), 1 deletion(-)
create mode 100644 tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php
diff --git a/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php b/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php
new file mode 100644
index 0000000000000..82fe7dabd61b2
--- /dev/null
+++ b/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php
@@ -0,0 +1,89 @@
+remove_added_uploads();
+
+ parent::tear_down();
+ }
+
+ /**
+ * Tests that filesize meta is generated for JPEGs.
+ *
+ * @ticket 49412
+ *
+ * @covers ::wp_create_image_subsizes
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_jpg_meta() {
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/canola.jpg' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+
+ foreach ( $metadata['sizes'] as $intermediate_size ) {
+ $this->assertArrayHasKey( 'filesize', $intermediate_size );
+ $this->assertNotEmpty( $intermediate_size['filesize'] );
+ $this->assertIsNumeric( $intermediate_size['filesize'] );
+ }
+ }
+
+ /**
+ * Checks that filesize meta is generated for PNGs.
+ *
+ * @ticket 49412
+ *
+ * @covers ::wp_create_image_subsizes
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_png_meta() {
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/test-image.png' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+ }
+
+ /**
+ * Checks that filesize meta is generated for PDFs.
+ *
+ * @ticket 49412
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_pdf_meta() {
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+ }
+
+ /**
+ * Checks that filesize meta is generated for PSDs.
+ *
+ * @ticket 49412
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_psd_meta() {
+ if ( is_multisite() ) {
+ // PSD mime type is not allowed by default on multisite.
+ add_filter(
+ 'upload_mimes',
+ static function( $mimes ) {
+ $mimes['psd'] = 'application/octet-stream';
+ return $mimes;
+ }
+ );
+ }
+
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/test-image.psd' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+ }
+}
diff --git a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
index 76fa203b7e73d..3ffe1bc6b4a19 100644
--- a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
+++ b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
@@ -1,7 +1,7 @@
Date: Tue, 22 Nov 2022 20:17:08 +0000
Subject: [PATCH 0072/1431] Tests: Clean up test file in `wpmu_delete_blog()`
tests.
This makes sure there are no leftover files after the tests from the `multisite` directory are run separately.
Follow-up to [30404].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54864 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/multisite/msFilesRewriting.php | 2 ++
tests/phpunit/tests/multisite/site.php | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tests/phpunit/tests/multisite/msFilesRewriting.php b/tests/phpunit/tests/multisite/msFilesRewriting.php
index 38818b50288bf..7d469769ba32a 100644
--- a/tests/phpunit/tests/multisite/msFilesRewriting.php
+++ b/tests/phpunit/tests/multisite/msFilesRewriting.php
@@ -72,6 +72,8 @@ public function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_
// The file on the main site should still exist. The file on the deleted site should not.
$this->assertFileExists( $file1['file'] );
$this->assertFileDoesNotExist( $file2['file'] );
+
+ unlink( $file1['file'] );
}
}
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 6507fbbf22de3..a3e179a88db73 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -398,6 +398,8 @@ public function test_upload_directories_after_multiple_wpmu_delete_blog() {
// The file on the main site should still exist. The file on the deleted site should not.
$this->assertFileExists( $file1['file'] );
$this->assertFileDoesNotExist( $file2['file'] );
+
+ unlink( $file1['file'] );
}
public function test_wpmu_update_blogs_date() {
From e385beb7478d1e193be2a9f7622dae052af58e98 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 22 Nov 2022 21:25:27 +0000
Subject: [PATCH 0073/1431] Tests: Correct references to `set_up()` and
`tear_down()` in various DocBlocks.
The `setUp()` and `tearDown()` methods were renamed to `set_up()` and `tear_down()`, respectively, as part of implementing the `void` return type solution for PHPUnit 8.0.
Follow-up to [29120], [29251], [30277], [32173], [32806], [38829], [42379], [50450], [51276], [51568].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54865 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/includes/abstract-testcase.php | 15 ++++++++-------
tests/phpunit/includes/testcase-canonical.php | 4 ++--
.../tests/customize/custom-css-setting.php | 2 +-
.../tests/customize/nav-menu-item-setting.php | 2 +-
.../phpunit/tests/customize/nav-menu-setting.php | 2 +-
tests/phpunit/tests/customize/nav-menus.php | 2 +-
tests/phpunit/tests/db/dbDelta.php | 2 +-
tests/phpunit/tests/query/postStatus.php | 2 +-
tests/phpunit/tests/user/capabilities.php | 2 +-
9 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php
index 38f846e54181b..6cfeaa307cc26 100644
--- a/tests/phpunit/includes/abstract-testcase.php
+++ b/tests/phpunit/includes/abstract-testcase.php
@@ -322,7 +322,7 @@ protected function reset__SERVER() {
* Saves the action and filter-related globals so they can be restored later.
*
* Stores $wp_actions, $wp_current_filter, and $wp_filter on a class variable
- * so they can be restored on tearDown() using _restore_hooks().
+ * so they can be restored on tear_down() using _restore_hooks().
*
* @global array $wp_actions
* @global array $wp_current_filter
@@ -340,7 +340,7 @@ protected function _backup_hooks() {
}
/**
- * Restores the hook-related globals to their state at setUp()
+ * Restores the hook-related globals to their state at set_up()
* so that future tests aren't affected by hooks set during this last test.
*
* @global array $wp_actions
@@ -1365,11 +1365,12 @@ public function rmdir( $path ) {
/**
* Deletes files added to the `uploads` directory during tests.
*
- * This method works in tandem with the `setUp()` and `rmdir()` methods:
- * - `setUp()` scans the `uploads` directory before every test, and stores its contents inside of the
- * `$ignore_files` property.
- * - `rmdir()` and its helper methods only delete files that are not listed in the `$ignore_files` property. If
- * called during `tearDown()` in tests, this will only delete files added during the previously run test.
+ * This method works in tandem with the `set_up()` and `rmdir()` methods:
+ * - `set_up()` scans the `uploads` directory before every test, and stores
+ * its contents inside of the `$ignore_files` property.
+ * - `rmdir()` and its helper methods only delete files that are not listed
+ * in the `$ignore_files` property. If called during `tear_down()` in tests,
+ * this will only delete files added during the previously run test.
*/
public function remove_added_uploads() {
$uploads = wp_upload_dir();
diff --git a/tests/phpunit/includes/testcase-canonical.php b/tests/phpunit/includes/testcase-canonical.php
index 833df23e5b876..26916fac6e96b 100644
--- a/tests/phpunit/includes/testcase-canonical.php
+++ b/tests/phpunit/includes/testcase-canonical.php
@@ -37,7 +37,7 @@ public function set_up() {
/**
* Generate fixtures to be shared between canonical tests.
*
- * Abstracted here because it's invoked by setUpBeforeClass() in more than one class.
+ * Abstracted here because it's invoked by wpSetUpBeforeClass() in more than one class.
*
* @since 4.1.0
*/
@@ -46,7 +46,7 @@ public static function generate_shared_fixtures( WP_UnitTest_Factory $factory )
self::$author_id = $factory->user->create( array( 'user_login' => 'canonical-author' ) );
/*
- * Also set in self::setUp(), but we must configure here to make sure that
+ * Also set in self::set_up(), but we must configure here to make sure that
* post authorship is properly attributed for fixtures.
*/
wp_set_current_user( self::$author_id );
diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php
index f651b509a85e5..015b6308af306 100644
--- a/tests/phpunit/tests/customize/custom-css-setting.php
+++ b/tests/phpunit/tests/customize/custom-css-setting.php
@@ -25,7 +25,7 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
/**
* Set up the test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php
index 212f871747ad1..256e5f577c5d7 100644
--- a/tests/phpunit/tests/customize/nav-menu-item-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php
@@ -16,7 +16,7 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase {
/**
* Set up a test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/nav-menu-setting.php b/tests/phpunit/tests/customize/nav-menu-setting.php
index 4a727618ebec3..6d50c96ee0c62 100644
--- a/tests/phpunit/tests/customize/nav-menu-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-setting.php
@@ -17,7 +17,7 @@ class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase {
/**
* Set up a test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php
index 5785558103c95..7b8ee43396448 100644
--- a/tests/phpunit/tests/customize/nav-menus.php
+++ b/tests/phpunit/tests/customize/nav-menus.php
@@ -17,7 +17,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
/**
* Set up a test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/db/dbDelta.php b/tests/phpunit/tests/db/dbDelta.php
index 6667f9aba39af..03426fa721997 100644
--- a/tests/phpunit/tests/db/dbDelta.php
+++ b/tests/phpunit/tests/db/dbDelta.php
@@ -99,7 +99,7 @@ public function tear_down() {
parent::tear_down();
- // This has to be called after the parent `tearDown()` method.
+ // This has to be called after the parent `tear_down()` method.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test" );
}
diff --git a/tests/phpunit/tests/query/postStatus.php b/tests/phpunit/tests/query/postStatus.php
index 1ab8aa849d1b8..238551b524f44 100644
--- a/tests/phpunit/tests/query/postStatus.php
+++ b/tests/phpunit/tests/query/postStatus.php
@@ -87,7 +87,7 @@ public function set_up() {
* Register custom post types and statuses used in multiple tests.
*
* CPTs and CPSs are reset between each test run so need to be registered
- * in both the wpSetUpBeforeClass() and setUp() methods.
+ * in both the wpSetUpBeforeClass() and set_up() methods.
*/
public static function register_custom_post_objects() {
register_post_type(
diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php
index c7e836f6e583e..4583e0155ba8e 100644
--- a/tests/phpunit/tests/user/capabilities.php
+++ b/tests/phpunit/tests/user/capabilities.php
@@ -1707,7 +1707,7 @@ public function test_borked_current_user_can_for_blog() {
}
public function nullify_current_user() {
- // Prevents fatal errors in ::tearDown()'s and other uses of restore_current_blog().
+ // Prevents fatal errors in ::tear_down()'s and other uses of restore_current_blog().
$function_stack = wp_debug_backtrace_summary( null, 0, false );
if ( in_array( 'restore_current_blog', $function_stack, true ) ) {
return;
From 04f55a430e2ee5a88e9b5b5485b75a68fabd5a83 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Wed, 23 Nov 2022 15:41:39 +0000
Subject: [PATCH 0074/1431] =?UTF-8?q?Docs:=20Revise=20comments=20using=20?=
=?UTF-8?q?=E2=80=9Cwe=E2=80=9D=20in=20WordPress=20root=20directory=20file?=
=?UTF-8?q?s.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This updates some inline comments to better match the guidelines and recommendations set forth in the make/core and make/docs handbooks:
> In general, use second person in your documentation. Second person depicts a friendly tone, with a perfect focus on the reader. In addition to this, directly addressing the reader helps avoid passive voice; thereby preventing unwanted confusion.
> ...
> the word “we” should be avoided (...) unless its made very clear which group is speaking.
Includes:
* Replacing first-person usage of "we" with second person point of view.
* Making small clarification adjustments where the voice is much too casual or lacks clear context, especially for non-native English speakers.
References:
* [https://make.wordpress.org/docs/style-guide/language-grammar/grammatical-person/ Style Guide: Grammatical person]
* [https://make.wordpress.org/docs/handbook/documentation-team-handbook/handbooks-style-and-formatting-guide/ Handbooks & HelpHub Style and Formatting Guide]
* [https://make.wordpress.org/core/handbook/best-practices/post-comment-guidelines/#style-and-substance Post & Comment Guidelines: Style and Substance]
Follow-up to [2176], [3430], [4676], [6009], [7991], [12688], [12762], [26008], [28978], [44488], [44962], [51979], [53131], [53132], [53156], [53131], [54200].
Props ironprogrammer, costdev, jorbin, SergeyBiryukov.
See #57052.
git-svn-id: https://develop.svn.wordpress.org/trunk@54866 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-cron.php | 4 ++--
src/wp-load.php | 6 +-----
src/wp-login.php | 2 +-
src/wp-mail.php | 2 +-
src/wp-settings.php | 12 ++++++------
src/wp-trackback.php | 2 +-
src/xmlrpc.php | 2 +-
7 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/src/wp-cron.php b/src/wp-cron.php
index 164e4ef191fc7..f4211d82cde13 100644
--- a/src/wp-cron.php
+++ b/src/wp-cron.php
@@ -23,7 +23,7 @@
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
}
-/* Don't make the request block till we finish, if possible. */
+// Don't run cron until the request finishes, if possible.
if ( PHP_VERSION_ID >= 70016 && function_exists( 'fastcgi_finish_request' ) ) {
fastcgi_finish_request();
} elseif ( function_exists( 'litespeed_finish_request' ) ) {
@@ -35,7 +35,7 @@
}
/**
- * Tell WordPress we are doing the cron task.
+ * Tell WordPress the cron task is running.
*
* @var bool
*/
diff --git a/src/wp-load.php b/src/wp-load.php
index 9e8241fef5924..5b869566ac105 100644
--- a/src/wp-load.php
+++ b/src/wp-load.php
@@ -68,11 +68,7 @@
$path = wp_guess_url() . '/wp-admin/setup-config.php';
- /*
- * We're going to redirect to setup-config.php. While this shouldn't result
- * in an infinite loop, that's a silly thing to assume, don't you think? If
- * we're traveling in circles, our last-ditch effort is "Need more help?"
- */
+ // Redirect to setup-config.php.
if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
header( 'Location: ' . $path );
exit;
diff --git a/src/wp-login.php b/src/wp-login.php
index f79385530cf30..a6a7bc8175a40 100644
--- a/src/wp-login.php
+++ b/src/wp-login.php
@@ -1244,7 +1244,7 @@ function wp_login_viewport_meta() {
)
);
} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
- // If cookies are disabled, we can't log in even with a valid user and password.
+ // If cookies are disabled, the user can't log in even with a valid username and password.
$user = new WP_Error(
'test_cookie',
sprintf(
diff --git a/src/wp-mail.php b/src/wp-mail.php
index eab3e0cf9f298..b37a88b885212 100644
--- a/src/wp-mail.php
+++ b/src/wp-mail.php
@@ -231,7 +231,7 @@
echo "\n" . $post_ID->get_error_message();
}
- // We couldn't post, for whatever reason. Better move forward to the next email.
+ // The post wasn't inserted or updated, for whatever reason. Better move forward to the next email.
if ( empty( $post_ID ) ) {
continue;
}
diff --git a/src/wp-settings.php b/src/wp-settings.php
index d80d79bb82d6b..3ed93b2f36629 100644
--- a/src/wp-settings.php
+++ b/src/wp-settings.php
@@ -19,8 +19,8 @@
* Version information for the current WordPress release.
*
* These can't be directly globalized in version.php. When updating,
- * we're including version.php from another installation and don't want
- * these values to be overridden if already set.
+ * include version.php from another installation and don't override
+ * these values if already set.
*
* @global string $wp_version The WordPress version string.
* @global int $wp_db_version WordPress database version.
@@ -60,7 +60,7 @@
// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
wp_initial_constants();
-// Make sure we register the shutdown handler for fatal errors as soon as possible.
+// Register the shutdown handler for fatal errors as soon as possible.
wp_register_fatal_error_handler();
// WordPress calculates offsets from UTC.
@@ -70,13 +70,13 @@
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
-// Check if we're in maintenance mode.
+// Check if the site is in maintenance mode.
wp_maintenance();
// Start loading timer.
timer_start();
-// Check if we're in WP_DEBUG mode.
+// Check if WP_DEBUG mode is enabled.
wp_debug_mode();
/**
@@ -145,7 +145,7 @@
register_shutdown_function( 'shutdown_action_hook' );
-// Stop most of WordPress from being loaded if we just want the basics.
+// Stop most of WordPress from being loaded if SHORTINIT is enabled.
if ( SHORTINIT ) {
return false;
}
diff --git a/src/wp-trackback.php b/src/wp-trackback.php
index d7d1881417532..7512e33fb41da 100644
--- a/src/wp-trackback.php
+++ b/src/wp-trackback.php
@@ -76,7 +76,7 @@ function trackback_response( $error = 0, $error_message = '' ) {
$blog_name = mb_convert_encoding( $blog_name, get_option( 'blog_charset' ), $charset );
}
-// Now that mb_convert_encoding() has been given a swing, we need to escape these three.
+// Escape values to use in the trackback.
$title = wp_slash( $title );
$excerpt = wp_slash( $excerpt );
$blog_name = wp_slash( $blog_name );
diff --git a/src/xmlrpc.php b/src/xmlrpc.php
index 341a6dc84dc55..ecac4c7c7a1bd 100644
--- a/src/xmlrpc.php
+++ b/src/xmlrpc.php
@@ -12,7 +12,7 @@
*/
define( 'XMLRPC_REQUEST', true );
-// Some browser-embedded clients send cookies. We don't want them.
+// Discard unneeded cookies sent by some browser-embedded clients.
$_COOKIE = array();
// $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
From 54d392e8d7739e5946b51d79cd3868315e282eed Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 23 Nov 2022 21:28:15 +0000
Subject: [PATCH 0075/1431] Docs: Improve various globals documentation, as per
documentation standards.
Props upadalavipul, mukesh27, krupalpanchal, jigar-bhanushali.
See #57069, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54867 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/class-wp-upgrader.php | 2 ++
src/wp-includes/class-wp-block.php | 2 ++
src/wp-includes/class-wp-locale.php | 1 -
src/wp-includes/class-wp-tax-query.php | 2 --
src/wp-includes/class-wp-term-query.php | 2 --
5 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php
index a2b2c9ed06fca..88c6d5d604b0c 100644
--- a/src/wp-admin/includes/class-wp-upgrader.php
+++ b/src/wp-admin/includes/class-wp-upgrader.php
@@ -911,6 +911,8 @@ public function maintenance_mode( $enable = false ) {
*
* @since 4.5.0
*
+ * @global wpdb $wpdb The WordPress database abstraction object.
+ *
* @param string $lock_name The name of this unique lock.
* @param int $release_timeout Optional. The duration in seconds to respect an existing lock.
* Default: 1 hour.
diff --git a/src/wp-includes/class-wp-block.php b/src/wp-includes/class-wp-block.php
index 8a51e66085bb4..890ae5e559353 100644
--- a/src/wp-includes/class-wp-block.php
+++ b/src/wp-includes/class-wp-block.php
@@ -196,6 +196,8 @@ public function __get( $name ) {
*
* @since 5.5.0
*
+ * @global WP_Post $post Global post object.
+ *
* @param array $options {
* Optional options object.
*
diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php
index ca98f9d301fcd..b001a099648b5 100644
--- a/src/wp-includes/class-wp-locale.php
+++ b/src/wp-includes/class-wp-locale.php
@@ -124,7 +124,6 @@ public function __construct() {
* @since 2.1.0
*
* @global string $text_direction
- * @global string $wp_version The WordPress version string.
*/
public function init() {
// The weekdays.
diff --git a/src/wp-includes/class-wp-tax-query.php b/src/wp-includes/class-wp-tax-query.php
index e7b1e2a95a551..881e0ce2dc72a 100644
--- a/src/wp-includes/class-wp-tax-query.php
+++ b/src/wp-includes/class-wp-tax-query.php
@@ -589,8 +589,6 @@ private function clean_query( &$query ) {
*
* @since 3.2.0
*
- * @global wpdb $wpdb The WordPress database abstraction object.
- *
* @param array $query The single query. Passed by reference.
* @param string $resulting_field The resulting field. Accepts 'slug', 'name', 'term_taxonomy_id',
* or 'term_id'. Default 'term_id'.
diff --git a/src/wp-includes/class-wp-term-query.php b/src/wp-includes/class-wp-term-query.php
index 18c85e89b28d7..ae391bfcf5829 100644
--- a/src/wp-includes/class-wp-term-query.php
+++ b/src/wp-includes/class-wp-term-query.php
@@ -910,8 +910,6 @@ public function get_terms() {
*
* @since 4.6.0
*
- * @global wpdb $wpdb WordPress database abstraction object.
- *
* @param string $orderby_raw Alias for the field to order by.
* @return string|false Value to used in the ORDER clause. False otherwise.
*/
From 34ffd3a466b17a19954be00c6d4274c1a38484e8 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 23 Nov 2022 21:34:24 +0000
Subject: [PATCH 0076/1431] Docs: Improve various globals documentation, as per
documentation standards.
Props upadalavipul.
See #57069, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54868 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/general-template.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 9cae9b930d39b..561ed30b2cd94 100644
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -3683,6 +3683,9 @@ function wp_preload_resources() {
*
* @since 4.6.0
*
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
* @return string[] A list of unique hosts of enqueued scripts and styles.
*/
function wp_dependencies_unique_hosts() {
From a9c3d2a2ed962e8184fb7ad37216cee0f58475b8 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 23 Nov 2022 22:21:20 +0000
Subject: [PATCH 0077/1431] Twenty Nineteen: Remove the incorrect
"flexible-header" tag.
This changeset removes the "flexible-header" tag from Twenty Nineteen, since the requirements for using this tag is that the theme includes support for a custom header with the flex-height and/or flex-width parameters, and Twenty Nineteen does not have support for header image.
Props poena, mukesh27, laurelfulford, audrasjb.
Fixes #46213.
git-svn-id: https://develop.svn.wordpress.org/trunk@54869 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-content/themes/twentynineteen/readme.txt | 2 +-
src/wp-content/themes/twentynineteen/style-rtl.css | 2 +-
src/wp-content/themes/twentynineteen/style.css | 2 +-
src/wp-content/themes/twentynineteen/style.scss | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/wp-content/themes/twentynineteen/readme.txt b/src/wp-content/themes/twentynineteen/readme.txt
index d715fc373196e..fb4cd7dd20158 100644
--- a/src/wp-content/themes/twentynineteen/readme.txt
+++ b/src/wp-content/themes/twentynineteen/readme.txt
@@ -1,6 +1,6 @@
=== Twenty Nineteen ===
Contributors: wordpressdotorg
-Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
+Tags: one-column, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
Requires at least: 4.9.6
Tested up to: 6.1
Stable tag: 2.4
diff --git a/src/wp-content/themes/twentynineteen/style-rtl.css b/src/wp-content/themes/twentynineteen/style-rtl.css
index 85a1dddf13f29..61b1fae6f46f3 100644
--- a/src/wp-content/themes/twentynineteen/style-rtl.css
+++ b/src/wp-content/themes/twentynineteen/style-rtl.css
@@ -12,7 +12,7 @@ Version: 2.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentynineteen
-Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
+Tags: one-column, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
diff --git a/src/wp-content/themes/twentynineteen/style.css b/src/wp-content/themes/twentynineteen/style.css
index 42e966189ae4a..0b8326bde8ed2 100644
--- a/src/wp-content/themes/twentynineteen/style.css
+++ b/src/wp-content/themes/twentynineteen/style.css
@@ -12,7 +12,7 @@ Version: 2.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentynineteen
-Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
+Tags: one-column, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
diff --git a/src/wp-content/themes/twentynineteen/style.scss b/src/wp-content/themes/twentynineteen/style.scss
index 67fb852eeb60a..da65e779e727e 100644
--- a/src/wp-content/themes/twentynineteen/style.scss
+++ b/src/wp-content/themes/twentynineteen/style.scss
@@ -11,7 +11,7 @@ Version: 2.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentynineteen
-Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
+Tags: one-column, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready, block-patterns
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
From 4e24a65a1b9fcfcc8b7fdea8686b18b8e7ac4326 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 24 Nov 2022 14:16:18 +0000
Subject: [PATCH 0078/1431] Coding Standards: Use `HOUR_IN_SECONDS` where
appropriate.
This aims to clarify the time units for some time offset values.
Follow-up to [21996], [23823], [40108], [41626].
See #56791.
git-svn-id: https://develop.svn.wordpress.org/trunk@54870 602fd350-edb4-49c9-b593-d223f7449a82
---
.../customize/class-wp-customize-date-time-control.php | 2 +-
.../rest-api/endpoints/class-wp-rest-posts-controller.php | 2 +-
src/wp-includes/revision.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/customize/class-wp-customize-date-time-control.php b/src/wp-includes/customize/class-wp-customize-date-time-control.php
index 55bf64dbe2c03..a055b4eeb47a0 100644
--- a/src/wp-includes/customize/class-wp-customize-date-time-control.php
+++ b/src/wp-includes/customize/class-wp-customize-date-time-control.php
@@ -234,7 +234,7 @@ public function get_timezone_info() {
if ( $tz ) {
$now = new DateTime( 'now', $tz );
- $formatted_gmt_offset = $this->format_gmt_offset( $tz->getOffset( $now ) / 3600 );
+ $formatted_gmt_offset = $this->format_gmt_offset( $tz->getOffset( $now ) / HOUR_IN_SECONDS );
$tz_name = str_replace( '_', ' ', $tz->getName() );
$timezone_info['abbr'] = $now->format( 'T' );
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 94e067dfb3280..3ec9a3a13460e 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
@@ -1797,7 +1797,7 @@ public function prepare_item_for_response( $item, $request ) {
* with the site's timezone offset applied.
*/
if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) {
- $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) );
+ $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
} else {
$post_modified_gmt = $post->post_modified_gmt;
}
diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php
index 0f76f908f185f..9d3ca6f42401e 100644
--- a/src/wp-includes/revision.php
+++ b/src/wp-includes/revision.php
@@ -859,7 +859,7 @@ function _wp_upgrade_revisions_of_post( $post, $revisions ) {
return false;
}
- if ( $locked > $now - 3600 ) {
+ if ( $locked > $now - HOUR_IN_SECONDS ) {
// Lock is not too old: some other process may be upgrading this post. Bail.
return false;
}
From bb948c5f6d462dc43483f198d36e9b0948d2e5f1 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 24 Nov 2022 15:36:42 +0000
Subject: [PATCH 0079/1431] Plugins: Improve "No plugin found" message
alignement in Plugins screen.
This changeset centers the "No plugin found" message in plugin search results.
Follow-up to [54149].
Props sruthi90, aparnajl, krupalpanchal, audrasjb, anantajitjg.
Fixes #57194.
See #55721, #55272.
git-svn-id: https://develop.svn.wordpress.org/trunk@54871 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/css/list-tables.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css
index 440d2a5381796..00a6d8c4a055f 100644
--- a/src/wp-admin/css/list-tables.css
+++ b/src/wp-admin/css/list-tables.css
@@ -1636,6 +1636,7 @@ div.action-links,
font-style: normal;
margin: 0;
padding: 100px 0 0;
+ width: 100%;
text-align: center;
}
From d19f5f01701838f4def68f94b580461c62f4babd Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 24 Nov 2022 22:09:39 +0000
Subject: [PATCH 0080/1431] Coding Standards: Remove extra slashes when
concatenating `ABSPATH` with a path.
Since `ABSPATH` is defined and documented to end with a forward slash `/`, this changeset removes the first `/` from strings appended to `ABSPATH` in various files, leading to `//` in the resulting path.
Props TobiasBg, audrasjb, SergeyBiryukov, emanuelx.
Fixes #57074.
See #57071.
git-svn-id: https://develop.svn.wordpress.org/trunk@54872 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/class-wp-site-health-auto-updates.php | 4 ++--
src/wp-admin/includes/class-wp-site-health.php | 2 +-
src/wp-admin/includes/file.php | 2 +-
tests/phpunit/includes/bootstrap.php | 2 +-
tests/phpunit/includes/install.php | 6 +++---
tests/phpunit/tests/customize/widgets.php | 2 +-
tests/phpunit/tests/feed/wpSimplePieFile.php | 4 ++--
tests/phpunit/tests/pluggable/signatures.php | 4 ++--
tests/phpunit/tests/pluggable/wpMail.php | 2 +-
tests/phpunit/tests/pomo/po.php | 2 +-
tests/phpunit/tests/post.php | 2 +-
tests/phpunit/tests/widgets.php | 2 +-
12 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
index f6fb7d79b9654..e3c02d062071c 100644
--- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php
+++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
@@ -277,7 +277,7 @@ public function test_vcs_abspath() {
public function test_check_wp_filesystem_method() {
// Make sure the `request_filesystem_credentials()` function is available during our REST API call.
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
- require_once ABSPATH . '/wp-admin/includes/file.php';
+ require_once ABSPATH . 'wp-admin/includes/file.php';
}
$skin = new Automatic_Upgrader_Skin;
@@ -328,7 +328,7 @@ public function test_all_files_writable() {
// Make sure the `get_core_checksums()` function is available during our REST API call.
if ( ! function_exists( 'get_core_checksums' ) ) {
- require_once ABSPATH . '/wp-admin/includes/update.php';
+ require_once ABSPATH . 'wp-admin/includes/update.php';
}
$checksums = get_core_checksums( $wp_version, 'en_US' );
diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
index abe0fc618488c..4300abd8de347 100644
--- a/src/wp-admin/includes/class-wp-site-health.php
+++ b/src/wp-admin/includes/class-wp-site-health.php
@@ -65,7 +65,7 @@ public function __construct() {
*/
public function show_site_health_tab( $tab ) {
if ( 'debug' === $tab ) {
- require_once ABSPATH . '/wp-admin/site-health-info.php';
+ require_once ABSPATH . 'wp-admin/site-health-info.php';
}
}
diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
index bfd32ec8991c7..a89e601060e09 100644
--- a/src/wp-admin/includes/file.php
+++ b/src/wp-admin/includes/file.php
@@ -2442,7 +2442,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
// Make sure the `submit_button()` function is available during the REST API call
// from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method().
if ( ! function_exists( 'submit_button' ) ) {
- require_once ABSPATH . '/wp-admin/includes/template.php';
+ require_once ABSPATH . 'wp-admin/includes/template.php';
}
?>
diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php
index 9a1b234b71686..1113a87eeaa01 100644
--- a/tests/phpunit/includes/bootstrap.php
+++ b/tests/phpunit/includes/bootstrap.php
@@ -302,7 +302,7 @@ function wp_tests_options( $value ) {
}
// Load WordPress.
-require_once ABSPATH . '/wp-settings.php';
+require_once ABSPATH . 'wp-settings.php';
// Delete any default posts & related data.
_delete_all_posts();
diff --git a/tests/phpunit/includes/install.php b/tests/phpunit/includes/install.php
index 1357b4d5fe905..3157fd9384495 100644
--- a/tests/phpunit/includes/install.php
+++ b/tests/phpunit/includes/install.php
@@ -37,10 +37,10 @@
tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' );
-require_once ABSPATH . '/wp-settings.php';
+require_once ABSPATH . 'wp-settings.php';
-require_once ABSPATH . '/wp-admin/includes/upgrade.php';
-require_once ABSPATH . '/wp-includes/class-wpdb.php';
+require_once ABSPATH . 'wp-admin/includes/upgrade.php';
+require_once ABSPATH . 'wp-includes/class-wpdb.php';
// Override the PHPMailer.
global $phpmailer;
diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php
index 446bcf5a68ad3..654008a7a9b1a 100644
--- a/tests/phpunit/tests/customize/widgets.php
+++ b/tests/phpunit/tests/customize/widgets.php
@@ -556,7 +556,7 @@ public function test_sanitize_widget_instance_empty_instance() {
*/
private function get_test_widget_control_args() {
global $wp_registered_widgets;
- require_once ABSPATH . '/wp-admin/includes/widgets.php';
+ require_once ABSPATH . 'wp-admin/includes/widgets.php';
$widget_id = 'search-2';
$widget = $wp_registered_widgets[ $widget_id ];
$args = array(
diff --git a/tests/phpunit/tests/feed/wpSimplePieFile.php b/tests/phpunit/tests/feed/wpSimplePieFile.php
index f9748e3a7bcac..fe16352cf76b8 100644
--- a/tests/phpunit/tests/feed/wpSimplePieFile.php
+++ b/tests/phpunit/tests/feed/wpSimplePieFile.php
@@ -19,8 +19,8 @@ class Tests_Feed_wpSimplePieFile extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();
- require_once ABSPATH . '/wp-includes/class-simplepie.php';
- require_once ABSPATH . '/wp-includes/class-wp-simplepie-file.php';
+ require_once ABSPATH . 'wp-includes/class-simplepie.php';
+ require_once ABSPATH . 'wp-includes/class-wp-simplepie-file.php';
}
/**
diff --git a/tests/phpunit/tests/pluggable/signatures.php b/tests/phpunit/tests/pluggable/signatures.php
index a802b03766c04..71c702964ad77 100644
--- a/tests/phpunit/tests/pluggable/signatures.php
+++ b/tests/phpunit/tests/pluggable/signatures.php
@@ -76,7 +76,7 @@ public function test_all_pluggable_functions_exist() {
*/
public function get_defined_pluggable_functions() {
- require_once ABSPATH . '/wp-admin/includes/upgrade.php';
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$test_functions = array(
'install_network',
@@ -103,7 +103,7 @@ public function get_defined_pluggable_functions() {
}
foreach ( $test_files as $file ) {
- preg_match_all( '#^\t?function (\w+)#m', file_get_contents( ABSPATH . '/' . $file ), $functions );
+ preg_match_all( '#^\t?function (\w+)#m', file_get_contents( ABSPATH . $file ), $functions );
foreach ( $functions[1] as $function ) {
$data[] = array(
diff --git a/tests/phpunit/tests/pluggable/wpMail.php b/tests/phpunit/tests/pluggable/wpMail.php
index bbe27bd88e65b..68982d6026b09 100644
--- a/tests/phpunit/tests/pluggable/wpMail.php
+++ b/tests/phpunit/tests/pluggable/wpMail.php
@@ -173,7 +173,7 @@ public function test_wp_mail_return_value() {
$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body' ) );
// Non-fatal errors.
- $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . '/non-existent-file.html' ) );
+ $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . 'non-existent-file.html' ) );
// Fatal errors.
$this->assertFalse( wp_mail( 'invalid.address', 'subject', 'body', '', array() ) );
diff --git a/tests/phpunit/tests/pomo/po.php b/tests/phpunit/tests/pomo/po.php
index d7652f27e67e2..8c58099b69505 100644
--- a/tests/phpunit/tests/pomo/po.php
+++ b/tests/phpunit/tests/pomo/po.php
@@ -48,7 +48,7 @@ class Tests_POMO_PO extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();
- require_once ABSPATH . '/wp-includes/pomo/po.php';
+ require_once ABSPATH . 'wp-includes/pomo/po.php';
}
public function test_prepend_each_line() {
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 6f07ca859364c..551cbd8c56e8f 100644
--- a/tests/phpunit/tests/post.php
+++ b/tests/phpunit/tests/post.php
@@ -285,7 +285,7 @@ public function test_utf8mb3_post_saves_with_emoji() {
$this->markTestSkipped( 'This test is only useful with the utf8 character set.' );
}
- require_once ABSPATH . '/wp-admin/includes/post.php';
+ require_once ABSPATH . 'wp-admin/includes/post.php';
$post_id = self::factory()->post->create();
diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php
index 2407a2de1bc3d..a3dbdfea73efd 100644
--- a/tests/phpunit/tests/widgets.php
+++ b/tests/phpunit/tests/widgets.php
@@ -813,7 +813,7 @@ public function test_wp_widget_control() {
);
wp_widgets_init();
- require_once ABSPATH . '/wp-admin/includes/widgets.php';
+ require_once ABSPATH . 'wp-admin/includes/widgets.php';
$widget_id = 'search-2';
$widget = $wp_registered_widgets[ $widget_id ];
$params = array(
From 3dc123624556efbe8953c377e777c12c985ba339 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 24 Nov 2022 22:34:13 +0000
Subject: [PATCH 0081/1431] Docs: Use third-person singular verbs for Block
Supports related function descriptions, as per docblocks standards.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54873 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-supports/colors.php | 2 +-
src/wp-includes/block-supports/custom-classname.php | 2 +-
src/wp-includes/block-supports/duotone.php | 2 +-
src/wp-includes/block-supports/elements.php | 6 +++---
src/wp-includes/block-supports/generated-classname.php | 4 ++--
src/wp-includes/block-supports/spacing.php | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/wp-includes/block-supports/colors.php b/src/wp-includes/block-supports/colors.php
index 15c949560eab4..25fe3edd6018d 100644
--- a/src/wp-includes/block-supports/colors.php
+++ b/src/wp-includes/block-supports/colors.php
@@ -57,7 +57,7 @@ function wp_register_colors_support( $block_type ) {
/**
- * Add CSS classes and inline styles for colors to the incoming attributes array.
+ * Adds CSS classes and inline styles for colors to the incoming attributes array.
* This will be applied to the block markup in the front-end.
*
* @since 5.6.0
diff --git a/src/wp-includes/block-supports/custom-classname.php b/src/wp-includes/block-supports/custom-classname.php
index 96d806a77924a..47bfbee6bd85a 100644
--- a/src/wp-includes/block-supports/custom-classname.php
+++ b/src/wp-includes/block-supports/custom-classname.php
@@ -31,7 +31,7 @@ function wp_register_custom_classname_support( $block_type ) {
}
/**
- * Add the custom classnames to the output.
+ * Adds the custom classnames to the output.
*
* @since 5.6.0
* @access private
diff --git a/src/wp-includes/block-supports/duotone.php b/src/wp-includes/block-supports/duotone.php
index 95428c9c013c4..0e04cb1631fb8 100644
--- a/src/wp-includes/block-supports/duotone.php
+++ b/src/wp-includes/block-supports/duotone.php
@@ -497,7 +497,7 @@ function wp_register_duotone_support( $block_type ) {
}
/**
- * Render out the duotone stylesheet and SVG.
+ * Renders out the duotone stylesheet and SVG.
*
* @since 5.8.0
* @since 6.1.0 Allow unset for preset colors.
diff --git a/src/wp-includes/block-supports/elements.php b/src/wp-includes/block-supports/elements.php
index 90c6d3d69161b..e7ade8b17f332 100644
--- a/src/wp-includes/block-supports/elements.php
+++ b/src/wp-includes/block-supports/elements.php
@@ -7,7 +7,7 @@
*/
/**
- * Get the elements class names.
+ * Gets the elements class names.
*
* @since 6.0.0
* @access private
@@ -20,7 +20,7 @@ function wp_get_elements_class_name( $block ) {
}
/**
- * Update the block content with elements class names.
+ * Updates the block content with elements class names.
*
* @since 5.8.0
* @access private
@@ -82,7 +82,7 @@ function wp_render_elements_support( $block_content, $block ) {
}
/**
- * Render the elements stylesheet.
+ * Renders the elements stylesheet.
*
* In the case of nested blocks we want the parent element styles to be rendered before their descendants.
* This solves the issue of an element (e.g.: link color) being styled in both the parent and a descendant:
diff --git a/src/wp-includes/block-supports/generated-classname.php b/src/wp-includes/block-supports/generated-classname.php
index 57d657ef95cb6..d794e0eab3404 100644
--- a/src/wp-includes/block-supports/generated-classname.php
+++ b/src/wp-includes/block-supports/generated-classname.php
@@ -7,7 +7,7 @@
*/
/**
- * Get the generated classname from a given block name.
+ * Gets the generated classname from a given block name.
*
* @since 5.6.0
*
@@ -39,7 +39,7 @@ function wp_get_block_default_classname( $block_name ) {
}
/**
- * Add the generated classnames to the output.
+ * Adds the generated classnames to the output.
*
* @since 5.6.0
*
diff --git a/src/wp-includes/block-supports/spacing.php b/src/wp-includes/block-supports/spacing.php
index ecb68566d9778..cfd60c8e08b53 100644
--- a/src/wp-includes/block-supports/spacing.php
+++ b/src/wp-includes/block-supports/spacing.php
@@ -33,7 +33,7 @@ function wp_register_spacing_support( $block_type ) {
}
/**
- * Add CSS classes for block spacing to the incoming attributes array.
+ * Adds CSS classes for block spacing to the incoming attributes array.
* This will be applied to the block markup in the front-end.
*
* @since 5.8.0
From 808d6a190987d4bfa1038d6bd9915ad41984b2dd Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 24 Nov 2022 22:50:16 +0000
Subject: [PATCH 0082/1431] Docs: Various docblock fixes in Block Supports
related functions.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54874 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/block-supports/elements.php | 7 +++----
src/wp-includes/block-supports/generated-classname.php | 9 ++++-----
src/wp-includes/block-supports/spacing.php | 2 +-
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/wp-includes/block-supports/elements.php b/src/wp-includes/block-supports/elements.php
index e7ade8b17f332..9966b00d01cd0 100644
--- a/src/wp-includes/block-supports/elements.php
+++ b/src/wp-includes/block-supports/elements.php
@@ -13,7 +13,7 @@
* @access private
*
* @param array $block Block object.
- * @return string The unique class name.
+ * @return string The unique class name.
*/
function wp_get_elements_class_name( $block ) {
return 'wp-elements-' . md5( serialize( $block ) );
@@ -92,9 +92,8 @@ function wp_render_elements_support( $block_content, $block ) {
* @since 6.1.0 Implemented the style engine to generate CSS and classnames.
* @access private
*
- * @param string|null $pre_render The pre-rendered content. Default null.
- * @param array $block The block being rendered.
- *
+ * @param string|null $pre_render The pre-rendered content. Default null.
+ * @param array $block The block being rendered.
* @return null
*/
function wp_render_elements_support_styles( $pre_render, $block ) {
diff --git a/src/wp-includes/block-supports/generated-classname.php b/src/wp-includes/block-supports/generated-classname.php
index d794e0eab3404..3ed779700c139 100644
--- a/src/wp-includes/block-supports/generated-classname.php
+++ b/src/wp-includes/block-supports/generated-classname.php
@@ -13,7 +13,7 @@
*
* @access private
*
- * @param string $block_name Block Name.
+ * @param string $block_name Block Name.
* @return string Generated classname.
*/
function wp_get_block_default_classname( $block_name ) {
@@ -30,8 +30,8 @@ function wp_get_block_default_classname( $block_name ) {
*
* @since 5.6.0
*
- * @param string $class_name The current applied classname.
- * @param string $block_name The block name.
+ * @param string $class_name The current applied classname.
+ * @param string $block_name The block name.
*/
$classname = apply_filters( 'block_default_classname', $classname, $block_name );
@@ -45,8 +45,7 @@ function wp_get_block_default_classname( $block_name ) {
*
* @access private
*
- * @param WP_Block_Type $block_type Block Type.
- *
+ * @param WP_Block_Type $block_type Block Type.
* @return array Block CSS classes and inline styles.
*/
function wp_apply_generated_classname_support( $block_type ) {
diff --git a/src/wp-includes/block-supports/spacing.php b/src/wp-includes/block-supports/spacing.php
index cfd60c8e08b53..ea9b39822de1b 100644
--- a/src/wp-includes/block-supports/spacing.php
+++ b/src/wp-includes/block-supports/spacing.php
@@ -1,7 +1,7 @@
Date: Fri, 25 Nov 2022 15:10:48 +0000
Subject: [PATCH 0083/1431] Docs: Correct the type for `_WP_Dependency::$src`
property.
The handle source can be set to `false`, which means the item is an alias of other items it depends on.
Follow-up to [7970], [25518], [43661], [47170], [48462], [54470].
Props mehulkaklotar, swissspidy, costdev.
Fixes #57206.
git-svn-id: https://develop.svn.wordpress.org/trunk@54875 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-dependencies.php | 2 +-
src/wp-includes/class-wp-dependency.php | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/class-wp-dependencies.php b/src/wp-includes/class-wp-dependencies.php
index 68b33be395630..0bc42bb282b77 100644
--- a/src/wp-includes/class-wp-dependencies.php
+++ b/src/wp-includes/class-wp-dependencies.php
@@ -241,7 +241,7 @@ public function all_deps( $handles, $recursion = false, $group = false ) {
* @param string $handle Name of the item. Should be unique.
* @param string|false $src Full URL of the item, or path of the item relative
* to the WordPress root directory. If source is set to false,
- * item is an alias of other items it depends on.
+ * the item is an alias of other items it depends on.
* @param string[] $deps Optional. An array of registered item handles this item depends on.
* Default empty array.
* @param string|bool|null $ver Optional. String specifying item version number, if it has one,
diff --git a/src/wp-includes/class-wp-dependency.php b/src/wp-includes/class-wp-dependency.php
index a018811773926..bcc780828c80c 100644
--- a/src/wp-includes/class-wp-dependency.php
+++ b/src/wp-includes/class-wp-dependency.php
@@ -29,8 +29,10 @@ class _WP_Dependency {
/**
* The handle source.
*
+ * If source is set to false, the item is an alias of other items it depends on.
+ *
* @since 2.6.0
- * @var string
+ * @var string|false
*/
public $src;
From b7931895c55095068b996b8716aaa1557c1116f3 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sat, 26 Nov 2022 09:10:28 +0000
Subject: [PATCH 0084/1431] Coding Standards: Fix brace indentation in
`wp-align/includes/noop.php`.
Props alberuni-azad.
Fixes #57209.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54876 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/noop.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/wp-admin/includes/noop.php b/src/wp-admin/includes/noop.php
index ba611fc9e13e5..b29f6044d8bdc 100644
--- a/src/wp-admin/includes/noop.php
+++ b/src/wp-admin/includes/noop.php
@@ -66,7 +66,8 @@ function get_bloginfo() {}
* @ignore
*/
function is_admin() {
- return true;}
+ return true;
+}
/**
* @ignore
From 78fc04c1cc3563de516ea79c33717b59680559ec Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sat, 26 Nov 2022 09:37:18 +0000
Subject: [PATCH 0085/1431] Docs: Improve various globals documentation, as per
documentation standards.
Props upadalavipul.
See #57069, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@54877 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-taxonomy.php | 2 --
src/wp-includes/class-wp-xmlrpc-server.php | 2 ++
src/wp-includes/comment.php | 2 ++
src/wp-includes/functions.php | 2 --
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/wp-includes/class-wp-taxonomy.php b/src/wp-includes/class-wp-taxonomy.php
index 1f7eed96f6b51..a73be9ea40c7e 100644
--- a/src/wp-includes/class-wp-taxonomy.php
+++ b/src/wp-includes/class-wp-taxonomy.php
@@ -278,8 +278,6 @@ final class WP_Taxonomy {
*
* @since 4.7.0
*
- * @global WP $wp Current WordPress environment instance.
- *
* @param string $taxonomy Taxonomy key, must not exceed 32 characters.
* @param array|string $object_type Name of the object type for the taxonomy object.
* @param array|string $args Optional. Array or query string of arguments for registering a taxonomy.
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index 9723488083a76..0c574475b13c9 100644
--- a/src/wp-includes/class-wp-xmlrpc-server.php
+++ b/src/wp-includes/class-wp-xmlrpc-server.php
@@ -6819,6 +6819,8 @@ public function mt_publishPost( $args ) {
*
* @since 1.5.0
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param array $args {
* Method arguments. Note: arguments must be ordered as documented.
*
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index b5be18ed7a749..ca79d54a24e0a 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -3783,6 +3783,8 @@ function wp_register_comment_personal_data_eraser( $erasers ) {
*
* @since 4.9.6
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param string $email_address The comment author email address.
* @param int $page Comment page.
* @return array
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 716be80980c49..8cb36f5e39f68 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -163,8 +163,6 @@ function wp_timezone() {
* @since 0.71
* @since 5.3.0 Converted into a wrapper for wp_date().
*
- * @global WP_Locale $wp_locale WordPress date and time locale object.
- *
* @param string $format Format to display the date.
* @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset
* in seconds. Default false.
From 4c0e7708b4d00da39215b7fcfa15f999c5d7dc67 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sat, 26 Nov 2022 16:11:01 +0000
Subject: [PATCH 0086/1431] Coding Standards: Correct the deprecation version
for `_filter_query_attachment_filenames()`.
Follow-up to [54524].
Props jrf.
See #56791.
git-svn-id: https://develop.svn.wordpress.org/trunk@54878 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/deprecated.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
index 8f41b1303810b..26be922a77c5d 100644
--- a/src/wp-includes/deprecated.php
+++ b/src/wp-includes/deprecated.php
@@ -4524,7 +4524,7 @@ function global_terms_enabled() {
* @return array The unmodified clauses.
*/
function _filter_query_attachment_filenames( $clauses ) {
- _deprecated_function( __FUNCTION__, '4.9.9', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
+ _deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
remove_filter( 'posts_clauses', __FUNCTION__ );
return $clauses;
}
From 1111d2b9e6d71bb5506e18940518cc96adbbdb97 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sat, 26 Nov 2022 20:59:05 +0000
Subject: [PATCH 0087/1431] Coding Standards: Various brace indentation
corrections.
Props mukesh27.
Fixes #57210.
See #56791.
git-svn-id: https://develop.svn.wordpress.org/trunk@54881 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/export.php | 3 ++-
src/wp-admin/includes/file.php | 3 ++-
src/wp-admin/options-discussion.php | 3 ++-
src/wp-admin/theme-editor.php | 3 ++-
src/wp-includes/feed-atom-comments.php | 3 ++-
src/wp-includes/theme-compat/header.php | 3 ++-
src/wp-links-opml.php | 3 ++-
7 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php
index 1c7694f02b4fd..ac673ec5b1eab 100644
--- a/src/wp-admin/includes/export.php
+++ b/src/wp-admin/includes/export.php
@@ -519,7 +519,8 @@ function wxr_filter_postmeta( $return_me, $meta_key ) {
" />
diff --git a/src/wp-admin/options-discussion.php b/src/wp-admin/options-discussion.php
index b83d822f2fedd..2e3f83189c095 100644
--- a/src/wp-admin/options-discussion.php
+++ b/src/wp-admin/options-discussion.php
@@ -71,7 +71,8 @@
diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php
index 863a5093c5cfc..cd37763d152e0 100644
--- a/src/wp-admin/theme-editor.php
+++ b/src/wp-admin/theme-editor.php
@@ -221,7 +221,8 @@
display( 'Name' );
if ( $description ) {
- echo ': ' . $description;}
+ echo ': ' . $description;
+ }
?>
diff --git a/src/wp-includes/feed-atom-comments.php b/src/wp-includes/feed-atom-comments.php
index b43f8d4eb156b..e11955f746bd0 100644
--- a/src/wp-includes/feed-atom-comments.php
+++ b/src/wp-includes/feed-atom-comments.php
@@ -93,7 +93,8 @@
' . get_comment_author_url() . '';}
+ echo '' . get_comment_author_url() . '';
+ }
?>
diff --git a/src/wp-includes/theme-compat/header.php b/src/wp-includes/theme-compat/header.php
index daa0088d232f1..cbd84eb20e798 100644
--- a/src/wp-includes/theme-compat/header.php
+++ b/src/wp-includes/theme-compat/header.php
@@ -43,7 +43,8 @@
diff --git a/src/wp-links-opml.php b/src/wp-links-opml.php
index ca43c3d43ca92..746c287a7e585 100644
--- a/src/wp-links-opml.php
+++ b/src/wp-links-opml.php
@@ -83,7 +83,8 @@
Date: Sat, 26 Nov 2022 22:01:01 +0000
Subject: [PATCH 0088/1431] Twenty Ten: Fixes brace indentation in
`loop-attachment` template.
Props mukesh27.
See #57210, #56791.
git-svn-id: https://develop.svn.wordpress.org/trunk@54882 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-content/themes/twentyten/loop-attachment.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/wp-content/themes/twentyten/loop-attachment.php b/src/wp-content/themes/twentyten/loop-attachment.php
index b886c019e80af..d3f6eb487165d 100644
--- a/src/wp-content/themes/twentyten/loop-attachment.php
+++ b/src/wp-content/themes/twentyten/loop-attachment.php
@@ -154,7 +154,8 @@
diff --git a/src/wp-content/themes/twentyeleven/style.css b/src/wp-content/themes/twentyeleven/style.css
index 19fd0881adc2a..7adc96a7941b7 100644
--- a/src/wp-content/themes/twentyeleven/style.css
+++ b/src/wp-content/themes/twentyeleven/style.css
@@ -1628,6 +1628,11 @@ section.feature-image.large img {
width: 14px;
height: 14px;
}
+.feature-slider a .feature-slider-tooltip {
+ display: block;
+ width: 14px;
+ height: 14px;
+}
.feature-slider a.active {
background: #1982d1;
-webkit-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8);
From 176f9a787b581857defe77eb1b6b1ba56b4dde5b Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sat, 26 Nov 2022 22:41:42 +0000
Subject: [PATCH 0091/1431] Twenty Nineteen: Remove useless `title` attributes.
This changeset removes `title` attributes from links, as they are adding redundant information.
Props sabernhardt.
See #57199, #24766, #24203.
git-svn-id: https://develop.svn.wordpress.org/trunk@54885 602fd350-edb4-49c9-b593-d223f7449a82
---
.../classes/class-twentynineteen-walker-comment.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php b/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php
index 3e02cf542f32f..f501de695a977 100644
--- a/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php
+++ b/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php
@@ -78,10 +78,9 @@ protected function html5_comment( $comment, $depth, $args ) {
$comment_timestamp = sprintf( __( '%1$s at %2$s', 'twentynineteen' ), get_comment_date( '', $comment ), get_comment_time() );
printf(
- '',
+ '',
esc_url( get_comment_link( $comment, $args ) ),
get_comment_time( 'c' ),
- esc_attr( $comment_timestamp ),
$comment_timestamp
);
From bdc2084b30fd842fe862f656aafd1a7c46c53317 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 27 Nov 2022 10:32:44 +0000
Subject: [PATCH 0092/1431] Twenty Twenty-One: Add a comment for the closing
`h2` tag in author info template.
This brings consistency with the `.comments-title` heading in the `comments.php` template.
Follow-up to [49216], [50234].
Props haritpanchal, sabernhardt, mukesh27.
Fixes #56476.
git-svn-id: https://develop.svn.wordpress.org/trunk@54886 602fd350-edb4-49c9-b593-d223f7449a82
---
.../themes/twentytwentyone/template-parts/post/author-bio.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-content/themes/twentytwentyone/template-parts/post/author-bio.php b/src/wp-content/themes/twentytwentyone/template-parts/post/author-bio.php
index 92151bb07481a..33a82dcd7e939 100644
--- a/src/wp-content/themes/twentytwentyone/template-parts/post/author-bio.php
+++ b/src/wp-content/themes/twentytwentyone/template-parts/post/author-bio.php
@@ -20,7 +20,7 @@
get_the_author()
);
?>
-
+
Date: Mon, 28 Nov 2022 15:11:03 +0000
Subject: [PATCH 0093/1431] Twenty Twenty-Three: In page template, make post
titles links.
In the "Blog (alternative)" page template, turn post titles into links. This is to better align with user expectations that individual post titles in a blog-like list of recent posts will be links to the corresponding blog posts.
Props scruffian.
Fixes #57175.
git-svn-id: https://develop.svn.wordpress.org/trunk@54887 602fd350-edb4-49c9-b593-d223f7449a82
---
.../themes/twentytwentythree/templates/blog-alternative.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-content/themes/twentytwentythree/templates/blog-alternative.html b/src/wp-content/themes/twentytwentythree/templates/blog-alternative.html
index 6212ea20cdb2f..cd6c89b516e42 100644
--- a/src/wp-content/themes/twentytwentythree/templates/blog-alternative.html
+++ b/src/wp-content/themes/twentytwentythree/templates/blog-alternative.html
@@ -15,7 +15,7 @@
-
+
From 5cb17e222d66d26793d51234840a23571ed476e2 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 28 Nov 2022 19:42:56 +0000
Subject: [PATCH 0094/1431] Comments: Make moderated or disallowed key check
case-insensitive for non-Latin words.
The `check_comment()` and `wp_check_comment_disallowed_list()` functions are expected to be case-insensitive, but that only worked for words using Latin script and consisting of ASCII characters.
This commit adds the Unicode flag to the regular expression used for the check in these functions, so that both pattern and subject can be treated as UTF-8 strings.
Reference: [https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php PHP Manual: Pattern Modifiers].
Follow-up to [984], [2075], [48121], [48575].
Props bonjour52, SergeyBiryukov.
Fixes #57207.
git-svn-id: https://develop.svn.wordpress.org/trunk@54888 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/comment.php | 4 ++--
tests/phpunit/tests/comment/checkComment.php | 21 ++++++++++++++++++-
.../comment/wpCheckCommentDisallowedList.php | 18 ++++++++++++++++
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index ca79d54a24e0a..bf646a2a27f36 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -97,7 +97,7 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent,
* Check the comment fields for moderation keywords. If any are found,
* fail the check for the given field by returning false.
*/
- $pattern = "#$word#i";
+ $pattern = "#$word#iu";
if ( preg_match( $pattern, $author ) ) {
return false;
}
@@ -1357,7 +1357,7 @@ function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $use
// in the spam words don't break things:
$word = preg_quote( $word, '#' );
- $pattern = "#$word#i";
+ $pattern = "#$word#iu";
if ( preg_match( $pattern, $author )
|| preg_match( $pattern, $email )
|| preg_match( $pattern, $url )
diff --git a/tests/phpunit/tests/comment/checkComment.php b/tests/phpunit/tests/comment/checkComment.php
index 5efcf9acceedb..c23e1d4dc2b76 100644
--- a/tests/phpunit/tests/comment/checkComment.php
+++ b/tests/phpunit/tests/comment/checkComment.php
@@ -70,7 +70,7 @@ public function test_should_return_true_when_comment_previously_approved_is_enab
$this->assertTrue( $results );
}
- public function test_should_return_false_when_content_matches_moderation_key() {
+ public function test_should_return_false_when_content_matches_moderation_keys() {
update_option( 'comment_previously_approved', 0 );
$author = 'WendytheBuilder';
@@ -86,6 +86,25 @@ public function test_should_return_false_when_content_matches_moderation_key() {
$this->assertFalse( $results );
}
+ /**
+ * @ticket 57207
+ */
+ public function test_should_return_false_when_content_with_non_latin_words_matches_moderation_keys() {
+ update_option( 'comment_previously_approved', 0 );
+
+ $author = 'Setup';
+ $author_email = 'setup@example.com';
+ $author_url = 'http://example.com';
+ $comment = 'Установка';
+ $author_ip = '192.168.0.1';
+ $user_agent = '';
+ $comment_type = '';
+
+ update_option( 'moderation_keys', "установка\nfoo" );
+ $results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
+ $this->assertFalse( $results );
+ }
+
public function test_should_return_true_when_content_does_not_match_moderation_keys() {
update_option( 'comment_previously_approved', 0 );
diff --git a/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php b/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php
index e478c5dae64d7..28c6e2a25e34f 100644
--- a/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php
+++ b/tests/phpunit/tests/comment/wpCheckCommentDisallowedList.php
@@ -40,6 +40,24 @@ public function test_should_return_true_when_content_with_html_matches_disallowe
$this->assertTrue( $result );
}
+ /**
+ * @ticket 57207
+ */
+ public function test_should_return_true_when_content_with_non_latin_words_matches_disallowed_keys() {
+ $author = 'Setup';
+ $author_email = 'setup@example.com';
+ $author_url = 'http://example.com';
+ $comment = 'Установка';
+ $author_ip = '192.168.0.1';
+ $user_agent = '';
+
+ update_option( 'disallowed_keys', "установка\nfoo" );
+
+ $result = wp_check_comment_disallowed_list( $author, $author_email, $author_url, $comment, $author_ip, $user_agent );
+
+ $this->assertTrue( $result );
+ }
+
public function test_should_return_true_when_author_matches_disallowed_keys() {
$author = 'Sideshow Mel';
$author_email = 'mel@example.com';
From 8f86cdb2e04f413e3258bee32c9981892732833d Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 29 Nov 2022 12:32:37 +0000
Subject: [PATCH 0095/1431] Coding Standards: Add visibility to methods in
`tests/phpunit/tests/`.
Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods. This continues the previous efforts to make sure visibility is declared on all methods.
Note: This will be enforced by WPCS 3.0.0.
Follow-up to [51919], [52009], [52010].
Props jrf.
See #56791.
git-svn-id: https://develop.svn.wordpress.org/trunk@54889 602fd350-edb4-49c9-b593-d223f7449a82
---
.../tests/admin/wpCommentsListTable.php | 2 +-
.../tests/admin/wpPostCommentsListTable.php | 2 +-
.../phpunit/tests/admin/wpPostsListTable.php | 20 ++++++------
tests/phpunit/tests/block-supports/border.php | 10 +++---
tests/phpunit/tests/block-supports/colors.php | 10 +++---
tests/phpunit/tests/block-supports/layout.php | 14 ++++----
.../phpunit/tests/block-supports/spacing.php | 10 +++---
.../tests/block-supports/typography.php | 18 +++++------
tests/phpunit/tests/block-template-utils.php | 18 +++++------
tests/phpunit/tests/block-template.php | 12 +++----
.../tests/blocks/renderCommentTemplate.php | 20 ++++++------
tests/phpunit/tests/functions.php | 2 +-
tests/phpunit/tests/kses.php | 20 ++++++------
tests/phpunit/tests/media.php | 8 ++---
tests/phpunit/tests/post/wpInsertPost.php | 2 +-
tests/phpunit/tests/query/fieldsClause.php | 4 +--
tests/phpunit/tests/theme/wpThemeJson.php | 32 +++++++++----------
.../tests/theme/wpThemeJsonResolver.php | 20 ++++++------
.../phpunit/tests/theme/wpThemeJsonSchema.php | 2 +-
tests/phpunit/tests/user/query.php | 4 +--
tests/phpunit/tests/widgets.php | 2 +-
21 files changed, 116 insertions(+), 116 deletions(-)
diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php
index 20fcd836e2cac..a394823d3777c 100644
--- a/tests/phpunit/tests/admin/wpCommentsListTable.php
+++ b/tests/phpunit/tests/admin/wpCommentsListTable.php
@@ -10,7 +10,7 @@ class Tests_Admin_wpCommentsListTable extends WP_UnitTestCase {
*/
protected $table;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
}
diff --git a/tests/phpunit/tests/admin/wpPostCommentsListTable.php b/tests/phpunit/tests/admin/wpPostCommentsListTable.php
index 98cb834bff2d7..126126327f0e8 100644
--- a/tests/phpunit/tests/admin/wpPostCommentsListTable.php
+++ b/tests/phpunit/tests/admin/wpPostCommentsListTable.php
@@ -12,7 +12,7 @@ class Tests_Admin_wpPostCommentsListTable extends WP_UnitTestCase {
*/
protected $table;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-post-comments' ) );
}
diff --git a/tests/phpunit/tests/admin/wpPostsListTable.php b/tests/phpunit/tests/admin/wpPostsListTable.php
index 9e19ff3d8a31f..c2dd5f586a452 100644
--- a/tests/phpunit/tests/admin/wpPostsListTable.php
+++ b/tests/phpunit/tests/admin/wpPostsListTable.php
@@ -14,7 +14,7 @@ class Tests_Admin_wpPostsListTable extends WP_UnitTestCase {
*/
protected $table;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => 'edit-page' ) );
}
@@ -79,7 +79,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
- function test_list_hierarchical_pages_first_page() {
+ public function test_list_hierarchical_pages_first_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 1,
@@ -98,7 +98,7 @@ function test_list_hierarchical_pages_first_page() {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
- function test_list_hierarchical_pages_second_page() {
+ public function test_list_hierarchical_pages_second_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 2,
@@ -118,7 +118,7 @@ function test_list_hierarchical_pages_second_page() {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
- function test_search_hierarchical_pages_first_page() {
+ public function test_search_hierarchical_pages_first_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 1,
@@ -138,7 +138,7 @@ function test_search_hierarchical_pages_first_page() {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
- function test_search_hierarchical_pages_second_page() {
+ public function test_search_hierarchical_pages_second_page() {
$this->_test_list_hierarchical_page(
array(
'paged' => 2,
@@ -158,7 +158,7 @@ function test_search_hierarchical_pages_second_page() {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
- function test_grandchildren_hierarchical_pages_first_page() {
+ public function test_grandchildren_hierarchical_pages_first_page() {
// Page 6 is the first page with grandchildren.
$this->_test_list_hierarchical_page(
array(
@@ -180,7 +180,7 @@ function test_grandchildren_hierarchical_pages_first_page() {
* @covers WP_Posts_List_Table::display_rows
* @covers WP_Posts_List_Table::set_hierarchical_display
*/
- function test_grandchildren_hierarchical_pages_second_page() {
+ public function test_grandchildren_hierarchical_pages_second_page() {
// Page 7 is the second page with grandchildren.
$this->_test_list_hierarchical_page(
array(
@@ -260,7 +260,7 @@ protected function _test_list_hierarchical_page( array $args, array $expected_id
*
* @covers WP_Posts_List_Table::extra_tablenav
*/
- function test_filter_button_should_not_be_shown_if_there_are_no_posts() {
+ public function test_filter_button_should_not_be_shown_if_there_are_no_posts() {
// Set post type to a non-existent one.
$this->table->screen->post_type = 'foo';
@@ -276,7 +276,7 @@ function test_filter_button_should_not_be_shown_if_there_are_no_posts() {
*
* @covers WP_Posts_List_Table::extra_tablenav
*/
- function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() {
+ public function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() {
// Set post type to a non-existent one.
$this->table->screen->post_type = 'foo';
@@ -292,7 +292,7 @@ function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() {
*
* @covers WP_Posts_List_Table::extra_tablenav
*/
- function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() {
+ public function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() {
// Set post type to a non-existent one.
$this->table->screen->post_type = 'foo';
diff --git a/tests/phpunit/tests/block-supports/border.php b/tests/phpunit/tests/block-supports/border.php
index 204c8e43a01ef..aae4d4d2cc03b 100644
--- a/tests/phpunit/tests/block-supports/border.php
+++ b/tests/phpunit/tests/block-supports/border.php
@@ -10,12 +10,12 @@ class Test_Block_Supports_Border extends WP_UnitTestCase {
*/
private $test_block_name;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->test_block_name = null;
}
- function tear_down() {
+ public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::set_up();
@@ -24,7 +24,7 @@ function tear_down() {
/**
* @ticket 55505
*/
- function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
+ public function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
$this->test_block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly';
register_block_type(
$this->test_block_name,
@@ -73,7 +73,7 @@ function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
/**
* @ticket 55505
*/
- function test_border_with_skipped_serialization_block_supports() {
+ public function test_border_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/border-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@@ -117,7 +117,7 @@ function test_border_with_skipped_serialization_block_supports() {
/**
* @ticket 55505
*/
- function test_radius_with_individual_skipped_serialization_block_supports() {
+ public function test_radius_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/radius-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
diff --git a/tests/phpunit/tests/block-supports/colors.php b/tests/phpunit/tests/block-supports/colors.php
index 109709e3d722f..f9d302a741fa7 100644
--- a/tests/phpunit/tests/block-supports/colors.php
+++ b/tests/phpunit/tests/block-supports/colors.php
@@ -10,12 +10,12 @@ class Tests_Block_Supports_Colors extends WP_UnitTestCase {
*/
private $test_block_name;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->test_block_name = null;
}
- function tear_down() {
+ public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::set_up();
@@ -24,7 +24,7 @@ function tear_down() {
/**
* @ticket 54337
*/
- function test_color_slugs_with_numbers_are_kebab_cased_properly() {
+ public function test_color_slugs_with_numbers_are_kebab_cased_properly() {
$this->test_block_name = 'test/color-slug-with-numbers';
register_block_type(
$this->test_block_name,
@@ -68,7 +68,7 @@ function test_color_slugs_with_numbers_are_kebab_cased_properly() {
/**
* @ticket 55505
*/
- function test_color_with_skipped_serialization_block_supports() {
+ public function test_color_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/color-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@@ -109,7 +109,7 @@ function test_color_with_skipped_serialization_block_supports() {
/**
* @ticket 55505
*/
- function test_gradient_with_individual_skipped_serialization_block_supports() {
+ public function test_gradient_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/gradient-with-individual-skipped-serialization-block-support';
register_block_type(
$this->test_block_name,
diff --git a/tests/phpunit/tests/block-supports/layout.php b/tests/phpunit/tests/block-supports/layout.php
index 3611c28efa22e..bcc21775ba008 100644
--- a/tests/phpunit/tests/block-supports/layout.php
+++ b/tests/phpunit/tests/block-supports/layout.php
@@ -32,7 +32,7 @@ class Test_Block_Supports_Layout extends WP_UnitTestCase {
*/
private $orig_theme_dir;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
$this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
@@ -50,7 +50,7 @@ function set_up() {
unset( $GLOBALS['wp_themes'] );
}
- function tear_down() {
+ public function tear_down() {
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
// Clear up the filters to modify the theme root.
@@ -63,14 +63,14 @@ function tear_down() {
parent::tear_down();
}
- function filter_set_theme_root() {
+ public function filter_set_theme_root() {
return $this->theme_root;
}
/**
* @ticket 55505
*/
- function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
+ public function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
@@ -86,7 +86,7 @@ function test_outer_container_not_restored_for_non_aligned_image_block_with_non_
/**
* @ticket 55505
*/
- function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
+ public function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
@@ -107,7 +107,7 @@ function test_outer_container_restored_for_aligned_image_block_with_non_themejso
* @param string $block_image_html The block image HTML passed to `wp_restore_image_outer_container`.
* @param string $expected The expected block image HTML.
*/
- function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme( $block_image_html, $expected ) {
+ public function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme( $block_image_html, $expected ) {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
@@ -160,7 +160,7 @@ public function data_block_image_html_restored_outer_container() {
/**
* @ticket 55505
*/
- function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
+ public function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
switch_theme( 'block-theme' );
$block = array(
'blockName' => 'core/image',
diff --git a/tests/phpunit/tests/block-supports/spacing.php b/tests/phpunit/tests/block-supports/spacing.php
index e0a849cf6bc30..4b5ada3798740 100644
--- a/tests/phpunit/tests/block-supports/spacing.php
+++ b/tests/phpunit/tests/block-supports/spacing.php
@@ -10,12 +10,12 @@ class Test_Block_Supports_Spacing extends WP_UnitTestCase {
*/
private $test_block_name;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->test_block_name = null;
}
- function tear_down() {
+ public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::set_up();
@@ -24,7 +24,7 @@ function tear_down() {
/**
* @ticket 55505
*/
- function test_spacing_style_is_applied() {
+ public function test_spacing_style_is_applied() {
$this->test_block_name = 'test/spacing-style-is-applied';
register_block_type(
$this->test_block_name,
@@ -72,7 +72,7 @@ function test_spacing_style_is_applied() {
/**
* @ticket 55505
*/
- function test_spacing_with_skipped_serialization_block_supports() {
+ public function test_spacing_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/spacing-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@@ -119,7 +119,7 @@ function test_spacing_with_skipped_serialization_block_supports() {
/**
* @ticket 55505
*/
- function test_margin_with_individual_skipped_serialization_block_supports() {
+ public function test_margin_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/margin-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
diff --git a/tests/phpunit/tests/block-supports/typography.php b/tests/phpunit/tests/block-supports/typography.php
index b9d16fbdf488e..177a154b9eeca 100644
--- a/tests/phpunit/tests/block-supports/typography.php
+++ b/tests/phpunit/tests/block-supports/typography.php
@@ -23,7 +23,7 @@ class Tests_Block_Supports_Typography extends WP_UnitTestCase {
*/
private $orig_theme_dir;
- function set_up() {
+ public function set_up() {
parent::set_up();
$this->test_block_name = null;
@@ -48,7 +48,7 @@ function set_up() {
/**
* Unregisters block type after each test.
*/
- function tear_down() {
+ public function tear_down() {
// Restores the original theme directory setup.
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
wp_clean_themes_cache();
@@ -68,7 +68,7 @@ function tear_down() {
*
* @covers ::wp_apply_typography_support
*/
- function test_should_kebab_case_font_size_slug_with_numbers() {
+ public function test_should_kebab_case_font_size_slug_with_numbers() {
$this->test_block_name = 'test/font-size-slug-with-numbers';
register_block_type(
$this->test_block_name,
@@ -104,7 +104,7 @@ function test_should_kebab_case_font_size_slug_with_numbers() {
*
* @covers ::wp_apply_typography_support
*/
- function test_should_generate_font_family_with_legacy_inline_styles_using_a_value() {
+ public function test_should_generate_font_family_with_legacy_inline_styles_using_a_value() {
$this->test_block_name = 'test/font-family-with-inline-styles-using-value';
register_block_type(
$this->test_block_name,
@@ -139,7 +139,7 @@ function test_should_generate_font_family_with_legacy_inline_styles_using_a_valu
*
* @covers ::wp_apply_typography_support
*/
- function test_should_skip_serialization_for_typography_block_supports() {
+ public function test_should_skip_serialization_for_typography_block_supports() {
$this->test_block_name = 'test/typography-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@@ -187,7 +187,7 @@ function test_should_skip_serialization_for_typography_block_supports() {
*
* @covers ::wp_apply_typography_support
*/
- function test_should_skip_serialization_for_letter_spacing_block_supports() {
+ public function test_should_skip_serialization_for_letter_spacing_block_supports() {
$this->test_block_name = 'test/letter-spacing-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
@@ -225,7 +225,7 @@ function test_should_skip_serialization_for_letter_spacing_block_supports() {
*
* @covers ::wp_apply_typography_support
*/
- function test_should_generate_css_var_for_font_family_with_legacy_inline_styles() {
+ public function test_should_generate_css_var_for_font_family_with_legacy_inline_styles() {
$this->test_block_name = 'test/font-family-with-inline-styles-using-css-var';
register_block_type(
$this->test_block_name,
@@ -260,7 +260,7 @@ function test_should_generate_css_var_for_font_family_with_legacy_inline_styles(
*
* @covers ::wp_apply_typography_support
*/
- function test_should_generate_classname_for_font_family() {
+ public function test_should_generate_classname_for_font_family() {
$this->test_block_name = 'test/font-family-with-class';
register_block_type(
$this->test_block_name,
@@ -308,7 +308,7 @@ function test_should_generate_classname_for_font_family() {
* @param bool $should_use_fluid_typography An override to switch fluid typography "on". Can be used for unit testing.
* @param string $expected_output Expected output.
*/
- function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography, $expected_output ) {
+ public function test_wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography, $expected_output ) {
$actual = wp_get_typography_font_size_value( $font_size_preset, $should_use_fluid_typography );
$this->assertSame( $expected_output, $actual );
diff --git a/tests/phpunit/tests/block-template-utils.php b/tests/phpunit/tests/block-template-utils.php
index a77f7e9d81821..6e4a5b9e5c81d 100644
--- a/tests/phpunit/tests/block-template-utils.php
+++ b/tests/phpunit/tests/block-template-utils.php
@@ -131,7 +131,7 @@ public function test_build_block_template_result_from_post() {
*
* @covers ::_build_block_template_result_from_post
*/
- function test_build_block_template_result_from_post_with_child_theme() {
+ public function test_build_block_template_result_from_post_with_child_theme() {
switch_theme( 'block-theme-child' );
$template = _build_block_template_result_from_post(
@@ -142,7 +142,7 @@ function test_build_block_template_result_from_post_with_child_theme() {
$this->assertSame( self::TEST_THEME, $template->theme );
}
- function test_build_block_template_result_from_file() {
+ public function test_build_block_template_result_from_file() {
$template = _build_block_template_result_from_file(
array(
'slug' => 'single',
@@ -188,7 +188,7 @@ function test_build_block_template_result_from_file() {
*
* @covers ::_build_block_template_result_from_file
*/
- function test_build_block_template_result_from_file_with_child_theme() {
+ public function test_build_block_template_result_from_file_with_child_theme() {
switch_theme( 'block-theme-child' );
$template = _build_block_template_result_from_file(
@@ -203,7 +203,7 @@ function test_build_block_template_result_from_file_with_child_theme() {
$this->assertSame( self::TEST_THEME, $template->theme );
}
- function test_inject_theme_attribute_in_block_template_content() {
+ public function test_inject_theme_attribute_in_block_template_content() {
$theme = get_stylesheet();
$content_without_theme_attribute = '';
$template_content = _inject_theme_attribute_in_block_template_content(
@@ -249,11 +249,11 @@ function test_inject_theme_attribute_in_block_template_content() {
*
* @dataProvider data_remove_theme_attribute_in_block_template_content
*/
- function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) {
+ public function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) {
$this->assertSame( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) );
}
- function data_remove_theme_attribute_in_block_template_content() {
+ public function data_remove_theme_attribute_in_block_template_content() {
return array(
array(
'',
@@ -279,7 +279,7 @@ function data_remove_theme_attribute_in_block_template_content() {
/**
* Should retrieve the template from the theme files.
*/
- function test_get_block_template_from_file() {
+ public function test_get_block_template_from_file() {
$id = get_stylesheet() . '//' . 'index';
$template = get_block_template( $id, 'wp_template' );
$this->assertSame( $id, $template->id );
@@ -329,7 +329,7 @@ public function test_get_block_template_from_post() {
/**
* Should flatten nested blocks
*/
- function test_flatten_blocks() {
+ public function test_flatten_blocks() {
$content_template_part_inside_group = '';
$blocks = parse_blocks( $content_template_part_inside_group );
$actual = _flatten_blocks( $blocks );
@@ -355,7 +355,7 @@ function test_flatten_blocks() {
* @ticket 54448
* @requires extension zip
*/
- function test_wp_generate_block_templates_export_file() {
+ public function test_wp_generate_block_templates_export_file() {
$filename = wp_generate_block_templates_export_file();
$this->assertFileExists( $filename, 'zip file is created at the specified path' );
$this->assertTrue( filesize( $filename ) > 0, 'zip file is larger than 0 bytes' );
diff --git a/tests/phpunit/tests/block-template.php b/tests/phpunit/tests/block-template.php
index b53aa496b0300..5439ac3793186 100644
--- a/tests/phpunit/tests/block-template.php
+++ b/tests/phpunit/tests/block-template.php
@@ -28,7 +28,7 @@ public function tear_down() {
parent::tear_down();
}
- function test_page_home_block_template_takes_precedence_over_less_specific_block_templates() {
+ public function test_page_home_block_template_takes_precedence_over_less_specific_block_templates() {
global $_wp_current_template_content;
$type = 'page';
$templates = array(
@@ -41,7 +41,7 @@ function test_page_home_block_template_takes_precedence_over_less_specific_block
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page-home.html', $_wp_current_template_content );
}
- function test_page_block_template_takes_precedence() {
+ public function test_page_block_template_takes_precedence() {
global $_wp_current_template_content;
$type = 'page';
$templates = array(
@@ -54,7 +54,7 @@ function test_page_block_template_takes_precedence() {
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page.html', $_wp_current_template_content );
}
- function test_block_template_takes_precedence_over_equally_specific_php_template() {
+ public function test_block_template_takes_precedence_over_equally_specific_php_template() {
global $_wp_current_template_content;
$type = 'index';
$templates = array(
@@ -71,7 +71,7 @@ function test_block_template_takes_precedence_over_equally_specific_php_template
*
* Covers https://github.com/WordPress/gutenberg/pull/29026.
*/
- function test_more_specific_php_template_takes_precedence_over_less_specific_block_template() {
+ public function test_more_specific_php_template_takes_precedence_over_less_specific_block_template() {
$page_id_template = 'page-1.php';
$page_id_template_path = get_stylesheet_directory() . '/' . $page_id_template;
$type = 'page';
@@ -93,7 +93,7 @@ function test_more_specific_php_template_takes_precedence_over_less_specific_blo
* Covers https://core.trac.wordpress.org/ticket/54515.
*
*/
- function test_child_theme_php_template_takes_precedence_over_equally_specific_parent_theme_block_template() {
+ public function test_child_theme_php_template_takes_precedence_over_equally_specific_parent_theme_block_template() {
switch_theme( 'block-theme-child' );
$page_slug_template = 'page-home.php';
@@ -108,7 +108,7 @@ function test_child_theme_php_template_takes_precedence_over_equally_specific_pa
$this->assertSame( $page_slug_template_path, $resolved_template_path );
}
- function test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template() {
+ public function test_child_theme_block_template_takes_precedence_over_equally_specific_parent_theme_php_template() {
global $_wp_current_template_content;
switch_theme( 'block-theme-child' );
diff --git a/tests/phpunit/tests/blocks/renderCommentTemplate.php b/tests/phpunit/tests/blocks/renderCommentTemplate.php
index 848b2caf38f07..5bfcd76487203 100644
--- a/tests/phpunit/tests/blocks/renderCommentTemplate.php
+++ b/tests/phpunit/tests/blocks/renderCommentTemplate.php
@@ -87,7 +87,7 @@ public function set_up() {
* @ticket 55505
* @covers ::build_comment_query_vars_from_block
*/
- function test_build_comment_query_vars_from_block_with_context() {
+ public function test_build_comment_query_vars_from_block_with_context() {
$parsed_blocks = parse_blocks(
''
);
@@ -118,7 +118,7 @@ function test_build_comment_query_vars_from_block_with_context() {
* @ticket 55567
* @covers ::build_comment_query_vars_from_block
*/
- function test_build_comment_query_vars_from_block_with_context_no_pagination() {
+ public function test_build_comment_query_vars_from_block_with_context_no_pagination() {
update_option( 'page_comments', false );
$parsed_blocks = parse_blocks(
''
@@ -148,7 +148,7 @@ function test_build_comment_query_vars_from_block_with_context_no_pagination() {
* @ticket 55505
* @covers ::build_comment_query_vars_from_block
*/
- function test_build_comment_query_vars_from_block_no_context() {
+ public function test_build_comment_query_vars_from_block_no_context() {
$parsed_blocks = parse_blocks(
''
);
@@ -178,7 +178,7 @@ function test_build_comment_query_vars_from_block_no_context() {
* @ticket 55658
* @covers ::build_comment_query_vars_from_block
*/
- function test_build_comment_query_vars_from_block_pagination_with_no_comments() {
+ public function test_build_comment_query_vars_from_block_pagination_with_no_comments() {
$comments_per_page = get_option( 'comments_per_page' );
$default_comments_page = get_option( 'default_comments_page' );
@@ -230,7 +230,7 @@ function test_build_comment_query_vars_from_block_pagination_with_no_comments()
* @ticket 55505
* @covers ::build_comment_query_vars_from_block
*/
- function test_build_comment_query_vars_from_block_sets_cpage_var() {
+ public function test_build_comment_query_vars_from_block_sets_cpage_var() {
// This could be any number, we set a fixed one instead of a random for better performance.
$comment_query_max_num_pages = 5;
@@ -267,7 +267,7 @@ function test_build_comment_query_vars_from_block_sets_cpage_var() {
*
* @ticket 55567
*/
- function test_rendering_comment_template() {
+ public function test_rendering_comment_template() {
$parsed_blocks = parse_blocks(
''
);
@@ -295,7 +295,7 @@ function test_rendering_comment_template() {
*
* @ticket 55567
*/
- function test_rendering_comment_template_nested() {
+ public function test_rendering_comment_template_nested() {
$first_level_ids = self::factory()->comment->create_post_comments(
self::$custom_post->ID,
2,
@@ -396,7 +396,7 @@ function test_rendering_comment_template_nested() {
*
* @ticket 55643
*/
- function test_render_block_core_comment_content_converts_to_html() {
+ public function test_render_block_core_comment_content_converts_to_html() {
$comment_id = self::$comment_ids[0];
$new_content = "Paragraph One\n\nP2L1\nP2L2\n\nhttps://example.com/";
self::factory()->comment->update_object(
@@ -430,7 +430,7 @@ function test_render_block_core_comment_content_converts_to_html() {
* @ticket 55634
* @covers ::build_comment_query_vars_from_block
*/
- function test_build_comment_query_vars_from_block_with_comment_preview() {
+ public function test_build_comment_query_vars_from_block_with_comment_preview() {
$parsed_blocks = parse_blocks(
''
);
@@ -471,7 +471,7 @@ function test_build_comment_query_vars_from_block_with_comment_preview() {
*
* @ticket 55643
*/
- function test_rendering_comment_template_unmoderated_preview() {
+ public function test_rendering_comment_template_unmoderated_preview() {
$parsed_blocks = parse_blocks(
''
);
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index 7f855e110f3d1..1fdba6ca847ab 100644
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -2069,7 +2069,7 @@ public function test_wp_get_default_extension_for_mime_type() {
* @ticket 55505
* @covers ::wp_recursive_ksort
*/
- function test_wp_recursive_ksort() {
+ public function test_wp_recursive_ksort() {
// Create an array to test.
$theme_json = array(
'version' => 1,
diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php
index 294cb84779465..84787a4501b08 100644
--- a/tests/phpunit/tests/kses.php
+++ b/tests/phpunit/tests/kses.php
@@ -1647,14 +1647,14 @@ public function test_wp_kses_main_tag_standard_attributes() {
* @param string $html A string of HTML to test.
* @param string $expected The expected result from KSES.
*/
- function test_wp_kses_object_tag_allowed( $html, $expected ) {
+ public function test_wp_kses_object_tag_allowed( $html, $expected ) {
$this->assertSame( $expected, wp_kses_post( $html ) );
}
/**
* Data provider for test_wp_kses_object_tag_allowed().
*/
- function data_wp_kses_object_tag_allowed() {
+ public function data_wp_kses_object_tag_allowed() {
return array(
'valid value for type' => array(
'',
@@ -1757,7 +1757,7 @@ function data_wp_kses_object_tag_allowed() {
* @param string $html A string of HTML to test.
* @param string $expected The expected result from KSES.
*/
- function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected ) {
+ public function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected ) {
add_filter( 'upload_dir', array( $this, 'wp_kses_upload_dir_filter' ), 10, 2 );
$this->assertSame( $expected, wp_kses_post( $html ) );
}
@@ -1765,7 +1765,7 @@ function test_wp_kses_object_data_url_with_port_number_allowed( $html, $expected
/**
* Data provider for test_wp_kses_object_data_url_with_port_number_allowed().
*/
- function data_wp_kses_object_data_url_with_port_number_allowed() {
+ public function data_wp_kses_object_data_url_with_port_number_allowed() {
return array(
'url with port number' => array(
'',
@@ -1804,7 +1804,7 @@ public function wp_kses_upload_dir_filter( $param ) {
*
* @ticket 54261
*/
- function test_wp_kses_object_added_in_html_filter() {
+ public function test_wp_kses_object_added_in_html_filter() {
$html = <<
From 8f44c445e6786f8f1bbd52825d4ad5b33a93a644 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Tue, 10 Jan 2023 09:07:01 +0000
Subject: [PATCH 0213/1431] Docs: Align spelling with American English.
This changeset updates the use of "-ise" suffix to American English "-ize" in docblocks.
Follow-up to [54663], [54664].
Props ironprogrammer, costdev.
See #56811, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55043 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/multisite/site.php | 6 ++++--
tests/phpunit/tests/query/vars.php | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index a3e179a88db73..0d1667fbae4c3 100644
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -2125,8 +2125,10 @@ public function test_wpmu_create_blog_cache_cleanup_backward_compatible() {
$blog_id = wpmu_create_blog( 'testsite1.example.org', '/test', 'test', 1, array( 'public' => 1 ), 2 );
- // Should not hit blog_details cache initialised in $this->populate_options_callback tirggered during
- // populate_options callback's call of get_blog_details.
+ /*
+ * Should not hit blog_details cache initialized in $this->populate_options_callback triggered during
+ * populate_options callback's call of get_blog_details.
+ */
$this->assertSame( 'http://testsite1.example.org/test', get_blog_details( $blog_id )->siteurl );
$this->assertSame( 'http://testsite1.example.org/test', get_site( $blog_id )->siteurl );
diff --git a/tests/phpunit/tests/query/vars.php b/tests/phpunit/tests/query/vars.php
index 7f336908a233a..4b4b96561b6ac 100644
--- a/tests/phpunit/tests/query/vars.php
+++ b/tests/phpunit/tests/query/vars.php
@@ -14,7 +14,7 @@ class Tests_Query_Vars extends WP_UnitTestCase {
public function testPublicQueryVarsAreAsExpected() {
global $wp;
- // Re-initialise any dynamically-added public query vars:
+ // Re-initialize any dynamically-added public query vars:
do_action( 'init' );
$this->assertSame(
From 5a32388a137ad8a5f92f00cfd820144ed1079eee Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Tue, 10 Jan 2023 09:28:17 +0000
Subject: [PATCH 0214/1431] Docs: Align spelling with American English.
This changeset updates the use of "-ise" suffix to American English "-ize" and replaces "behaviour" with "behavior" in various docblocks.
Follow-up to [54663], [54664], [55043].
Props kebbet.
See #56811, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55044 602fd350-edb4-49c9-b593-d223f7449a82
---
src/js/_enqueues/admin/postbox.js | 4 ++--
src/js/_enqueues/lib/comment-reply.js | 2 +-
src/js/_enqueues/lib/image-edit.js | 4 ++--
src/js/_enqueues/wp/api.js | 2 +-
src/wp-includes/pluggable.php | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/js/_enqueues/admin/postbox.js b/src/js/_enqueues/admin/postbox.js
index 4f521acd93ba3..c80866f3a23bc 100644
--- a/src/js/_enqueues/admin/postbox.js
+++ b/src/js/_enqueues/admin/postbox.js
@@ -14,7 +14,7 @@
__ = wp.i18n.__;
/**
- * This object contains all function to handle the behaviour of the post boxes. The post boxes are the boxes you see
+ * This object contains all function to handle the behavior of the post boxes. The post boxes are the boxes you see
* around the content on the edit page.
*
* @since 2.7.0
@@ -347,7 +347,7 @@
},
/**
- * Initializes all the postboxes, mainly their sortable behaviour.
+ * Initializes all the postboxes, mainly their sortable behavior.
*
* @since 2.7.0
*
diff --git a/src/js/_enqueues/lib/comment-reply.js b/src/js/_enqueues/lib/comment-reply.js
index 5d20672058a03..59cf5a1aa0551 100644
--- a/src/js/_enqueues/lib/comment-reply.js
+++ b/src/js/_enqueues/lib/comment-reply.js
@@ -59,7 +59,7 @@ window.addComment = ( function( window ) {
* @since 5.1.1
*/
function ready() {
- // Initialise the events.
+ // Initialize the events.
init();
// Set up a MutationObserver to check for comments loaded late.
diff --git a/src/js/_enqueues/lib/image-edit.js b/src/js/_enqueues/lib/image-edit.js
index 18d3099f62cf5..0d4f7b015a4e0 100644
--- a/src/js/_enqueues/lib/image-edit.js
+++ b/src/js/_enqueues/lib/image-edit.js
@@ -11,7 +11,7 @@
var __ = wp.i18n.__;
/**
- * Contains all the methods to initialise and control the image editor.
+ * Contains all the methods to initialize and control the image editor.
*
* @namespace imageEdit
*/
@@ -636,7 +636,7 @@
btn.removeClass( 'button-activated' );
spin.removeClass( 'is-active' );
} );
- // Initialise the Image Editor now that everything is ready.
+ // Initialize the Image Editor now that everything is ready.
imageEdit.init( postid );
} );
diff --git a/src/js/_enqueues/wp/api.js b/src/js/_enqueues/wp/api.js
index b033a6f02b0d2..1d0baea8cdf28 100644
--- a/src/js/_enqueues/wp/api.js
+++ b/src/js/_enqueues/wp/api.js
@@ -7,7 +7,7 @@
'use strict';
/**
- * Initialise the WP_API.
+ * Initialize the WP_API.
*/
function WP_API() {
/** @namespace wp.api.models */
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index 6ecd6727065b3..8ee9724331536 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -1238,7 +1238,7 @@ function auth_redirect() {
* Ensures intent by verifying that a user was referred from another admin page with the correct security nonce.
*
* This function ensures the user intends to perform a given action, which helps protect against clickjacking style
- * attacks. It verifies intent, not authorisation, therefore it does not verify the user's capabilities. This should
+ * attacks. It verifies intent, not authorization, therefore it does not verify the user's capabilities. This should
* be performed with `current_user_can()` or similar.
*
* If the nonce value is invalid, the function will exit with an "Are You Sure?" style message.
From 76253b9997be684c92ad230776fdda58fddcfbc7 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Tue, 10 Jan 2023 11:04:36 +0000
Subject: [PATCH 0215/1431] General: Align spelling with American English.
This changeset renames `url-friendly-colour` to `url-friendly-color` in `_admin.scss`.
Follow-up to [54663], [54664], [55043], [55044].
Props kebbet.
See #56811.
git-svn-id: https://develop.svn.wordpress.org/trunk@55045 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/css/colors/_admin.scss | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-admin/css/colors/_admin.scss b/src/wp-admin/css/colors/_admin.scss
index e4c8c2fe6b105..427e2ad37a3a1 100644
--- a/src/wp-admin/css/colors/_admin.scss
+++ b/src/wp-admin/css/colors/_admin.scss
@@ -2,7 +2,7 @@
@import 'variables';
@import 'mixins';
-@function url-friendly-colour( $color ) {
+@function url-friendly-color( $color ) {
@return '%23' + str-slice( '#{ $color }', 2, -1 );
}
@@ -62,7 +62,7 @@ span.wp-media-buttons-icon:before {
/* Forms */
input[type=checkbox]:checked::before {
- content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27#{url-friendly-colour($form-checked)}%27%2F%3E%3C%2Fsvg%3E");
+ content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27#{url-friendly-color($form-checked)}%27%2F%3E%3C%2Fsvg%3E");
}
input[type=radio]:checked::before {
From 234698c55171f6479e4b6c127b0dcd6992ed7bf1 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 10 Jan 2023 11:28:31 +0000
Subject: [PATCH 0216/1431] HTTP API: Use correct class reference for Requests'
HTTP Proxy in `WP_Http::request()`.
Renaming the class was missed in [54997] when updating changes in `WP_Http::request()` for the Requests 2.0.0 external library upgrade. The `HTTP` class no longer exists and caused a fatal error:
{{{
PHP Fatal error: Class 'WpOrg\Requests\Proxy\HTTP' not found in wp-includes/class-wp-http.php on line 382
}}}
This commit renames the class to `Http` and resolves the fatal error.
Follow-up to [52244], [52315], [52327], [52328], [54997], [55007].
Props danielbachhuber, jrf.
See #54504.
git-svn-id: https://develop.svn.wordpress.org/trunk@55046 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-http.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/class-wp-http.php b/src/wp-includes/class-wp-http.php
index 24723678354f0..7edffe0e6bf0d 100644
--- a/src/wp-includes/class-wp-http.php
+++ b/src/wp-includes/class-wp-http.php
@@ -379,7 +379,7 @@ public function request( $url, $args = array() ) {
// Check for proxies.
$proxy = new WP_HTTP_Proxy();
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
- $options['proxy'] = new WpOrg\Requests\Proxy\HTTP( $proxy->host() . ':' . $proxy->port() );
+ $options['proxy'] = new WpOrg\Requests\Proxy\Http( $proxy->host() . ':' . $proxy->port() );
if ( $proxy->use_authentication() ) {
$options['proxy']->use_authentication = true;
From 0d39c0aa1e7c31db14aa4e2110c61e80423a7943 Mon Sep 17 00:00:00 2001
From: Tonya Mork
Date: Tue, 10 Jan 2023 13:59:00 +0000
Subject: [PATCH 0217/1431] I18N: Initialize `WP_Locale` array properties.
Initializing the `WP_Locale` array properties to an empty array at the class definition point. Why?
* Ensure the properties initialize to an `array` data type at instantiation (rather than `null`).
This initialization is needed to ensure the properties are not `null` if another class inherits from `WP_Locale` but does not run `WP_Locale::init()` from the constructor. In this case, the initialization prevents
{{{
Warning: array_values() expects parameter 1 to be array, null given
}}}
when Core uses any of the properties.
* Good design practice.
The code and documentation are clearly expecting these properties to be an `array` data type. Setting each to a default `array()` state further helps to clearly communicate the code design.
Follow-up to [37889], [36292], [31078], [3676], [6589].
Props tyxla, SergeyBiryukov, azaozz, hellofromTonya, mukesh27.
See #57427.
git-svn-id: https://develop.svn.wordpress.org/trunk@55047 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-locale.php | 24 +++++++++++------
tests/phpunit/tests/locale.php | 41 +++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 8 deletions(-)
diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php
index b001a099648b5..ea8b67c987dfb 100644
--- a/src/wp-includes/class-wp-locale.php
+++ b/src/wp-includes/class-wp-locale.php
@@ -19,9 +19,10 @@ class WP_Locale {
* Stores the translated strings for the full weekday names.
*
* @since 2.1.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $weekday;
+ public $weekday = array();
/**
* Stores the translated strings for the one character weekday names.
@@ -32,41 +33,46 @@ class WP_Locale {
* @see WP_Locale::init() for how to handle the hack.
*
* @since 2.1.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $weekday_initial;
+ public $weekday_initial = array();
/**
* Stores the translated strings for the abbreviated weekday names.
*
* @since 2.1.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $weekday_abbrev;
+ public $weekday_abbrev = array();
/**
* Stores the translated strings for the full month names.
*
* @since 2.1.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $month;
+ public $month = array();
/**
* Stores the translated strings for the month names in genitive case, if the locale specifies.
*
* @since 4.4.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $month_genitive;
+ public $month_genitive = array();
/**
* Stores the translated strings for the abbreviated month names.
*
* @since 2.1.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $month_abbrev;
+ public $month_abbrev = array();
/**
* Stores the translated strings for 'am' and 'pm'.
@@ -74,9 +80,10 @@ class WP_Locale {
* Also the capitalized versions.
*
* @since 2.1.0
+ * @since 6.2.0 Initialized to an empty array.
* @var string[]
*/
- public $meridiem;
+ public $meridiem = array();
/**
* The text direction of the locale language.
@@ -92,9 +99,10 @@ class WP_Locale {
* The thousands separator and decimal point values used for localizing numbers.
*
* @since 2.3.0
+ * @since 6.2.0 Initialized to an empty array.
* @var array
*/
- public $number_format;
+ public $number_format = array();
/**
* The separator string used for localizing list item separator.
diff --git a/tests/phpunit/tests/locale.php b/tests/phpunit/tests/locale.php
index 2e7daa87e17c4..a3a100547e0b2 100644
--- a/tests/phpunit/tests/locale.php
+++ b/tests/phpunit/tests/locale.php
@@ -15,6 +15,39 @@ public function set_up() {
$this->locale = new WP_Locale();
}
+ /**
+ * @ticket 57427
+ *
+ * @dataProvider data_property_initializes_to_array
+ *
+ * @param string $name Property name to test.
+ */
+ public function test_property_initializes_to_array( $name ) {
+ $this->assertIsArray( $this->locale->$name, "WP_Locale::{$name} property should be an array" );
+
+ // Test a custom implementation when `init()` is not invoked in the constructor.
+ $wp_locale = new Custom_WP_Locale();
+ $this->assertIsArray( $wp_locale->$name, "Custom_WP_Locale::{$name} property should be an array" );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_property_initializes_to_array() {
+ return array(
+ 'weekday' => array( 'weekday' ),
+ 'weekday_initial' => array( 'weekday_initial' ),
+ 'weekday_abbrev' => array( 'weekday_abbrev' ),
+ 'month' => array( 'month' ),
+ 'month_genitive' => array( 'month_genitive' ),
+ 'month_abbrev' => array( 'month_abbrev' ),
+ 'meridiem' => array( 'meridiem' ),
+ 'number_format' => array( 'number_format' ),
+ );
+ }
+
/**
* @covers WP_Locale::get_weekday
*/
@@ -141,3 +174,11 @@ public function test_is_rtl() {
$this->assertFalse( $this->locale->is_rtl() );
}
}
+
+class Custom_WP_Locale extends WP_Locale {
+ public function __construct() {
+ // Do not initialize to test property initialization.
+ // $this->init();
+ $this->register_globals();
+ }
+}
From 80bb61d33fc5ad8324b8688bb3774d69d9ce55d4 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 11 Jan 2023 09:15:06 +0000
Subject: [PATCH 0218/1431] General: revert [55045].
This changeset reverts [55045] to maintain backward compatibility for developers using the function in their SCSS.
Follow-up to [55045].
Unprops audrasjb.
Props peterwilsoncc, kebbet.
See #56811.
git-svn-id: https://develop.svn.wordpress.org/trunk@55048 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/css/colors/_admin.scss | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/wp-admin/css/colors/_admin.scss b/src/wp-admin/css/colors/_admin.scss
index 427e2ad37a3a1..1d06aa93fb66a 100644
--- a/src/wp-admin/css/colors/_admin.scss
+++ b/src/wp-admin/css/colors/_admin.scss
@@ -2,7 +2,11 @@
@import 'variables';
@import 'mixins';
-@function url-friendly-color( $color ) {
+/**
+ * This function name uses British English to maintain backward compatibility, as developers
+ * may use the function in their own admin CSS files. See #56811.
+ */
+@function url-friendly-colour( $color ) {
@return '%23' + str-slice( '#{ $color }', 2, -1 );
}
@@ -62,7 +66,7 @@ span.wp-media-buttons-icon:before {
/* Forms */
input[type=checkbox]:checked::before {
- content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27#{url-friendly-color($form-checked)}%27%2F%3E%3C%2Fsvg%3E");
+ content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27#{url-friendly-colour($form-checked)}%27%2F%3E%3C%2Fsvg%3E");
}
input[type=radio]:checked::before {
From f3dc0609c042a3e7857c8581c2301cd319cb4362 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Wed, 11 Jan 2023 11:50:01 +0000
Subject: [PATCH 0219/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/customize/nav-menus.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$type` and `$object` parameters to `$object_type` and `$object_name` in `Test_WP_Customize_Nav_Menus::filter_items()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55049 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/customize/nav-menus.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php
index 7b8ee43396448..6cc8f3d08c5b6 100644
--- a/tests/phpunit/tests/customize/nav-menus.php
+++ b/tests/phpunit/tests/customize/nav-menus.php
@@ -57,18 +57,18 @@ public function filter_item_types( $items ) {
/**
* Filter to add custom menu items.
*
- * @param array $items The menu items.
- * @param string $type The object type (e.g. taxonomy).
- * @param string $object The object name (e.g. category).
+ * @param array $items The menu items.
+ * @param string $object_type The object type (e.g. taxonomy).
+ * @param string $object_name The object name (e.g. category).
* @return array Menu items.
*/
- public function filter_items( $items, $type, $object ) {
+ public function filter_items( $items, $object_type, $object_name ) {
$items[] = array(
'id' => 'custom-1',
'title' => 'Cool beans',
- 'type' => $type,
+ 'type' => $object_type,
'type_label' => 'Custom Label',
- 'object' => $object,
+ 'object' => $object_name,
'url' => home_url( '/cool-beans/' ),
'classes' => 'custom-menu-item cool-beans',
);
From c45465ca9f0c2195681b4009356c5d1941745b99 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Wed, 11 Jan 2023 12:21:41 +0000
Subject: [PATCH 0220/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/customize/setting.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$default` parameter to `$default_value` in:
* `Tests_WP_Customize_Setting::custom_type_getter()`
* `Tests_WP_Customize_Setting::custom_type_value_filter()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55050 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/customize/setting.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/phpunit/tests/customize/setting.php b/tests/phpunit/tests/customize/setting.php
index 7645ec4c6afdd..ef7ea0d93a081 100644
--- a/tests/phpunit/tests/customize/setting.php
+++ b/tests/phpunit/tests/customize/setting.php
@@ -316,13 +316,13 @@ public function test_preview_standard_types_multidimensional() {
*/
protected $custom_type_data_previewed;
- private function custom_type_getter( $name, $default = null ) {
+ private function custom_type_getter( $name, $default_value = null ) {
if ( did_action( "customize_preview_{$name}" ) && array_key_exists( $name, $this->custom_type_data_previewed ) ) {
$value = $this->custom_type_data_previewed[ $name ];
} elseif ( array_key_exists( $name, $this->custom_type_data_saved ) ) {
$value = $this->custom_type_data_saved[ $name ];
} else {
- $value = $default;
+ $value = $default_value;
}
return $value;
}
@@ -334,17 +334,17 @@ private function custom_type_setter( $name, $value ) {
/**
* Filter for `customize_value_{$id_base}`.
*
- * @param mixed $default
+ * @param mixed $default_value
* @param WP_Customize_Setting $setting
*
* @return mixed|null
*/
- public function custom_type_value_filter( $default, $setting = null ) {
+ public function custom_type_value_filter( $default_value, $setting = null ) {
$name = preg_replace( '/^customize_value_/', '', current_filter() );
$this->assertInstanceOf( 'WP_Customize_Setting', $setting );
$id_data = $setting->id_data();
$this->assertSame( $name, $id_data['base'] );
- return $this->custom_type_getter( $name, $default );
+ return $this->custom_type_getter( $name, $default_value );
}
/**
From a930d258b932b2e7d6e50f7fccc1d3d0607a5f0f Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 11 Jan 2023 13:57:17 +0000
Subject: [PATCH 0221/1431] Docs: Align spelling with American English.
This changeset updates the use of "-ise" suffix to American English "-ize" in various files.
Follow-up to [54663], [54664], [55043], [55044].
Props kebbet, mukesh27.
See #56811, #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55051 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/formatting.php | 2 +-
src/wp-includes/general-template.php | 16 ++++++++--------
src/wp-mail.php | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index bade4e27884da..d3d54c422fd88 100644
--- a/src/wp-includes/formatting.php
+++ b/src/wp-includes/formatting.php
@@ -4728,7 +4728,7 @@ function wp_make_link_relative( $link ) {
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $option The name of the option.
- * @param string $value The unsanitised value.
+ * @param string $value The unsanitized value.
* @return string Sanitized value.
*/
function sanitize_option( $option, $value ) {
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index c2765d7b5abf9..40e6811443ee5 100644
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -10,7 +10,7 @@
* Loads header template.
*
* Includes the header template for a theme or if a name is specified then a
- * specialised header will be included.
+ * specialized header will be included.
*
* For the parameter, if the file is called "header-special.php" then specify
* "special".
@@ -19,7 +19,7 @@
* @since 5.5.0 A return value was added.
* @since 5.5.0 The `$args` parameter was added.
*
- * @param string $name The name of the specialised header.
+ * @param string $name The name of the specialized header.
* @param array $args Optional. Additional arguments passed to the header template.
* Default empty array.
* @return void|false Void on success, false if the template does not exist.
@@ -54,7 +54,7 @@ function get_header( $name = null, $args = array() ) {
* Loads footer template.
*
* Includes the footer template for a theme or if a name is specified then a
- * specialised footer will be included.
+ * specialized footer will be included.
*
* For the parameter, if the file is called "footer-special.php" then specify
* "special".
@@ -63,7 +63,7 @@ function get_header( $name = null, $args = array() ) {
* @since 5.5.0 A return value was added.
* @since 5.5.0 The `$args` parameter was added.
*
- * @param string $name The name of the specialised footer.
+ * @param string $name The name of the specialized footer.
* @param array $args Optional. Additional arguments passed to the footer template.
* Default empty array.
* @return void|false Void on success, false if the template does not exist.
@@ -98,7 +98,7 @@ function get_footer( $name = null, $args = array() ) {
* Loads sidebar template.
*
* Includes the sidebar template for a theme or if a name is specified then a
- * specialised sidebar will be included.
+ * specialized sidebar will be included.
*
* For the parameter, if the file is called "sidebar-special.php" then specify
* "special".
@@ -107,7 +107,7 @@ function get_footer( $name = null, $args = array() ) {
* @since 5.5.0 A return value was added.
* @since 5.5.0 The `$args` parameter was added.
*
- * @param string $name The name of the specialised sidebar.
+ * @param string $name The name of the specialized sidebar.
* @param array $args Optional. Additional arguments passed to the sidebar template.
* Default empty array.
* @return void|false Void on success, false if the template does not exist.
@@ -145,7 +145,7 @@ function get_sidebar( $name = null, $args = array() ) {
* in the theme.
*
* Includes the named template part for a theme or if a name is specified then a
- * specialised part will be included. If the theme contains no {slug}.php file
+ * specialized part will be included. If the theme contains no {slug}.php file
* then no template will be included.
*
* The template is included using require, not require_once, so you may include the
@@ -159,7 +159,7 @@ function get_sidebar( $name = null, $args = array() ) {
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
- * @param string $name The name of the specialised template.
+ * @param string $name The name of the specialized template.
* @param array $args Optional. Additional arguments passed to the template.
* Default empty array.
* @return void|false Void on success, false if the template does not exist.
diff --git a/src/wp-mail.php b/src/wp-mail.php
index b37a88b885212..631645cbede10 100644
--- a/src/wp-mail.php
+++ b/src/wp-mail.php
@@ -147,7 +147,7 @@
if ( preg_match( '/Date: /i', $line ) ) { // Of the form '20 Mar 2002 20:32:37 +0100'.
$ddate = str_replace( 'Date: ', '', trim( $line ) );
- // Remove parenthesised timezone string if it exists, as this confuses strtotime().
+ // Remove parenthesized timezone string if it exists, as this confuses strtotime().
$ddate = preg_replace( '!\s*\(.+\)\s*$!', '', $ddate );
$ddate_timestamp = strtotime( $ddate );
$post_date = gmdate( 'Y-m-d H:i:s', $ddate_timestamp + $time_difference );
From c3aed4a3b1606ab9dd9fdabb0caa8124ddbd3f5c Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 11 Jan 2023 14:05:22 +0000
Subject: [PATCH 0222/1431] Code Modernization: Fix a jQuery Migrate
deprecation in `wpdialog`.
This changeset replaces a `focus()` shorthand in WP Core's customized jQuery UI widget `wpdialog` to avoid a jQuery Migrate deprecation notice in the browser's console.
Props TobiasBg, elifvish.
Fixes #56830.
git-svn-id: https://develop.svn.wordpress.org/trunk@55052 602fd350-edb4-49c9-b593-d223f7449a82
---
src/js/_enqueues/lib/dialog.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/js/_enqueues/lib/dialog.js b/src/js/_enqueues/lib/dialog.js
index 327d8768b8739..eb7af5e6e3363 100644
--- a/src/js/_enqueues/lib/dialog.js
+++ b/src/js/_enqueues/lib/dialog.js
@@ -17,7 +17,7 @@
this._super();
// WebKit leaves focus in the TinyMCE editor unless we shift focus.
- this.element.focus();
+ this.element._trigger('focus');
this._trigger('refresh');
}
});
From 0aa20cc0502f9d46cc1fe99abd3ba8bdfb4fc5d1 Mon Sep 17 00:00:00 2001
From: Felix Arntz
Date: Wed, 11 Jan 2023 15:21:18 +0000
Subject: [PATCH 0223/1431] Formatting: Improve performance of `esc_url()`.
This changeset indirectly improves performance of the commonly used `esc_url()` function by optimizing the low-level function `wp_kses_bad_protocol()` for the by far most common scenarios, which are URLs using either the `http` or `https` protocol.
For this common scenario, the changeset now avoids the `do while` loop. While for a single call to the `esc_url()` function the performance wins are negligible, given that `esc_url()` is often called many times in one page load, they can add up, making this a worthwhile improvement.
Props mukesh27, schlessera, markjaquith, azaozz, spacedmonkey.
Fixes #22951.
git-svn-id: https://develop.svn.wordpress.org/trunk@55053 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/kses.php | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php
index 7928f6d57aaad..157be6be119f1 100644
--- a/src/wp-includes/kses.php
+++ b/src/wp-includes/kses.php
@@ -1686,7 +1686,16 @@ function wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) {
* @return string Filtered content.
*/
function wp_kses_bad_protocol( $content, $allowed_protocols ) {
- $content = wp_kses_no_null( $content );
+ $content = wp_kses_no_null( $content );
+
+ // Short-circuit if the string starts with `https://` or `http://`. Most common cases.
+ if (
+ ( str_starts_with( $content, 'https://' ) && in_array( 'https', $allowed_protocols, true ) ) ||
+ ( str_starts_with( $content, 'http://' ) && in_array( 'http', $allowed_protocols, true ) )
+ ) {
+ return $content;
+ }
+
$iterations = 0;
do {
From 55c34595d013ed02c1126a05ede66c1943ab72b3 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Wed, 11 Jan 2023 23:18:12 +0000
Subject: [PATCH 0224/1431] Date/Time: Prevent errors in `current_time()` when
using timestamp and no value for `gmt_offset`.
This changeset moves typecasting to affect the `get_option` value, which ensures that when math is done it does not generate any error. In PHP 7.4 and earlier the previous implementation was dismissed as a warning, but in PHP 8+ it would have throw a fatal error.
Follow-up to [45856].
Props Nick_theGeek, SergeyBiryukov, johnbillion.
Fixes #57035.
git-svn-id: https://develop.svn.wordpress.org/trunk@55054 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/functions.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 620ff23ed74a8..5d1f52e762a20 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -72,7 +72,7 @@ function mysql2date( $format, $date, $translate = true ) {
function current_time( $type, $gmt = 0 ) {
// Don't use non-GMT timestamp, unless you know the difference and really need to.
if ( 'timestamp' === $type || 'U' === $type ) {
- return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
+ return $gmt ? time() : time() + ( (int) get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
}
if ( 'mysql' === $type ) {
From 5836a438084356ebd232ffc152e18a6cf1c4f16f Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 12 Jan 2023 00:17:45 +0000
Subject: [PATCH 0225/1431] Upgrade/Install: Revert a temporary conditional for
testing the Rollbacks feature project.
The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-update-failure/ Rollback Update Failure feature project] has been split into two plugins for testing:
* [https://github.com/afragen/faster-updates Faster Updates] speeds up plugin or theme updates by moving files rather than copying them, thus decreasing the memory usage and reducing the chance of timeouts or running out of disk space during updates.
* [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure] creates a temporary backup of plugins and themes before updating. This aims to make the update process more reliable and ensure that if a plugin or theme update fails, the previous version can be safely restored.
The current priority of the feature project is to test the new `move_dir()` function, which offers better performance than `copy_dir()`. Instead of copying a directory in a recursive manner file by file from one location to another, `move_dir()` uses the `rename()` PHP function to speed up the process, which is instrumental in updating large plugins without a delay. If the renaming failed, it falls back to the `copy_dir()` WP function.
The `move_dir()` function is self-contained in the Faster Updates plugin and does not require any special hooks in core, so the conditional previously added to `WP_Upgrader::install_package()` to facilitate testing is no longer needed and can be removed.
Follow-up to [53578], [54484], [54643].
Props afragen, costdev, peterwilsoncc.
See #56057, #57375, #57386.
git-svn-id: https://develop.svn.wordpress.org/trunk@55055 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/class-wp-upgrader.php | 28 ++++-----------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php
index 88c6d5d604b0c..c1d65972c8c93 100644
--- a/src/wp-admin/includes/class-wp-upgrader.php
+++ b/src/wp-admin/includes/class-wp-upgrader.php
@@ -594,35 +594,17 @@ public function install_package( $args = array() ) {
}
// Copy new version of item into place.
- if ( class_exists( 'Rollback_Update_Failure\WP_Upgrader' )
- && function_exists( '\Rollback_Update_Failure\move_dir' )
- ) {
- /*
- * If the {@link https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure}
- * feature plugin is installed, use the move_dir() function from there for better performance.
- * Instead of copying a directory from one location to another, it uses the rename() PHP function
- * to speed up the process. If the renaming failed, it falls back to copy_dir().
- *
- * This condition aims to facilitate broader testing of the Rollbacks (temp backups) feature project.
- * It is temporary, until the plugin is merged into core.
- */
- $result = \Rollback_Update_Failure\move_dir( $source, $remote_destination );
- } else {
- $result = copy_dir( $source, $remote_destination );
- }
-
- if ( is_wp_error( $result ) ) {
- if ( $args['clear_working'] ) {
- $wp_filesystem->delete( $remote_source, true );
- }
- return $result;
- }
+ $result = copy_dir( $source, $remote_destination );
// Clear the working folder?
if ( $args['clear_working'] ) {
$wp_filesystem->delete( $remote_source, true );
}
+ if ( is_wp_error( $result ) ) {
+ return $result;
+ }
+
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
if ( '.' === $destination_name ) {
$destination_name = '';
From 344c4dce6881a5649ba69b50a6e9b89ff4a890ef Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 12 Jan 2023 09:03:29 +0000
Subject: [PATCH 0226/1431] Users: Add an action hook on `wp_set_password()`.
This changeset introduces the `wp_set_password` action hook, triggered after a password is set for a given user. As several plugins are calling `wp_set_password()` directly, adding an action to the end of the function will help plugin authors to catch all instances of password setting.
Props tanner-m, audrasjb.
Fixes #57436.
git-svn-id: https://develop.svn.wordpress.org/trunk@55056 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/pluggable.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index 8ee9724331536..b3921cddaf0c3 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -2740,6 +2740,16 @@ function wp_set_password( $password, $user_id ) {
);
clean_user_cache( $user_id );
+
+ /**
+ * Fires after the password is set.
+ *
+ * @since 6.2.0
+ *
+ * @param string $password The plain text password just set.
+ * @param mixed $user_id The ID of the user whose password was just set.
+ */
+ do_action( 'wp_set_password', $password, $user_id );
}
endif;
From 9dcb8f97c9613c6925b6957bf4ca76c9a4c5e8ca Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Thu, 12 Jan 2023 13:12:44 +0000
Subject: [PATCH 0227/1431] Docs: Correct the type of the `$user_id` parameter
in `wp_set_password` action.
Follow-up to [6600], [55056].
See #57436.
git-svn-id: https://develop.svn.wordpress.org/trunk@55057 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/pluggable.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index b3921cddaf0c3..9ea90655841b7 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -2742,12 +2742,12 @@ function wp_set_password( $password, $user_id ) {
clean_user_cache( $user_id );
/**
- * Fires after the password is set.
+ * Fires after the user password is set.
*
* @since 6.2.0
*
- * @param string $password The plain text password just set.
- * @param mixed $user_id The ID of the user whose password was just set.
+ * @param string $password The plaintext password just set.
+ * @param int $user_id The ID of the user whose password was just set.
*/
do_action( 'wp_set_password', $password, $user_id );
}
From 771a0c9f58e5a42c13661c115150d7d645f7617e Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Thu, 12 Jan 2023 23:06:20 +0000
Subject: [PATCH 0228/1431] Build/Test Tools: Fix an incorrect inline comment
in `Tests_Ajax_wpAjaxReplytoComment`.
This changeset replaces "Become an administrator" with "Become a subscriber" in an inline comment located in `Tests_Ajax_wpAjaxReplytoComment::test_as_subscriber`.
Props davidbinda.
Fixes #57452.
git-svn-id: https://develop.svn.wordpress.org/trunk@55058 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/ajax/wpAjaxReplytoComment.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/phpunit/tests/ajax/wpAjaxReplytoComment.php b/tests/phpunit/tests/ajax/wpAjaxReplytoComment.php
index 3700418b211e6..b67a7ba828439 100644
--- a/tests/phpunit/tests/ajax/wpAjaxReplytoComment.php
+++ b/tests/phpunit/tests/ajax/wpAjaxReplytoComment.php
@@ -98,7 +98,7 @@ public function test_as_admin() {
*/
public function test_as_subscriber() {
- // Become an administrator.
+ // Become a subscriber.
$this->_setRole( 'subscriber' );
// Get a comment.
From 515d3fe69fab163a68d4610715c036d100a9e53f Mon Sep 17 00:00:00 2001
From: Andrew Ozz
Date: Thu, 12 Jan 2023 23:23:01 +0000
Subject: [PATCH 0229/1431] Menus: Compare `$menu_item->ID` and
`$menu_item->menu_item_parent` as strings and avoid moidifying them. Plugins
may change the ID to a string.
Props Chouby, peterwilsoncc, Chrystl, manooweb, azaozz.
Fixes #57169.
git-svn-id: https://develop.svn.wordpress.org/trunk@55059 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/nav-menu-template.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
index 135d35e13024f..50ed2d481e53b 100644
--- a/src/wp-includes/nav-menu-template.php
+++ b/src/wp-includes/nav-menu-template.php
@@ -198,8 +198,12 @@ function wp_nav_menu( $args = array() ) {
$sorted_menu_items = array();
$menu_items_with_children = array();
foreach ( (array) $menu_items as $menu_item ) {
- // Fix invalid `menu_item_parent`. See: https://core.trac.wordpress.org/ticket/56926.
- if ( (int) $menu_item->ID === (int) $menu_item->menu_item_parent ) {
+ /*
+ * Fix invalid `menu_item_parent`. See: https://core.trac.wordpress.org/ticket/56926.
+ * Compare as strings. Plugins may change the ID to string.
+ * To avoid modifying the object, use `strval()` rather than casting to (string).
+ */
+ if ( strval( $menu_item->ID ) === strval( $menu_item->menu_item_parent ) ) {
$menu_item->menu_item_parent = 0;
}
From f8904ff48a4e24fd1c588dabbe79405636535e1e Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 13 Jan 2023 00:59:29 +0000
Subject: [PATCH 0230/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/file.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$case` parameter to `$filename` in `Tests_File::test_wp_tempnam()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55060 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/file.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/phpunit/tests/file.php b/tests/phpunit/tests/file.php
index 8e315e33aa5a0..79da981a2270f 100644
--- a/tests/phpunit/tests/file.php
+++ b/tests/phpunit/tests/file.php
@@ -188,8 +188,8 @@ public function test_unique_filename_no_ext() {
/**
* @dataProvider data_wp_tempnam_filenames
*/
- public function test_wp_tempnam( $case ) {
- $file = wp_tempnam( $case );
+ public function test_wp_tempnam( $filename ) {
+ $file = wp_tempnam( $filename );
unlink( $file );
$this->assertNotEmpty( basename( basename( $file, '.tmp' ), '.zip' ) );
From 9d48ae36c3a4e19e6a830749a0696593c61b4ebb Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Fri, 13 Jan 2023 13:17:45 +0000
Subject: [PATCH 0231/1431] Bundled Themes: Add Mastodon domains for menu item
icons.
This changeset adds the top 10 Mastodon domains by popularity to Twenty Twenty and Twenty Twenty-One Social icon feature.
Note: other Mastodon domains can be added to the array of domain mapping using `twentytwenty_social_icons_map` and `twenty_twenty_one_social_icons_map` filters.
Props triumvirate, sabernhardt, audrasjb, peterwilsoncc, rryyaanndd, ianbelanger.
Fixes #57293, #49099.
git-svn-id: https://develop.svn.wordpress.org/trunk@55061 602fd350-edb4-49c9-b593-d223f7449a82
---
.../classes/class-twentytwenty-svg-icons.php | 12 ++++++++++++
.../classes/class-twenty-twenty-one-svg-icons.php | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php
index 714b3a14542d2..0e576f0af6651 100644
--- a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php
+++ b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php
@@ -214,6 +214,18 @@ public static function get_social_link_svg( $uri ) {
'mail' => array(
'mailto:',
),
+ 'mastodon' => array(
+ 'mastodon.social',
+ 'pawoo.net',
+ 'mstdn.jp',
+ 'mastodon.cloud',
+ 'mastodon.online',
+ 'counter.social',
+ 'mstdn.social',
+ 'mas.to',
+ 'mastodon.world',
+ 'gc2.jp',
+ ),
'pocket' => array(
'getpocket.com',
),
diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php
index 3a82cf76ab4c4..d88aabc0944ac 100644
--- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php
+++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php
@@ -127,6 +127,18 @@ class Twenty_Twenty_One_SVG_Icons {
'mail' => array(
'mailto:',
),
+ 'mastodon' => array(
+ 'mastodon.social',
+ 'pawoo.net',
+ 'mstdn.jp',
+ 'mastodon.cloud',
+ 'mastodon.online',
+ 'counter.social',
+ 'mstdn.social',
+ 'mas.to',
+ 'mastodon.world',
+ 'gc2.jp',
+ ),
'pocket' => array(
'getpocket.com',
),
From 4912e0107dddbc34bdac71a1a7bc9f8e21335742 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 13 Jan 2023 13:57:18 +0000
Subject: [PATCH 0232/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/formatting/sanitizeTextField.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$string` parameter to `$str` in `Tests_Formatting_SanitizeTextField::test_sanitize_text_field()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55062 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/formatting/sanitizeTextField.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/phpunit/tests/formatting/sanitizeTextField.php b/tests/phpunit/tests/formatting/sanitizeTextField.php
index 240f38850b98d..ffee22535401a 100644
--- a/tests/phpunit/tests/formatting/sanitizeTextField.php
+++ b/tests/phpunit/tests/formatting/sanitizeTextField.php
@@ -131,7 +131,7 @@ public function data_sanitize_text_field() {
* @ticket 32257
* @dataProvider data_sanitize_text_field
*/
- public function test_sanitize_text_field( $string, $expected ) {
+ public function test_sanitize_text_field( $str, $expected ) {
if ( is_array( $expected ) ) {
$expected_oneline = $expected['oneline'];
$expected_multiline = $expected['multiline'];
@@ -139,8 +139,8 @@ public function test_sanitize_text_field( $string, $expected ) {
$expected_oneline = $expected;
$expected_multiline = $expected;
}
- $this->assertSame( $expected_oneline, sanitize_text_field( $string ) );
- $this->assertSameIgnoreEOL( $expected_multiline, sanitize_textarea_field( $string ) );
+ $this->assertSame( $expected_oneline, sanitize_text_field( $str ) );
+ $this->assertSameIgnoreEOL( $expected_multiline, sanitize_textarea_field( $str ) );
}
}
From 1c9f84f963ecc27b116e12ec32bdd61992fd045c Mon Sep 17 00:00:00 2001
From: John Blackbourn
Date: Fri, 13 Jan 2023 14:20:46 +0000
Subject: [PATCH 0233/1431] HTTP API: Correct the documentation for the
`https_ssl_verify` and `https_local_ssl_verify` filters.
The value for both these filters can also contain a string path to a CA file used to authenticate the identity of the remote server.
Props chesio, mcaskill
Fixes #54803
git-svn-id: https://develop.svn.wordpress.org/trunk@55063 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-http-streams.php | 5 +++--
src/wp-includes/class-wp-http.php | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/wp-includes/class-wp-http-streams.php b/src/wp-includes/class-wp-http-streams.php
index 48078cfafa5e4..b0dc302a39b79 100644
--- a/src/wp-includes/class-wp-http-streams.php
+++ b/src/wp-includes/class-wp-http-streams.php
@@ -101,8 +101,9 @@ public function request( $url, $args = array() ) {
* @since 2.8.0
* @since 5.1.0 The `$url` parameter was added.
*
- * @param bool $ssl_verify Whether to verify the SSL connection. Default true.
- * @param string $url The request URL.
+ * @param bool|string $ssl_verify Boolean to control whether to verify the SSL connection
+ * or path to an SSL certificate.
+ * @param string $url The request URL.
*/
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
} elseif ( ! $is_local ) {
diff --git a/src/wp-includes/class-wp-http.php b/src/wp-includes/class-wp-http.php
index 7edffe0e6bf0d..6f4fa47200ac7 100644
--- a/src/wp-includes/class-wp-http.php
+++ b/src/wp-includes/class-wp-http.php
@@ -371,8 +371,9 @@ public function request( $url, $args = array() ) {
* @since 2.8.0
* @since 5.1.0 The `$url` parameter was added.
*
- * @param bool $ssl_verify Whether to verify the SSL connection. Default true.
- * @param string $url The request URL.
+ * @param bool|string $ssl_verify Boolean to control whether to verify the SSL connection
+ * or path to an SSL certificate.
+ * @param string $url The request URL.
*/
$options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'], $url );
From f254a95e635aa4e2151277ec5d4ea3a0e15cdfd3 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 13 Jan 2023 14:36:11 +0000
Subject: [PATCH 0234/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/formatting/sanitizeTrackbackUrls.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$break` parameter to `$separator` in `Tests_Formatting_SanitizeTrackbackUrls::test_sanitize_trackback_urls_with_multiple_urls()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55064 602fd350-edb4-49c9-b593-d223f7449a82
---
.../tests/formatting/sanitizeTrackbackUrls.php | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/phpunit/tests/formatting/sanitizeTrackbackUrls.php b/tests/phpunit/tests/formatting/sanitizeTrackbackUrls.php
index 9e9c096a76ec5..f5a5404e93354 100644
--- a/tests/phpunit/tests/formatting/sanitizeTrackbackUrls.php
+++ b/tests/phpunit/tests/formatting/sanitizeTrackbackUrls.php
@@ -8,13 +8,16 @@
class Tests_Formatting_SanitizeTrackbackUrls extends WP_UnitTestCase {
/**
* @ticket 21624
- * @dataProvider breaks
+ * @dataProvider separators
*/
- public function test_sanitize_trackback_urls_with_multiple_urls( $break ) {
- $this->assertSame( "http://example.com\nhttp://example.org", sanitize_trackback_urls( "http://example.com{$break}http://example.org" ) );
+ public function test_sanitize_trackback_urls_with_multiple_urls( $separator ) {
+ $this->assertSame(
+ "http://example.com\nhttp://example.org",
+ sanitize_trackback_urls( "http://example.com{$separator}http://example.org" )
+ );
}
- public function breaks() {
+ public function separators() {
return array(
array( "\r\n\t " ),
array( "\r" ),
From be2f7bbfae6cb734c97b58fbf30fb4586c27e7e8 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Fri, 13 Jan 2023 22:11:04 +0000
Subject: [PATCH 0235/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/functions/deprecated.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$function` parameter to `$function_name` in `Tests_Functions_Deprecated::deprecated_function()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55065 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions/deprecated.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/phpunit/tests/functions/deprecated.php b/tests/phpunit/tests/functions/deprecated.php
index b1d4a9f6e7bc9..3d932011fbe71 100644
--- a/tests/phpunit/tests/functions/deprecated.php
+++ b/tests/phpunit/tests/functions/deprecated.php
@@ -66,13 +66,13 @@ public function tear_down() {
/**
* Catches functions that have passed through _deprecated_function().
*
- * @param string $function
+ * @param string $function_name
* @param string $replacement
* @param float $version
*/
- public function deprecated_function( $function, $replacement, $version ) {
+ public function deprecated_function( $function_name, $replacement, $version ) {
$this->_deprecated_functions[] = array(
- 'function' => $function,
+ 'function' => $function_name,
'replacement' => $replacement,
'version' => $version,
);
From c17a4760b7482f0859329fdf6e94f6c7d6c468f7 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sat, 14 Jan 2023 02:06:02 +0000
Subject: [PATCH 0236/1431] Tests: Move the test for `wp_save_image_file()`
with a GD resource to a more appropriate place.
When passed a GD resource as `$image`, `wp_save_image_file()` should throw a deprecated argument notice:
{{{
Function wp_save_image_file was called with an argument that is deprecated since version 3.5.0!
$image needs to be a WP_Image_Editor object.
}}}
The test verifies that the notice is thrown as expected.
Includes:
* Removing the `Tests_Functions_Deprecated` class. It appears to be initially intended for testing deprecated functions or arguments, but this was later superseded by the `@expectedDeprecated` annotation.
* Removing a redundant test for `wp_save_image_file()` **not** throwing a deprecation notice when passed a `WP_Image_Editor` instance. This is already covered by `test_wp_save_image_file()`, which would fail if there is an unexpected deprecation notice.
Follow-up to [1061/tests], [25408], [25409], [53529].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@55066 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions/deprecated.php | 185 -------------------
tests/phpunit/tests/image/functions.php | 23 +++
2 files changed, 23 insertions(+), 185 deletions(-)
delete mode 100644 tests/phpunit/tests/functions/deprecated.php
diff --git a/tests/phpunit/tests/functions/deprecated.php b/tests/phpunit/tests/functions/deprecated.php
deleted file mode 100644
index 3d932011fbe71..0000000000000
--- a/tests/phpunit/tests/functions/deprecated.php
+++ /dev/null
@@ -1,185 +0,0 @@
-_deprecated_functions = array();
- $this->_deprecated_arguments = array();
- $this->_deprecated_files = array();
- add_action( 'deprecated_function_run', array( $this, 'deprecated_function' ), 10, 3 );
- add_action( 'deprecated_function_trigger_error', '__return_false' );
- add_action( 'deprecated_argument_run', array( $this, 'deprecated_argument' ), 10, 3 );
- add_action( 'deprecated_argument_trigger_error', '__return_false' );
- add_action( 'deprecated_file_included', array( $this, 'deprecated_file' ), 10, 4 );
- add_action( 'deprecated_file_trigger_error', '__return_false' );
- }
-
- /**
- * Tears down the test fixture.
- */
- public function tear_down() {
- remove_action( 'deprecated_function_run', array( $this, 'deprecated_function' ), 10, 3 );
- remove_action( 'deprecated_function_trigger_error', '__return_false' );
- remove_action( 'deprecated_argument_run', array( $this, 'deprecated_argument' ), 10, 3 );
- remove_action( 'deprecated_argument_trigger_error', '__return_false' );
- remove_action( 'deprecated_file_included', array( $this, 'deprecated_argument' ), 10, 4 );
- remove_action( 'deprecated_file_trigger_error', '__return_false' );
- parent::tear_down();
- }
-
- /**
- * Catches functions that have passed through _deprecated_function().
- *
- * @param string $function_name
- * @param string $replacement
- * @param float $version
- */
- public function deprecated_function( $function_name, $replacement, $version ) {
- $this->_deprecated_functions[] = array(
- 'function' => $function_name,
- 'replacement' => $replacement,
- 'version' => $version,
- );
- }
-
- /**
- * Catches arguments that have passed through _deprecated_argument().
- *
- * @param string $argument
- * @param string $message
- * @param float $version
- */
- public function deprecated_argument( $argument, $message, $version ) {
- $this->_deprecated_arguments[] = array(
- 'argument' => $argument,
- 'message' => $message,
- 'version' => $version,
- );
- }
-
- /**
- * Catches arguments that have passed through _deprecated_argument().
- *
- * @param string $argument
- * @param string $message
- * @param float $version
- */
- public function deprecated_file( $file, $version, $replacement, $message ) {
- $this->_deprecated_files[] = array(
- 'file' => $file,
- 'version' => $version,
- 'replacement' => $replacement,
- 'message' => $message,
- );
- }
-
- /**
- * Checks if something was deprecated.
- *
- * @param string $type argument|function|file
- * @param string $name
- * @return array|false
- */
- protected function was_deprecated( $type, $name ) {
- switch ( $type ) {
- case 'argument':
- $search = $this->_deprecated_arguments;
- $key = 'argument';
- break;
- case 'function':
- $search = $this->_deprecated_functions;
- $key = 'function';
- break;
- default:
- $search = $this->_deprecated_files;
- $key = 'file';
- }
- foreach ( $search as $v ) {
- if ( $name === $v[ $key ] ) {
- return $v;
- }
- }
- return false;
- }
-
- /**
- * Tests that wp_save_image_file() has a deprecated argument when passed a GD resource.
- *
- * @ticket 6821
- * @expectedDeprecated wp_save_image_file
- * @requires function imagejpeg
- *
- * @covers ::wp_save_image_file
- */
- public function test_wp_save_image_file_deprecated_with_gd_resource() {
- // Call wp_save_image_file().
- require_once ABSPATH . 'wp-admin/includes/image-edit.php';
- $file = wp_tempnam();
- $img = imagecreatefromjpeg( DIR_TESTDATA . '/images/canola.jpg' );
- wp_save_image_file( $file, $img, 'image/jpeg', 1 );
- imagedestroy( $img );
- unlink( $file );
-
- // Check if the arg was deprecated.
- $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
- $this->assertNotEmpty( $check );
- }
-
- /**
- * Tests that wp_save_image_file() doesn't have a deprecated argument when passed a WP_Image_Editor.
- *
- * @ticket 6821
- * @requires function imagejpeg
- *
- * @covers ::wp_save_image_file
- */
- public function test_wp_save_image_file_not_deprecated_with_wp_image_editor() {
- // Call wp_save_image_file().
- require_once ABSPATH . 'wp-admin/includes/image-edit.php';
- $file = wp_tempnam();
- $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
- wp_save_image_file( $file, $img, 'image/jpeg', 1 );
- unset( $img );
- unlink( $file );
-
- // Check if the arg was deprecated.
- $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
- $this->assertFalse( $check );
- }
-}
diff --git a/tests/phpunit/tests/image/functions.php b/tests/phpunit/tests/image/functions.php
index 38ef2892a644e..7ed944b43938f 100644
--- a/tests/phpunit/tests/image/functions.php
+++ b/tests/phpunit/tests/image/functions.php
@@ -327,6 +327,29 @@ public function data_wp_save_image_file() {
return $data;
}
+ /**
+ * Tests that wp_save_image_file() throws a deprecated argument notice when passed a GD resource.
+ *
+ * @ticket 6821
+ * @expectedDeprecated wp_save_image_file
+ * @requires function imagejpeg
+ *
+ * @covers ::wp_save_image_file
+ */
+ public function test_wp_save_image_file_deprecated_argument_with_gd_resource() {
+ require_once ABSPATH . 'wp-admin/includes/image-edit.php';
+
+ // Call wp_save_image_file().
+ $file = wp_tempnam();
+ $img = imagecreatefromjpeg( DIR_TESTDATA . '/images/canola.jpg' );
+ $ret = wp_save_image_file( $file, $img, 'image/jpeg', 1 );
+
+ imagedestroy( $img );
+ unlink( $file );
+
+ $this->assertTrue( $ret, 'Image failed to save.' );
+ }
+
/**
* Tests that a passed mime type overrides the extension in the filename when saving an image.
*
From cb8713510330cba710f1c5bdca5fb7c18e182aa7 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sat, 14 Jan 2023 09:34:55 +0000
Subject: [PATCH 0237/1431] Themes: Add opt-in Appearance Tools support for
Classic Themes.
This changeset merges the following changes from Gutenberg repository:
- Allow themes without `theme.json` to opt-in to appearance tools via `add_theme_support( 'appearance-tools' );`
- Update `wpThemeJsonResolver` unit tests accordingly
See the following pull request for more info: https://github.com/WordPress/gutenberg/pull/43337
Props ironprogrammer, audrasjb.
Fixes #57460.
git-svn-id: https://develop.svn.wordpress.org/trunk@55067 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-theme-json-resolver.php | 5 +++++
tests/phpunit/tests/theme/wpThemeJsonResolver.php | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php
index b1f15897b1af5..e4afc3c1489d8 100644
--- a/src/wp-includes/class-wp-theme-json-resolver.php
+++ b/src/wp-includes/class-wp-theme-json-resolver.php
@@ -322,6 +322,11 @@ public static function get_theme_data( $deprecated = array(), $options = array()
// Classic themes without a theme.json don't support global duotone.
$theme_support_data['settings']['color']['defaultDuotone'] = false;
+
+ // Allow themes to enable appearance tools via theme_support.
+ if ( current_theme_supports( 'appearance-tools' ) ) {
+ $theme_support_data['settings']['appearanceTools'] = true;
+ }
}
$with_theme_supports = new WP_Theme_JSON( $theme_support_data );
$with_theme_supports->merge( static::$theme );
diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
index cd71b889e1c97..541699c686172 100644
--- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php
+++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
@@ -449,6 +449,9 @@ public function test_switching_themes_recalculates_data() {
/**
* @ticket 54336
+ * @ticket 56467
+ *
+ * @covers ::add_theme_support
*/
public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
switch_theme( 'default' );
@@ -471,15 +474,18 @@ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json
);
add_theme_support( 'editor-color-palette', $color_palette );
add_theme_support( 'custom-line-height' );
+ add_theme_support( 'appearance-tools' );
$settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
remove_theme_support( 'custom-line-height' );
remove_theme_support( 'editor-color-palette' );
+ remove_theme_support( 'appearance-tools' );
$this->assertFalse( WP_Theme_JSON_Resolver::theme_has_support() );
$this->assertTrue( $settings['typography']['lineHeight'] );
$this->assertSame( $color_palette, $settings['color']['palette']['theme'] );
+ $this->assertTrue( $settings['border']['color'], 'Support for appearance-tools was not added.' );
}
/**
From f434da3decf9208532b0f3e6e2ee7ea069597ffd Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sat, 14 Jan 2023 10:47:40 +0000
Subject: [PATCH 0238/1431] Embeds: Update Mixcloud oEmbed URL to the new
domain.
Replaces `https://www.mixcloud.com/oembed` with `https://app.mixcloud.com/oembed`.
Mixcloud plan to redirect old URLs to the new endpoint.
Props matclayton, peterwilsoncc, audrasjb, ayeshrajans.
Fixes #57376.
git-svn-id: https://develop.svn.wordpress.org/trunk@55068 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-wp-oembed.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/class-wp-oembed.php b/src/wp-includes/class-wp-oembed.php
index e177223435969..83eada58fe3d3 100644
--- a/src/wp-includes/class-wp-oembed.php
+++ b/src/wp-includes/class-wp-oembed.php
@@ -77,7 +77,7 @@ public function __construct() {
'#https?://(open|play)\.spotify\.com/.*#i' => array( 'https://embed.spotify.com/oembed/', true ),
'#https?://(.+\.)?imgur\.com/.*#i' => array( 'https://api.imgur.com/oembed', true ),
'#https?://(www\.)?issuu\.com/.+/docs/.+#i' => array( 'https://issuu.com/oembed_wp', true ),
- '#https?://(www\.)?mixcloud\.com/.*#i' => array( 'https://www.mixcloud.com/oembed', true ),
+ '#https?://(www\.)?mixcloud\.com/.*#i' => array( 'https://app.mixcloud.com/oembed', true ),
'#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'https://www.ted.com/services/v1/oembed.{format}', true ),
'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'https://animoto.com/oembeds/create', true ),
'#https?://(.+)\.tumblr\.com/.*#i' => array( 'https://www.tumblr.com/oembed/1.0', true ),
From b223ec07eda42d237b69bca3530e72af45d52ca0 Mon Sep 17 00:00:00 2001
From: John Blackbourn
Date: Sun, 15 Jan 2023 00:59:52 +0000
Subject: [PATCH 0239/1431] HTTP API: Correct the name of a filter referenced
in the docs for `wp_redirect()` and `wp_safe_redirect()`.
Props pbiron, audrasjb, SergeyBiryukov
Fixes #57464
git-svn-id: https://develop.svn.wordpress.org/trunk@55069 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/pluggable.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index 9ea90655841b7..c7decd1e8e1ad 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -1348,7 +1348,7 @@ function check_ajax_referer( $action = -1, $query_arg = false, $stop = true ) {
* exit;
*
* Exiting can also be selectively manipulated by using wp_redirect() as a conditional
- * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_location'} filters:
+ * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters:
*
* if ( wp_redirect( $url ) ) {
* exit;
@@ -1494,7 +1494,7 @@ function _wp_sanitize_utf8_in_redirect( $matches ) {
* exit;
*
* Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional
- * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_location'} filters:
+ * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters:
*
* if ( wp_safe_redirect( $url ) ) {
* exit;
From 3a63ed2939092ceeccbfd5733d009f1252eca1e6 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Sun, 15 Jan 2023 13:36:10 +0000
Subject: [PATCH 0240/1431] Tests: Use more specific assertions in image saving
tests.
When passed a `WP_Image_Editor` instance as the `$image` parameter, `wp_save_image_file()` returns an array on success, so we can specifically check for an array instead of any non-empty result.
Likewise, in PDF tests, when creating an attachment is expected to return an integer ID and not a `WP_Error` object, we can specifically check for that.
Follow-up to [1061/tests], [38949], [39617], [42792], [53529], [53530], [53531], [55019], [55066].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@55070 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/image/functions.php | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tests/phpunit/tests/image/functions.php b/tests/phpunit/tests/image/functions.php
index 7ed944b43938f..82988c5f6b64d 100644
--- a/tests/phpunit/tests/image/functions.php
+++ b/tests/phpunit/tests/image/functions.php
@@ -283,8 +283,8 @@ public function test_wp_save_image_file( $class_name, $mime_type ) {
$ret = wp_save_image_file( $file, $img, $mime_type, 1 );
// Make assertions.
- $this->assertNotEmpty( $ret, 'Image failed to save - "empty" response returned.' );
$this->assertNotWPError( $ret, 'Image failed to save - WP_Error returned.' );
+ $this->assertIsArray( $ret, 'Image failed to save - non-array response returned.' );
$this->assertSame( $mime_type, $this->get_mime_type( $ret['path'] ), 'Mime type of the saved image does not match.' );
// Clean up.
@@ -374,8 +374,8 @@ public function test_mime_overrides_filename_when_saving_an_image( $class_name )
$ret = $img->save( $file, $mime_type );
// Make assertions.
- $this->assertNotEmpty( $ret, 'Image failed to save - "empty" response returned.' );
$this->assertNotWPError( $ret, 'Image failed to save - WP_Error returned.' );
+ $this->assertIsArray( $ret, 'Image failed to save - non-array response returned.' );
$this->assertSame( $mime_type, $this->get_mime_type( $ret['path'] ), 'Mime type of the saved image did not override file name.' );
// Clean up.
@@ -420,8 +420,8 @@ public function test_inferred_mime_types_when_saving_an_image( $class_name, $ext
$ret = $img->save( trailingslashit( $temp ) . $file );
// Make assertions.
- $this->assertNotEmpty( $ret, 'Image failed to save - "empty" response returned.' );
$this->assertNotWPError( $ret, 'Image failed to save - WP Error returned.' );
+ $this->assertIsArray( $ret, 'Image failed to save - non-array response returned.' );
$this->assertSame( $mime_type, $this->get_mime_type( $ret['path'] ), 'Mime type of the saved image was not inferred correctly.' );
// Clean up.
@@ -679,7 +679,8 @@ public function test_wp_generate_attachment_metadata_pdf() {
)
);
- $this->assertNotEmpty( $attachment_id );
+ $this->assertNotWPError( $attachment_id, 'Could not create attachment - WP_Error returned.' );
+ $this->assertIsInt( $attachment_id, 'Could not create attachment - non-integer response returned.' );
$temp_dir = get_temp_dir();
@@ -756,7 +757,8 @@ public function test_crop_setting_for_pdf() {
)
);
- $this->assertNotEmpty( $attachment_id );
+ $this->assertNotWPError( $attachment_id, 'Could not create attachment - WP_Error returned.' );
+ $this->assertIsInt( $attachment_id, 'Could not create attachment - non-integer response returned.' );
$temp_dir = get_temp_dir();
@@ -829,7 +831,8 @@ public function test_fallback_intermediate_image_sizes() {
)
);
- $this->assertNotEmpty( $attachment_id );
+ $this->assertNotWPError( $attachment_id, 'Could not create attachment - WP_Error returned.' );
+ $this->assertIsInt( $attachment_id, 'Could not create attachment - non-integer response returned.' );
add_image_size( 'test-size', 100, 100 );
add_filter( 'fallback_intermediate_image_sizes', array( $this, 'filter_fallback_intermediate_image_sizes' ), 10, 2 );
From 124a4a9773d1513b3dd3c8c7e296c95eb2612025 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 15 Jan 2023 14:48:03 +0000
Subject: [PATCH 0241/1431] Docs: Improve `wp_style_add_data()` function
description.
This changeset removes an extra apostrophe in `wp_style_add_data()` DocBlock.
Props lanacodes, ashrafulsarkar, SergeyBiryukov.
Fixes #57466.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55071 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/functions.wp-styles.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/functions.wp-styles.php b/src/wp-includes/functions.wp-styles.php
index 1dba9311b0c87..8b7f4595c31b5 100644
--- a/src/wp-includes/functions.wp-styles.php
+++ b/src/wp-includes/functions.wp-styles.php
@@ -226,7 +226,7 @@ function wp_style_is( $handle, $status = 'enqueued' ) {
* 'alt' bool For rel="alternate stylesheet".
* 'title' string For preferred/alternate stylesheets.
* 'path' string The absolute path to a stylesheet. Stylesheet will
- * load inline when 'path'' is set.
+ * load inline when 'path' is set.
*
* @see WP_Dependencies::add_data()
*
From 61074b97e786ec71cddd74503f4807b7dcf4a8df Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 15 Jan 2023 14:55:19 +0000
Subject: [PATCH 0242/1431] Docs: Use third-person singular verbs for Script
Loader related function descriptions, as per docblocks standards.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55072 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/functions.wp-scripts.php | 14 +++++++-------
src/wp-includes/functions.wp-styles.php | 18 +++++++++---------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/wp-includes/functions.wp-scripts.php b/src/wp-includes/functions.wp-scripts.php
index 1bd4d28bf39b7..d6c8aaddd2ad5 100644
--- a/src/wp-includes/functions.wp-scripts.php
+++ b/src/wp-includes/functions.wp-scripts.php
@@ -9,7 +9,7 @@
*/
/**
- * Initialize $wp_scripts if it has not been set.
+ * Initializes $wp_scripts if it has not been set.
*
* @global WP_Scripts $wp_scripts
*
@@ -148,7 +148,7 @@ function wp_add_inline_script( $handle, $data, $position = 'after' ) {
}
/**
- * Register a new script.
+ * Registers a new script.
*
* Registers a script to be enqueued later using the wp_enqueue_script() function.
*
@@ -184,7 +184,7 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_f
}
/**
- * Localize a script.
+ * Localizes a script.
*
* Works only if the script has already been registered.
*
@@ -249,7 +249,7 @@ function wp_set_script_translations( $handle, $domain = 'default', $path = '' )
}
/**
- * Remove a registered script.
+ * Removes a registered script.
*
* Note: there are intentional safeguards in place to prevent critical admin scripts,
* such as jQuery core, from being unregistered.
@@ -322,7 +322,7 @@ function wp_deregister_script( $handle ) {
}
/**
- * Enqueue a script.
+ * Enqueues a script.
*
* Registers the script if $src provided (does NOT overwrite), and enqueues it.
*
@@ -364,7 +364,7 @@ function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $
}
/**
- * Remove a previously enqueued script.
+ * Removes a previously enqueued script.
*
* @see WP_Dependencies::dequeue()
*
@@ -400,7 +400,7 @@ function wp_script_is( $handle, $status = 'enqueued' ) {
}
/**
- * Add metadata to a script.
+ * Adds metadata to a script.
*
* Works only if the script has already been registered.
*
diff --git a/src/wp-includes/functions.wp-styles.php b/src/wp-includes/functions.wp-styles.php
index 8b7f4595c31b5..592bb41ade183 100644
--- a/src/wp-includes/functions.wp-styles.php
+++ b/src/wp-includes/functions.wp-styles.php
@@ -9,7 +9,7 @@
*/
/**
- * Initialize $wp_styles if it has not been set.
+ * Initializes $wp_styles if it has not been set.
*
* @global WP_Styles $wp_styles
*
@@ -28,7 +28,7 @@ function wp_styles() {
}
/**
- * Display styles that are in the $handles queue.
+ * Displays styles that are in the $handles queue.
*
* Passing an empty array to $handles prints the queue,
* passing an array with one string prints that style,
@@ -69,7 +69,7 @@ function wp_print_styles( $handles = false ) {
}
/**
- * Add extra CSS styles to a registered stylesheet.
+ * Adds extra CSS styles to a registered stylesheet.
*
* Styles will only be added if the stylesheet is already in the queue.
* Accepts a string $data containing the CSS. If two or more CSS code blocks
@@ -105,7 +105,7 @@ function wp_add_inline_style( $handle, $data ) {
}
/**
- * Register a CSS stylesheet.
+ * Registers a CSS stylesheet.
*
* @see WP_Dependencies::add()
* @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
@@ -133,7 +133,7 @@ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media
}
/**
- * Remove a registered stylesheet.
+ * Removes a registered stylesheet.
*
* @see WP_Dependencies::remove()
*
@@ -148,7 +148,7 @@ function wp_deregister_style( $handle ) {
}
/**
- * Enqueue a CSS stylesheet.
+ * Enqueues a CSS stylesheet.
*
* Registers the style if source provided (does NOT overwrite) and enqueues.
*
@@ -184,7 +184,7 @@ function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $m
}
/**
- * Remove a previously enqueued CSS stylesheet.
+ * Removes a previously enqueued CSS stylesheet.
*
* @see WP_Dependencies::dequeue()
*
@@ -199,7 +199,7 @@ function wp_dequeue_style( $handle ) {
}
/**
- * Check whether a CSS stylesheet has been added to the queue.
+ * Checks whether a CSS stylesheet has been added to the queue.
*
* @since 2.8.0
*
@@ -215,7 +215,7 @@ function wp_style_is( $handle, $status = 'enqueued' ) {
}
/**
- * Add metadata to a CSS stylesheet.
+ * Adds metadata to a CSS stylesheet.
*
* Works only if the stylesheet has already been registered.
*
From 682c579436aebbc1ff7fa5454150aa9d25653849 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 15 Jan 2023 15:22:04 +0000
Subject: [PATCH 0243/1431] Docs: Typo correction in POP3 class `send_cmd()`
inline docs.
Props nitman43, manojkpatil, kebbet.
Fixes #57449.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55073 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/class-pop3.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/class-pop3.php b/src/wp-includes/class-pop3.php
index 767b74391298e..2fa60110e255f 100644
--- a/src/wp-includes/class-pop3.php
+++ b/src/wp-includes/class-pop3.php
@@ -443,7 +443,7 @@ function send_cmd ( $cmd = "" )
// Sends a user defined command string to the
// POP server and returns the results. Useful for
// non-compliant or custom POP servers.
- // Do NOT includ the \r\n as part of your command
+ // Do NOT include the \r\n as part of your command
// string - it will be appended automatically.
// The return value is a standard fgets() call, which
From 253b2db06b9e3633005305c132ea51f673a61276 Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 15 Jan 2023 17:16:02 +0000
Subject: [PATCH 0244/1431] Docs: Add a missing quote to
`wp_is_large_network()` Docblock params.
Props lanacodes.
Fixes #57468.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55074 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/ms-functions.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index 7cc82166132a6..6c757ac197e7f 100644
--- a/src/wp-includes/ms-functions.php
+++ b/src/wp-includes/ms-functions.php
@@ -2636,7 +2636,7 @@ function upload_size_limit_filter( $size ) {
* @since 3.3.0
* @since 4.8.0 The `$network_id` parameter has been added.
*
- * @param string $using 'sites or 'users'. Default is 'sites'.
+ * @param string $using 'sites' or 'users'. Default is 'sites'.
* @param int|null $network_id ID of the network. Default is the current network.
* @return bool True if the network meets the criteria for large. False otherwise.
*/
From 78f6ac9c29eedd528d5748ee99613b715ac94e9c Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Sun, 15 Jan 2023 17:50:13 +0000
Subject: [PATCH 0245/1431] Docs: Various docblock fixes in Multisite WordPress
API related functions.
Follow-up to [55074].
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55075 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/ms-functions.php | 38 ++++++++++++++++----------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index 6c757ac197e7f..6c1b9eb815060 100644
--- a/src/wp-includes/ms-functions.php
+++ b/src/wp-includes/ms-functions.php
@@ -145,7 +145,7 @@ function get_blog_post( $blog_id, $post_id ) {
*
* @param int $blog_id ID of the blog the user is being added to.
* @param int $user_id ID of the user being added.
- * @param string $role The role you want the user to have.
+ * @param string $role User role.
* @return true|WP_Error True on success or a WP_Error object if the user doesn't exist
* or could not be added.
*/
@@ -307,7 +307,7 @@ function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
*
* @param int $blog_id ID of the source blog.
* @param int $post_id ID of the desired post.
- * @return string The post's permalink
+ * @return string The post's permalink.
*/
function get_blog_permalink( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
@@ -329,9 +329,9 @@ function get_blog_permalink( $blog_id, $post_id ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $domain
+ * @param string $domain Website domain.
* @param string $path Optional. Not required for subdomain installations.
- * @return int 0 if no blog found, otherwise the ID of the matching blog
+ * @return int 0 if no blog found, otherwise the ID of the matching blog.
*/
function get_blog_id_from_url( $domain, $path = '/' ) {
$domain = strtolower( $domain );
@@ -913,7 +913,7 @@ function wpmu_signup_user( $user, $user_email, $meta = array() ) {
* @param string $title The site title.
* @param string $user_login The user's login name.
* @param string $user_email The user's email address.
- * @param string $key The activation key created in wpmu_signup_blog()
+ * @param string $key The activation key created in wpmu_signup_blog().
* @param array $meta Optional. Signup meta data. By default, contains the requested privacy setting and lang_id.
* @return bool
*/
@@ -1152,7 +1152,7 @@ function wpmu_signup_user_notification( $user_login, $user_email, $key, $meta =
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $key The activation key provided to the user.
- * @return array|WP_Error An array containing information about the activated user and/or blog
+ * @return array|WP_Error An array containing information about the activated user and/or blog.
*/
function wpmu_activate_signup( $key ) {
global $wpdb;
@@ -1304,7 +1304,7 @@ function wp_delete_signup_on_user_delete( $id, $reassign, $user ) {
* @param string $user_name The new user's login name.
* @param string $password The new user's password.
* @param string $email The new user's email address.
- * @return int|false Returns false on failure, or int $user_id on success
+ * @return int|false Returns false on failure, or int $user_id on success.
*/
function wpmu_create_user( $user_name, $password, $email ) {
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
@@ -1908,9 +1908,9 @@ function wpmu_welcome_user_notification( $user_id, $password, $meta = array() )
*
* @since MU (3.0.0)
*
- * @global WP_Network $current_site
+ * @global WP_Network $current_site The current network.
*
- * @return WP_Network
+ * @return WP_Network The current network.
*/
function get_current_site() {
global $current_site;
@@ -1927,8 +1927,8 @@ function get_current_site() {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param int $user_id
- * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts
+ * @param int $user_id User ID.
+ * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts.
*/
function get_most_recent_post_of_user( $user_id ) {
global $wpdb;
@@ -2075,7 +2075,7 @@ function redirect_this_site( $deprecated = '' ) {
*
* @blessed
*
- * @param array $upload
+ * @param array $upload An array of information about the newly-uploaded file.
* @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
*/
function upload_is_file_too_big( $upload ) {
@@ -2262,7 +2262,7 @@ function add_new_user_to_blog( $user_id, $password, $meta ) {
}
/**
- * Corrects From host on outgoing mail to match the site domain
+ * Corrects From host on outgoing mail to match the site domain.
*
* @since MU (3.0.0)
*
@@ -2300,8 +2300,8 @@ function is_user_spammy( $user = null ) {
*
* @since MU (3.0.0)
*
- * @param int $old_value
- * @param int $value The new public value
+ * @param int $old_value The old public value.
+ * @param int $value The new public value.
*/
function update_blog_public( $old_value, $value ) {
update_blog_status( get_current_blog_id(), 'public', (int) $value );
@@ -2378,8 +2378,8 @@ function force_ssl_content( $force = '' ) {
*
* @since 2.8.5
*
- * @param string $url URL
- * @return string URL with https as the scheme
+ * @param string $url URL.
+ * @return string URL with https as the scheme.
*/
function filter_SSL( $url ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
if ( ! is_string( $url ) ) {
@@ -2545,7 +2545,7 @@ function get_space_used() {
*
* @since MU (3.0.0)
*
- * @return int Quota in megabytes
+ * @return int Quota in megabytes.
*/
function get_space_allowed() {
$space_allowed = get_option( 'blog_upload_space' );
@@ -2573,7 +2573,7 @@ function get_space_allowed() {
*
* @since 3.0.0
*
- * @return int of upload space available in bytes
+ * @return int of upload space available in bytes.
*/
function get_upload_space_available() {
$allowed = get_space_allowed();
From 9a309c3609244e9e3fcdb080edf0851797db3131 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 16 Jan 2023 16:16:48 +0000
Subject: [PATCH 0246/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/functions/wpListFilter.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$list` parameter to `$input_list` in `Tests_Functions_wpListFilter::test_wp_list_filter()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55076 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions/wpListFilter.php | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/phpunit/tests/functions/wpListFilter.php b/tests/phpunit/tests/functions/wpListFilter.php
index 45ea4f9601f6e..7b7f54d2d9105 100644
--- a/tests/phpunit/tests/functions/wpListFilter.php
+++ b/tests/phpunit/tests/functions/wpListFilter.php
@@ -11,14 +11,14 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase {
/**
* @dataProvider data_test_wp_list_filter
*
- * @param array $list An array of objects to filter.
- * @param array $args An array of key => value arguments to match
- * against each object.
- * @param string $operator The logical operation to perform.
- * @param array $expected Expected result.
+ * @param array $input_list An array of objects to filter.
+ * @param array $args An array of key => value arguments to match
+ * against each object.
+ * @param string $operator The logical operation to perform.
+ * @param array $expected Expected result.
*/
- public function test_wp_list_filter( $list, $args, $operator, $expected ) {
- $this->assertEqualSetsWithIndex( $expected, wp_list_filter( $list, $args, $operator ) );
+ public function test_wp_list_filter( $input_list, $args, $operator, $expected ) {
+ $this->assertEqualSetsWithIndex( $expected, wp_list_filter( $input_list, $args, $operator ) );
}
public function data_test_wp_list_filter() {
From f7bb05ab970ce0c9d5b7aba4880554166f35be10 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 16 Jan 2023 16:19:54 +0000
Subject: [PATCH 0247/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/functions/wpListPluck.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$list` parameter to `$input_list` in `Tests_Functions_wpListPluck::test_wp_list_pluck()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55077 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions/wpListPluck.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/phpunit/tests/functions/wpListPluck.php b/tests/phpunit/tests/functions/wpListPluck.php
index 10c78ed9bd3ff..63b66670c9890 100644
--- a/tests/phpunit/tests/functions/wpListPluck.php
+++ b/tests/phpunit/tests/functions/wpListPluck.php
@@ -195,13 +195,13 @@ public function test_wp_list_pluck_containing_references_keys() {
/**
* @dataProvider data_test_wp_list_pluck
*
- * @param array $list List of objects or arrays.
- * @param int|string $field Field from the object to place instead of the entire object
- * @param int|string $index_key Field from the object to use as keys for the new array.
- * @param array $expected Expected result.
+ * @param array $input_list List of objects or arrays.
+ * @param int|string $field Field from the object to place instead of the entire object
+ * @param int|string $index_key Field from the object to use as keys for the new array.
+ * @param array $expected Expected result.
*/
- public function test_wp_list_pluck( $list, $field, $index_key, $expected ) {
- $this->assertSameSetsWithIndex( $expected, wp_list_pluck( $list, $field, $index_key ) );
+ public function test_wp_list_pluck( $input_list, $field, $index_key, $expected ) {
+ $this->assertSameSetsWithIndex( $expected, wp_list_pluck( $input_list, $field, $index_key ) );
}
public function data_test_wp_list_pluck() {
From f438c0bff6674eed40a8300dc8145386e9016a5b Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 16 Jan 2023 16:24:45 +0000
Subject: [PATCH 0248/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/functions/wpListSort.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$list` parameter to `$input_list` in:
* `Tests_Functions_wpListSort::test_wp_list_sort()`
* `Tests_Functions_wpListSort::test_wp_list_sort_preserve_keys()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55078 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/functions/wpListSort.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/phpunit/tests/functions/wpListSort.php b/tests/phpunit/tests/functions/wpListSort.php
index e493cd23219b5..a77354d70ee82 100644
--- a/tests/phpunit/tests/functions/wpListSort.php
+++ b/tests/phpunit/tests/functions/wpListSort.php
@@ -15,8 +15,8 @@ class Tests_Functions_wpListSort extends WP_UnitTestCase {
* of multiple orderby fields as `$orderby => $order`.
* @param string $order Either 'ASC' or 'DESC'.
*/
- public function test_wp_list_sort( $list, $orderby, $order, $expected ) {
- $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order ) );
+ public function test_wp_list_sort( $input_list, $orderby, $order, $expected ) {
+ $this->assertSame( $expected, wp_list_sort( $input_list, $orderby, $order ) );
}
public function data_test_wp_list_sort() {
@@ -340,8 +340,8 @@ public function data_test_wp_list_sort() {
* of multiple orderby fields as `$orderby => $order`.
* @param string $order Either 'ASC' or 'DESC'.
*/
- public function test_wp_list_sort_preserve_keys( $list, $orderby, $order, $expected ) {
- $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order, true ) );
+ public function test_wp_list_sort_preserve_keys( $input_list, $orderby, $order, $expected ) {
+ $this->assertSame( $expected, wp_list_sort( $input_list, $orderby, $order, true ) );
}
public function data_test_wp_list_sort_preserve_keys() {
From 659694d2c6d5a5a3d47952454112a0168a1d2a02 Mon Sep 17 00:00:00 2001
From: Felix Arntz
Date: Mon, 16 Jan 2023 19:57:29 +0000
Subject: [PATCH 0249/1431] Editor: Update packages to unblock lazy-loading
issues.
Fixing the issue that featured images are always lazy-loaded in block themes required an upstream Gutenberg change https://github.com/WordPress/gutenberg/pull/45534. This changeset updates packages in order to unblock the remainder of the fix in `trunk`.
Props mamaduka.
See #56930.
git-svn-id: https://develop.svn.wordpress.org/trunk@55079 602fd350-edb4-49c9-b593-d223f7449a82
---
package-lock.json | 46 +++++++++----------
package.json | 12 ++---
.../blocks/post-featured-image.php | 6 +++
3 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index e99f973612300..f2adec4747775 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4021,9 +4021,9 @@
}
},
"@wordpress/block-directory": {
- "version": "3.15.11",
- "resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.15.11.tgz",
- "integrity": "sha512-KiQrYfxkiLrrQJgRaw1C32a9vXbNEZorEd0KuEVRZs4LYtNOKj/Je1low4Tvj77lh870Q38SiOCMWgtqtRtRJA==",
+ "version": "3.15.12",
+ "resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.15.12.tgz",
+ "integrity": "sha512-pcrjkDFRehae4Q9ZwYa7dXHwSaGgJl5iDHDavNIEdNeH3xFZi3KzWvumwSWtUWqM19W8EiekTR0T2qQytnKKvw==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
@@ -4034,7 +4034,7 @@
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
- "@wordpress/edit-post": "^6.14.11",
+ "@wordpress/edit-post": "^6.14.12",
"@wordpress/editor": "^12.16.10",
"@wordpress/element": "^4.15.1",
"@wordpress/hooks": "^3.17.1",
@@ -4095,9 +4095,9 @@
}
},
"@wordpress/block-library": {
- "version": "7.14.11",
- "resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-7.14.11.tgz",
- "integrity": "sha512-BiLDYp1snS+FCzNWJJEjMxNjKlhLTRQgKzNUwiK/UIQr/5Drif6GNPsNOiFs3ha5kKZli7l4CyFHiZE99PNiJA==",
+ "version": "7.14.12",
+ "resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-7.14.12.tgz",
+ "integrity": "sha512-iw3ndfgsbMTf7RMhXumH3Fsj40va73u/EdiE9E9I+EXO72YU/deEMt0BImkfZrnp4AF21ji4zFItLUBt+b/GMQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
@@ -4300,13 +4300,13 @@
}
},
"@wordpress/customize-widgets": {
- "version": "3.14.11",
- "resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-3.14.11.tgz",
- "integrity": "sha512-aJ/++NFDjirmTF0zAbOzfKSeX+6sMK0vjv07Pjis4gztRJ4P+lfYaj/aUCjQz/OhJwaw1jyQNx3FxcbS3L/iLg==",
+ "version": "3.14.12",
+ "resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-3.14.12.tgz",
+ "integrity": "sha512-s5zZzkg5gZnunwS1ZOHXrCnxIUl1CpYdiEX5vVYZT5UpbvLtk5HiOAsoXtAZoIJfIKKPjNPugFTHSi8VL3vWZw==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/block-editor": "^10.0.10",
- "@wordpress/block-library": "^7.14.11",
+ "@wordpress/block-library": "^7.14.12",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
@@ -4451,15 +4451,15 @@
}
},
"@wordpress/edit-post": {
- "version": "6.14.11",
- "resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-6.14.11.tgz",
- "integrity": "sha512-ZqNPUlCRBRd4rUYExTVDmaIX/J0yAwaZybtcfSWPacrNnq40xrv16wrLFNZAFn5oCTrKAkuTWWjsjuQhEbw8yg==",
+ "version": "6.14.12",
+ "resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-6.14.12.tgz",
+ "integrity": "sha512-8m2TTf0nJTodmhX9Fv32HtP72r8vqfyoBVYVgfYIpOubquMESZpQnbrwmMksthE9wKrcKm/B3/J3SdxX03Cw6Q==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/block-editor": "^10.0.10",
- "@wordpress/block-library": "^7.14.11",
+ "@wordpress/block-library": "^7.14.12",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
@@ -4488,15 +4488,15 @@
}
},
"@wordpress/edit-site": {
- "version": "4.14.13",
- "resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-4.14.13.tgz",
- "integrity": "sha512-A5mmwIOSVgiJ1QoCHfnO+ehECoI4gW/g0/GDCpvxbEiHLhexKh3aNDwsy2izO990IoAd1h55hYPYAUBxNX8a+w==",
+ "version": "4.14.14",
+ "resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-4.14.14.tgz",
+ "integrity": "sha512-gmkteOtJcxBdC6sAaRUQiJCFaLBKydsagYtSEQQ5EX6BDRnphns8Euurm8/UVqMSZetMFYxwXd1o7PdwIt3WeQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/block-editor": "^10.0.10",
- "@wordpress/block-library": "^7.14.11",
+ "@wordpress/block-library": "^7.14.12",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
@@ -4529,14 +4529,14 @@
}
},
"@wordpress/edit-widgets": {
- "version": "4.14.11",
- "resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-4.14.11.tgz",
- "integrity": "sha512-5nb583zlv/YZCbIfEkV7gTk+UddZNDGr1C4B/7EWAjNhQAg3/dv3eqD0N/WYTYLxBAUI3O2heO0i85/AiGqUKg==",
+ "version": "4.14.12",
+ "resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-4.14.12.tgz",
+ "integrity": "sha512-a0+2oyG9qgFMk9Omhz7x2A1SKmUg7yanM3MBBljtTfhl5Ipt6uqal/lGiIaiGeAamTKh45g6j7mpGmwx2mTSFQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/block-editor": "^10.0.10",
- "@wordpress/block-library": "^7.14.11",
+ "@wordpress/block-library": "^7.14.12",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
diff --git a/package.json b/package.json
index c81dd3c6b9a0f..73258d249cf11 100644
--- a/package.json
+++ b/package.json
@@ -81,24 +81,24 @@
"@wordpress/api-fetch": "6.14.1",
"@wordpress/autop": "3.17.1",
"@wordpress/blob": "3.17.1",
- "@wordpress/block-directory": "3.15.11",
+ "@wordpress/block-directory": "3.15.12",
"@wordpress/block-editor": "10.0.10",
- "@wordpress/block-library": "7.14.11",
+ "@wordpress/block-library": "7.14.12",
"@wordpress/block-serialization-default-parser": "4.17.1",
"@wordpress/blocks": "11.16.4",
"@wordpress/components": "21.0.7",
"@wordpress/compose": "5.15.2",
"@wordpress/core-data": "5.0.4",
- "@wordpress/customize-widgets": "3.14.11",
+ "@wordpress/customize-widgets": "3.14.12",
"@wordpress/data": "7.1.3",
"@wordpress/data-controls": "2.17.3",
"@wordpress/date": "4.17.1",
"@wordpress/deprecated": "3.17.1",
"@wordpress/dom": "3.17.2",
"@wordpress/dom-ready": "3.17.1",
- "@wordpress/edit-post": "6.14.11",
- "@wordpress/edit-site": "4.14.13",
- "@wordpress/edit-widgets": "4.14.11",
+ "@wordpress/edit-post": "6.14.12",
+ "@wordpress/edit-site": "4.14.14",
+ "@wordpress/edit-widgets": "4.14.12",
"@wordpress/editor": "12.16.10",
"@wordpress/element": "4.15.1",
"@wordpress/escape-html": "2.17.1",
diff --git a/src/wp-includes/blocks/post-featured-image.php b/src/wp-includes/blocks/post-featured-image.php
index 40a7f41cd78ac..068b7eeac6899 100644
--- a/src/wp-includes/blocks/post-featured-image.php
+++ b/src/wp-includes/blocks/post-featured-image.php
@@ -19,6 +19,12 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
}
$post_ID = $block->context['postId'];
+ // Check is needed for backward compatibility with third-party plugins
+ // that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
+ if ( ! in_the_loop() && have_posts() ) {
+ the_post();
+ }
+
$is_link = isset( $attributes['isLink'] ) && $attributes['isLink'];
$size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail';
$post_title = trim( strip_tags( get_the_title( $post_ID ) ) );
From d9ec8536f7961ca066dc54c39e53fd41cbc5ecab Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Mon, 16 Jan 2023 20:37:19 +0000
Subject: [PATCH 0250/1431] Docs: Remove unused `post_modified` and
`post_modified_gmt` params from `wp_insert_post()` docblock.
Props dshanske, mehulkaklotar.
Fixes #57473.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55080 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-includes/post.php | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 0bf6c52654813..7e3f47aba1e92 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -4014,10 +4014,6 @@ function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
* Default empty.
* @type string $pinged Space or carriage return-separated list of URLs that have
* been pinged. Default empty.
- * @type string $post_modified The date when the post was last modified. Default is
- * the current time.
- * @type string $post_modified_gmt The date when the post was last modified in the GMT
- * timezone. Default is the current time.
* @type int $post_parent Set this for the post it belongs to, if any. Default 0.
* @type int $menu_order The order the post should be displayed in. Default 0.
* @type string $post_mime_type The mime type of the post. Default empty.
From e8eda98db9598517a56ee6b58673a741e9c32c41 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Tue, 17 Jan 2023 14:05:38 +0000
Subject: [PATCH 0251/1431] Code Modernization: Rename parameters that use
reserved keywords in `phpunit/tests/hooks/addFilter.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$string` parameter to `$value` in:
* `Tests_Hooks_AddFilter::_filter_remove_and_add1()`
* `Tests_Hooks_AddFilter::_filter_remove_and_add2()`
* `Tests_Hooks_AddFilter::_filter_remove_and_recurse_and_add2()`
* `Tests_Hooks_AddFilter::_filter_remove_and_add3()`
* `Tests_Hooks_AddFilter::_filter_remove_and_add4()`
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55081 602fd350-edb4-49c9-b593-d223f7449a82
---
tests/phpunit/tests/hooks/addFilter.php | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/tests/phpunit/tests/hooks/addFilter.php b/tests/phpunit/tests/hooks/addFilter.php
index afa526b4848dd..df4db364c5877 100644
--- a/tests/phpunit/tests/hooks/addFilter.php
+++ b/tests/phpunit/tests/hooks/addFilter.php
@@ -1,6 +1,5 @@
assertSame( '1-134-234', $value );
}
- public function _filter_remove_and_add1( $string ) {
- return $string . '1';
+ public function _filter_remove_and_add1( $value ) {
+ return $value . '1';
}
- public function _filter_remove_and_add2( $string ) {
+ public function _filter_remove_and_add2( $value ) {
$this->hook->remove_filter( 'remove_and_add', array( $this, '_filter_remove_and_add2' ), 11 );
$this->hook->add_filter( 'remove_and_add', array( $this, '_filter_remove_and_add2' ), 11, 1 );
- return $string . '2';
+ return $value . '2';
}
- public function _filter_remove_and_recurse_and_add2( $string ) {
+ public function _filter_remove_and_recurse_and_add2( $value ) {
$this->hook->remove_filter( 'remove_and_add', array( $this, '_filter_remove_and_recurse_and_add2' ), 11 );
- $string .= '-' . $this->hook->apply_filters( '', array() ) . '-';
+ $value .= '-' . $this->hook->apply_filters( '', array() ) . '-';
$this->hook->add_filter( 'remove_and_add', array( $this, '_filter_remove_and_recurse_and_add2' ), 11, 1 );
- return $string . '2';
+ return $value . '2';
}
- public function _filter_remove_and_add3( $string ) {
- return $string . '3';
+ public function _filter_remove_and_add3( $value ) {
+ return $value . '3';
}
- public function _filter_remove_and_add4( $string ) {
- return $string . '4';
+ public function _filter_remove_and_add4( $value ) {
+ return $value . '4';
}
public function test_remove_and_add_action() {
From 7f788f38c8a8a53880730250ea1bd0df2f327d9e Mon Sep 17 00:00:00 2001
From: Jb Audras
Date: Tue, 17 Jan 2023 21:32:42 +0000
Subject: [PATCH 0252/1431] Administration: Use a consistent capitalization in
Privacy Policy related strings.
This changeset fixes a few use case:
- When referring to the Privacy Policy page, "Privacy Policy" should use capitalization on "Privacy Policy", but "page" should remain lowercase;
- When referring to the fact that a website needs, let's say "a relevant privacy policy", "privacy policy" should stay lowercase.
This changeset also updates other small capitalization issues.
Props aravindajith, audrasjb, sarathar, nithi22, costdev.
Fixes #57226.
git-svn-id: https://develop.svn.wordpress.org/trunk@55082 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/options-privacy.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/wp-admin/options-privacy.php b/src/wp-admin/options-privacy.php
index 008ea30fcf7e9..8f2f6d6e36985 100644
--- a/src/wp-admin/options-privacy.php
+++ b/src/wp-admin/options-privacy.php
@@ -181,16 +181,16 @@ static function( $body_class ) {
-
+
-
-
+
+
-
+
Check out our Privacy Policy guide%3$s for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
+ __( 'Need help putting together your new Privacy Policy page? Check out our privacy policy guide%3$s for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ),
'',
''
@@ -253,7 +253,7 @@ static function( $body_class ) {