Commit Graph

33723 Commits

Author SHA1 Message Date
Sergey Biryukov
16a24b396e Build/Test Tools: Call wpTearDownAfterClass() before deleting all data, instead of after.
As of [35186] and [51568], there are two sets of methods used for setup/teardown in the test suite before and after a test class is run:

* `set_up_before_class()` / `tear_down_after_class()`
* `wpSetUpBeforeClass()` / `wpTearDownAfterClass()`. (Note the `wp` prefix, these are WordPress' own methods and are not the same as the native PHPUnit `setUpBeforeClass()` / `tearDownAfterClass()` methods.)

The main difference is that `wpSetUpBeforeClass()` receives the `$factory` argument for ease of use, and both `wpSetUpBeforeClass()` and `wpTearDownAfterClass()` don't need to call `self::commit_transaction()`.

Many tests use the `wpTearDownAfterClass()` method to clean up posts, users, roles, etc. created via `wpSetUpBeforeClass()`. However, due to [source:tags/6.0/tests/phpunit/includes/abstract-testcase.php?marks=88-95#L82 how the method was previously called], this cleanup happened after all data is **already deleted** from the database.

This could cause some confusion when refactoring tests. For example:
{{{
public static function wpTearDownAfterClass() {
	$GLOBALS['_wp_additional_image_sizes'] = self::$_sizes;
}

public static function tear_down_after_class() {
	wp_delete_attachment( self::$large_id, true );
	parent::tear_down_after_class();
}
}}}

At a glance, it seems like these two methods can be combined:
{{{
public static function wpTearDownAfterClass() {
	wp_delete_attachment( self::$large_id, true );

	$GLOBALS['_wp_additional_image_sizes'] = self::$_sizes;
}
}}}
However, that would not work as expected: by the time `wp_delete_attachment()` runs, the attachment ID is no longer in the database, so it returns early, leaving some files in the `uploads` directory.

By calling `wpTearDownAfterClass()` in `WP_UnitTestCase_Base::tear_down_after_class()` before deleting all data, instead of after, we ensure that both of these methods have access to the same data and can be used interchangeably to perform cleanup as necessary.

Additionally, this commit moves the calls to parent methods in `WP_UnitTestCase_Base`:

* `parent::set_up_before_class()` to be the first thing called in `::set_up_before_class()`
* `parent::tear_down_after_class()` to be the last thing called in `::tear_down_after_class()`

This does not have any effect in practice, but brings consistency with how these methods are called in the test suite.

Follow-up to [35186], [35225], [35242], [38398], [39626], [49001], [51568].

Props ironprogrammer, SergeyBiryukov.
Fixes #55918. See #55652.
Built from https://develop.svn.wordpress.org/trunk@54366


git-svn-id: http://core.svn.wordpress.org/trunk@53925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-02 15:13:13 +00:00
Sergey Biryukov
4517e90af4 Tests: Ensure prerequisites are met for draft length tests in Tests_L10n.
These three tests for `wp_dashboard_recent_drafts()` would run into a PHP 8.1 "passing null to non-nullable" deprecation for the call to `ltrim()` when the result of `get_edit_post_link()` is passed to `esc_url()`.

Setting a deprecation expectation would not solve this as the returned value would still not match the expected value(s).

The recent drafts list is only displayed on the Dashboard screen for users with the `edit_posts` capability. By setting the current user to Editor, the prerequisites for `wp_dashboard_recent_drafts()` are met, which means the deprecation notice is avoided and the assertions will succeed.

This commit addresses a few errors in the test suite along the lines of:
{{{
1) Tests_L10n::test_length_of_draft_should_be_counted_by_words
ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

/var/www/src/wp-includes/formatting.php:4376
/var/www/src/wp-admin/includes/dashboard.php:657
/var/www/tests/phpunit/tests/l10n.php:449
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [45505], [52253], [52259].

Props jrf, desrosj, SergeyBiryukov.
See #56681, #55652, #55656.
Built from https://develop.svn.wordpress.org/trunk@54365


git-svn-id: http://core.svn.wordpress.org/trunk@53924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-01 15:49:09 +00:00
Sergey Biryukov
446d463a19 Code Modernization: Check the return type of parse_url() in url_to_postid().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

In this case, `parse_url()` is called with `PHP_URL_HOST` as `$component`, which returns `null` if the URL only has a path. The return value of `parse_url()` was then passed to `str_replace()`, leading to a notice on PHP 8.1:
{{{
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}

Adding validation for the return type value of `parse_url()` prevents that.

This commit addresses a few errors in the test suite along the lines of:
{{{
5) Tests_Rewrite::test_url_to_postid_home_has_path
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

/var/www/src/wp-includes/rewrite.php:503
/var/www/tests/phpunit/tests/rewrite.php:271
/var/www/vendor/bin/phpunit:123
}}}

Includes adding a dedicated unit test for a URL that only has a path.

Follow-up to [41786], [51606], [51622], [51626], [51629], [51630], [52799].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54364


git-svn-id: http://core.svn.wordpress.org/trunk@53923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-01 03:25:10 +00:00
davidbaumwald
9b493706ef Editor: Cast theme.json values to string on theme export.
Props glendaviesnz.
See #56684.
Built from https://develop.svn.wordpress.org/trunk@54363


git-svn-id: http://core.svn.wordpress.org/trunk@53922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-30 14:48:12 +00:00
Sergey Biryukov
35fb05f30d Code Modernization: Fix null to non-nullable deprecation in WP_Theme_JSON::get_property_value().
This commit aims to fix errors caused by incorrect usage of the `strncmp()` function inside the `WP_Theme_JSON::get_property_value()` method on PHP 8.1 and above.

Some history of the affected code:
* [50973] introduced the `WP_Theme_JSON::get_property_value()` method.
* [54162] removed the `$default` parameter from the `_wp_array_get()` call in the method.

With the latter change, the default value that is returned if the path does not exist within the array, or if `$array` or `$path` are not arrays, became `null` instead of an empty string. Since `null` would then be unintentionally passed to the `strncmp()` function further in the code, this caused ~35 errors in the test suite along the lines of:
{{{
1) Tests_Blocks_Editor::test_get_block_editor_settings_theme_json_settings
strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated

/var/www/src/wp-includes/class-wp-theme-json.php:1754
/var/www/src/wp-includes/class-wp-theme-json.php:1641
/var/www/src/wp-includes/class-wp-theme-json.php:2066
/var/www/src/wp-includes/class-wp-theme-json.php:1002
/var/www/src/wp-includes/class-wp-theme-json.php:898
/var/www/src/wp-includes/global-styles-and-settings.php:140
/var/www/src/wp-includes/block-editor.php:421
/var/www/tests/phpunit/tests/blocks/editor.php:388
/var/www/vendor/bin/phpunit:123
}}}

This commit includes:
* Restoring the `$default` value for `_wp_array_get()` call.
* Adding an early return if the value is an empty string or `null`.
* Adding a dedicated unit test to ensure that the method returns a string for invalid paths or `null` values.

Follow-up to [50973], [54162].

Props antonvlasenko, jrf, imadarshakshat, SergeyBiryukov.
Fixes #56620.
Built from https://develop.svn.wordpress.org/trunk@54362


git-svn-id: http://core.svn.wordpress.org/trunk@53921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-30 00:40:11 +00:00
audrasjb
1c1e37a8a4 Plugins: Fix Upgrade icon alignment on mobile in Plugins Install screen.
This changeset ensures the upgrade icon is correctly aligned on small screens, in the Plugins Install screen.

Props rajanpanchal2028, mukesh27, robinwpdeveloper.
Fixes #55627.

Built from https://develop.svn.wordpress.org/trunk@54361


git-svn-id: http://core.svn.wordpress.org/trunk@53920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 20:03:10 +00:00
davidbaumwald
0296dc6d98 Editor: Ensure settings for fluid typography and spacingScale are not lost on theme export.
This change adds fluid typography as a valid setting and removes `spacingScale` from the array of presets.

Props glendaviesnz, ramonopoly, tellthemachines.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54360


git-svn-id: http://core.svn.wordpress.org/trunk@53919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 19:45:09 +00:00
davidbaumwald
fc0840a5f5 Docs: Add @since to wp_enqueue_classic_theme_styles() docblock.
Follow-up to [54358].

Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54359


git-svn-id: http://core.svn.wordpress.org/trunk@53918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 19:15:10 +00:00
davidbaumwald
143fd4c1f7 Editor: Reintroduce styles that were removed for classic themes.
After block CSS was merged with `theme.json` styles in [https://github.com/WordPress/gutenberg/pull/34180 Gutenberg PR #34180], this removed some existing, default styling for some elements, including buttons.  This change re-adds the removed styles by enqueueing `classic.css` for classic themes.

Merges [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR #44334] into trunk.

Follow-up to [54257].

Props scruffian, oandregal, ramonopoly, aristath, andrewserong, get_dave, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54358


git-svn-id: http://core.svn.wordpress.org/trunk@53917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 18:55:10 +00:00
davidbaumwald
4722fcfca8 Editor: Remove deprecated callable in WP_Style_Engine class.
Resolves a `Use of "static" in callables is deprecated` notice in = PHP 8.2 and mark `WP_Style_Engine` as a `final` class that will not be extended.

Follow-up to [54156].

Props ramonopoly, jrf, andrewserong.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54357


git-svn-id: http://core.svn.wordpress.org/trunk@53916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 18:05:09 +00:00
davidbaumwald
ded36ac650 Editor: Remove leading whitespace from some translated strings.
Merges [https://github.com/WordPress/gutenberg/pull/44314 Gutenberg PR #44314] into trunk.

Follow-up to [54263] and [54269].

Props kebbet, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54356


git-svn-id: http://core.svn.wordpress.org/trunk@53915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 17:54:09 +00:00
Sergey Biryukov
3f512acb78 Build/Test Tools: Disable process timeout when running PHPUnit tests via Composer.
When running the full test suite locally via `npm run grunt phpunit` or `composer test`, it is not uncommon for the test run to exceed the Composer's default timeout, causing an error in the middle of the test output:
{{{
The process "..." exceeded the timeout of 300 seconds.
}}}

This commit disables the process timeout for the `composer test` command, allowing the test run to complete successfully.

Follow-up to [47881], [51016].

Props ironprogrammer, robinwpdeveloper, SergeyBiryukov.
Fixes #55919.
Built from https://develop.svn.wordpress.org/trunk@54355


git-svn-id: http://core.svn.wordpress.org/trunk@53914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 14:45:10 +00:00
desrosj
0084598e3b External Libraries: Update MediaElement.js to version 4.2.17.
This is a minor bug fix release and the latest in the 4.x branch.

A full list of changes can be found on the library’s GitHub: https://github.com/mediaelement/mediaelement/releases/tag/4.2.17.

While this is not the latest version (the 5.x branch is), further testing needs to be done to confirm compatibility in WordPress. #56320 has been opened to explore this.

Props cdbessig, desrosj.
Fixes #56319.
Built from https://develop.svn.wordpress.org/trunk@54354


git-svn-id: http://core.svn.wordpress.org/trunk@53913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 14:21:11 +00:00
davidbaumwald
6824b4dcbd Docs: Use Latin C instead of Cyrillic С in docblock for get_test_theme_version().
Follow-up to [48168].

Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54353


git-svn-id: http://core.svn.wordpress.org/trunk@53912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 13:55:09 +00:00
spacedmonkey
3b58a4828d Query: Save excessive cache add and sets in WP_Query.
In [53941] database query caching was added to `WP_Query`. However on sites with persistent object caching enabled, this resulted in a high number of unnecessary cache set and adds being run on every request. Caches are not set, if the query cache already exists and is cached. Replace usage of `update_post_caches` with `_prime_post_caches` to ensure that only posts that are not in cache are primed. 

Props spacedmonkey, peterwilsoncc, mukesh27.
See #22176.
Built from https://develop.svn.wordpress.org/trunk@54352


git-svn-id: http://core.svn.wordpress.org/trunk@53911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 10:09:11 +00:00
Sergey Biryukov
70f3a062db I18N: Use correct default value for JavaScript translations path.
The `$path` parameter of some script translation functions had a default value of `null`, even though the parameter is documented as a string.

This commit corrects the default value for `$path` in:
* `WP_Dependency::set_translations()`
* `WP_Scripts::set_translations()`
* `wp_set_script_translations()`

Additionally, this commit removes an `is_string()` check for `$path` in `load_script_textdomain()`. Now that the default value for `$path` in that function has also been corrected to an empty string instead of `null`, that check is no longer necessary, as it would ''hide'' an error which should be ''fixed'' (at the source of the problem) instead.

Follow-up to [54349].

Props jrf, johnjamesjacoby.
See #55967, #55656.
Built from https://develop.svn.wordpress.org/trunk@54351


git-svn-id: http://core.svn.wordpress.org/trunk@53910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 22:19:10 +00:00
Weston Ruter
14b6270285 Build/Test Tools: Remove extraneous -- from docker-compose up command.
This end of command options mark can be erreonously interpreted as an (invalid) container name.

Props westonruter, saggre
Fixes #56550

Built from https://develop.svn.wordpress.org/trunk@54350


git-svn-id: http://core.svn.wordpress.org/trunk@53909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 21:56:12 +00:00
Sergey Biryukov
d3006e8a16 Code Modernization: Use correct default value for JavaScript translations path.
The `$path` parameter of `load_script_textdomain()` had a default value of `null`, but would be passed onto the `untrailingslashit()` function without any input validation, even though the latter explicitly only expects/supports a string input.

This commit changes the default value for `$path` to an empty string, and adds an `is_string()` check before passing the value to `untrailingslashit()` to fix the issue at the point where the invalid input is incorrectly (not) validated.

Note: Changing the `untrailingslashit()` function is outside the scope of this commit.

Includes:
* Adding a dedicated unit test for this issue.
* Correcting the default value for `$path` from `null` to an empty string in a few related methods and functions:
 * `WP_Dependency::set_translations()`
 * `WP_Scripts::set_translations()`
 * `wp_set_script_translations()`
 * `load_script_textdomain()`

This fix also allows to remove a couple of calls to `expectDeprecation()` in unrelated tests.

Fixes an error when running the test suite:
{{{
4) Tests_Dependencies_Scripts::test_wp_external_wp_i18n_print_order
rtrim(): Passing null to parameter #1 ($string) of type string is deprecated

/var/www/src/wp-includes/formatting.php:2782
/var/www/src/wp-includes/l10n.php:1068
/var/www/src/wp-includes/class.wp-scripts.php:605
/var/www/src/wp-includes/class.wp-scripts.php:320
/var/www/src/wp-includes/class.wp-dependencies.php:136
/var/www/src/wp-includes/functions.wp-scripts.php:109
/var/www/tests/phpunit/tests/dependencies/scripts.php:1505
/var/www/tests/phpunit/includes/utils.php:436
/var/www/tests/phpunit/tests/dependencies/scripts.php:1507
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [44169], [44607], [51968].

Props jrf, ocean90, Chouby, swissspidy, lovor, iviweb, meysamnorouzi, DarkoG, oneearth27, SergeyBiryukov.
Fixes #55967. See #55656.
Built from https://develop.svn.wordpress.org/trunk@54349


git-svn-id: http://core.svn.wordpress.org/trunk@53908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 17:33:18 +00:00
audrasjb
f8bd8914da Script Loader: Prevent double space between attributes in WP_Styles class.
This changeset prevents `<link />` elements to display a double space between attributes when no `title` attribute is provided.

Props elten, audrasjb, whaze, SergeyBiryukov.
Fixes #56675.

Built from https://develop.svn.wordpress.org/trunk@54348


git-svn-id: http://core.svn.wordpress.org/trunk@53907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 14:59:10 +00:00
audrasjb
525c52c873 Docs: Various docblock fixes in wp-includes/revision.php, as per documentation standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@54347


git-svn-id: http://core.svn.wordpress.org/trunk@53906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 14:47:12 +00:00
Sergey Biryukov
2a81bee262 I18N: Move code out of a translatable string in register_rest_route().
To simplify the string and exclude any parts that don't require translation, `$args` can be moved out of the string and added as a placeholder.

Follow-up to [54339].

See #51986.
Built from https://develop.svn.wordpress.org/trunk@54346


git-svn-id: http://core.svn.wordpress.org/trunk@53905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 14:04:11 +00:00
Sergey Biryukov
bb8988e3ec Options, Meta APIs: Prevent excessive notoptions key lookups.
When the `notoptions` key does not exist in a persistent object cache, it was requested hundreds of times until the first not-option is written.

This commit improves performance by setting the value to an empty array to prevent non-existent `notoptions` key from triggering multiple key lookups.

Follow-up to [4855], [14515].

Props tillkruess, dd32, spacedmonkey.
Fixes #56639.
Built from https://develop.svn.wordpress.org/trunk@54345


git-svn-id: http://core.svn.wordpress.org/trunk@53904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 13:44:15 +00:00
audrasjb
84729259de Twenty Ten: Escape get_author_posts_url() where appropriate in functions.php file.
This changeset adds missing escaping to some instances of `get_author_posts_url()` used in Twenty Ten, as per WordPress Coding Standards.

Props hztyfoon, robinwpdeveloper, mukesh27, rudlinkon, SergeyBiryukov, jakariaistauk.
Fixes #56674.

Built from https://develop.svn.wordpress.org/trunk@54344


git-svn-id: http://core.svn.wordpress.org/trunk@53903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 12:40:15 +00:00
desrosj
27f92a2fdc Build/Test Tools: Remove the retryAfter input.
This was included in the original pull request that aimed to add support for `octokit/plugin-retry.js` in `actions/github-scripts`, but was actually removed before being merged.

Follow up to [54342].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54343


git-svn-id: http://core.svn.wordpress.org/trunk@53902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 02:22:09 +00:00
desrosj
489b6b80b4 Build/Test Tools: Update actions/github-scripts to the latest version.
This version adds support for `octokit/plugin-retry.js`, which retries requests automatically when `4xx` or `5xx` response codes are returned.

To start, the feature is configured to retry all `4xx` and `5xx` response codes, unless the server identifies as a teapot.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54342


git-svn-id: http://core.svn.wordpress.org/trunk@53901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 01:55:11 +00:00
audrasjb
79d521d784 Twenty Ten: Escape get_permalink() where appropriate in functions.php file.
This changeset adds missing `esc_url()` to some instances of `get_permalink()` used in Twenty Ten, as per WordPress Coding Standards.

Props hztyfoon, robinwpdeveloper, mukesh27, rudlinkon, fuadragib01.
Fixes #56667.

Built from https://develop.svn.wordpress.org/trunk@54341


git-svn-id: http://core.svn.wordpress.org/trunk@53900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 22:26:16 +00:00
audrasjb
377db68158 Twenty Eleven: Improve text color consistency of Table Block heading cells and figcaption.
This changeset ensures the text color selected for the text of the Table Block is reflected on the `thead` cells, on the figcaption and on the border below it. It also adds better consistency in headings cells padding.

Props umesh84, mukesh27, multidots1896, sabernhardt.
Fixes #56462.

Built from https://develop.svn.wordpress.org/trunk@54340


git-svn-id: http://core.svn.wordpress.org/trunk@53899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 21:55:11 +00:00
davidbaumwald
7a15b3353a REST API: Ensure args is an array of arrays in register_rest_route().
When calling `register_rest_route()`, the `args` parameter for a route should be an array of arrays.  However, some plugins/themes have passed an array of strings or key-value pairs which produces a PHP warning when `array_intersect_key` is used to filter the array keys based on an allowed list of schema keywords.

This change adds a check of the `args` parameter to ensure it's an array of arrays, presenting a `_doing_it_wrong` if any element of `args` is not an array and restructuring to an array of arrays.  This change also adds a unit test for the incorrect usage described above, expecting that a `_doing_it_wrong` is produced.

Props slaFFik, desrosj, apermo, AndrewNZ, aristath, poena, dovyp, timothyblynjacobs, Hinjiriyo, johnmark8080, nateallen.
Fixes #51986.
Built from https://develop.svn.wordpress.org/trunk@54339


git-svn-id: http://core.svn.wordpress.org/trunk@53898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 20:13:13 +00:00
davidbaumwald
888d01689d Administration: Guard against false transient key in get_cached_events().
Inside `WP_Community_Events::get_cached_events()`, `WP_Community_Events::get_events_transient_key()` is used to retrieve the transient key name, based on the user's location.  However, the transient key can potentially return `false`, resulting in a call to `get_site_transient()` with the `$key` being `false`.

This change first attempts to evaluate and guard against a `false` return from `WP_Community_Events::get_events_transient_key()`.  The result is an early `false` return from `WP_Community_Events::get_cached_events()`.

Props malthert, rafiahmedd, audrasjb, costdev.
Fixes #55888.
Built from https://develop.svn.wordpress.org/trunk@54338


git-svn-id: http://core.svn.wordpress.org/trunk@53897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 18:57:13 +00:00
davidbaumwald
f99287285d Post WordPress 6.1 Beta 2 version bump.
Built from https://develop.svn.wordpress.org/trunk@54337


git-svn-id: http://core.svn.wordpress.org/trunk@53896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 18:10:08 +00:00
davidbaumwald
46f013b3d6 WordPress 6.1 Beta 2.
Built from https://develop.svn.wordpress.org/trunk@54336


git-svn-id: http://core.svn.wordpress.org/trunk@53895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 17:48:12 +00:00
hellofromTonya
cce69f5098 Editor: Update packages for 6.1 Beta 2.
Package updates for bug and regression fixes:

* @wordpress/block-directory: 3.15.3
* @wordpress/block-editor: 10.0.3
* @wordpress/block-library: 7.14.3
* @wordpress/block-serialization-default-parser: 4.17.1
* @wordpress/blocks: 11.16.3
* @wordpress/components: 21.0.3
* @wordpress/compose: 5.15.2
* @wordpress/core-data: 5.0.3
* @wordpress/customize-widgets: 3.14.3
* @wordpress/edit-post: 6.14.3
* @wordpress/edit-site: 4.14.4
* @wordpress/edit-widgets: 4.14.3
* @wordpress/editor: 12.16.3
* @wordpress/format-library: 3.15.3
* @wordpress/interface: 4.16.3
* @wordpress/list-reusable-blocks: 3.15.3
* @wordpress/nux: 5.15.3
* @wordpress/preferences: 2.9.3
* @wordpress/reusable-blocks: 3.15.3
* @wordpress/server-side-render: 3.15.3
* @wordpress/style-engine: 1.0.2
* @wordpress/widgets: 2.15.3

References:
* [https://github.com/WordPress/gutenberg/pull/44233 Gutenberg PR 44233] – Blocks: Fix searching of blocks when description is non-string
* [https://github.com/WordPress/gutenberg/pull/44301 Gutenberg PR 44301] – Block Toolbar: update position when moving blocks
* [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR 44334] – Global Styles: Re-add styles that were removed, for classic themes
* [https://github.com/WordPress/gutenberg/pull/44351 Gutenberg PR 44351] – Comments block: Support nested comments settings in the comments blocks
* [https://github.com/WordPress/gutenberg/pull/44448 Gutenberg PR 44448] – Add a correct TS signature for useEntityRecords
* [https://github.com/WordPress/gutenberg/pull/44315 Gutenberg PR 44315] – Pullquote: fix transform to quote crash
* [https://github.com/WordPress/gutenberg/pull/44446 Gutenberg PR 44446] – Fix spacing property generation in flow layout type.
* [https://github.com/WordPress/gutenberg/pull/44408 Gutenberg PR 44408] – Upgrade react-easy-crop to bring in fix for site editor iframe
* [https://github.com/WordPress/gutenberg/pull/44406 Gutenberg PR 44406] – Style engine: kebab case preset slugs in the editor
* [https://github.com/WordPress/gutenberg/pull/44209 Gutenberg PR 44209] – Fixing padding on the post editor when RootPaddingAwareAlignments setting is enabled
* [https://github.com/WordPress/gutenberg/pull/42950 Gutenberg PR 42950] – Popover: fix limitShift logic by adding iframe offset correctly (and a custom shift limiter)
* [https://github.com/WordPress/gutenberg/pull/44337 Gutenberg PR 44337] – Submenu block href only if url is not empty
* [https://github.com/WordPress/gutenberg/pull/44291 Gutenberg PR 44291] – Add role=application to list view to prevent browse mode triggering in NVDA
* [https://github.com/WordPress/gutenberg/pull/44283 Gutenberg PR 44283] – Navigation block: Fix submenu colors for imported classic menus
* [https://github.com/WordPress/gutenberg/pull/44282 Gutenberg PR 44282] – Fix popover stacking in the customize widgets editor
* [https://github.com/WordPress/gutenberg/pull/44247 Gutenberg PR 44247] – Spacing presets: switch to using numbers instead of t-shirt sizes for labels
* [https://github.com/WordPress/gutenberg/pull/44299 Gutenberg PR 44299] – Backport template creation changes from core
* [https://github.com/WordPress/gutenberg/pull/44294 Gutenberg PR 44294] – [Block Library - Query Loop]: Fix broken preview in specific category template
* [https://github.com/WordPress/gutenberg/pull/44287 Gutenberg PR 44287] – [Block Library]: Rename Comments pagination inner blocks
* [https://github.com/WordPress/gutenberg/pull/44256 Gutenberg PR 44256] – Avoid showing the recursion warning in previews when replacing template parts
* [https://github.com/WordPress/gutenberg/pull/44265 Gutenberg PR 44265] – Blocks: officially deprecated the children and node matchers
* [https://github.com/WordPress/gutenberg/pull/44251 Gutenberg PR 44251] – Global styles: Remove the beta label from global styles header

Props bernhard-reiter, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54335


git-svn-id: http://core.svn.wordpress.org/trunk@53894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 17:32:52 +00:00
davidbaumwald
fe346c1464 Comments: Prevent AYS prompt when replying to a comment and nothing has been entered.
When replying to a comment and nothing has yet been entered for the reply content, clicking "Reply" or "Quick Edit" on another comment presents the "Are you sure..." prompt indicating there are unsaved changes in the reply content.  However, if nothing is entered, this prompt should not be displayed.

This change implements a new check to determine if any text has been entered by the user before deciding to show the "Are you sure..." prompt.

Props cu121, mkox, azouamauriac, hasanuzzamanshamim, pls78, faisal03, rafiahmedd.
Fixes #54990.
Built from https://develop.svn.wordpress.org/trunk@54334


git-svn-id: http://core.svn.wordpress.org/trunk@53893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 17:06:09 +00:00
davidbaumwald
bed72ed20d Editor: Revert dynamic template names and descriptions.
After discussions with the Editor Tech leads for 6.1(@bernhard-reiter, @cbravobernal, and @ndiego) and additional guidance from @hellofromtonya, the decision has been made to exclude [https://github.com/WordPress/gutenberg/pull/43862 Gutenberg PR #43862] from the pre-Beta 2 Gutenberg sync PR and revert [54280]. Why? [54280] added the feature's PHP code, but the JS package updates were not included before feature freeze(Beta 1), meaning the feature was incomplete. As the PHP code does not work without the JS package update, the feature is incomplete and missed the feature freeze deadline.

Leaving the PHP code was discussed. However, there is a risk of it needing to change which could complicate backwards compatibility in 6.2 when the feature is eventually introduced.

Follow-up to [54280].

Props hellofromTonya, bernhard-reiter, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54333


git-svn-id: http://core.svn.wordpress.org/trunk@53892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:33:10 +00:00
Sergey Biryukov
cd0ae0eb85 Bootstrap/Load: Revert the is_*_admin_screen() aliases for is_*_admin() function family.
After some further discussion, it is apparent that the added clarity was subjective, and the `_screen` suffix may not always be appropriate, e.g. in Ajax context. To address any confusion with the existing names, the documentation for these functions can be updated instead.

Additionally, the `is_super_admin_user()` alias for `is_super_admin()` is reverted as well, which may be reconsidered in the future.

Follow-up to [54259].

Props azaozz, jrf, johnbillion, manfcarlo, Clorith.
See #56400.
Built from https://develop.svn.wordpress.org/trunk@54332


git-svn-id: http://core.svn.wordpress.org/trunk@53891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:31:10 +00:00
Sergey Biryukov
33d7ee09f4 Tests: Update block registration tests to account for RTL stylesheet loading changes.
The RTL data should only be added in `register_block_style_handle()` if an RTL locale is selected, so these test expectations do not appear to be correct.

Follow-up to [49982], [53091], [54330].

See #56325.
Built from https://develop.svn.wordpress.org/trunk@54331


git-svn-id: http://core.svn.wordpress.org/trunk@53890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:10:09 +00:00
Sergey Biryukov
12b190eb17 Editor: Correctly load RTL stylesheets in register_block_style_handle().
When setting an RTL language under Settings → General, some RTL stylesheets were not loaded, with LTR stylesheets being loaded instead, meaning that some blocks were not displayed correctly.

This commit ensures that all appropriate RTL stylesheets are loaded when selecting an RTL language.

Additionally, this commit improves performance by only running a `file_exists()` check for an RTL stylesheet if `is_rtl()` returns true, i.e. an RTL locale is selected.

Follow-up to [49982], [50836].

Props zoonini, sabernhardt, maahrokh, ankit-k-gupta, aristath, poena, SergeyBiryukov.
See #56325.
Built from https://develop.svn.wordpress.org/trunk@54330


git-svn-id: http://core.svn.wordpress.org/trunk@53889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:43:09 +00:00
Sergey Biryukov
abf66fa018 Users: Correctly pass the context property for persisted preferences.
The user meta `context` property in `wp_register_persisted_preferences_meta()` was incorrectly configured. It should be part of the `schema` array, not the `show_in_rest` array.

Follow-up to [54182].

Props talldanwp, dd32.
Fixes #56665. See #56467.
Built from https://develop.svn.wordpress.org/trunk@54329


git-svn-id: http://core.svn.wordpress.org/trunk@53888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:23:10 +00:00
desrosj
3ed1ed5c13 External Libraries: Update Underscore.js to version 1.13.6.
There are no code changes to the library in this release.

Updating to the latest version for WordPress 6.1 ensures security scanners do not incorrectly flag sites as potentially insecure for having out of date libraries.

Fixes #56030.
Built from https://develop.svn.wordpress.org/trunk@54328


git-svn-id: http://core.svn.wordpress.org/trunk@53887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:18:25 +00:00
Sergey Biryukov
6dfd98cfe0 Blocks: Remove extra get_theme_file_path() calls in register_block_style_handle().
The `register_block_style_handle()` function runs ~200 times on each page load. Each time it runs, we call `get_theme_file_path()` and then run it through `wp_normalize_path()`.

`get_theme_file_path()` calls a few other functions: `get_stylesheet_directory()`, `get_stylesheet()`, `get_option()`, and there's a bunch of filters that run on each iteration of that, without ever changing.

By caching the value in a static variable, we can avoid ~200 calls on many functions and filters, improving performance.

Follow-up to [53091], [54290], [54291], [54309].

Props aristath, mukesh27.
Fixes #56666.
Built from https://develop.svn.wordpress.org/trunk@54327


git-svn-id: http://core.svn.wordpress.org/trunk@53886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 15:11:14 +00:00
audrasjb
b0ebbf6beb Upgrade/Install: Keep search engine checkbox value when reloading the Install screen.
This changeset ensures the value of the search engine checkbox is not reset to its default value when a faulty form is sent in the Install screen.

Props ramon-fincken, audrasjb, whaze, rafiahmedd, khokansardar, costdev, ankit-k-gupta.
Fixes #55900.

Built from https://develop.svn.wordpress.org/trunk@54326


git-svn-id: http://core.svn.wordpress.org/trunk@53885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 10:37:13 +00:00
audrasjb
2c8c3fed63 Site Health: Fix incorrect message about the status of WP_AUTO_UPDATE_CORE.
Previously, the Site Health message said "The WP_AUTO_UPDATE_CORE constant is defined and enabled" when in fact the constant was defined and disabled using `define( 'WP_AUTO_UPDATE_CORE', false );`.

This changeset improves the message by providing the value of the constant. For example: "The WP_AUTO_UPDATE_CORE constant is defined as false".

Props johnbillion, chrisbudd1, robinwpdeveloper, audrasjb, Clorith.
Fixes #51041.

Built from https://develop.svn.wordpress.org/trunk@54325


git-svn-id: http://core.svn.wordpress.org/trunk@53884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 10:18:12 +00:00
audrasjb
32cefdce56 Docs: Use third-person singular verbs in class-wp-site-health-auto-updates.php, as per docblocks standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@54324


git-svn-id: http://core.svn.wordpress.org/trunk@53883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 10:16:22 +00:00
gziolo
8cb2e8aa60 Blocks: Fix 404 error for core styles with no file
[54155] broke loading of style.css files, namely it was enqueuing style.css files that don't exist on the frontend, which lead to 404 HTTO errors. All these style.css files don't exist for core blocks as they should be registered style handlers without a file path.

Follow-up to [54155].
Props tobiasbg, nendeb55.
Fixes #56408, #56614.


Built from https://develop.svn.wordpress.org/trunk@54323


git-svn-id: http://core.svn.wordpress.org/trunk@53882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 07:40:11 +00:00
Peter Wilson
8364c68daa Security: Introduce strings to indicate support status.
Add strings for use in future maintenance/security releases to indicate the security support status of the version of WordPress.

Two strings are introduced:

* indicating the version of WordPress is not receiving security updates, and,
* indicating the version of WordPress will shortly stop receiving security updates.

This change does not make use of the strings, the purpose is to make them available to translators prior to dropping support of selected versions of WordPress.

Props costdev, chesio, robinwpdeveloper, desrosj, rudlinkon, mukesh27, sumitbagthariya16.
See #56532.


Built from https://develop.svn.wordpress.org/trunk@54322


git-svn-id: http://core.svn.wordpress.org/trunk@53881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 06:12:13 +00:00
Sergey Biryukov
ce8fb38739 Code Modernization: Fix null to non-nullable deprecations in wp_xmlrpc_server::_insert_post().
The `wp_xmlrpc_server::_insert_post()` method creates a new post via `wp_insert_post()` or updates an existing one via `wp_update_post()`, which subsequently calls `wp_insert_post()`. However, the default/fallback values used in the function were not in line with the default/fallback values used in the `wp_insert_post()` function.

The `wp_insert_post()` function does a `wp_parse_args()` (array merge) of the received arguments with the defaults. If any of the received arguments are `null`, this would overwrite the default value, as seen in [https://3v4l.org/bfVlv array_merge() example], and lead to "passing null to non-nullable" deprecation notices on PHP 8.1 for certain arguments.

Unfortunately, the conditional logic within the `wp_xmlrpc_server::_insert_post()` function itself often uses an `isset()` to trigger certain code blocks, so syncing the defaults with those used in the `wp_insert_post()` function was not an option.

This commit:
* Updates the default/fallback values in the `$defaults` array only for those values where this would not lead to a change in the behavior of the function.
* Adds a safeguard function, filtering out all remaining `null` values from the `$post_data` array before it is passed on to the `wp_insert_post()` or `wp_update_post()` functions. Removing those values is safe as this means that these array keys will now:
 * either be set to the default/fallback value as defined in `wp_insert_post()`.
 * or not be set and for those values which don't have a default/fallback value in `wp_insert_post()`, the function does an `! empty()` or `isset()` check anyway and those array keys not being defined means that the result of those checks will remain the same.

Includes
* Removing a couple of conditions which are now redundant.
* Removing an `expectDeprecation()` in the `Tests_Date_XMLRPC` test class, which is now no longer needed.

Fixes various errors along the lines of:
{{{
36) Tests_XMLRPC_wp_newPost::test_no_content
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated

/var/www/src/wp-includes/kses.php:2074
/var/www/src/wp-includes/class-wp-hook.php:307
/var/www/src/wp-includes/plugin.php:205
/var/www/src/wp-includes/post.php:2835
/var/www/src/wp-includes/post.php:2720
/var/www/src/wp-includes/post.php:4066
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:1683
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:1347
/var/www/tests/phpunit/tests/xmlrpc/wp/newPost.php:25
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [1563], [4793], [7900], [16824], [19848], [19873], [20632], [40677], [51968], [54320].

Props jrf.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54321


git-svn-id: http://core.svn.wordpress.org/trunk@53880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 02:18:10 +00:00
Sergey Biryukov
6746d64fd4 Code Modernization: Fix null to non-nullable deprecations in wp_xmlrpc_server::mw_newPost().
The `wp_xmlrpc_server::mw_newPost()` method creates a new post via `wp_insert_post()`, but the default/fallback values used in the function were not in line with the default/fallback values used in the `wp_insert_post()` function.

The `wp_insert_post()` function does a `wp_parse_args()` (array merge) of the received arguments with the defaults. If any of the received arguments are `null`, this would overwrite the default value, as seen in [https://3v4l.org/bfVlv array_merge() example], and lead to "passing null to non-nullable" deprecation notices on PHP 8.1 for certain arguments.

This commit:
* Ensures that all arguments are defined before they are `compact()`'ed together to the arguments array.
* Verifies that the default/fallback value of the arguments as set within the `wp_xmlrpc_server::mw_newPost()` method are the same as the default/fallback values used in the `wp_insert_post()` function.
* Verifies that arguments which do not have a default/fallback value defined in the `wp_insert_post()` function are handled correctly.
 * This was not the case for `$post_name`, which would previously already get an empty string default value in the `wp_xmlrpc_server::mw_newPost()` function, but then in the `wp_insert_post()` function, this would prevent the slug generation from being activated. Fixed now by setting the default in the `wp_xmlrpc_server::mw_newPost()` function to `null`.
 * The `page_template` argument was handled, but not documented in the `wp_insert_post()` function. The argument is now documented in the `wp_insert_post()` function DocBlock. Note: There are more than likely several other potential arguments missing from that list, but verifying the whole list is outside the scope of this particular commit.

Includes minor simplifications, such as:
* Setting a default ahead of an `if`, instead of in an `else` clause (as long as no function call is needed to set the default).
* Removing the unnecessary logic duplication in the `$post_status` switch.
* Using a combined concatenation + assignment operator for adding `$post_more`.

Fixes various errors along the lines of:
{{{
1) Tests_XMLRPC_mw_editPost::test_draft_not_prematurely_published
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

/var/www/src/wp-includes/formatting.php:2497
/var/www/src/wp-includes/class-wp-hook.php:308
/var/www/src/wp-includes/plugin.php:205
/var/www/src/wp-includes/post.php:2835
/var/www/src/wp-includes/post.php:2720
/var/www/src/wp-includes/post.php:4066
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:5616
/var/www/tests/phpunit/tests/xmlrpc/mw/editPost.php:315

...

23) Tests_XMLRPC_mw_editPost::test_draft_not_prematurely_published
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated

/var/www/src/wp-includes/kses.php:2074
/var/www/src/wp-includes/class-wp-hook.php:307
/var/www/src/wp-includes/plugin.php:205
/var/www/src/wp-includes/post.php:2835
/var/www/src/wp-includes/post.php:2720
/var/www/src/wp-includes/post.php:4066
/var/www/src/wp-includes/class-wp-xmlrpc-server.php:5615
/var/www/tests/phpunit/tests/xmlrpc/mw/editPost.php:315
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [1563], [4793], [7900], [16824], [19848], [40677], [51968].

Props jrf.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54320


git-svn-id: http://core.svn.wordpress.org/trunk@53879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 02:00:09 +00:00
davidbaumwald
b266a2d535 Shortcodes: Revert recent apply_shortcodes and do_shortcode changes.
[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004].  After further consideration, the long history of `do_shortcodes` should be favored over any subjective semantic improvements.  This change reverts the remaining changes from #55883 not already reverted in [54278].

Follow-up to [47004], [54248], and [54278].

Props azaozz, jorbin.
See #55883.
Built from https://develop.svn.wordpress.org/trunk@54319


git-svn-id: http://core.svn.wordpress.org/trunk@53878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 22:43:10 +00:00
John Blackbourn
2eabdd1490 Docs: Increase the specificity of various property documentation.
See #55646

Built from https://develop.svn.wordpress.org/trunk@54318


git-svn-id: http://core.svn.wordpress.org/trunk@53877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 22:10:16 +00:00
hellofromTonya
d7893c3cea Code Modernization: Fix null to non-nullable deprecation in WP_REST_Users_Controller::update_item().
Not all requests are accompanied by a `$request['email']`. This leads to a PHP 8.1 "passing null to non-nullable" deprecation notice when the `WP_REST_Users_Controller::update_item()` method passes a `null` email address onto `email_exists()`, which eventually reached the `WP_User::get_data_by()` method where things go wrong.

In the next condition in the code of the `WP_REST_Users_Controller::update_item()` method - `if ( $owner_id && $owner_id !== $id )` - you can see that the code already takes this into account as it will not throw a `WP_Error` if `$owner_id` is falsey.

`WP_User::get_data_by()` returns `false` for a failed field request. The other functions through which the return value is passed through, do the same.

So, by setting a default value for `$owner_id` of `false` and only checking `email_exists()` when there is an email to check, the "passing null to non-nullable" deprecation notice is bypassed without breaking BC.

Fixes a whole slew of test errors along the lines of:
{{{
6) WP_Test_REST_Users_Controller::test_update_item_en_US_locale
trim(): Passing null to parameter https://github.com/WordPress/wordpress-develop/pull/1 ($string) of type string is deprecated

/var/www/src/wp-includes/class-wp-user.php:211
/var/www/src/wp-includes/pluggable.php:105
/var/www/src/wp-includes/user.php:1953
/var/www/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:728
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1143
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:990
/var/www/tests/phpunit/includes/spy-rest-server.php:67
/var/www/tests/phpunit/tests/rest-api/rest-users-controller.php:1719
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [44641], [38832].

Props jrf.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54317


git-svn-id: http://core.svn.wordpress.org/trunk@53876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 21:46:09 +00:00
audrasjb
d6e06921a8 Menus: Remove bulk action checkboxes when menu is empty.
This changeset removes the bulk action checkboxes when there is no menu item to select.

Follow-up to [51006], [51539].

Props oglekler, krishaweb, costdev, Boniu91, hugodevos, audrasjb.
Fixes #54799.
See #21603, #53654.

Built from https://develop.svn.wordpress.org/trunk@54316


git-svn-id: http://core.svn.wordpress.org/trunk@53875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 21:44:09 +00:00
audrasjb
fd8b414c5f i18n: Ensure empty strings are consistently translated to ''.
This changeset fixes an edge case where empty strings were wrongly translated to `'0'` (falsey value) instead of `''` (empty string).

Props Chouby, manooweb, rafiahmedd, lopo.
Fixes #55941.

Built from https://develop.svn.wordpress.org/trunk@54315


git-svn-id: http://core.svn.wordpress.org/trunk@53874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 20:56:10 +00:00
audrasjb
457f15283a Twenty Twenty: Ensure the fallback fonts is applied to all content elements for non-latin languages.
This changeset adds missing CSS selectors to `get_non_latin_css()` function.

Props sabernhardt, audrasjb.
Fixes #56396.

Built from https://develop.svn.wordpress.org/trunk@54314


git-svn-id: http://core.svn.wordpress.org/trunk@53873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 20:31:10 +00:00
desrosj
f15654e0d4 Build/Test Tools: Remove unnecessary --no-interaction option from Composer commands.
As of version `2.17.0` of the `shivammathur/setup-php` action, the `COMPOSER_NO_INTERACTION` environment variable is configured by default. `—-no-interaction` will always be used.

Props jrf, hellofromTonya, SergeyBiryukov, costdev, desrosj.
Fixes #54695.
Built from https://develop.svn.wordpress.org/trunk@54313


git-svn-id: http://core.svn.wordpress.org/trunk@53872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 19:17:09 +00:00
desrosj
906280f933 Twenty Twenty-Three: Bug fixes and improvements for beta 2.
This brings over the latest bug fixes and improvements ahead of WordPress 6.1 beta 2, which includes an additional style variation, “Aubergine”.

For a full list of changes being included, see the `twentytwentythree` repository on GitHub: 1b97bb83f1...ac96e8d545.

Props mikachan, poena, madhudollu, critterverse, beafialho, felipeelia.
See #56383.
Built from https://develop.svn.wordpress.org/trunk@54312


git-svn-id: http://core.svn.wordpress.org/trunk@53871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 18:34:14 +00:00
hellofromTonya
26b2f466f4 Editor: Fix spacing property generation in flow layout type.
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [https://github.com/WordPress/gutenberg/issues/44435 Gutenberg issue 44435].

Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [https://github.com/WordPress/wordpress-develop/pull/3324 Gutenberg PR 3324].

Also adds a test dataset that fails before the bugfix and passes after the bugix.

Follow-up to [54274].

Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54311


git-svn-id: http://core.svn.wordpress.org/trunk@53870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 14:58:12 +00:00
Sergey Biryukov
2d3bea434b Upgrade/Install: Update sodium_compat to v1.19.0.
The latest version of sodium_compat includes improved compatibility with the PHP 8.0 named parameters functionality.

Release notes:
https://github.com/paragonie/sodium_compat/releases/tag/v1.19.0

A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.18.0...v1.19.0

Follow-up to [49741], [51002], [51591], [52988], [54150].

Props jrf, paragoninitiativeenterprises.
Fixes #56653.
Built from https://develop.svn.wordpress.org/trunk@54310


git-svn-id: http://core.svn.wordpress.org/trunk@53869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 14:00:10 +00:00
Sergey Biryukov
aaffa2bcff General: Remove file_exists() checks after calling realpath().
`realpath()` already checks if the file exists, and returns `false` on failure. The additional `file_exists()` check is not necessary and can be removed, improving the performance.

This commit simplifies the checks in two functions:
* `register_block_type_from_metadata()`
* `wp_json_file_decode()`

Note: In both of these cases, the values are passed through `wp_normalize_path()` after `realpath()`, so if the file does not exist, the `false` value gets converted to an empty string. The updated checks work both for `false` and `''` values.

Though this is a small tweak, it saves a lot of checks since one of the places we do this is when registering block styles, so it runs quite a few times on each page load.

Reference: [https://www.php.net/manual/en/function.realpath.php PHP Manual: realpath()].

Follow-up to [51599], [54132], [54290], [54291].

Props aristath.
Fixes #56654.
Built from https://develop.svn.wordpress.org/trunk@54309


git-svn-id: http://core.svn.wordpress.org/trunk@53868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 13:07:14 +00:00
gziolo
ec8368e14c Tools: Simplify syncing core blocks from Gutenberg plugin to Core
Follow-up [53688].

Removes the hardcoded list of blocks that should be synced from the Gutenberg plugin. webpack reads all information from the `@wordpress/block-library` by scanning `block.json` files.

Props zieladam, azaozz.
Fixes #56179.


Built from https://develop.svn.wordpress.org/trunk@54308


git-svn-id: http://core.svn.wordpress.org/trunk@53867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 11:42:13 +00:00
gziolo
b92a407e22 Tools: Fix running build scripts on Windows does not generate CSS files for blocks
Starting with WordPress 6.0, when running `npm run build` or `npm run build:dev`, no CSS files were generated for the blocks within `wp-includes/blocks/**`.

Props wildworks, clorith, sergeybiryukov.
Fixes #56616.


Built from https://develop.svn.wordpress.org/trunk@54307


git-svn-id: http://core.svn.wordpress.org/trunk@53866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 11:22:10 +00:00
jorgefilipecosta
5e32e7de29 Fix: Revert [54305].
This commit caused an incompatibility with the latest released Gutenberg version.

Props bernhard-reiter.
Built from https://develop.svn.wordpress.org/trunk@54306


git-svn-id: http://core.svn.wordpress.org/trunk@53865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 10:17:11 +00:00
jorgefilipecosta
7882623807 Editor: Fix missing frontend section presets output.
Backports PHP changes in WordPress/gutenberg#42124 to the core. Adds the missing mechanism to output frontend styles of block level presets to the core.

Props mcsf, oandregal, dmsnell, draganescu.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54305


git-svn-id: http://core.svn.wordpress.org/trunk@53864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 09:08:21 +00:00
Sergey Biryukov
44e2aebd03 Tests: Revert removing empty directory in WP_UnitTestCase_Base::rmdir() for now.
This appears to need more investigation. Instead, delete the `test-plugin` and `link-manager` directories in REST API plugins controller tests, for which this change was initially intended.

Follow-up to [54300], [54301], [54303].

See #55652, #56629.
Built from https://develop.svn.wordpress.org/trunk@54304


git-svn-id: http://core.svn.wordpress.org/trunk@53863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 04:49:10 +00:00
Sergey Biryukov
dc65565f76 Tests: Remove nested empty directories in WP_UnitTestCase_Base::rmdir().
Includes:
* Checking if the directory exists and returning early otherwise.
* Removing a redundant `rmdir()` call in `clean_dirsize_cache()` tests.

Follow-up to [49744], [54300].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54303


git-svn-id: http://core.svn.wordpress.org/trunk@53862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 03:40:09 +00:00
Sergey Biryukov
9fc5df7da5 Coding Standards: Remove extra space in REST API plugins controller test class.
This fixes a WPCS error:

* `Tabs must be used to indent lines; spaces are not allowed`

Follow-up to [54301].

See #56629.
Built from https://develop.svn.wordpress.org/trunk@54302


git-svn-id: http://core.svn.wordpress.org/trunk@53861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 02:53:10 +00:00
Sergey Biryukov
b23baf4ce7 Tests: Delete Link Manager plugin after running REST API plugins controller tests.
After running the multisite PHPUnit test suite, the following files remained, contributing towards a dirty working copy:
{{{
tests/phpunit/data/plugins/link-manager/link-manager.php
tests/phpunit/data/plugins/link-manager/readme.txt
}}}
These files should be deleted after running the tests.

This commit ensures the `link-manager` plugin is deleted during test tear down, which was previously done at the beginning of some test methods, but not afterwards.

Follow-up to [48242], [54300].

Props ironprogrammer.
Fixes #56629.
Built from https://develop.svn.wordpress.org/trunk@54301


git-svn-id: http://core.svn.wordpress.org/trunk@53860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 02:43:10 +00:00
Sergey Biryukov
24838999e6 Tests: Remove empty directory in WP_UnitTestCase_Base::rmdir().
The `WP_UnitTestCase_Base::rmdir()` method selectively deletes files from a directory, skipping any paths from the `$ignore_files` property.

This commit updates the method to remove the empty directory if there are no files left, bringing some parity with PHP native `rmdir()` function.

Follow-up to [677/tests], [29120].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54300


git-svn-id: http://core.svn.wordpress.org/trunk@53859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-25 02:39:14 +00:00
Sergey Biryukov
3d245c574e General: Correct the fallback logic in apache_mod_loaded().
If the `apache_get_modules()` function is redeclared to return an empty array, `apache_mod_loaded()` would assume that no Apache modules are installed and activated, which may not be correct.

This commit improves the logic by using pre-existing `phpinfo()` fallback to check for loaded modules in that case.

Includes replacing a hardcoded number passed as a flag to `phpinfo()` with the `INFO_MODULES` predefined constant for clarity.

Follow-up to [7441], [7508], [29330].

Props engahmeds3ed, audrasjb, Clorith, SergeyBiryukov.
Fixes #56010.
Built from https://develop.svn.wordpress.org/trunk@54299


git-svn-id: http://core.svn.wordpress.org/trunk@53858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-24 13:53:13 +00:00
davidbaumwald
99d0310f77 Coding Standards: Correct alignment in WP_Theme_JSON_Resolver::get_core_data().
Follow-up to [54251].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@54298


git-svn-id: http://core.svn.wordpress.org/trunk@53857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 21:31:10 +00:00
desrosj
5023368035 Build/Test Tools: Test building WordPress to run from src first.
Because of the scripts that run when `build:dev` is run, it’s more common for this Grunt task to change version-controlled files than when building WordPress to run from `build`.

This moves the `build:dev` tests before the `build` ones in order to detect changes earlier in the workflow.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54297


git-svn-id: http://core.svn.wordpress.org/trunk@53856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 20:04:13 +00:00
desrosj
e4a97cc8e9 Build/Test Tools: Update NPM dependencies to their latest versions.
The following dependencies are being updated:

- `copy-webpack-plugin` from `10.2.4` to `11.0.0`.
- `dotenv` from `16.0.1` to `16.0.2`.
- `dotenv-expand` from `8.0.3` to `9.0.0`.
- `sass` from `1.53.0` to `1.55.0`.
- `sinon-test` from `3.1.3` to `3.1.4`.
- `source-map-loader` from `3.0.1` to `4.0.0`.
- `terser-webpack-plugin` from `5.3.1` to `5.3.6`.
- `uglify-js` from `3.16.1` to `3.17.1`.
- `uuid` from `8.3.2` to `9.0.0`.
- `webpack` from `5.72.0` to `5.74.0`.

This also contains changes after running `npm audit fix`.

Fixes #56641.
Built from https://develop.svn.wordpress.org/trunk@54296


git-svn-id: http://core.svn.wordpress.org/trunk@53855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 19:55:30 +00:00
desrosj
1e41885e42 Build/Test Tools: Update NPM dependencies in default themes, part 2.
Follow up to [54294].

See #56641.
Built from https://develop.svn.wordpress.org/trunk@54295


git-svn-id: http://core.svn.wordpress.org/trunk@53854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 18:53:10 +00:00
desrosj
c07a7f38dd Build/Test Tools: Update NPM dependencies in default themes.
This updates NPM dependencies for all default themes that have them.

See #56641.
Built from https://develop.svn.wordpress.org/trunk@54294


git-svn-id: http://core.svn.wordpress.org/trunk@53853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 18:31:09 +00:00
desrosj
b85b4cb634 Build/Test Tools: Increase the timeout value for MacOS jobs.
The current `timeout-minutes` value of `20` is a bit too short for MacOS jobs in GitHub Actions, which on occasion take a bit longer.

This bumps that limit to `30` to avoid unnecessarily flagging a job as stuck.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@54293


git-svn-id: http://core.svn.wordpress.org/trunk@53852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 17:03:08 +00:00
davidbaumwald
1b463c4601 Docs: Correct @see reference to deprecated_function_run in the _deprecated_function docblock.
In the docblock for `_deprecated_function`, there is a `@see` reference to the `deprecated_function_run` hook run inside `_deprecated_function`.  However, the `@see` reference includes the word "hook" inside the quotes which is generating a bad link at https://developer.wordpress.org/reference/functions/_deprecated_function/.

This change simply moves the word "hook" outside the `@see` reference to correct the link parsing on https://developer.wordpress.org.

Props Camwynsp, kebbet, SergeyBiryukov, hilayt24.
Fixes #56625.
Built from https://develop.svn.wordpress.org/trunk@54292


git-svn-id: http://core.svn.wordpress.org/trunk@53851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 16:20:09 +00:00
Sergey Biryukov
8cb55f5451 Block Editor: Remove repetitive calls to file_get_contents() in block editor settings.
The `get_default_block_editor_settings()` function used to repeatedly get the `default-editor-styles.css` file contents without any implementation to avoid this.

This commit utilizes a static variable to remove repetitive calls made during the same request. In tests ran on the front page of a site using Xdebug & Webgrind, the total `file_get_contents()` invocation count goes down from 181 to 93, and total self cost (the time that the function is responsible for) goes down from 160 ms to 93 ms.

Follow-up to [52042].

Props aristath, mukesh27.
Fixes #56637.
Built from https://develop.svn.wordpress.org/trunk@54291


git-svn-id: http://core.svn.wordpress.org/trunk@53850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 14:00:09 +00:00
Sergey Biryukov
4d6518c2d5 Blocks: Remove duplicate use of realpath() in register_block_style_handle().
The `register_block_style_handle()` function called `realpath()` when retrieving the normalized style path, and then a few lines below that, recalculated the exact same value, running `realpath()` again.

This commit removes duplicate calculations, reducing the number of `realpath()` calls in the function by half. In tests ran using Xdebug & Webgrind, the total `realpath()` invocation count goes down from 639 to 461, and total self cost (the time that the function is responsible for) goes down from 146 ms to 89 ms.

Follow-up to [48141], [52291], [53091], [54155].

Props aristath.
Fixes #56636.
Built from https://develop.svn.wordpress.org/trunk@54290


git-svn-id: http://core.svn.wordpress.org/trunk@53849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 13:26:09 +00:00
gziolo
d963f95253 Build: Improve how combined assets are generated
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows.

Improvements included:
- generate combined asset files for both production and development
- store in the repository only the production version of the combined assets for packages, we use everything else only in development
- to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code

Props bernhard-reiter, jsnajdr, clorith, wildworks.
Fixes #56615.


Built from https://develop.svn.wordpress.org/trunk@54289


git-svn-id: http://core.svn.wordpress.org/trunk@53848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 08:27:12 +00:00
jorgefilipecosta
d8525e93c0 REST API: Fix check for has_archive inclusion.
Props dlh, audrasjb, mukesh27.
Fixes #56618.
Built from https://develop.svn.wordpress.org/trunk@54288


git-svn-id: http://core.svn.wordpress.org/trunk@53847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 11:33:13 +00:00
Sergey Biryukov
574cedca42 Docs: Use typed array notation for the $locales parameter in plugin update filters.
The value comes from `get_available_languages()`, which returns an array of strings.

This affects:
* `plugins_update_check_locales` filter.
* `update_plugins_{$hostname}` filter.

Follow-up to [36630], [46660], [50921], [53933], [54284].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@54287


git-svn-id: http://core.svn.wordpress.org/trunk@53846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 11:13:14 +00:00
audrasjb
a9e5a09bcc Docs: Fix prev_text and next_text parameters type in paginate_links().
Props gabri3lmarques, maximemeganck.
Fixes #56622.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@54286


git-svn-id: http://core.svn.wordpress.org/trunk@53845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 09:26:15 +00:00
John Blackbourn
f6fc33d81b Docs: Remove a change that needs to instead be applied in the Gutenberg repo.
See https://github.com/WordPress/gutenberg/pull/44342

See #55646

Built from https://develop.svn.wordpress.org/trunk@54285


git-svn-id: http://core.svn.wordpress.org/trunk@53844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 20:57:12 +00:00
John Blackbourn
f7dc68f99a Docs: Updates and corrections to various inline docs added in 6.1.
See #55646

Built from https://develop.svn.wordpress.org/trunk@54284


git-svn-id: http://core.svn.wordpress.org/trunk@53843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 20:24:12 +00:00
desrosj
9bc97dca8c Network and Sites: Move global_terms_enabled() to its proper final resting place.
When initially deprecated in [54240], `global_terms_enabled()` was incorrectly moved to the `wp-includes/ms-deprecated.php` file. This file is only loaded for multisite installs.

The function previously lived in `wp-includes/functions.php`, which is loaded for all sites. The proper deprecated file is `wp-includes/deprecated.php`.

Props vikasprogrammer, davidbaumwald, courane01, desrosj.
Fixes #21734.
Built from https://develop.svn.wordpress.org/trunk@54283


git-svn-id: http://core.svn.wordpress.org/trunk@53842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 19:48:13 +00:00
davidbaumwald
685acca99c Post WordPress 6.1 Beta 1 version bump.
Built from https://develop.svn.wordpress.org/trunk@54282


git-svn-id: http://core.svn.wordpress.org/trunk@53841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 17:03:09 +00:00
davidbaumwald
4f7cfb7b83 WordPress 6.1 Beta 1.
Built from https://develop.svn.wordpress.org/trunk@54281


git-svn-id: http://core.svn.wordpress.org/trunk@53840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 16:27:12 +00:00
jorgefilipecosta
292636ff72 Editor: Make template names and descriptions dynamic.
Backports PHP changes in WordPress/gutenberg#43862 to the core. Adds a mechanism to dynamically compute names and descriptions of the author, page, single, tag, category, and taxonomy templates.

Props mcsf, ntsekouras, antonvlasenko, jameskoster.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54280


git-svn-id: http://core.svn.wordpress.org/trunk@53839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:45:12 +00:00
joedolson
a8b79b2250 Media: Fix JS TypeError with video playlists and native video.
Verify that the `resized` property exists on a video in the playlist before attempting to read it. Prevent a TypeError from being thrown and breaking the playlist if a video type requires native video support.

Props afercia, here.
Fixes #47513.
Built from https://develop.svn.wordpress.org/trunk@54279


git-svn-id: http://core.svn.wordpress.org/trunk@53838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:30:14 +00:00
davidbaumwald
0f97ff203b Shortcodes: Revert default filter callback changes from apply_shortcodes to do_shortcode.
[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004].  Default filter callbacks that used `do_shortcode` were also updated to use `apply_shortcodes`.  However, this introduced a backward-compatibility break because any attempt to unhook a filter using the previous `do_shortcode` callback would be futile.

This change reverts only the filter callback changes in [54248] to resolve the backward-compatibility break.

Follow-up to [47004] and [54248].

Props ocean90, SergeyBiryukov.
See #55883.
Built from https://develop.svn.wordpress.org/trunk@54278


git-svn-id: http://core.svn.wordpress.org/trunk@53837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:06:12 +00:00
desrosj
b82e57f204 Build/Test Tools: Temporarily allow the NPM testing workflow to fail.
This changes the Test NPM GitHub Action workflow to temporarily allow the job validating build tools on Windows to fail.

When the `build:dev` Grunt task is run on Windows, the resulting hashes calculated by Webpack are different than other platforms. This seems to be related to how the `remove-accents` dependency is read and processed during the build script.

Since a Windows machine is not used to build WordPress on the build server, this will only affect local development installs for Windows contributors. While this is investigated, this workflow job can be allowed to fail.

Props bernhard-reiter, desrosj, Clorith, gziolo.
See #56615.
Built from https://develop.svn.wordpress.org/trunk@54277


git-svn-id: http://core.svn.wordpress.org/trunk@53836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 14:28:14 +00:00
Sergey Biryukov
f092e4b013 Editor: Improve block loading PHP performance.
This commit improves PHP performance for core blocks by reading a single PHP file with block metadata, instead of reading a JSON file per-block and then decoding from JSON to PHP.

Includes:
* Adding a new Grunt task to convert `block.json` files to `block-json.php`.
* Using the new `block-json.php` file in the `register_block_type_from_metadata()` function.

Follow-up to [48141].

Props aristath, gziolo, johnbillion, presstoke, mukesh27, hellofromTonya, petitphp, adamsilverstein, costdev, desrosj, SergeyBiryukov.
Fixes #55005.
Built from https://develop.svn.wordpress.org/trunk@54276


git-svn-id: http://core.svn.wordpress.org/trunk@53835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 13:57:21 +00:00
hellofromTonya
bb11a85be0 Docs: Fix wp_get_layout_style() parameter documentation.
* Changed `boolean` to `bool`.
* Added `Optional.` and `Default` for each optional parameter.
* Improved `@return` documentation to include empty string.

Follow-up to [54274], [53421], [53085], [52069].

Props mukesh27, hellofromTonya.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54275


git-svn-id: http://core.svn.wordpress.org/trunk@53834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 13:42:09 +00:00
hellofromTonya
04166db031 Editor: Improves layout block support in wp_get_layout_style().
This commit merges the remaining changes from [https://github.com/WordPress/gutenberg/pull/40875 Gutenberg PR 40875]. It's Part 2 (see [54162] for Part 1) of a layout improvement initiative and targets `wp_get_layout_style()` in `layout.php`.

Context:
The overall initiative is to improve layout block support:
>to use centralised layout definitions, output base layout styles from global styles, introduce a layout type semantic classname, reduce duplication of container class and style tag output, and fix blockGap at the block level in global styles.

Changes include:
* Adding an optional parameter `$block_spacing` to `wp_get_layout_style()` for setting a custom spacing on the block.
* Adding handle for the block spacing.
* Using the style engine to to enqueue and render layout styles via `wp_style_engine_get_stylesheet_from_css_rules()`.
* Introduces a new test file for `wp_get_layout_style()`.

Follow-up to [54162], [54160], [54159], [53421], [52380], [53085], [52069].

Props andrewserong, isabel_brison, costdev, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54274


git-svn-id: http://core.svn.wordpress.org/trunk@53833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 13:02:09 +00:00
jorgefilipecosta
73cf7271bc Editor: Add has_archive property to the post types REST endpoint.
Backports PHP changes in WordPress/gutenberg#42746 to the core. Adds a has_archive field to the post types endpoint.

Props mcsf, ntsekouras, oandregal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54273


git-svn-id: http://core.svn.wordpress.org/trunk@53832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 12:29:13 +00:00
audrasjb
325e60a744 Editor: Introduce spacing presets in global style properties.
This changeset is part of the Gutenberg changes merged into WP 6.1. It adds spacing presets support in global style properties.

Follow-up to [54211].

Props glendaviesnz, andrewserong, costdev, audrasjb, mukesh27.
See #56467.

Built from https://develop.svn.wordpress.org/trunk@54272


git-svn-id: http://core.svn.wordpress.org/trunk@53831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 11:43:13 +00:00
Peter Wilson
2d21751903 Posts, Post Types: Fix WP_Query parameter used by get_page_by_title().
Fixes the call to `WP_Query` within `get_page_by_title()` by using the correct title parameter, `title`.

Modify the `orderby` parameter to prioritize the oldest published date over the smallest post ID. This ensures the behaviour matches that of the previous version of `get_page_by_title()`.

The tests have been modified to include a populated post table to ensure the posts returned are matched by design rather than coincidence.

Follow up to [54234].

Props dd32, timothyblynjacobs, peterwilsoncc.
Fixes #56609.
See #36905.


Built from https://develop.svn.wordpress.org/trunk@54271


git-svn-id: http://core.svn.wordpress.org/trunk@53830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 05:29:09 +00:00
Peter Wilson
a0cefe8a20 Themes: Relocate actions firing prior to and after template loading.
This relocates the actions `wp_before_load_template` and `wp_after_load_template` to fire within the `load_template()` function.

Prior to this change the actions fired in the `locate_template()` function.

Follow up to [53560].

Props johnjamesjacoby, johnbillion.
Fixes #54541.


Built from https://develop.svn.wordpress.org/trunk@54270


git-svn-id: http://core.svn.wordpress.org/trunk@53829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 01:09:10 +00:00
hellofromTonya
3b68d37905 Editor: Adds template types, is_wp_suggestion, and fallback template content.
This commit improves site editor templates by:

* Adds a post meta `is_wp_suggestion` to templates created from the site editor.

Why? To differentiate the templates created from the post editor in the Template panel in inspector controls and the templates suggested in site editor.

See [https://github.com/WordPress/gutenberg/pull/41387 Gutenberg PR 41387] for more details.

* Expands the template types that can be added to the site editor to include single custom post type and specific posts templates.

See [https://github.com/WordPress/gutenberg/pull/41189 Gutenberg PR 41189] for more details.

* Adds fallback template content on creation in site editor:
   * Introduces `get_template_hierarchy()` to get the template hierarchy for a given template slug to be created.
   * Adds a `lookup` route to `WP_REST_Templates_Controller` to get the fallback template content.

See [https://github.com/WordPress/gutenberg/pull/42520 Gutenberg PR 42520] for more details.

* Fixes a typo in default category template's description within `get_default_block_template_types()`.

See [https://github.com/WordPress/gutenberg/pull/42586 Gutenberg PR 42586] for more details.

* Changes field checks from `in_array()` to `rest_is_field_included()` in `WP_REST_Post_Types_Controller`.
* Adds an `icon` field to `WP_REST_Post_Types_Controller`

Follow-up to [53129], [52331], [52275], [52062], [51962], [43087].

Props ntsekouras, spacedmonkey, mamaduka, mburridge, jameskoster, bernhard-reiter, mcsf, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54269


git-svn-id: http://core.svn.wordpress.org/trunk@53828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 21:21:09 +00:00
audrasjb
f2b9a6c546 Help/About: Remove an unwanted whitespace in a Theme Install screen help tab string.
Follow-up to [54252].

Props kebbet.
Fixes #56405.

Built from https://develop.svn.wordpress.org/trunk@54268


git-svn-id: http://core.svn.wordpress.org/trunk@53827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 21:14:09 +00:00
John Blackbourn
c117e5ae74 Docs: Various improvements and corrections to inline docs.
See #55646

Built from https://develop.svn.wordpress.org/trunk@54267


git-svn-id: http://core.svn.wordpress.org/trunk@53826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 20:32:09 +00:00