47236 Commits

Author SHA1 Message Date
Jorge Costa
620760e1c1 Add: Template types to the patterns API.
Backports https://github.com/WordPress/gutenberg/pull/45814 into the core.
This commit adds a new templateType property to the patterns registration API.
This property allows a pattern to specify which template it makes sense on, e.g.: 404, single-post, single-product, category.

Props youknowriad, ntsekouras, 
spacedmonkey.

git-svn-id: https://develop.svn.wordpress.org/trunk@55168 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 16:47:58 +00:00
Jorge Costa
aaf0a3366c Update: Improve performance of gutenberg_render_layout_support_flag.
Backports https://github.com/WordPress/gutenberg/pull/46074 into the core.
render_layout_support_flag is run per block, and inside we called get_global_settings three times. get_global_settings calls get_merged_data, which is costly. render_layout_support_flag is a filter called during the block render. When the blocks start rendering, there is no expectation that the theme.json settings change during the block render, so the settings and their derived information should all be static information of this function.
This simple change removes 3*NUMBER_OF_BLOCKS calls of get_merged_data to just one call.

Props oandregal, aristath, felixarntz, tellthemachines, andrewserong, aaronrobertshaw, aaronrobertshaw.

git-svn-id: https://develop.svn.wordpress.org/trunk@55167 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 15:22:33 +00:00
Sergey Biryukov
3ed5f38a4d Docs: Fix typo in the send_auth_cookies filter DocBlock.
Follow-up to [55164], [55165].

See #56971, #39367.

git-svn-id: https://develop.svn.wordpress.org/trunk@55166 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 12:18:52 +00:00
Sergey Biryukov
4c926bf77c Docs: Remove a duplicate line in the send_auth_cookies filter DocBlock.
Describe the default values for the `$send` and `$expire` parameters.

Follow-up to [55164].

See #56971, #39367.

git-svn-id: https://develop.svn.wordpress.org/trunk@55165 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 12:16:23 +00:00
Jb Audras
186abb264d Users: Add context to the send_auth_cookies filter.
This changeset adds `$user_id`, `$expire`, `$expiration` and `$token` parameters to provide context to `send_auth_cookies` hook, which allows the filter to skip sending auth cookies.

Props dd32, mukesh27, costdev, peterwilsoncc, audrasjb.
Fixes #56971.
See #39367.


git-svn-id: https://develop.svn.wordpress.org/trunk@55164 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 08:44:58 +00:00
Sergey Biryukov
b74cfa8dd9 Code Modernization: Allow some parameters with reserved keywords in wp-includes/class-wp-text-diff-renderer-*.php.
This commit adds inline comments instructing PHPCS to ignore parameters with reserved keywords in the affected methods that should not be renamed:
* `$string` parameter in `WP_Text_Diff_Renderer_inline::_splitOnWords()`
* `$final` parameter in `WP_Text_Diff_Renderer_Table::_changed()` and `::interleave_changed_lines()`

This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function parameter name. Found: $string
It is recommended not to use reserved keyword "final" as function parameter name. Found: $final
}}}

The two `WP_Text_Diff_Renderer_*` classes in question extend the `Text_Diff_Renderer_inline` and `Text_Diff_Renderer` classes from the `Text_Diff` package and should have the same parameters as the parent class methods, per the Task 1 section of ticket #51553.

The `Text_Diff` library currently included in WordPress core is no longer kept in sync with the upstream project and can be considered “adopted”, so the `$string` and `$final` parameters in the  parent class methods can technically be renamed, e.g. to `$input_string` and `$modified`, respectively.

However, the “final” wording is also used to represent modified content in other parts the library, so it is more internally consistent to keep these parameters as is for now.

Follow-up to [7747], [38352], [55136].

See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55163 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-30 15:22:17 +00:00
Sergey Biryukov
51e9aed3b7 Code Modernization: Rename parameters that use reserved keywords in wp-includes/formatting.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 `$class` parameter to `$classname` in `sanitize_html_class()`.

Follow-up to [54927].

See also: [search:?q=code+modernization+rename+parameters+that+use+reserved+keywords&changeset=on equivalent commits for other files].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55162 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-30 14:13:49 +00:00
Pascal Birchler
bce2a0a534 I18N: Introduce switch_to_user_locale().
This new function makes it easier to switch to a specific user’s locale by reducing duplicate code and storing the user’s ID as additional context for plugins to consume. Existing usage of `switch_to_locale()` in core has been replaced with `switch_to_user_locale()` where appropriate.

Also, this change ensures `WP_Locale_Switcher` properly filters `determine_locale` so that anyyone using the `determine_locale()` function will get the correct locale information when switching is in effect.

Props costdev.
Fixes #57123.
See #26511.

git-svn-id: https://develop.svn.wordpress.org/trunk@55161 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-30 10:25:53 +00:00
Sergey Biryukov
3b4132d6c0 Build/Test Tools: Back up and restore the $wp_filters global when running tests.
Introduced along with the `did_filter()` function, the `$wp_filters` global stores the number of times each filter has been applied during the current request.

This commit adds `$wp_filters` to the list of globals that are saved in `WP_UnitTestCase_Base::_backup_hooks()` and restored in `::_restore_hooks()` so that hooks set by the current test do not accidentally affect future tests.

Additionally, this commit brings some consistency by backing up and restoring the hook-related globals in the same order they are defined in `wp-includes/plugin.php`.

Follow-up to [29251], [53803].

Props sanjucta, SergeyBiryukov.
Fixes #57236.

git-svn-id: https://develop.svn.wordpress.org/trunk@55160 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-29 16:24:02 +00:00
Jb Audras
533b9b10de Media: Deprecate unused method WP_Media_List_Table::column_desc().
This changeset formally deprecates the `column_desc()` method from `WP_Media_List_Table`, as it was never used anywhere in core.

Props iandunn, JeffMatson, antpb, costdev, audrasjb.
Fixes #39710.


git-svn-id: https://develop.svn.wordpress.org/trunk@55159 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-28 22:15:16 +00:00
Sergey Biryukov
fcea1a91c8 Database: Replace substr_compare() usage with substr() in wpdb::prepare().
This amends the previous commit to avoid a warning on PHP < 7.2.18 if haystack is an empty string:
{{{
Warning: substr_compare(): The start position cannot exceed initial string length
}}}

Follow-up to [55151], [55157].

See #52506.

git-svn-id: https://develop.svn.wordpress.org/trunk@55158 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-28 20:56:10 +00:00
Sergey Biryukov
d64680e98d Database: Replace str_ends_with() usage in wpdb::prepare().
This avoids a fatal error if the file is included directly outside of WordPress core, e.g. by HyperDB.

While WordPress core does include a polyfill function, it is not directly loaded in the `wpdb` class.

This commit replaces the `str_ends_with()` calls with `substr_compare()` for now.

Follow-up to [55151].

Props Otto42.
See #52506.

git-svn-id: https://develop.svn.wordpress.org/trunk@55157 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-28 13:46:16 +00:00
Joe Dolson
999f02218b Media: Add download link to media modal and attachment details.
Make it easier for users to download their uploaded media by providing a download link on the attachment details screen and in the media modal.

Props countrymusicchicago, joedolson, amin7
Fixes #41474.

git-svn-id: https://develop.svn.wordpress.org/trunk@55156 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 23:05:35 +00:00
Felix Arntz
1b1fa72384 Editor: Use a non-persistent object cache in wp_get_global_settings().
This changeset is part of a greater effort to enhance the caching strategy for `theme.json` based data. Similar to [55138] and [55148], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

This addition of a non-persistent cache results in a significant performance improvement for the overall load time of WordPress, with the Server-Timing load metric being ~8% faster and Time to First Byte being 25+% faster than before.

Props oandregal, spacedmonkey, hellofromtonya, flixos90, azaozz, aristath.
Fixes #57502.


git-svn-id: https://develop.svn.wordpress.org/trunk@55155 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 22:12:37 +00:00
Adam Silverstein
30175c97ac Revisions: only create autosave when content changed.
In the autosave REST API endpoint, avoid excessive database writes when an autosave is sent with content that is unchanged from the saved post. 

Before this fix, clicking "preview" in the editor (which uses the autosave feature) multiple times would cause an identical autosave entry to be deleted and re-created repeatedly.

Props inwerpsel, aduth, mukesh27, ironprogrammer.
Fixes #49532.



git-svn-id: https://develop.svn.wordpress.org/trunk@55154 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 22:01:59 +00:00
David Baumwald
ece2e850ca Tests: Resolve some line endings issues in blocks/renderCommentTemplate.php on Windows machines.
This change resolves a unit test failure in `Tests_Blocks_RenderReusableCommentTemplate::test_rendering_comment_template_nested()` on systems using `\r\n` line endings.

Props SergeyBiryukov.
See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@55153 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 20:49:15 +00:00
Jonathan Desrosiers
b6f9fff7c3 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party GitHub Actions to their latest versions.

- `actions/cache`
- `actions/checkout`
- `actions/upload-artifact`
- `actions/setup-node`
- `actions/setup-php`
- `actions/github-script`

See #57572.

git-svn-id: https://develop.svn.wordpress.org/trunk@55152 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 19:23:20 +00:00
David Baumwald
ab7f91562d Database: Add %i placeholder support to $wpdb->prepare to escape table and column names, take 2.
[53575] during the 6.1 cycle was reverted in [54734] to address issues around multiple `%` placeholders not being properly quoted as reported in #56933.  Since then, this issue has been resolved and the underlying code improved significantly.  Additionally, the unit tests have been expanded and the inline docs have been improved as well.

This change reintroduces `%i` placeholder support in `$wpdb->prepare()` to give extenders the ability to safely escape table and column names in database queries.

Follow-up to [53575] and [54734].

Props craigfrancis, jrf, xknown, costdev, ironprogrammer, SergeyBiryukov.
Fixes #52506.

git-svn-id: https://develop.svn.wordpress.org/trunk@55151 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 18:47:53 +00:00
Jonathan Desrosiers
94ea12b60c Build/Test Tools: Update PostCSS to version 8.
This updates PostCSS related dependencies for the main Core build process to versions that use the latest major version of PostCSS, 8.x.

There were no changes to any versioned CSS files as a result of this update directly. However, two occurrences of `-o-tab-size` have been removed due to the version of `caniuse-lite` used being updated in the process.

See #57554, #57555.

git-svn-id: https://develop.svn.wordpress.org/trunk@55150 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 15:53:15 +00:00
Sergey Biryukov
c86eb190ab Themes: Add "Style Variations" to the list of WordPress theme features.
Follow-up to [meta12372].

Props poena, mukesh27, costdev.
Fixes #56869. See #meta6545.

git-svn-id: https://develop.svn.wordpress.org/trunk@55149 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-27 15:52:56 +00:00
Felix Arntz
dd33e32767 Editor: Use a non-persistent object cache instead of transient in wp_get_global_stylesheet().
This changeset is part of a greater effort to enhance the caching strategy for `theme.json` based data. Similar to [55138], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props oandregal, spacedmonkey, hellofromtonya, flixos90, ironprogrammer, azaozz, aristath, costdev, mcsf.
Fixes #56910.


git-svn-id: https://develop.svn.wordpress.org/trunk@55148 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-26 23:01:10 +00:00
Tonya Mork
e2b5177e7c Editor: Add is block theme setting to get_block_editor_settings().
The block editor's iframe needs to know if the theme is a block theme. This changeset adds a setting to `get_block_editor_settings()`.

Reference:
* https://github.com/WordPress/gutenberg/pull/46212

Props ellatrix, alexstine, costdev, dgwyer, glendaviesnz, scruffian.
Fixes #57549.

git-svn-id: https://develop.svn.wordpress.org/trunk@55147 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-26 19:59:16 +00:00
Felix Arntz
1df9b8acf4 Themes: Avoid unnecessary database queries from get_default_block_editor_settings() in WP_Theme_JSON_Resolver::get_theme_data().
The `get_default_block_editor_settings()` function included several pieces of data that are irrelevant for the purpose that `WP_Theme_JSON_Resolver` was calling it for, yet resulted in three database queries on page load that can be avoided.

This changeset introduces a new function `get_classic_theme_supports_block_editor_settings()` to takes responsibility of only the data needed in `WP_Theme_JSON_Resolver`, which now uses that function. This leads to a reduction of database queries and accordingly a performance improvement.

Props mamaduka, spacedmonkey, oandregal, flixos90, audrasjb, mukesh27.
Fixes #57547.


git-svn-id: https://develop.svn.wordpress.org/trunk@55146 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-26 18:37:47 +00:00
Sergey Biryukov
d1f3f85f0f Coding Standards: Bring some consistency to the order of attributes in password fields.
Follow-up to [11359], [13592], [13696], [33023], [33246], [33353], [41556], [46256], [49248], [53111], [55094].

See #56791.

git-svn-id: https://develop.svn.wordpress.org/trunk@55145 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-26 18:10:54 +00:00
Tonya Mork
8ca206a849 Docs: Update $types param for wp_get_global_stylesheet().
In 6.1.0, the values the `$types` parameter accepts changed to include `'base-layout-styles'`.

This commit updates the DocBlock to reflect this change and provide clear information of what the function will load if no types are passed to it.

Reference:
* https://github.com/WordPress/gutenberg/pull/46817

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

Props oandregal, jorgefilipecosta , ntsekouras.
Fixes #57563.
See #56792.

git-svn-id: https://develop.svn.wordpress.org/trunk@55144 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-26 17:21:41 +00:00
Felix Arntz
bce22ebbf8 Bootstrap/Load: Avoid initializing WP_Recovery_Mode when fatal error handler is disabled.
The WordPress recovery mode only works in combination with the fatal error handler that works as the entry mode for recovery mode. The fatal error handler can be disabled using the `WP_DISABLE_FATAL_ERROR_HANDLER` constant, but so far the logic in the `WP_Recovery_Mode` class was still being initialized even when that constant was set to `true`, which is unnecessary.

This changeset updates the WordPress bootstrap process to only initialize `WP_Recovery_Mode` when needed.

Props costdev.
Fixes #56848.


git-svn-id: https://develop.svn.wordpress.org/trunk@55143 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-26 00:05:05 +00:00
Felix Arntz
9356d97222 Editor: Fix undefined variable following [54805].
Props mamaduka, costdev, mukesh27.
See #56974, #57067.


git-svn-id: https://develop.svn.wordpress.org/trunk@55142 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 22:07:47 +00:00
Tonya Mork
ca90afc1f8 Editor: Remove WP_DEBUG defined check in wp_tinycolor_hue_to_rgb().
The constant `WP_DEBUG` is a default constant that is set within `wp_initial_constants()` when not defined. This means the constant will always be defined, thus making the `defined( 'WP_DEBUG' )` unnecessary.

Removing the `defined()` provides these benefits:
* Makes the code more readable.
* Tiny performance optimization.

References:
* https://github.com/WordPress/gutenberg/pull/45979

Follow-up to [52049].

Props ocean90, spacedmonkey, mamaduka.
See #57527. 

git-svn-id: https://develop.svn.wordpress.org/trunk@55141 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 21:54:43 +00:00
Tonya Mork
616f0bca52 Editor: Use in/decrementors in wp_tinycolor_hue_to_rgb().
Replaces `+=` and `-=` with `++$t` and `--$t` (in/decrementors) within the `wp_tinycolor_hue_to_rgb()`. 

Why? For performance: in/decrementors are more performant than an assignment with a calculation.

References:
* https://www.php.net/manual/en/language.operators.increment.php
* https://github.com/WordPress/gutenberg/pull/44551

Follow-up to [50929].

Props jrf, czapla, antonvlasenko, aristath, mamaduka.
See #57527. 

git-svn-id: https://develop.svn.wordpress.org/trunk@55140 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 21:41:00 +00:00
Jonathan Desrosiers
0c8c4f89a3 Build/Test Tools: Revert [55137].
This changeset resulted in some unexpected JavaScript validation failures.

See #57555.

git-svn-id: https://develop.svn.wordpress.org/trunk@55139 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 20:20:15 +00:00
Tonya Mork
f8bdacb6fc Themes: Add static cache variable to wp_theme_has_theme_json().
For performance, a static variable is added to `wp_theme_has_theme_json()` to cache the boolean result of determining if a theme (or its parent) has a `theme.json` file. 

This cache avoids the overhead of calling `get_stylesheet_directory()` and `get_template_directory()` each time `wp_theme_has_theme_json()` is invoked.

The cache is lean, non-persistent, and encapsulated within the function (i.e. function scope and not available externally).

The cache is ignored when:
* `WP_DEBUG` is on to avoid interrupting theme developer's workflow and for extender automated test suites.
* `WP_RUN_CORE_TESTS` is on to ensure each Core test exercises the checking code.

Follow-up to [55092], [55086].

Props oandregal, azaozz, costdev, dmsnell, flixos90, hellofromTonya, Otto42, spacedmonkey.
Fixes #56975.

git-svn-id: https://develop.svn.wordpress.org/trunk@55138 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 19:36:58 +00:00
Jonathan Desrosiers
26ca958e2a Build/Test Tools: Update caniuse-lite to the latest version.
This updates the `caniuse-lite` database from `1.0.30001407` to `1.0.30001448` and applies the resulting changes to generated WP Admin CSS.

This removes two occurrences of `-o-tab-size`, which was required for partial support of the `tab-size` property in Opera Mini. Usage has dropped below 1%, hence this vendor prefix being removed.

See #57555.

git-svn-id: https://develop.svn.wordpress.org/trunk@55137 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 19:13:35 +00:00
Sergey Biryukov
01623b164c Coding Standards: Allow some parameters with reserved keywords in wp-includes/compat.php.
Parameter names for PHP polyfills in WordPress core need to 100% match the native PHP parameter names. Otherwise using named parameters with those functions could cause fatal errors for installations where the polyfills kick in.

This commit adds inline comments instructing PHPCS to ignore parameters with reserved keywords in the affected functions that should not be renamed:
* `$string` parameter in `mb_substr()` and `mb_strlen()`
* `$array` parameter in `array_key_first()` and `array_key_last()`

This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function parameter name. Found: $string
}}}

Follow-up to [7140], [10707], [17603], [17621], [32114], [52038], [53365].

Props jrf.
See #56788, #56791.

git-svn-id: https://develop.svn.wordpress.org/trunk@55136 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-25 01:38:59 +00:00
Jb Audras
cb5d5be4ca Menus: Add missing escaping function in Admin Menu walker.
Props aniketpatel, mukesh27, costdev.
Fixes #57541.


git-svn-id: https://develop.svn.wordpress.org/trunk@55135 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 21:30:42 +00:00
Jb Audras
4643bb45e0 Code Modernization: Fix a JS error in wpdialog.
This changeset replaces `this.element._trigger('focus');` with `this.element.trigger('focus');` in `wpdialog` to fix a JS error introduced in [55052].

Indeed, `this` inside the `open()` function of `wpdialog` refers to the jQuery UI widget, whereas `this.element` is the jQuery object of the DOM element. Thus, native jQuery methods need to be used, as `_trigger` is only defined on the jQuery UI widget.

Follow-up to [55052].

Props TobiasBg, audrasjb, shubham1gupta.
Fixes #56830.


git-svn-id: https://develop.svn.wordpress.org/trunk@55134 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 21:11:47 +00:00
Tonya Mork
e4ccebf2d7 Editor: Adds 'settings.typography.fluid.minFontSize' support to wp_get_typography_font_size_value().
In `wp_get_typography_font_size_value()`, adds support for using a minimum font size for fluid typography when defined in a theme's `theme.json` file.

Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/42489 Gutenberg PR 42489]

Follow-up to [54497], [54260].

Props andrewserong, ramonopoly, hellofromTonya, joen.
Fixes #57529.

git-svn-id: https://develop.svn.wordpress.org/trunk@55133 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 20:38:25 +00:00
Tonya Mork
119ec3240e Editor: Adds pagination and ordering support to WP_REST_Pattern_Directory_Controller.
Adds pagination and ordering support to `WP_REST_Pattern_Directory_Controller` by allow listing `'per_page'`, `'page'`, `'offset'`, `'order'`, and `'orderby'` query parameters. This change enables pagination and ordering features in the pattern directory explorer by using the same sort as wordpress.org/patterns.

Reference:
* [https://github.com/WordPress/gutenberg/pull/45293 Gutenberg PR 45293]

Follow-up to [55098], [51206], [51021].

Props ntsekouras, ryelle, arrasel403, hellofromTonya, ironprogrammer, mukesh27, robinwpdeveloper.
Fixes #57501.

git-svn-id: https://develop.svn.wordpress.org/trunk@55132 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 16:52:42 +00:00
Sergey Biryukov
1f28106a14 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/kses.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 `$global` parameter to `$global_name` in `Tests_Kses::test_kses_globals_are_defined()`.

Follow-up to [52229], [54203], [55090].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55131 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 16:03:26 +00:00
Sergey Biryukov
b1363cc7fe Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/functions/wpRefererField.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 `$echo` parameter to `$display` in `Tests_Functions_wpRefererField::test_wp_referer_field_should_respect_display_arg()`.

Follow-up to [54420], [54929].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55130 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 15:53:46 +00:00
Sergey Biryukov
662b151d44 Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-theme-json.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 `WP_Theme_JSON::get_metadata_boolean()`.

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], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120], [55126], [55127].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55129 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 15:43:53 +00:00
Sergey Biryukov
29c6bca953 Docs: Add missing @since tag for WP_Theme_JSON_Resolver::remove_json_comments().
Follow-up to [54162].

See #56792.

git-svn-id: https://develop.svn.wordpress.org/trunk@55128 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 15:39:31 +00:00
Sergey Biryukov
0ab59b1bdb Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-theme-json-resolver.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 `$array` parameter to `$input_array` in `WP_Theme_JSON_Resolver::remove_json_comments()`.

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], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120], [55126].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55127 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 15:35:59 +00:00
Sergey Biryukov
6bb9cf4751 Code Modernization: Rename parameters that use reserved keywords in wp-includes/blocks.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 `block_has_support()`.

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], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55126 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 14:40:47 +00:00
Tonya Mork
2bcd6390b2 Editor: Migrate old to the new pattern categories.
Adds a new non-public `WP_REST_Block_Patterns_Controller::migrate_pattern_categories()` method to automatically migrate existing content's pattern categories to the new ones introduced in [55098].

Old to  New
`'buttons'` to `'call-to-action'`
`'columns'` to `'text'`
`'query'`   to `'posts'`

Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/46144 Gutenberg PR 46144]

Follow-up to [55098], [53152].

Props ntsekouras, annezazu, jameskoster, joen, hellofromTonya, mcsf, paaljoachim, ryelle.
Fixes #57532.

git-svn-id: https://develop.svn.wordpress.org/trunk@55125 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 14:34:10 +00:00
Jb Audras
f7de6aa943 Twenty Twenty-One: Refine primary-navigation.js behavior for anchor links.
This changeset fixes a bug where clicking on an anchor link in the content changes the state of the button that opens and closes the responsive menu. It adds a conditional to check if the clicked anchor link is inside the primary navigation menu (`#site-navigation`), in order to prevent content anchor links from changing the state of the button.

Known limitations: The state of the button is not reset when the browser is resized. If a menu anchor link is first clicked while on desktop width, and the browser width is reduced, the menu button will show the text "Close" even though the menu is not opened.

Props andreaboe, sabernhardt, poena, afercia, chaion07, cu121, mukesh27.
Fixes #53331.


git-svn-id: https://develop.svn.wordpress.org/trunk@55124 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 12:56:13 +00:00
Jb Audras
ac2ddd82f2 Docs: Various improvements in ms-blogs.php function descriptions, as per docblocks standards.
See #56792.


git-svn-id: https://develop.svn.wordpress.org/trunk@55123 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 12:55:14 +00:00
Jb Audras
7db8ca56de Twenty Twenty-Two: Remove color reference from pattern names.
This changeset removes color names from pattern names to make them less opinionated, and avoid mismatching when the user changes related colors. It does not update filenames for now, as they are not directly exposed to end users.

Props poena, mukesh27.
Fixes #56720.


git-svn-id: https://develop.svn.wordpress.org/trunk@55122 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 08:49:47 +00:00
Jb Audras
0ed98f98f2 Themes: Support additional link related pseudo classes in theme.json.
This changeset adds support for `:link` and `:any-link` in `theme.json`, using the `VALID_ELEMENT_PSEUDO_SELECTORS` array. `:link` can be used to style unvisited links and `:any-link` can be used to style any link containing an `href` attribute.

Props peterwilsoncc, whaze, audrasjb, costdev, mukesh27.
Fixes #57053.


git-svn-id: https://develop.svn.wordpress.org/trunk@55121 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-24 08:09:21 +00:00
Sergey Biryukov
0ab4ae8b4c Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/widgets/wpWidgetMedia.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 `$object` parameter to `$widget` in `Tests_Widgets_wpWidgetMedia::filter_widget_mocked_instance()`.

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], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55120 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-23 16:52:36 +00:00
Sergey Biryukov
698c003a64 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/shortcode.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 `$return` parameter to `$output` in:
 * `Tests_Shortcode::filter_pre_do_shortcode_tag_attr()`
 * `Tests_Shortcode::filter_do_shortcode_tag_replace()`
 * `Tests_Shortcode::filter_do_shortcode_tag_generate()`
 * `Tests_Shortcode::filter_do_shortcode_tag_attr()`
* Amends the `$return` parameter of the `pre_do_shortcode_tag` filter for consistency.

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], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

git-svn-id: https://develop.svn.wordpress.org/trunk@55119 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-23 16:33:57 +00:00