Commit Graph

20849 Commits

Author SHA1 Message Date
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
John Blackbourn
0974640a7c Taxonomy: Standardise the format used to describe arguments passed to actions and filters inside wp_insert_term() and wp_update_term().
Props SergeyBiryukov, mboynes

Fixes #55441

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


git-svn-id: http://core.svn.wordpress.org/trunk@53825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 18:53:09 +00:00
antpb
4084c0dd6c Media: Respect EXIF Rotations.
Previously, the logic to determine EXIF rotation information was not providing the correct rotation. This patch respects the information properly by swapping some of the `flip()` logic on certain rotations.

Props tbember, SergeyBiryukov, costdev, mikeschroder, adamsilverstein.
Fixes #54937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 16:59:10 +00:00
desrosj
fbe7454070 Build/Test Tools: Enable debugging when rerunning a failed workflow.
Follow up to [53947], [54039].

Fixes #56407.
Built from https://develop.svn.wordpress.org/trunk@54264


git-svn-id: http://core.svn.wordpress.org/trunk@53823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 16:56:09 +00:00
jorgefilipecosta
d3b0d0f1df Editor: Add post types property to wp-rest-block-patterns-controller.php.
Backports PHP changes in WordPress/gutenberg#41791 to the core. Adds the post types property to the rest API patterns endpoint.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 16:29:12 +00:00
Sergey Biryukov
7049f79f97 Users: Make wp_list_authors() and wp_list_users() filterable.
This commit adds three filters to customize the `wp_list_authors()` and `wp_list_users()` output:

* `wp_list_authors_args`: Filters the query arguments for the list of all authors of the site.
* `pre_wp_list_authors_post_counts_query`: Filters whether to short-circuit performing the query for author post counts. This may be useful to account for custom post types or post statuses. 
* `wp_list_users_args`: Filters the query arguments for the list of all users of the site.

Follow-up to [979], [3848], [5135], [5727], [31653], [52064], [53486], [53501].

Props kevinB, wonderboymusic, DrewAPicture, Mte90, audrasjb, rafiahmedd, costdev, nacin, afercia, chetan200891, hellofromTonya, TimothyBlynJacobs, chaion07, SergeyBiryukov.
Fixes #17025.
Built from https://develop.svn.wordpress.org/trunk@54262


git-svn-id: http://core.svn.wordpress.org/trunk@53821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 16:26:10 +00:00
gziolo
9d0887f112 Chore: Run browserslits update
Follow-up [54257].
See #56467.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 16:02:11 +00:00
hellofromTonya
b29bbddb5f Editor: Introduces fluid typography and uses Style Engine.
This commit introduces fluid typography block supports and switches to use the Style Engine for typography and colors.

The motivation for fluid typography block supports:
>"Fluid typography" describes how a site's font sizes adapt to every change in screen size, for example, growing larger as the viewport width increases, or smaller as it decreases.
>
>Font sizes can smoothly scale between minimum and maximum viewport widths.

Typography changes introduced from Gutenberg:

* Uses the Style Engine to generate the CSS and classnames in `wp_apply_typography_support()`.
* Introduces `wp_typography_get_preset_inline_style_value()` for backwards-compatibility.
* Introduces a private internal function called `wp_get_typography_value_and_unit()`, for checking and getting typography unit and value.
* Introduces a private internal function called  `wp_get_computed_fluid_typography_value()`, for an internal implementation of CSS `clamp()`.
* Deprecates `wp_typography_get_css_variable_inline_style()`.

References:
* [https://github.com/WordPress/gutenberg/pull/40332 WordPress/gutenberg PR 40332] Style Engine: add typography and color to backend
* [https://github.com/WordPress/gutenberg/pull/39529 WordPress/gutenberg PR 39529] Block supports: add fluid typography

Follow-up to [53076], [52302], [52069], [51089], [50761], [49226].

Props ramonopoly, youknowriad, aristath, oandregal, aaronrobertshaw, cbirdsong, jorgefilipecosta, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54260


git-svn-id: http://core.svn.wordpress.org/trunk@53819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 15:47:09 +00:00
Sergey Biryukov
e5935d0436 Bootstrap/Load: Introduce is_*_admin_screen() aliases for is_*_admin() function family.
Following the introduction of `is_login_screen()` in [53884], it is time to reconsider the `is_*_admin()` functions:

* `is_admin()`: Determines whether the current request is for an administrative interface page.
* `is_blog_admin()`: Whether the current request is for a site's administrative interface, e.g. `/wp-admin/`.
* `is_network_admin()`: Whether the current request is for the network administrative interface, e.g. `/wp-admin/network/`.
* `is_user_admin()`: Whether the current request is for a user admin screen, e.g. `/wp-admin/user/`.

For someone new to WordPress, these names can be quite confusing, especially the last one. When using these functions, one always needs to remember that they don't actually check if the current user is a site administrator.

To complicate things further, there is one more similarly named function that does exactly the latter:
* `is_super_admin()`: Determines whether user is a site admin.

With the above in mind, this commit introduces aliases that better match the functionality and allow for more descriptive code:

* `is_admin()` → `is_admin_screen()`
* `is_blog_admin()` → `is_site_admin_screen()`
* `is_network_admin()` → `is_network_admin_screen()`
* `is_user_admin()` → `is_user_admin_screen()`

Additionally, `is_super_admin_user()` is introduced as an alias for `is_super_admin()`:
* `is_super_admin()` → `is_super_admin_user()`

Plugins and themes are encouraged to start using the newer function names to make code self-descriptive and bring more clarity. The older names are not deprecated at this time, though it may be up for discussion in the future.

Follow-up to [2481], [6412], [12393], [12732], [15558], [15481], [15746], [53884].

Props jrf, tobifjellner, SergeyBiryukov.
See #56400.
Built from https://develop.svn.wordpress.org/trunk@54259


git-svn-id: http://core.svn.wordpress.org/trunk@53818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 15:45:49 +00:00
audrasjb
84d1984866 Cron API: Add error logging and hooks to wp-cron.php.
This changeset adds error logging on `wp_reschedule_event()` and `wp_unschedule_event` in `wp-cron.php`. This allows proper error logging when random errors appear. It also introduces `cron_reschedule_event_error` and `cron_unschedule_event_error` hooks which can be used to trigger additional behaviors when an error occurs.

Props Enchiridion, johnbillion, costdev.
Fixes #56048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 15:44:38 +00:00
gziolo
1044eb572a Editor: Sync changes from the Gutenberg plugin 14.1 release
Updated WordPress packages necessary for releasing WordPress 6.1 Beta 1:

- @wordpress/a11y@3.17.1
 - @wordpress/annotations@2.17.2
 - @wordpress/api-fetch@6.14.1
 - @wordpress/autop@3.17.1
 - @wordpress/babel-plugin-import-jsx-pragma@4.0.1
 - @wordpress/babel-plugin-makepot@5.1.1
 - @wordpress/babel-preset-default@7.1.1
 - @wordpress/base-styles@4.8.1
 - @wordpress/blob@3.17.1
 - @wordpress/block-directory@3.15.2
 - @wordpress/block-editor@10.0.2
 - @wordpress/block-library@7.14.2
 - @wordpress/block-serialization-default-parser@4.17.1
 - @wordpress/block-serialization-spec-parser@4.17.1
 - @wordpress/blocks@11.16.2
 - @wordpress/browserslist-config@5.0.1
 - @wordpress/components@21.0.2
 - @wordpress/compose@5.15.2
 - @wordpress/core-data@5.0.2
 - @wordpress/create-block-tutorial-template@2.5.1
 - @wordpress/create-block@4.1.1
 - @wordpress/custom-templated-path-webpack-plugin@2.1.3
 - @wordpress/customize-widgets@3.14.2
 - @wordpress/data-controls@2.17.2
 - @wordpress/data@7.1.2
 - @wordpress/date@4.17.1
 - @wordpress/dependency-extraction-webpack-plugin@4.0.2
 - @wordpress/deprecated@3.17.1
 - @wordpress/docgen@1.26.1
 - @wordpress/dom-ready@3.17.1
 - @wordpress/dom@3.17.2
 - @wordpress/e2e-test-utils@8.1.1
 - @wordpress/e2e-tests@5.1.2
 - @wordpress/edit-post@6.14.2
 - @wordpress/edit-site@4.14.2
 - @wordpress/edit-widgets@4.14.2
 - @wordpress/editor@12.16.2
 - @wordpress/element@4.15.1
 - @wordpress/env@5.2.1
 - @wordpress/escape-html@2.17.1
 - @wordpress/eslint-plugin@13.1.1
 - @wordpress/format-library@3.15.2
 - @wordpress/hooks@3.17.1
 - @wordpress/html-entities@3.17.1
 - @wordpress/i18n@4.17.1
 - @wordpress/icons@9.8.1
 - @wordpress/interface@4.16.2
 - @wordpress/is-shallow-equal@4.17.1
 - @wordpress/jest-console@6.0.1
 - @wordpress/jest-preset-default@9.0.1
 - @wordpress/jest-puppeteer-axe@5.0.1
 - @wordpress/keyboard-shortcuts@3.15.2
 - @wordpress/keycodes@3.17.1
 - @wordpress/lazy-import@1.4.3
 - @wordpress/library-export-default-webpack-plugin@2.3.3
 - @wordpress/list-reusable-blocks@3.15.2
 - @wordpress/media-utils@4.8.1
 - @wordpress/notices@3.17.2
 - @wordpress/npm-package-json-lint-config@4.2.1
 - @wordpress/nux@5.15.2
 - @wordpress/plugins@4.15.2
 - @wordpress/postcss-plugins-preset@4.1.1
 - @wordpress/postcss-themes@5.0.1
 - @wordpress/preferences-persistence@1.9.1
 - @wordpress/preferences@2.9.2
 - @wordpress/prettier-config@2.0.1
 - @wordpress/primitives@3.15.1
 - @wordpress/priority-queue@2.17.2
 - @wordpress/project-management-automation@1.16.1
 - @wordpress/react-i18n@3.15.1
 - @wordpress/readable-js-assets-webpack-plugin@2.0.1
 - @wordpress/redux-routine@4.17.1
 - @wordpress/reusable-blocks@3.15.2
 - @wordpress/rich-text@5.15.2
 - @wordpress/scripts@24.1.2
 - @wordpress/server-side-render@3.15.2
 - @wordpress/shortcode@3.17.1
 - @wordpress/style-engine@1.0.1
 - @wordpress/stylelint-config@21.0.1
 - @wordpress/token-list@2.17.1
 - @wordpress/url@3.18.1
 - @wordpress/viewport@4.15.2
 - @wordpress/warning@2.17.1
 - @wordpress/widgets@2.15.2
 - @wordpress/wordcount@3.17.1


Props bernhard-reiter, cbravobernal, czapla, oandregal, isabel_brison, andrewserong, mciampini.
See #56467.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 15:43:29 +00:00
spacedmonkey
da4456672c Networks and Sites: Store main site id of a network in network options.
Instead of caching main site id an object cache, store main site id on a network options. This results in less database queries on sites without persistent object caching. 

Props spacedmonkey, johnjamesjacoby, peterwilsoncc, desrosj.
Fixes #55802.
Built from https://develop.svn.wordpress.org/trunk@54256


git-svn-id: http://core.svn.wordpress.org/trunk@53815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 14:26:10 +00:00
audrasjb
5dcad0a618 Media: Add caching to wp_count_attachments().
This changeset adds caching to `wp_count_attachments()`, for better consistency with `wp_count_posts()`.

Props jeherve, antpb, mukesh27, robinwpdeveloper, costdev.
Fixes #55227.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 14:22:09 +00:00
Sergey Biryukov
c58963b07f Coding Standards: Rename WordPress Dependencies API class files.
The current coding standards note that the name of the class files should be based on the class name with `class-` prepended, and the underscores replaced by hyphens (see the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions] section in the handbook), except for the three legacy files: `class.wp-dependencies.php`, `class.wp-scripts.php`, `class.wp-styles.php`.

To bring more consistency to the codebase and make it easier to implement autoloading in the future, this commit renames those three legacy files to conform to the coding standards:

* `wp-includes/class.wp-dependencies.php` → `wp-includes/class-wp-dependencies.php`
* `wp-includes/class.wp-scripts.php` → `wp-includes/class-wp-scripts.php`
* `wp-includes/class.wp-styles.php` → `wp-includes/class-wp-styles.php`

Includes:
* Loading the new files from the old ones, for anyone that may have been including the files directly.
* Replacing references to the old filenames with the new filenames.

Follow-up to [7970], [45654], [45662], [45663], [45678], [47197], [52026], [53749].

Props afragen, schlessera, swissspidy, dingo_d, hellofromTonya, SergeyBiryukov.
Fixes #37861. See #55647.
Built from https://develop.svn.wordpress.org/trunk@54254


git-svn-id: http://core.svn.wordpress.org/trunk@53813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 14:17:12 +00:00
desrosj
62f77df49a Editor: Add box-shadow support for blocks through theme.json files.
This makes it possible to add `box-shadow` to specific blocks (such as buttons or groups), allowing this to be configured in block themes without custom CSS.

Props andrewserong, cbravobernal, madhudollu, scruffian, onemaggie.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54253


git-svn-id: http://core.svn.wordpress.org/trunk@53812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 13:50:09 +00:00
audrasjb
fd7c5261ec Help/About: Add a help tab in Theme Install screen for the new "Block Themes" search filter.
Follow-up to [53906].

Props audrasjb, poena, robinwpdeveloper, webcommsat.
Fixes #56405.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 13:48:11 +00:00
audrasjb
fa4cc8f69d Editor: Backport hooks to filter theme.json data from Gutenberg to 6.1.
This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the `theme.json` data. Specifically, it adds the following filters: `theme_json_default`, `theme_json_blocks`, `theme_json_theme`, and `theme_json_user`.

For more details, see the following Gutenberg pull requests:

- [https://github.com/WordPress/gutenberg/pull/44015 gutenberg#44015]: Make global styles data filterable
- [https://github.com/WordPress/gutenberg/pull/44109 gutenberg#44109]: Prepare `WP_Theme_JSON_Data` class for backporting
- [https://github.com/WordPress/gutenberg/pull/44159 gutenberg#44159]: Update hook's names from `global_styles_*` to `theme_json_*`

Props oandregal, czapla, gziolo, bernhard-reiter.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 13:13:21 +00:00
Sergey Biryukov
9b3535cc14 Bootstrap/Load: Send HTTP headers after querying posts in WP::main().
By running `WP::send_headers()` after posts have been queried, we can ensure that conditional tags like `is_front_page()`, `is_home()`, etc. work as expected.

This provides better context and more flexibility when adjusting HTTP headers via the `wp_headers` filter or `send_headers` action.

Previously, the earliest action where conditional tags worked correctly was `wp`.

Includes moving the `X-Pingback` header, previously sent in `WP::handle_404()`​ after posts have been queried, to a more appropriate place in `WP::send_headers()`.

Follow-up to [2627], [34442].

Props jonoaldersonwp, joostdevalk, peterwilsoncc, adamsilverstein, SergeyBiryukov.
Fixes #56068.
Built from https://develop.svn.wordpress.org/trunk@54250


git-svn-id: http://core.svn.wordpress.org/trunk@53809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 13:12:10 +00:00
audrasjb
06cb9d7691 Security: Salting functions: translate the phrase "put your unique phrase here".
In `wp_salt()` WordPress pre-populates the check for duplicate salt values with the default put your unique phrase here. As the `wp-config.php file` for non-en_US can be translated in downloaded packages, a translated version of this phrase ought to be in the pre-populated duplicate values array too.

Props peterwilsoncc, SergeyBiryukov, whaze, costdev, audrasjb.
Fixes #55937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 11:57:20 +00:00
audrasjb
85cb9e4963 Shortcodes: Reverse wrapping of apply_shortcodes() and do_shortcode().
This changeset reverses the wrapping of `apply_shortcodes()` and `do_shortcode()` such that `apply_shortcodes()` is now the recommended function. In addition:

- Calls to `do_shortcode()` have been changed to `apply_shortcodes()`.
- Some default filter callbacks have been changed from `'do_shortcode'` to `'apply_shortcodes'`.
- Applicable documentation has been updated to refer to `apply_shortcodes()` instead.

Follow-up to [47004].

Props SergeyBiryukov, rafiahmedd, namithjawahar, peterwilsoncc, costdev.
Fixes #55883.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 10:31:14 +00:00
audrasjb
987bf2ede8 Administration: Allow to wrap Settings sections with custom HTML content.
This changeset improves the `add_settings_section()` function to allow developers to pass extra HTML mark-up to be rendered before and after the settings section. Extra argument `$args` can now be passed to the function, and is an array that can contain the following items:

- `before_section`: HTML content to prepend to the section's HTML output. Receives the section's class name provided with the `section_class` argument via an optional `%s` placeholder. Default empty.
- `after_section`: HTML content to append to the section's HTML output. Default empty.
- `section_class`: The class name to use for the section. Used by `before_section` if a `%s` placeholder is present. Default empty.

The HTML passed using these extra arguments is escaped using `wp_kses_post()` just before rendering. This changeset also provides a set of unit tests for this new feature.

Props griffinjt, nacin, scribu, ross_ritchey, ryan, chriscct7, palmiak, rehanali, costdev, martinkrcho, chaion07, audrasjb, hellofromtonya.
Fixes #17851.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 09:59:12 +00:00
spacedmonkey
3462a37760 Posts, Post Types: Post title should not be translatable in get_user_data_from_wp_global_styles method.
In [52280] `wp_template_part` and `wp_template` posts, made the title of the post created not translatable. This was changed [54186] by mistake. This commit reverts that change.

Follow up to [54186], [52280].

Props mukesh27, kebbet.
See #55392.
Built from https://develop.svn.wordpress.org/trunk@54246


git-svn-id: http://core.svn.wordpress.org/trunk@53805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 09:37:09 +00:00
audrasjb
350f7bb46e General: Revert [54225].
The My Site screen is not documented on HelpHub yet, so let's re-add the former Codex link for now.

Follow-up to [54225].

Props SergeyBiryukov.
Unprops audrasjb.
See #48987.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 08:19:10 +00:00
Peter Wilson
e241ac664a Posts, Post types: Prevent get_sample_permalink() modifying the post object.
`get_sample_permalink()` (ab)uses the `$post->filter` property to indicate a sample permalink is being generated for the post. This change ensures the property is restored to its original value.

Props herregroen, hellofromTonya, peterwilsoncc, Rahmohn, costdev.
Fixes #54736.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 04:31:09 +00:00
joedolson
ee24b9b733 Media: Change alt attribute field to textarea in media library.
Change the input field used for `alt` attributes in the media library views from a text input to a textarea. This gives users more flexibility in resizing the field for easier management of longer alt attributes. 

This patch includes a less-common use of `esc_attr` for a `textarea`. This is because the primary usage of the `alt` attribute will be escaped using `esc_attr`, and the value in editing should match the value output on the front end.

Props edent, sabernhardt, afercia, JavierCasares, audrasjb, joedolson.
Fixes #50066.
Built from https://develop.svn.wordpress.org/trunk@54243


git-svn-id: http://core.svn.wordpress.org/trunk@53802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 04:02:10 +00:00
Peter Wilson
8731d43633 Posts, Post types: Coding standards fixes following [54234].
Props costdev.
See #36905.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 03:58:09 +00:00
desrosj
a16bec07f2 General: Throw a more descriptive error when templates are not found.
When `wp.template()` is called in JavaScript for a template element that does not exist, a very nondescript error message is currently returned (“Uncaught TypeError: Cannot read property `replace` of `undefined`”).

This updates adds a check for this scenario and a new “Template not found” error is now thrown instead.

Props joehoyle, noisysocks, hilayt24.
Fixes #36631.
Built from https://develop.svn.wordpress.org/trunk@54241


git-svn-id: http://core.svn.wordpress.org/trunk@53800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 03:52:10 +00:00
desrosj
7d87ce12c8 Networks and Sites: Officially remove global terms.
Global terms was a feature from the WordPress MU days where multisite and single site installs used different code bases.

In WordPress 3.0, WordPress MU was merged into one location and the UI [14854] and “on” switch [14880] for global terms were completely removed.

Even before this merge, global terms was bug infested and unreliable. After [14854]/[14880], the feature was no longer maintained and became increasingly broken as taxonomies progressed without it (term splitting and term meta do not work at all). At this point, the feature has not worked in 12+ years and there’s no hope for saving it.

This deprecates the remaining global terms related code and no-ops the functions.

Global terms, you don’t have to go home, but you can’t stay here.

Props scribu, wonderboymusic, SergeyBiryukov, nacin, pento, desrosj, johnjamesjacoby, johnbillion, dd32.
Fixes #21734.
Built from https://develop.svn.wordpress.org/trunk@54240


git-svn-id: http://core.svn.wordpress.org/trunk@53799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 02:51:09 +00:00
desrosj
0cac41db2e Bootstrap/Load: Confirm the value of WP_ENVIRONMENT_TYPE before using.
This adjusts the check for the presence of the `WP_ENVIRONMENT_TYPE` constant to also confirm it is set to a non-empty value before using.

Props dd32, khokansardar, ramon-fincken.
Fixes #55741.
Built from https://develop.svn.wordpress.org/trunk@54239


git-svn-id: http://core.svn.wordpress.org/trunk@53798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 02:24:12 +00:00
desrosj
510047a552 Coding Standards: Applying an alignment fix from running composer format.
Follow up to [54214].

See #56467.
Built from https://develop.svn.wordpress.org/trunk@54238


git-svn-id: http://core.svn.wordpress.org/trunk@53797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:42:10 +00:00
Sergey Biryukov
0a4909f027 Date/Time: Minor tweak to support deprecated timezones on General Settings screen.
Underneath the timezone selector on the General Settings screen, a small snippet of info about the selected time zone is displayed.

This information would be missing if the timezone is set to a deprecated timezone value, even though PHP is perfectly capable of generating that information, including for deprecated timezones.

By passing the `DateTimeZone::ALL_WITH_BC` constant as the `$timezoneGroup` parameter to the PHP native `timezone_identifiers_list()` function, a timezone name list is retrieved containing both current and deprecated timezone names, preventing the condition from failing when the current timezone is a deprecated one.

See the extensive write-up about this in ticket #56468.

Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].

Note: As this is an admin/output page, no pre-existing tests are available.

Follow-up to [54207], [54217], [54227], [54229], [54230], [54232], [54233].

Props jrf, costdev, marcyoast.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54237


git-svn-id: http://core.svn.wordpress.org/trunk@53796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:39:10 +00:00
desrosj
5bcb080993 Themes: Import Twenty Twenty-Three is now the default theme.
Follow up to [54235].

See #56383.
Built from https://develop.svn.wordpress.org/trunk@54236


git-svn-id: http://core.svn.wordpress.org/trunk@53795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:36:09 +00:00
desrosj
add7561ddc Bundled Themes: Import Twenty Twenty-Three, the new default theme for WordPress 6.1.
Twenty Twenty-Three is a stripped-back, minimal version of Twenty Twenty-Two that includes a collection of 10 distinct style variations designed and submitted by members of the WordPress community.

This unique approach to creating a default theme harnesses all of the flexibility that full site editing has to offer.

Everybody loves you when you’re twenty-three. What’s my age again?

Props amjadr360, anariel-design, audrasjb, beafialho, bgardner, colorful-tones, critterverse, daisyo, desrosj, dianeco, greenshady, joen, jffng, kafleg, kishanjasani, kraftbj, luminuu, madhudollu, mikachan, mtias, onemaggie, pbking , poena, richtabor, scruffian, soean, tanvirul, thelovekesh.
See #56383.
Built from https://develop.svn.wordpress.org/trunk@54235


git-svn-id: http://core.svn.wordpress.org/trunk@53794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:22:10 +00:00
Peter Wilson
4f748ac3fa Posts, Post types: Cache get_page_by_title().
Convert `get_page_by_title()` to a `WP_Query` wrapper to take advantage of the object caching built in to the latter.

Add dedicated unit tests for the function `get_page_by_title()`.

Props spacedmonkey, boonebgorges, igmoweb, pcfreak30, pbearne.
Fixes #36905.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:15:11 +00:00
Sergey Biryukov
526dba25c2 Date/Time: Correct timezone dropdown list creation in wp_timezone_choice().
This fixes a bug where if the `timezone_string` is set to a timezone name which has since been deprecated, no option would be (pre-)selected in the generated dropdown list and when the form using the dropdown list is submitted, the “old”, originally saved value would be lost as the form would submit without a value being selected for the `timezone_string` field.

The fix is a little hacky: it basically checks ahead of generating the actual dropdown list whether the `$selected_zone` value would be recognized and set to “selected” and if not, verifies that the value ''is'' a valid but outdated timezone name and if so, adds an extra dropdown entry to the top of the list with the original value and sets this value to “selected”.

See the extensive write-up about this in ticket #56468.

Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].

Note: There are no pre-existing tests at all for this method and adding a complete set of tests for this method is outside the scope of this ticket, so this fix does not contain any tests.

Follow-up to [54207], [54217], [54227], [54229], [54230], [54232].

Props jrf, costdev, marcyoast.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54233


git-svn-id: http://core.svn.wordpress.org/trunk@53792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:02:10 +00:00
Sergey Biryukov
3d18a0c264 Date/Time: Correct sanitization of localized default timezone_string in populate_options().
This fixes a bug where if the default `timezone_string` is set to a deprecated timezone name due to a localization providing an outdated timezone name string, this localized timezone string would be discarded and an empty string would be set as the timezone value instead.

By passing the `DateTimeZone::ALL_WITH_BC` constant as the `$timezoneGroup` parameter to the PHP native `timezone_identifiers_list()` function, a timezone name list is retrieved containing both current and deprecated timezone names, preventing the invalidation of the option value.

See the extensive write-up about this in ticket #56468.

Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].

Includes:
* Expanding the translators comment to encourage translators to use “old” names over “new” names.
* Adding a dedicated test to the `Tests_Admin_IncludesSchema` test class.

Follow-up to [54207], [54217], [54227], [54229], [54230].

Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54232


git-svn-id: http://core.svn.wordpress.org/trunk@53791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 00:43:09 +00:00
davidbaumwald
a8cbd8c3da Upgrade/Install: Use "placeholder" for example values in setup-config.php.
During install, the user is prompted for database connection settings.  Inputs for the database name, username, and password will most likely be changed from the examples given, but these example values are presented as the input's `value` property.  This required the user to clear the current value before entering their own.

This change moves the example values for these fields to the `placeholder` property.

Props oliverstapelfeldt, audrasjb, krupalpanchal, sabernhardt.
Fixes #56365.
Built from https://develop.svn.wordpress.org/trunk@54231


git-svn-id: http://core.svn.wordpress.org/trunk@53790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 23:55:09 +00:00
Sergey Biryukov
aa6972c247 Tests: Add tests with deprecated timezone strings.
This commit adds tests in select places to ensure that these date/time related functions continue to behave as expected when the `timezone_string` option is set to an outdated/deprecated timezone name.

The timezone string used in these tests, `America/Buenos_Aires`, is a timezone string which was already deprecated in PHP 5.6.20 (the current minimum PHP version), so using this timezone string, we can safely test the handling of deprecated timezone names on all supported PHP versions.

See: [https://3v4l.org/Holsr#v5.6.20 timezone_identifiers_list() output for PHP 5.6.20].

Follow-up to [54207], [54217], [54227], [54229].

Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54230


git-svn-id: http://core.svn.wordpress.org/trunk@53789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 23:53:09 +00:00
Sergey Biryukov
22e363e6c6 Date/Time: Correct sanitization of timezone_string in sanitize_option().
This fixes a bug where if the `timezone_string` is set to a timezone name which has since been deprecated, the option value would be “lost” when saving the value again, as the comparison being done to verify whether it is a valid timezone name would only take “current” timezone names into account and would invalidate deprecated timezone names.

By passing the `DateTimeZone::ALL_WITH_BC` constant as the `$timezoneGroup` parameter to the PHP native `timezone_identifiers_list()` function, a timezone name list is retrieved containing both current and deprecated timezone names, preventing the invalidation of the option value.

See the extensive write-up about this in ticket #56468.

Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].

Includes adding a dedicated test to the data provider used in the `Tests_Option_SanitizeOption` test class.

Note: The new data set is ''named'', even though the other data sets are unnamed, to make sure it is clear what this data set is testing. Adding test names for the original data sets in this data provider would be a great future improvement, but is outside of the scope of this commit.

Follow-up to [18323], [33119], [54207], [54217], [54227].

Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54229


git-svn-id: http://core.svn.wordpress.org/trunk@53788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 23:48:08 +00:00
joedolson
c5d200cb52 Media: Set https as placeholder for embedding media from URL.
Change the "Insert from URL" field in the media library to use a placeholder suggesting the `https://` protocol instead of a value attribute with `http://`.

Props Presskopp, adamsilverstein, joyously, thijso, joedolson, costdev.
Fixes #53404.
Built from https://develop.svn.wordpress.org/trunk@54228


git-svn-id: http://core.svn.wordpress.org/trunk@53787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 23:34:10 +00:00
Sergey Biryukov
af253aa544 I18N: Update list of continents and cities for the timezone selection.
Based on a two-way comparison between the available timezone city names in PHP 5.6.20 and PHP 8.2.0.

Lists of available timezone names have been retrieved using the PHP `timezone_identifiers_list()` function.

See: [https://3v4l.org/ro1vY/rfc#vgit.master timezone_identifiers_list() output and comparison].

Note: Both spellings of `Kiev`/`Kyiv` need to be in the list to allow it to work PHP cross-version.
* The “old” version — `Kiev` — will be used as the basis to find the localized name for the timezone dropdown lists on PHP 5.6 to 8.1.
* The corrected spelling — `Kyiv` — will be used to find the localized name on PHP 8.2 and up.

Follow-up to [50555], [54207], [54217].

Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54227


git-svn-id: http://core.svn.wordpress.org/trunk@53786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 23:24:11 +00:00
davidbaumwald
5eb0223369 Media: Revert WebP generation.
Given [https://make.wordpress.org/core/2022/09/11/webp-in-core-for-6-1/ Matt's recent post about removing WebP from core] and possibly implementing the feature in a future [https://make.wordpress.org/core/2022/09/11/canonical-plugins-revisited/ "Canonical Plugin"], this change reverts changesets [54086], [54094], and [54097].  Additionally, [54210] contained a coding standards follow-up in one of the affected files that is no longer needed.

Reverts [54086], [54094], and [54097].

Props SergeyBiryukov.
See #55443.
Built from https://develop.svn.wordpress.org/trunk@54226


git-svn-id: http://core.svn.wordpress.org/trunk@53785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:53:10 +00:00
audrasjb
5ec680a5a1 General: Replace Codex links with their HelpHub counterparts - My Sites screen
Props chaton666.
See #48987.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:37:10 +00:00
Sergey Biryukov
d34882e9e6 Docs: Correct the wording in wp_lostpassword_url() description.
This affects:
* The `wp_lostpassword_url()` function.
* The `lost_password_html_link` filter.

The filter description was copied from the function, which appears to be not quite accurate, as the lost password can only be reset, not retrieved.

Follow-up to [11448], [54206].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:26:10 +00:00
Sergey Biryukov
7d0a24c29e Coding Standards: Move WP_List_Table::get_views_links() to a more appropriate place.
This moves the newly introduced `::get_views_links()` method to a more predictable location, next to the the `::get_views()` and `::views()` methods.

Follow-up to [54215].

See #42066.
Built from https://develop.svn.wordpress.org/trunk@54223


git-svn-id: http://core.svn.wordpress.org/trunk@53782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:24:09 +00:00
Sergey Biryukov
6c48acbbd3 I18N: Remove <code> tags from translatable strings in WP_List_Table::get_views_links().
To simplify the strings and exclude any parts that don't require translation, the `<code>` tags wrapping a placeholder can be moved out of the string and added to the placeholder value.

Follow-up to [54215].

See #42066.
Built from https://develop.svn.wordpress.org/trunk@54222


git-svn-id: http://core.svn.wordpress.org/trunk@53781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:15:10 +00:00
audrasjb
4ebc3861ea Twenty Twenty-One: Add a missing HTML comment for Customizer notice control.
This brings consistency with other bundled themes, like Twenty Nineteen.

Props haritpanchal.
Fixes #55725.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:07:11 +00:00
audrasjb
08d046c717 General: Ensure admin notices are properly displayed on Site Health layout.
This changeset adds some CSS tweaks to ensure admin notices like the "Automated update failed" notice don't break the layout of the Site Health and Privacy Settings screens.

Props johnjamesjacoby, costdev, Clorith, audrasjb, SergeyBiryukov, joedolson.
Fixes #54624.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:51:11 +00:00
davidbaumwald
0c20fb1ad8 Help/About: Make translator comments version agnostic and make version translatable on the About page.
In past versions of the About page, translator comments referencing the Field Guide and Release Notes links included the current version number.  This change updates these translator comments to remove a specific version number, which was not necessary.

This change also abstracts the version number out of the "Read the WordPress X.X Release Notes" string, making it translatable.

Props Presskopp, audrasjb, SergeyBiryukov, marybaum.
Fixes #54741.
Built from https://develop.svn.wordpress.org/trunk@54219


git-svn-id: http://core.svn.wordpress.org/trunk@53778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:43:10 +00:00
audrasjb
4bb6301eb9 General: Pass $action to nonce_life filter.
This changeset contextualizes the usage of `nonce_life` filter by passing the `$action` parameter. It allows to alterate the default lifespan of nonces on a case by case basis.

Props giuseppemazzapica, dwainm, DrewAPicture, jorbin, audrasjb, SergeyBiryukov, costdev, antonvlasenko.
Fixes #35188.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:36:10 +00:00
Sergey Biryukov
8c7039e9c8 Tests: Replace the timezone used in date/time tests.
The `Europe/Kiev` timezone has been deprecated in PHP 8.2 and replaced with `Europe/Kyiv`.

The tests updated in this commit are testing the WordPress date/time functionality. They are **not** testing whether WP or PHP can handle deprecated timezone names correctly.

To ensure the tests follow the original purpose, the use of `Europe/Kiev` within these tests is now replaced with the `Europe/Helsinki` timezone, which is within the same timezone as `Europe/Kyiv`. This should ensure that these tests run without issue and test what they are supposed to be testing on every supported PHP version (unless at some point in the future `Europe/Helsinki` would be renamed, but that's a bridge to cross if and when).

Note: Separate tests should/will be added to ensure that relevant date/time related functions handle a deprecated timezone correctly, but that is not something ''these'' tests are supposed to be testing.

Follow-up to [45853], [45856], [45876], [45882], [45887], [45908], [45914], [46577], [46154], [46580], [46864], [46974], [54207].

Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54217


git-svn-id: http://core.svn.wordpress.org/trunk@53776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:20:09 +00:00
joedolson
43e32ffa5c Editor: Fix text zoom on link popup editor.
Update CSS in the classic visual editor link popup to remove sizing in pixels that caused significant text overlaps when the base font size is scaled or set to a larger custom value in the browser or operating system.

Props jonny-s, sabernhardt, joedolson.
Fixes #53174.
Built from https://develop.svn.wordpress.org/trunk@54216


git-svn-id: http://core.svn.wordpress.org/trunk@53775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:18:09 +00:00
davidbaumwald
be9b533e13 Administration: Add new get_views_links method to WP_List_Table.
Many `WP_List_Table` child classes in core use mostly the same code to create their "view" links markup.  To DRY-up the code, a new `WP_List_Table->get_view_links` method is being introduced to consolidate the HTML link generation when provided an array of links.

This change also implements this new method in the relevant `WP_List_Table_xxx` child classes `get_views` methods.  Finally, unit tests are being added to validate view links markup and test for some "unhappy paths".

Props afercia, costdev, garrett-eclipse, Dharm1025, juhise, peterwilsoncc.
Fixes #42066.
Built from https://develop.svn.wordpress.org/trunk@54215


git-svn-id: http://core.svn.wordpress.org/trunk@53774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:08:10 +00:00
audrasjb
130e13e39e Editor: Backport block supports filter callback, registrations and tests to 6.1.
This changeset backports the following changes:

- Implement [https://github.com/WordPress/gutenberg/pull/42880 gutenberg#42880]: Backport script loader: enqueue stored block supports styles
- Allow a way to bypass `SCRIPT_DEBUG` in tests. See [https://github.com/WordPress/wordpress-develop/pull/3259#issuecomment-1250403735 comment] and the related [https://github.com/WordPress/gutenberg/pull/44248 Gutenberg pull request]

Props ramonopoly, gziolo, bernhard-reiter, audrasjb, costdev.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:56:10 +00:00
davidbaumwald
89213a3e4e Role/Capability: Add a new update_role function.
Until now, changing a user's role involved deleting a user's role then re-adding.  This change creates a new `update_role` function and associated method in `WP_Roles` to consolidate this process.

This commit also introduces new unit tests around `update_role` and adds additional "unhappy path" tests for roles and capabilities in general.

Props maksimkuzmin, peterwilsoncc, NomNom99, costdev, SergeyBiryukov.
Fixes #54572.
Built from https://develop.svn.wordpress.org/trunk@54213


git-svn-id: http://core.svn.wordpress.org/trunk@53772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:49:10 +00:00
davidbaumwald
5358008d68 Upgrade/Install: Add plugin URL to the automatic update email.
For each automatic plugin update, both successful and failed, information about each plugin is included in the email upon completion of the process.  This change adds the plugin URL, if known, to the information included for each plugin that was processed.

This change also adds unit tests to validate the email contents after various automatic plugin update scenarios.

Props JosVelasco, pbiron, oliverstapelfeldt, ChrisHardie, Ipstenu, dd32, peterwilsoncc, audrasjb, costdev.
Fixes #53049.
Built from https://develop.svn.wordpress.org/trunk@54212


git-svn-id: http://core.svn.wordpress.org/trunk@53771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:28:11 +00:00
audrasjb
3639a578ef Editor: Backport block supports (border, color, elements, spacing) from Gutenberg to WP 6.1.
This changeset backports `border`, `color`, `elements` and `spacing` block supports changes from Gutenberg to WP 6.1. 

See tracking issue on Gutenberg repository: [https://github.com/WordPress/gutenberg/pull/43440 gutenberg#43440].

Props ramonopoly, glendaviesnz, bernhard-reiter, audrasjb, costdev.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:14:10 +00:00
desrosj
1966addc05 Coding Standards: Various alignment fixes from composer format.
Follow up to [53874], [54097], [54110], [54155], [54162], [54184].

See #39210, #55443, #56288, #56092, #56408, #56467, #55881.
Built from https://develop.svn.wordpress.org/trunk@54210


git-svn-id: http://core.svn.wordpress.org/trunk@53769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 19:51:09 +00:00
desrosj
0fe6115af2 External Libraries: Update the jQuery UI library to version 1.13.2.
This is a bug fix release. For more information on the changes included, see https://jqueryui.com/changelog/1.13.2/.

Props Clorith, monolithon, desrosj.
Fixes #56239.
Built from https://develop.svn.wordpress.org/trunk@54209


git-svn-id: http://core.svn.wordpress.org/trunk@53768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 18:04:09 +00:00
davidbaumwald
34cd38aa84 Posts, Post Types: Update new wp_post_class_taxonomies filter name for consistency.
In [54066], a new filter was added to alter the taxonomies for which class names are generated for a given post type.  At the time, the filter name was prefixed with `wp_`.

For consistency with filters of a similar type, this change updates the filter name to `post_class_taxonomies`.

Follow-up to [54066].

Props SergeyBiryukov.
See #37114.
Built from https://develop.svn.wordpress.org/trunk@54208


git-svn-id: http://core.svn.wordpress.org/trunk@53767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 17:54:11 +00:00
Sergey Biryukov
04f0d611f8 Tests: Reset timezone-related options if the tests change them.
The `options` table is not explicitly reset after each test or test class, so if an option is changed during a test, it should be reset to the default value ''after'' the test.

This commit does so for those tests which did not have such resetting in place yet, while one or more tests in the class ''do'' change the value of the `timezone_string` option.

Note: The test suite executes a `ROLLBACK` query after each test, which should reset the `options` table in theory, however that appears to not always be enough, as some timezone-related tests can fail in a complete test suite run, while not failing when run in isolation. This commit aims to improve stability of the tests.

Follow-up to [45857] / #45821.

Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54207


git-svn-id: http://core.svn.wordpress.org/trunk@53766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 17:45:09 +00:00
davidbaumwald
0da06515aa Login and Registration: Add a new filter for the lost password link.
On the login page, the "Register" link for new users has been filterable for some time.  This change adds the ability to filter the "Lost your password?" link as well.

Props wparslan, audrasjb, rafiahmedd, SergeyBiryukov, antonvlasenko, hellofromTonya.
Fixes #55388.
Built from https://develop.svn.wordpress.org/trunk@54206


git-svn-id: http://core.svn.wordpress.org/trunk@53765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 17:09:08 +00:00
Clorith
f277e8c168 Site Health: Improve the details provided by the REST API checks.
The descriptions provided whenever a REST API check failed lacked details that would help in troubleshooting any issues, most notably the actual REST API endpoint that was being tested.

Adding this vital piece of detail, along with a revamp of the error messages shown, where previously there was a risk that the markup of your website was included as an error message, improves the overall user experience, and gives more accurate details that can be looked when looking up how to fix or improve the behavior of the REST API.

Props dingo_d, shetheliving.
Fixes #54617.
Built from https://develop.svn.wordpress.org/trunk@54205


git-svn-id: http://core.svn.wordpress.org/trunk@53764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 15:30:09 +00:00
hellofromTonya
94ae52c079 Editor: Fix function name case in wp_default_packages_inline_scripts().
Fixes function name typo by changing from uppercase `get_current_user_ID()` to lowercase `get_current_user_id()`.

>Note: Function names are case-insensitive for the ASCII characters A to Z, though it is usually good form to call functions as they appear in their declaration.
[https://www.php.net/manual/en/functions.user-defined.php As per the PHP manual], PHP functions are case-insensitive, meaning the code runs. However, this fix is necessary for consistency, maintainability, and future-proofing.

Follow-up to [54182].

Unprop hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54204


git-svn-id: http://core.svn.wordpress.org/trunk@53763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 14:20:09 +00:00
Sergey Biryukov
93bc199337 Tests: Simplify the data provider for testing whether KSES globals are defined.
To avoid duplicating array values as keys when using a named data provider, the `text_array_to_dataprovider()` helper method can be used.

Follow-up to [52229], [53521].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 14:18:09 +00:00
desrosj
9913822661 External Libraries: Update the jQuery library to version 3.6.1.
This is a maintenance release. For more information on the changs included, see https://blog.jquery.com/2022/08/26/jquery-3-6-1-maintenance-release/.

Props tobiasbg.
See #56451.
Built from https://develop.svn.wordpress.org/trunk@54202


git-svn-id: http://core.svn.wordpress.org/trunk@53761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 14:16:24 +00:00
audrasjb
2fda7d7d1a Coding Standards: Replace double quote with single quote in test_if_failed_update().
Follow-up to [54200].
See #55758.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 09:16:11 +00:00
audrasjb
7b14bdbec0 Text Changes: Remove self-reference ("we") in WordPress Admin.
This changes some admin-area, user-facing text, to better match the guidelines and recommendations set forth in the make/core handbook, specifically:

> the word “we” should be avoided (...) unless its made very clear which group is speaking

Follow-up to [51979], [53131], [53132], [53148], [53156].

Props kebbet, costdev, SergeyBiryukov.
Fixes #55758.
See #46057.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 08:59:11 +00:00
audrasjb
c279ba3edb Docs: Typo correction in _load_textdomain_just_in_time() docblock.
Props kebbet.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 08:44:10 +00:00
Sergey Biryukov
38e393f7d0 Tests: Move the basic get_block_templates() test to the dedicated file.
Now that the function has its own test class, the remaining test from `Tests_Block_Template_Utils` can be moved to `Tests_Blocks_GetBlockTemplates` for consistency.

Includes:
* Uncommenting some assertions previously commented out.
* Moving the `get_template_ids()` helper method to the top of the class.
* Standardizing on `wpSetUpBeforeClass()`/`wpTearDownAfterClass()` in both classes.
* Declaring the test theme name as a constant in both classes, since the value is not changed by any of the tests.
* Renaming some properties in both classes for clarity.

Follow-up to [51003], [52062], [53927], [54184], [54187].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-18 13:10:09 +00:00
Clorith
e68db2692f Site Health: Adjust margins for the Site Health dashboard widget.
This aligns the spacing within the widget with other core widgets, and removes an unintended margin which was pushing the indicator slightly above the centered position it was intended to have.

Props sabernhardt, costdev, mukesh27.
Fixes #56369.
Built from https://develop.svn.wordpress.org/trunk@54197


git-svn-id: http://core.svn.wordpress.org/trunk@53756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-18 01:29:09 +00:00
Clorith
3c1cd858dd Site Health: Improve the description for Authorization header checks.
Previously the description left the user stuck with no path forward if flushing their permalinks was not enough.

This change givers a clearer description of what approving an application may involve (allowing these to connect to the users site), but also an additional step towards resolution if flushing permalinks are not enough; pointing them towards their host.

Props Presskopp, webcommsat.
Fixes #54508.
Built from https://develop.svn.wordpress.org/trunk@54196


git-svn-id: http://core.svn.wordpress.org/trunk@53755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-17 23:51:08 +00:00
Sergey Biryukov
4dd6f110a3 Docs: Revert the WP_Block_Parser documentation changes now.
This commit reverts [54193] and [54194].

It appears that these changes should first be made [533e0b7dad/packages/block-serialization-default-parser/parser.php upstream in the Gutenberg respository] and then backported to core, as the [https://github.com/WordPress/wordpress-develop/actions/runs/3074068296/jobs/4966609235#step:8:1 tests fail otherwise].

See #56581.
Built from https://develop.svn.wordpress.org/trunk@54195


git-svn-id: http://core.svn.wordpress.org/trunk@53754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-17 17:31:11 +00:00
Sergey Biryukov
e076ee2ee1 Docs: Correct @return type for WP_Block_Parser::parse().
This affects:
* `WP_Block_Parser::parse()`
* `WP_Block_Parser::$output`

Both the method and the property are documented as returning `WP_Block_Parser_Block[]` (an array of `WP_Block_Parser_Block` objects), but the result is in fact an array of arrays of various values, so `array[]` is the correct notation.

Follow-up to [43751] for the 5.0 branch, [44116] for trunk.

Props Chouby.
Fixes #56581.
Built from https://develop.svn.wordpress.org/trunk@54194


git-svn-id: http://core.svn.wordpress.org/trunk@53753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-17 17:13:11 +00:00
Sergey Biryukov
6435a4c9c7 Docs: Correct @since tags for some block parser properties and methods.
This affects:
* `WP_Block_Parser::$empty_attrs`
* `WP_Block_Parser::next_token()`
* `WP_Block_Parser::freeform()`
* `WP_Block_Parser_Block::$innerContent`

The `@since` tags referred to early Gutenberg versions instead of WordPress core. These properties and methods were introduced in WordPress 5.0, so `5.0.0` is the correct version.

Some of the other `@since` tags are removed, as they are related to early Gutenberg development before it was merged into WordPress core, and are not relevant for core.

Follow-up to [43751], [43884], [43955] for the 5.0 branch, [44116], [44261], [44281] for trunk.

Props Chouby.
See #56581.
Built from https://develop.svn.wordpress.org/trunk@54193


git-svn-id: http://core.svn.wordpress.org/trunk@53752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-17 16:49:09 +00:00
joedolson
b67e8e4dd9 Login and Registration: Required fields in network registration.
Properly label site and user information on the network registration screen with the HTML5 required attribute and clarify the values expected for the site domain and subdirectory fields.

Props SteelWagstaff, henrywright, sabernhardt.
Fixes #54344.
Built from https://develop.svn.wordpress.org/trunk@54192


git-svn-id: http://core.svn.wordpress.org/trunk@53751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-17 00:35:10 +00:00
joedolson
4ed6d8ad76 Login and Registration: Access improvements to network signup.
Fix a variety of accessibility issues with the network registration and activation screens. Fix associations between error messages and fields, improve labels for radio buttons, add fieldset and legend to properly group fields.

Props afercia, allisonplus, sabernhardt.
Fixes #40361.
Built from https://develop.svn.wordpress.org/trunk@54191


git-svn-id: http://core.svn.wordpress.org/trunk@53750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 23:13:10 +00:00
audrasjb
cad5069194 Docs: Update wp_rand docblock to clarify that it returns a non-negative number.
Props hakre, westi, jeremyfelt, neychok, sabernhardt, audrasjb.
Fixes #15089.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 22:39:11 +00:00
audrasjb
17480cc205 General: Replace Codex with HelpHub in WordPress readme.
This updates WordPress main `readme.txt` file to replace Codex link with HelpHub.

Props audrasjb, netweb, SergeyBiryukov, tobifjellner.
See #48987.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 22:27:10 +00:00
audrasjb
eafd18308b Code Modernization: Remove -webkit-appearance CSS declarations.
This changeset removes the deprecated `-webkit-appearance` CSS property used in `customizer-controls.css`. It doesn't change anything to the interface.

Props laurent22777, desrosj, celloexpressions, costdev, rolfsiebers, audrasjb, Clorith.
Fixes #38431.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 22:17:10 +00:00
Sergey Biryukov
8375b6e2eb Tests: Update the test for respecting the post type in get_block_templates().
* Use `assertSameSets()` to avoid a failure when array items are returned in different order ([https://github.com/WordPress/wordpress-develop/actions/runs/3067320461/jobs/4953478602#step:19:274 example]).
* Move the test to a more appropriate place now that the function has its own test class.
* Rename the test method to match the function name.

Follow-up to [52062], [53927], [54184].

See #55881.
Built from https://develop.svn.wordpress.org/trunk@54187


git-svn-id: http://core.svn.wordpress.org/trunk@53746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 15:12:09 +00:00
spacedmonkey
b01bafe003 Posts, Post Types: Improve performance of the get_user_data_from_wp_global_styles method.
Improve the logic found in `get_user_data_from_wp_global_styles` method. Replace call to `wp_get_recent_posts` with the more standard, `WP_Query` for consistancy. Use transient over standard cache, to improve performance on sites without persistent object caching. Improve handling of cases where `wp_insert_post` returns a `WP_Error`.

Props spacedmonkey, adamsilverstein, mukesh27, peterwilsoncc, andregal.
Fixes #55392.
Built from https://develop.svn.wordpress.org/trunk@54186


git-svn-id: http://core.svn.wordpress.org/trunk@53745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 10:57:14 +00:00
audrasjb
44569531b2 Code Modernization: Reduce CSS float usage in wp-admin - Timezone settings.
This changeset is a part of a task dedicated to improve wp-admin CSS code with less floating, as float never was intended for layout. The idea is to gradually replace floating methods that take the HTML element out of the normal flow of the document with more modern and robust positioning methods.

Props kebbet.
See #55557.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 22:59:11 +00:00
hellofromTonya
47d61a73ef Editor: Fix get_block_templates() to get templates for a post type.
When a post type is passed to `get_block_templates()` in the query, return only the templates that match that post type.

Fixes an issue where:
* when a block template provided by a theme has been edited by the user
* and that template has specific defined `postTypes`
* but after editing, the template was available for all post types.

Follow-up to [52062].

Props aljullu, bernhard-reiter, hellofromTonya.
Fixes #55881.
Built from https://develop.svn.wordpress.org/trunk@54184


git-svn-id: http://core.svn.wordpress.org/trunk@53743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 22:28:13 +00:00
Sergey Biryukov
335203e971 Editor: Finalize the theme_json_get_style_nodes hook name.
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [https://github.com/WordPress/wordpress-develop/pull/3247 #3247 Add hooks to filter theme.json data].

Follow-up to [54118].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 20:28:18 +00:00
hellofromTonya
8c85dde1c6 Editor: Persist preferences in user meta.
Adds a new feature to persist editor UI preferences between page loads and browsers.

* Adds a new preferences persistence API.
* Saves editor preferences in user meta instead of in browser's local storage.

Why?
Due to the transient nature of browser storage, this persistence is not as sticky as it is expected to be, including: switching browsers (unique storage between browsers), or using private browsing tabs (storage cleared between sessions), or the same user across a network of sites (storage unique by domain).

This is a backport from Gutenberg.[https://github.com/WordPress/gutenberg/pull/39795 See WordPress/gutenberg PR 39795].

Props talldanwp, youknowriad, noisysocks, mamaduka, costdev, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54182


git-svn-id: http://core.svn.wordpress.org/trunk@53741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 16:45:40 +00:00
Sergey Biryukov
21eb7900b3 Docs: Clarify the $allowed_protocols default value in various KSES functions.
Add a note that the parameter is optional and defaults to the result of `wp_allowed_protocols()`.

This affects:
* `wp_kses()`
* `filter_block_content()`
* `filter_block_kses()`
* `filter_block_kses_value()`

Includes synchronizing the `$allowed_html` parameter description for consistency.

Follow-up to [649], [6630], [18826], [32603], [43016], [46896], [48478].

Props armondal, SergeyBiryukov.
Fixes #56580.
Built from https://develop.svn.wordpress.org/trunk@54181


git-svn-id: http://core.svn.wordpress.org/trunk@53740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 13:29:13 +00:00
audrasjb
82c08816f6 Docs: Use third-person singular verbs in Template Loading functions descriptions, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:49:08 +00:00
audrasjb
199454f6ae Docs: Clarify that get_page_template() doesn't work on block themes.
When working on a block theme, `locate_block_template()` should be used instead of `get_page_template()`. This changeset updates the docblock of this function accordingly.

Props audrasjb, costdev, robinwpdeveloper.
Fixes #56394.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:44:09 +00:00
Sergey Biryukov
3b0c68d032 Docs: Clarify documentation for the nav_menu_item_id filter.
This aims to make it clear that the filter is applied to an HTML ID attribute for the menu item's `<li>` element, and not a numeric ID.

Follow-up to [15407], [25410], [27201], [38559], [51739].

Props dilipbheda, robinwpdeveloper, mukesh27, audrasjb, SergeyBiryukov.
See #56574, #55646.
Built from https://develop.svn.wordpress.org/trunk@54178


git-svn-id: http://core.svn.wordpress.org/trunk@53737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:32:08 +00:00
audrasjb
57b47f0a09 Help/About: Remove .hidden class when the Help Tab panel is displayed.
It is obviously more logical and semantic to remove the `hidden` class when the panel is displayed. Plus, it prevents from weird behavior occurring when plugins also use the `hidden` class to hide stuff.

Props grabmedia, SergeyBiryukov, helen, sabernhardt, costdev, audrasjb.
Fixes #27697.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:29:12 +00:00
hellofromTonya
f3ff15edfc Themes: Introduces block-based template parts for Classic themes.
Allows Classic / Hybrid themes to use block-based template parts without using complete block-based templates.

* Exposes the Site Editor's template parts UI
* Adds Appearance > "Template Parts" menu
* Enabled within the theme via adding a theme support for `'block-template-parts'`
{{{#!php
add_theme_support( 'block-template-parts' );
}}}

This is a backport from Gutenberg.[https://github.com/WordPress/gutenberg/pull/42729 See WordPress/gutenberg PR 42729].

Follow-up to [52330], [52069], [52178].

Props mamaduka, fabiankaegy, poena, scruffian, manfcarlo, bernhard-reiter, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54176


git-svn-id: http://core.svn.wordpress.org/trunk@53735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 12:20:09 +00:00
audrasjb
5ea7b42f89 Editor: Backport build_query_vars_from_query_block changes from Gutenberg repository.
This changeset backports changes from the following Gutenberg pull requests:

- [https://github.com/WordPress/gutenberg/pull/43590 gutenberg#43590] Add a filter to `build_query_vars_from_query_block`
- [https://github.com/WordPress/gutenberg/pull/40933 gutenberg#40933] Block Library - Query Loop: Add parents filter

Props ntsekouras, bernhard-reiter.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 11:41:10 +00:00
audrasjb
c72fae1c58 Editor: Backport wp_theme_element_class_name() alias.
This changeset backports the `wp_theme_element_class_name()` alias for the "internal" `WP_Theme_JSON::get_element_class_name()` function.

This is a backport of [https://github.com/WordPress/gutenberg/pull/44099 gutenberg/PR44099].

Note: this changeset doesn't replace calls to `WP_Theme_JSON::get_element_class_name` in the tests, since those are specifically for the `WP_Theme_JSON` class.

Props bernhard-reiter, cbravobernal, costdev.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 10:55:08 +00:00
audrasjb
81ada51ba4 Docs: Use third-person singular verbs in Media API function descriptions, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 10:52:08 +00:00
audrasjb
83a2c2428a Docs: Add missing @since history in Gallery Shortcode function.
Props bengreeley, audrasjb, desrosj, mukesh27.
Fixes #56206.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 08:56:08 +00:00
audrasjb
11fdb19ae3 Twenty Nineteen: Define underline thickness for links.
This changeset adds `text-decoration-thickness: 2px;` to all underlined link to ensure that underline thickness stay consistent across browsers. This fixes an issue where the underline style on links using the Hoefler Text font was too thin in Firefox.

Props allancole, sabernhardt, danfarrow, audrasjb, neychok, multidots1896, maartenj.
Fixes #45925.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 08:35:18 +00:00
audrasjb
1efbea5145 Twenty Twenty-One: Remove WooCommerce related CSS selectors.
The selectors for Twenty Twenty-One's default `max-width` have used the `.woocommerce` class since the theme's [956a3172a4 (diff-b757cb999144a1bc7e14604bc6d4bab7d87ea1a3bf5000c33937e490d75b9d92R3-R9) initial commit]. This changeset removes all WooCommerce CSS selector from the theme, as they would need to be supported forever. The change was tested with WooCommerce installed and no issues were raised. 

Props sabernhardt, audrasjb, davidbaumwald, tahmidulkarim, mukesh27.
Fixes #56366.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 22:33:10 +00:00
Andrew Ozz
c9d23006db Site health:
- Add a check to `wp_check_php_version()` whether the current PHP version is lower than the next (desired) minimum version.
- Set the next desired minimum PHP version to 7.2.
- Use that check to update the warnings in the `wp_dashboard_php_nag()` widget, and on the Site Health screen.

Props Clorith, SergeyBiryukov, ironprogrammer, azaozz.
See #56199.
Built from https://develop.svn.wordpress.org/trunk@54169


git-svn-id: http://core.svn.wordpress.org/trunk@53728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 22:19:14 +00:00
audrasjb
e254c02be5 Twenty Twenty-Two: Add "Accessibility Ready" tag to theme in repository
A cross-team consensus has been reached to allow Twenty Twenty-Two to be tagged as "Accessibility Ready" on the WordPress Themes repository.

Props bph, kjellr, utz119, ryokuhi, joedolson, audrasjb, mikeschroder, poena, annezazu.
Fixes #55172.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 21:52:14 +00:00
audrasjb
6d5fca2685 Twenty Twenty: Fix Social Links widget alignment.
This fixes an alignment issue with the Social Links block used in the context of a widget area.

Props grandeljay, sabernhardt.
Fixes #56474.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 21:34:10 +00:00
audrasjb
ea0711255f Twenty Twenty: Ensure Latest Posts block set to 2 columns displays accordingly in the Editor.
This brings consistency between block editor and front-end rendering.

Props smit08, mukesh27, sabernhardt, multidots1896.
Fixes #56175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 21:19:10 +00:00
Andrew Ozz
136dc2b108 Site health: Add a menu bubble with the critical issues count to the Tools -> Site Health submenu.
Props: Clorith
See: #56199

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


git-svn-id: http://core.svn.wordpress.org/trunk@53724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 21:14:14 +00:00
audrasjb
ae532c8ef2 Twenty Twenty-One: Fix Heading Block alignment when nested in Cover Block.
This brings consistency between block editor and front-end rendering.

Props mrfoxtalbot, kajalgohel, harshvaishnav, audrasjb.
Fixes #56050.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 20:51:16 +00:00
audrasjb
9ea8cc678c Twenty Twenty: Fix Heading Block alignment when nested in Cover Block.
This brings consistency between block editor and front-end rendering.

Props mrfoxtalbot, tahmidulkarim, NomNom99, audrasjb.
Fixes #56049.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 19:43:13 +00:00
hellofromTonya
bfcd054304 Editor: Backport foundation for Layout block support refactor (part 1).
Backports the following changes from the Gutenberg repository:

* [WordPress/gutenberg/40875 gutenberg/40875] Layout: Use semantic classnames, centralize layout definitions, reduce duplication, and fix blockGap in theme.json
* [WordPress/gutenberg/42544 gutenberg/42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg/42544
* [WordPress/gutenberg/42087 gutenberg/42087] Theme.json: Add block support feature level selectors for blocks gutenberg/42087
* [WordPress/gutenberg/43792 gutenberg/43792] Global Styles: Split root layout rules into a different function gutenberg/43792
* [WordPress/gutenberg/42544 gutenberg/42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg/42544
* [WordPress/gutenberg/42665 gutenberg/42665] Layout: Reduce specificity of fallback blockGap styles gutenberg/42665
* [WordPress/gutenberg/42085 gutenberg/42085] Core CSS support for root padding and alignfull blocks gutenberg/42085

Notes:
* It doesn't entirely port over PR 40875 — the remaining PHP changes for that PR will be explored in a separate PR targeting `layout.php`.
* [54159] was reverted in [54160] due to PHPUnit test failures for tests added by the commit. Later, tests passed when applied on top of `trunk`. There were various outages today of upstream `wp-env` dependencies, which likely were the root cause of the earlier failures. For historical tracking and to make sure, recommitting [54159] but instead on top of current `trunk`. See PR 3205 for more details.
* Giving additional props for those who did a deep dive investigation into the failed tests.

Follow-up to [54160], [54159].

Props andrewserong, aaronrobertshaw, isabel_brison, bernhard-reiter, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54162


git-svn-id: http://core.svn.wordpress.org/trunk@53721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 18:44:09 +00:00
Sergey Biryukov
2c79eaf031 Feeds: Add a set of fine-grained filters to disable the different types of feed links separately.
The previously available set of filters in the `feed_links()` function to enable or disable display of various feed links was quite limited:
* `feed_links_show_posts_feed` to control the main feed
* `feed_links_show_comments_feed` to control both the global comments feed and the comment feed for singular posts.

In order to disable the other feeds (post type archive, category, tag, custom taxonomy, author archive, search results), one would have to unhook `feed_links_extra()` from `wp_head`, but that would completely remove all of those feeds, as well as the single post comments feed.

To allow for more flexibility, this commit introduces a full set of filters in the `feed_links_extra()` function to control each one of the feeds independently, including a way to enable/disable the single post comments feed when the global comments feed is disabled/enabled:

* `feed_links_extra_show_post_comments_feed`
* `feed_links_extra_show_post_type_archive_feed`
* `feed_links_extra_show_category_feed`
* `feed_links_extra_show_tag_feed`
* `feed_links_extra_show_tax_feed`
* `feed_links_extra_show_author_feed`
* `feed_links_extra_show_search_feed`

All of them default to `true`, except for `feed_links_extra_show_post_comments_feed` which defaults to the result of `feed_links_show_comments_feed` to ensure backward compatibility.

Follow-up to [33838], [33839], [53125].

Props lopo, mukesh27, audrasjb, SergeyBiryukov.
Fixes #55904.
Built from https://develop.svn.wordpress.org/trunk@54161


git-svn-id: http://core.svn.wordpress.org/trunk@53720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 17:14:10 +00:00
hellofromTonya
d5c8952218 Editor: Revert [54159].
Reverting changeset due to failing PHPUnit tests. Tests pass without changeset [54156], but fail with it. Reverting to explore why in the original PR after rebasing.

See #56467.
Built from https://develop.svn.wordpress.org/trunk@54160


git-svn-id: http://core.svn.wordpress.org/trunk@53719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 15:52:11 +00:00
audrasjb
c2ff10f1c1 Editor: Backport foundation for Layout block support refactor (part 1).
This change backports the following changes from Gutenberg repository:

- [WordPress/gutenberg#40875 gutenberg#40875] Layout: Use semantic classnames, centralize layout definitions, reduce duplication, and fix blockGap in theme.json
- [WordPress/gutenberg#42544 gutenberg#42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg#42544
- [WordPress/gutenberg#42087 gutenberg#42087] Theme.json: Add block support feature level selectors for blocks gutenberg#42087
- [WordPress/gutenberg#43792 gutenberg#43792] Global Styles: Split root layout rules into a different function gutenberg#43792
- [WordPress/gutenberg#42544 gutenberg#42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg#42544
- [WordPress/gutenberg#42665 gutenberg#42665] Layout: Reduce specificity of fallback blockGap styles gutenberg#42665
- [WordPress/gutenberg#42085 gutenberg#42085] Core CSS support for root padding and alignfull blocks gutenberg#42085

Note that it doesn't entirely port over PR40875 — the remaining PHP changes for that PR will be explored in a separate PR targeting `layout.php`.

Props andrewserong, aaronrobertshaw, isabel_brison.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 14:21:22 +00:00
gziolo
69040b7afe Code Quality: Remove unwanted spaces in the WP_Block_Type class
Follow-up [54155].
Props TobiasBg.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 13:53:13 +00:00
Sergey Biryukov
a2aa01cdac Docs: Correct @return value for wp_get_http_headers().
Following the update to replace the HTTP API internals with Requests library in WordPress 4.6, the return value of `wp_remote_retrieve_headers()` has changed from a simple array to an object which implements `ArrayAccess`.

Since `wp_get_http_headers()` directly returns the result of `wp_remote_retrieve_headers()`, its return value should reflect that change.

Includes:
* Updating the return value for the deprecated `wp_get_http()` function, which also directly returns the result of `wp_remote_retrieve_headers()`.
* Minor DocBlock formatting changes for some other HTTP API functions per the documentation standards.

Follow-up to [2416], [6390], [8092], [9013], [37428], [37989], [38730].

Props mhkuu.
See #54225, #55646.
Built from https://develop.svn.wordpress.org/trunk@54157


git-svn-id: http://core.svn.wordpress.org/trunk@53716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 13:08:14 +00:00
audrasjb
1e791f041d Editor: Backport Style Engine API functions, classes and tests.
This PR migrates the Style Engine PHP functions, classes and tests into Core for 6.1. It backports the original [WordPress/gutenberg#40260 PR #40260] from Gutenberg repository.

Props ramonopoly, bernhard-reiter, costdev, azaozz, andrewserong, mukesh27, aristath.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 12:48:16 +00:00
gziolo
714e57b2fc Blocks: Allow registering multiple items for all supported asset types
Follow-up #54337, [52069]. Part of https://github.com/WordPress/gutenberg/issues/41236. More details in https://github.com/WordPress/gutenberg/issues/33542.

Allow passing more than one script per block for `editorScript`, `script`, and `viewScript` fields in the `block.json` metadata file. This aligns with the previously added changes for `style` and `editorStyle` fields.

This change impacts the `WP_Block_Type` class and the REST API endpoint for block types. To ensure backward compatibiliy old names were soft deprecated in favor of new fields that work with array values and have `_handles` suffix.

Props zieladam, dlh, timothyblynjacobs, aristath, bernhard-reiter.
Fixes #56408.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 10:52:08 +00:00
audrasjb
1f47c2bcbf Twenty Twenty: Ensure headings styles are consistent between editor and front-end.
This changeset removes `.wp-block` container from headings CSS selectors to restore consistency between editor and front-end styles. It also removes `.wp-block` from headings selectors in the `'block-editor'` array of `twentytwenty_get_localized_font_family_elements()`.

Props kajalgohel, kmadhak, poena, multidots1896, tahmidulkarim, audrasjb.
Fixes #56194.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 10:48:11 +00:00
audrasjb
5499d60580 Twenty Twenty: Ensure link color is inherited from paragraph in the editor.
This changeset improves link colors consistency between front-end and the editor.

Props sabernhardt, webcommsat, audrasjb.
Fixes #56214.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 10:19:12 +00:00
audrasjb
b078199637 Twenty Twenty: Correctly align Social Icons block in the editor.
This changeset resets `padding-left` property for the Social Icons block in the editor.

Props umesh84, audrasjb, nidhidhandhukiya, kajalgohel.
Fixes #55987.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 10:04:10 +00:00
audrasjb
3eff1ca584 Twenty Fifteen: Ensure border-bottom styles are applied to the Button Block.
This issue was related to the `:where()` selector, which also affected Twenty Twenty (see #55824).

Props umesh84, sabernhardt.
Fixes #55006.
See #55824.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 09:31:12 +00:00
Sergey Biryukov
aa22aba0ba Upgrade/Install: Update sodium_compat to v1.18.0.
The latest version of sodium_compat includes some improvements, as well as a new feature which will also be included in PHP 8.2.

* Fixed issues with the PHP autoloader:
 * [https://github.com/paragonie/sodium_compat/pull/145 #145]: For WordPress, this ensures when Ed25519 is included, so too is the class it inherits from.
 * [https://github.com/paragonie/sodium_compat/issues/148 #148], [https://github.com/paragonie/sodium_compat/issues/149 #149]: For PHP 7.4+ with opcache preloading, this ensures the include guards don't fail.
* [https://github.com/paragonie/sodium_compat/pull/144 #144]: Added `sodium_crypto_stream_xchacha20_xor_ic()`
 * See [https://github.com/php/php-src/pull/8276 pull request for php-src] (merged in PHP 8.2)
 * For motivation: [https://github.com/paragonie/halite/issues/178 paragonie/halite#178]

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

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

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

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


git-svn-id: http://core.svn.wordpress.org/trunk@53709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 00:13:14 +00:00
audrasjb
7c01b0a340 Plugins: Visually align plugin cards in Plugin Install screen.
This changeset adds a flexible CSS columns layout to plugin cards in the Plugin Install screen, to ensure plugin cards all have the same height.

Props jamesckemp, audrasjb, joyously, sabernhardt, sharjeelkhanvmi, joyously.
Fixes #55721.
See #55272.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 21:51:12 +00:00
Sergey Biryukov
30a13227bd Tests: Rename the test for wp_guess_url() to match the function name.
Includes adding `public` visibilty keyword for the data provider.

Follow-up to [54146].

See #36827.
Built from https://develop.svn.wordpress.org/trunk@54148


git-svn-id: http://core.svn.wordpress.org/trunk@53707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 20:40:11 +00:00
Sergey Biryukov
e9d2ae077c Tests: Rename the test for pre_option filter to match the filter name.
Move the method to a more appropriate place, next to the test for `default_option_*` filter.

Follow-up to [54145].

See #37930.
Built from https://develop.svn.wordpress.org/trunk@54147


git-svn-id: http://core.svn.wordpress.org/trunk@53706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 20:21:08 +00:00
davidbaumwald
1db23fca3f General: Correct path replacement regex in wp_guess_url.
In `wp_guess_url`, the regex to check for wp-login.php in the URL is slightly too permissive, not escaping `.` in "wp-login.php".  `.` is a token in regex that matches any character.

This change simply escapes the `.` and adds unit test coverage for `wp_guess_url`.

Props cfinke, ocean90, jrf, voldemortensen, jdgrimes, curdin, netweb, petitphp, SergeyBiryukov, costdev.
Fixes #36827.
Built from https://develop.svn.wordpress.org/trunk@54146


git-svn-id: http://core.svn.wordpress.org/trunk@53705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 19:50:12 +00:00
davidbaumwald
11a582b0d4 Options, Meta APIs: Add a new pre-option filter.
Although a `pre_option_{$option}` filter already exists, this change adds a more general `pre_option` filter that will run on every `get_option` call.  This brings the control flow into similar flow as `update_option`.

Props flixos90, NathanAtmoz, desrosj, spacedmonkey, pbearne.
Fixes #37930.
Built from https://develop.svn.wordpress.org/trunk@54145


git-svn-id: http://core.svn.wordpress.org/trunk@53704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 19:29:12 +00:00
davidbaumwald
2608eae664 General: Add a new filter for the_posts_pagination_args.
Props pbiron, joyously, audrasjb, robinwpdeveloper.
Fixes 53392.
Built from https://develop.svn.wordpress.org/trunk@54144


git-svn-id: http://core.svn.wordpress.org/trunk@53703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 18:05:09 +00:00
Sergey Biryukov
4229519bec Upgrade/Install: Remove _copy_dir() function as originally intended.
WordPress 3.2 introduced several enhancements to the `copy_dir()` function:
* No more re-installing Akismet upon upgrade.
* Respect custom `WP_CONTENT_DIR` for bundled plugins/theme installation.
* Respect custom `WP_CONTENT_DIR`/`WP_LANG_DIR` for language files when upgrading.
* Add an exclusion list to `copy_dir()` as well as `WP_Filesystem_Base::wp_lang_dir()`.
* Standardize `WP_Filesystem` path method returns.

However, the version of `copy_dir()` that runs during the upgrade process is the one from the older install, not the newer, which means that these enhancements would only be available after upgrading to WordPress 3.2 first, e.g. in a subsequent upgrade to WordPress 3.3.

In order to make these enhancements immediately available in WordPress 3.2, specifically to take advantage of skip lists and avoid re-installing Akismet if it was previously deleted, a temporary copy of the function was utilized, with the intention to remove it in WordPress 3.3 or a later release.

With further enhancements made to the Upgrade API to support partial and no-content builds, this temporary copy is no longer relevant and can be safely removed.

Follow-up to [17576], [17580], [17581], [18225].

Props afragen, costdev, dd32, peterwilsoncc, SergeyBiryukov.
Fixes #55712. See #17173.
Built from https://develop.svn.wordpress.org/trunk@54143


git-svn-id: http://core.svn.wordpress.org/trunk@53702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 16:57:10 +00:00
Sergey Biryukov
47b11120d8 Code Modernization: Fix autovivification from false to array in WP_Scripts::localize().
This function was previously already problematic as it does not do proper input validation, and it has already received tweaks related to PHP 8.0 in [50408] / #52534, which also introduced a `_doing_it_wrong()` notice and added tests.

The short of it is:
* The function expects to receive an `array` for the `$l10n` parameter;
* ...but silently supported the parameter being passed as a `string`;
* ...and would expect PHP to gracefully handle everything else or throw appropriate warnings/errors.

In the previous fix, a `_doing_it_wrong()` notice was added for any non-array inputs. The function would also cause a PHP native "Cannot use a scalar value as an array" warning (PHP < 8.0) or error (PHP 8.0+) for all scalar values, except `false`.

PHP 8.1 deprecated autovivification from `false` to `array`, so now `false` starts throwing an "Automatic conversion of false to array is deprecated" notice.

By rights, the function should just throw an exception when a non-array/string input is received, but that would be a backward compatibility break.

So the current change will maintain the previous behavior, but will prevent both the "Cannot use a scalar value as an array" warning/error as well as the "Automatic conversion of false to array" deprecation notice for invalid inputs.

Invalid inputs ''will'' still receive a `_doing_it_wrong()` notice, which is the reason this fix is considered acceptable.

Includes:
* Adding a test passing an empty array.
* Adding a test to the data provider for a `null` input to make sure that the function will not throw a PHP 8.1 "passing null to non-nullable" notice.

This solves the following PHP 8.1 test error:
{{{
Tests_Dependencies_Scripts::test_wp_localize_script_data_formats with data set #8 (false, '[""]')
Automatic conversion of false to array is deprecated

/var/www/src/wp-includes/class.wp-scripts.php:514
/var/www/src/wp-includes/functions.wp-scripts.php:221
/var/www/tests/phpunit/tests/dependencies/scripts.php:1447
/var/www/vendor/bin/phpunit:123
}}}

Reference: [https://www.php.net/manual/en/migration81.deprecated.php#migration81.deprecated.core.autovivification-false PHP Manual: PHP 8.1 Deprecations: Autovivification from false].

Follow-up to [7970], [18464], [18490], [19217], [50408].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 15:58:12 +00:00
audrasjb
b089b1d99c Twenty Twenty: Improve support for Post Title block alignment.
This changeset ensures alignement settings are correctly reflected for the Post Title block in the Editor.

Props smit08, kajalgohel, devtanbir, sabernhardt, audrasjb.
Fixes #56167.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 08:47:12 +00:00
audrasjb
fd3e5e5f21 Themes: Implement file description for theme.json.
This changeset adds a file description for `theme.json`. This description is notably used in the Theme File Editor.

Props ocean90, kapilpaul, poena.
Fixes #55325.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 08:20:13 +00:00
audrasjb
bcdc46c51c Twenty Seventeen: Ensure long text wraps correctly in the Button Block.
This changeset replaces `white-space: nowrap` with `white-space: preline` to ensure long text used in the button block correctly wraps to a second line.

Follow-up to [44148].

Props robertghetau, bhrugesh12, sabernhardt, mukesh27.
Fixes #55783.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 23:50:11 +00:00
audrasjb
7c4a64e67b Editor: Hide query loop pagination link arrows from assistive technology.
This changeset adss an `aria-hidden="true"` attribute to the optional arrows/chevron characters to the Query Loop and to the Comments Query Loop blocks pagination links.

These characters are text, so they're read out by assistive technologies. For better accessibility, it's best to reduce noise for screen reader users and prevent them to be rendered, using the `aria-hidden="true"` attribute.

Follow-up to [52057].

Props afercia, sabernhardt, kamig478, zieladam, audrasjb, joedolson, costdev.
Fixes #56067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 23:34:12 +00:00
audrasjb
43b406a5ee Comments: Make wp_required_field_indicator() and wp_required_field_message() output filterable.
This changeset introduces two new hooks:

- `wp_required_field_indicator` allows developers to filter the HTML output of the `wp_required_field_indicator()` function.
- `wp_required_field_message` does the same for the `wp_required_field_message()` function.

The changeset also adds new phpunit tests for these filters.

Follow-up to [53888], [54136].

Props kebbet, audrasjb, sabernhardt, costdev, mukesh27.
Fixes #56389.
See #54394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 22:31:10 +00:00
audrasjb
6b6302f95e Comments: Remove aria-hidden="true" attribute for visible text in comment template.
This changeset removes `aria-hidden="true"` attribute used for required fields in comments template, for better accessibility. It removes the attribute from both `wp_required_field_indicator()` and `wp_required_field_message()` patterns.

Follow-up to [53888].

Props juliemoynat, audrasjb, joedolson, sabernhardt, afercia, costdev.
Fixes #55717.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 21:52:10 +00:00
Sergey Biryukov
59e1077010 Code Modernization: Pass correct value to parse_url() in WP_Customize_Manager::get_return_url().
This particular code block only makes sense to run when `$this->return_url` is not null. Previously, it caused a "passing null to non-nullable" deprecation notice on PHP 8.1.

By moving the code into the `if ( $this->return_url )` condition block, the code will only be run when `$this->return_url` contains a non-falsey/non-null value.

No additional tests added as this issue was found via the existing tests for the function containing the bug.

This solves the following two PHP 8.1 test errors:
{{{
1) Tests_WP_Customize_Manager::test_return_url
parse_url(): Passing null to parameter #1 ($url) of type string is deprecated

/var/www/src/wp-includes/class-wp-customize-manager.php:4696
/var/www/tests/phpunit/tests/customize/manager.php:2975
/var/www/vendor/bin/phpunit:123

2) Tests_WP_Customize_Manager::test_customize_pane_settings
parse_url(): Passing null to parameter #1 ($url) of type string is deprecated

/var/www/src/wp-includes/class-wp-customize-manager.php:4696
/var/www/src/wp-includes/class-wp-customize-manager.php:4898
/var/www/tests/phpunit/tests/customize/manager.php:3085
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [46754].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 21:50:14 +00:00
Sergey Biryukov
ca57157a39 Code Modernization: Replace deprecated string interpolation patterns.
PHP 8.2 deprecates string interpolation patterns that place the dollar sign outside the curly braces:
{{{
echo "Hello ${name}";
}}}

This commit fixes such patterns by replacing them with proper curly braced patterns:
{{{
echo "Hello {$name}";
}}}

This addresses `Deprecated: Using ${var} in strings is deprecated, use {$var} instead` notices when running tests on PHP 8.2.

References:
* [https://php.watch/versions/8.2/$%7Bvar%7D-string-interpolation-deprecated PHP.Watch: PHP 8.2: ${var} string interpolation deprecated]
* [https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation PHP RFC: Deprecate ${} string interpolation]

Follow-up to [10584], [31733], [42360], [53922].

Props ayeshrajans, jrf.
Fixes #55787.
Built from https://develop.svn.wordpress.org/trunk@54134


git-svn-id: http://core.svn.wordpress.org/trunk@53693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 17:52:08 +00:00
Sergey Biryukov
c03305852e Code Modernization: Add AllowDynamicProperties attribute to all (parent) classes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.

To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, this commit adds the `#[AllowDynamicProperties]` attribute to all “parent” classes in WP.

The logic used for this commit is as follows:
* If a class already has the attribute: no action needed.
* If a class does not `extend`: add the attribute.
* If a class does `extend`:
 - If it extends `stdClass`: no action needed (as `stdClass` supports dynamic properties).
 - If it extends a PHP native class: add the attribute.
 - If it extends a class from one of WP's external dependencies: add the attribute.
* In all other cases: no action — the attribute should not be needed as child classes inherit from the parent.

Whether or not a class contains magic methods has not been taken into account, as a review of the currently existing magic methods has shown that those are generally not sturdy enough and often even set dynamic properties (which they should not). See the [https://www.youtube.com/watch?v=vDZWepDQQVE live stream from August 16, 2022] for more details.

This commit only affects classes in the `src` directory of WordPress core.
* Tests should not get this attribute, but should be fixed to not use dynamic properties instead. Patches for this are already being committed under ticket #56033.
* While a number bundled themes (2014, 2019, 2020, 2021) contain classes, they are not a part of this commit and may be updated separately.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [53922].

Props jrf, hellofromTonya, markjaquith, peterwilsoncc, costdev, knutsp, aristath.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54133


git-svn-id: http://core.svn.wordpress.org/trunk@53692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 15:47:14 +00:00
gziolo
b0f4c2c37e Blocks: Add new render property in block.json for block types
New `render` field in `block.json` file that accepts a string value. It allows to pass a path to the PHP file that is going to be used to render the block on the server.  Related PR in Gutenberg: https://github.com/WordPress/gutenberg/pull/42430.

Props spacedmonkey, luisherranz, welcher, noisysocks, matveb, fabiankaegy, aristath, zieladam.
Fixes #53148.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 13:14:13 +00:00
TimothyBlynJacobs
950bf585bc REST API: Add support for settings to specify their own additionalProperties.
This switches the Settings Controller to use `rest_default_additional_properties_to_false` and deprecates its own method.

Props anna.bansaghi.
Fixes #56493.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 23:30:10 +00:00
antpb
f185aeb638 Autosave/REST API: Block autosaving from overwriting changes when locked from editing.
Previously when a user was locked from editing a post in the block editor, autosave functionality was allowed to overwrite changes made by the editor that has taken control. This patch honors the lock status keeping autosave from conflicitng with other content editors. 

Props jhart35, adamsilverstein, sathyapulse, chanthaboune, primetimejas, joemcgill, kadamwhite.
Fixes #55659.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 22:35:08 +00:00
Helen Hou-Sandí
3ca1825716 Embeds: Add Google Data Studio as a trusted oEmbed provider
Props swissspidy
Fixes #55771

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


git-svn-id: http://core.svn.wordpress.org/trunk@53688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 22:25:10 +00:00
antpb
fbe878f68d Media: Add muted property for video elements.
This change allows for the muted property to be used in video elements which solves for content that wishes to `autoPlay` when a page is viewed. Adding `muted` to video elements adhears to the requirements browsers have to honor `autoPlay` functionality.

Props prokium, peterwilsoncc, costdev, johnbillion, Benouare.
Fixes #54788.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 22:19:10 +00:00
K. Adam White
bd607c1118 REST API: Introduce _pretty query parameter to opt in to JSON_PRETTY_PRINT.
Add support for a "_pretty" meta-parameter on all REST controllers which instructs WordPress to return pretty-printed JSON, for better readability when inspecting endpoint responses in curl output or certain developer tools.

Introduce the "rest_json_encode_options" filter to permit site owners to control this behavior globally.

Props Viper007Bond, TimothyBlynJacobs, chrisguitarguy, johnbillion, swissspidy, adamsilverstein, danielbachhuber, rmccue.
Fixes #41998.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 22:02:09 +00:00
Pascal Birchler
7973933ad6 Date/Time: Cast extracted strings to integers in wp_resolve_post_date().
`wp_resolve_post_date()` extracts year/month/day from a post date (which is a string) and passes it to `wp_checkdate` (and from there to `checkdate()`), which requires `int`s.

Casting the strings to integers avoids PHP notices due to incorrect argument types.

Props hilayt24.
Fixes #54186
Built from https://develop.svn.wordpress.org/trunk@54126


git-svn-id: http://core.svn.wordpress.org/trunk@53685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 21:59:09 +00:00
Weston Ruter
aee27cf6c0 Customize: Prevent JS error in Links widget when selective refresh is enabled
This prevents erroneously replacing the `data-customize-partial-id` when only the `id` attribute should be replaced. 

Props dlh, costdev, nikeo, greenshady.
Fixes #39451.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 21:57:09 +00:00
Aaron Jorbin
6937c8d87e Build/Test: Prevent using unsupported NPM versions.
Using NPM 7+ currently causes a number of issues. In order to improve developer experience, we should prevent a developer from going down the road of using incompatible engines.

See also: https://github.com/WordPress/gutenberg/pull/29204 and https://github.com/WordPress/gutenberg/pull/23600.

Props rcorrales.
Fixes #56547.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 21:54:08 +00:00
TimothyBlynJacobs
fc4485c17f REST API: Add support for searching resources by id.
This brings support for the `include` and `exclude` collection parameters to the Search Controller. This can be used to find an item by id when it's subtype is unknown.

Props kadamwhite.
Fixes #56546.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 21:12:11 +00:00
Joe McGill
8f390b309a Editor: Refresh nones for metaboxes after reauthentication.
This fixes an issue where metaboxes fail to save after a session expires and a user logs in again via the heartbeat API.

Props LinSoftware.
Fixes #52584.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 20:46:10 +00:00
TimothyBlynJacobs
ef6619d68e REST API: Use helper functions for building routes in more places.
Props get_dave, spacedmonkey.
Fixes #56472.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 18:55:09 +00:00
Aaron Jorbin
a99adb76ed Customize: Use Semantically correct function
Functionally, `add_action` and `add_filter` are essentially the same, but semantically they are not.

Props Drivingralle.
Fixes #56285.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 18:18:10 +00:00
Sergey Biryukov
1a37650766 Docs: Correct @global tags in WP_User_Query::prepare_query().
* `$blog_id` global was replaced with `get_current_blog_id()` and is no longer used directly.
* `$wp_roles` global usage was previously undocumented.

Follow-up to [32637], [38457], [51943].

Props shoaibkarimali.
Fixes #56543.
Built from https://develop.svn.wordpress.org/trunk@54119


git-svn-id: http://core.svn.wordpress.org/trunk@53678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 13:13:12 +00:00
Sergey Biryukov
70c0f6f0e1 Editor: Backport Elements API updates.
This commit backports the original PRs from Gutenberg repository:

* [https://github.com/WordPress/gutenberg/pull/40260 #40260 Add support for button elements to theme.json]
* [https://github.com/WordPress/gutenberg/pull/40889 #40889 Theme Json: Don't output double selectors for elements inside blocks]
* [https://github.com/WordPress/gutenberg/pull/41140 #41140 Global Styles: Add support for caption elements]
* [https://github.com/WordPress/gutenberg/pull/41160 #41160 Global Styles: Load block CSS conditionally]
* [https://github.com/WordPress/gutenberg/pull/41240 #41240 Global Styles: Button Element: update button element selector]
* [https://github.com/WordPress/gutenberg/pull/41335 #41335 Duotone: Fix CSS Selectors rendered by theme.json duotone/filter settings for blocks on public pages]
* [https://github.com/WordPress/gutenberg/pull/41446 #41446 Block styles: Account for style block nodes that have no name]
* [https://github.com/WordPress/gutenberg/pull/41696 #41696 Global Styles: Allow references to values in other locations in the tree]
* [https://github.com/WordPress/gutenberg/pull/41753 #41753 Elements: Add an API make it easier to get class names]
* [https://github.com/WordPress/gutenberg/pull/41786 #41786 Support pseudo selectors on elements in theme json]
* [https://github.com/WordPress/gutenberg/pull/41822 #41822 Elements: Button - Fix element selectors]
* [https://github.com/WordPress/gutenberg/pull/41981 #41981 Global Styles: Add support for heading elements]
* [https://github.com/WordPress/gutenberg/pull/42072 #42072 Fix link element hover bleeding into button element default styles]
* [https://github.com/WordPress/gutenberg/pull/42096 #42096 Add visited to link element allowed pseudo selector list]
* [https://github.com/WordPress/gutenberg/pull/42669 #42669 Link elements: Add a :where selector to the :not to lower specificity]
* [https://github.com/WordPress/gutenberg/pull/42776 #42776 Theme JSON: Add a static $blocks_metadata data definition to the Gutenberg instance of WP_Theme_JSON]
* [https://github.com/WordPress/gutenberg/pull/43088 #43088 Pseudo elements supports on button elements]
* [https://github.com/WordPress/gutenberg/pull/43167 #43167 Theme_JSON: Use existing append_to_selector for pseudo elements]
* [https://github.com/WordPress/gutenberg/pull/43988 #43988 Styles API: Fixed selectors for nested elements]

Props onemaggie, bernhard-reiter, cbravobernal, mmaattiiaass, scruffian, andraganescu, dpcalhoun, get_dave, Mamaduka, SergeyBiryukov.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54118


git-svn-id: http://core.svn.wordpress.org/trunk@53677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-10 12:38:12 +00:00
Sergey Biryukov
9ba0095255 KSES: Allow assigning values to CSS variables.
The `safecss_filter_attr()` function allows using custom CSS variables like `color: var(--color)`. However, it did not allow assigning values to CSS variables like `--color: #F00`, which is common in Global Styles and Gutenberg.

This commit adds support for assigning values to CSS variables, so that the function can be used consistently in Global Styles and the future Style Engine in Gutenberg.

Follow-up to [50923], [54100].

Props aristath, ramonopoly, SergeyBiryukov.
Fixes #56353.
Built from https://develop.svn.wordpress.org/trunk@54117


git-svn-id: http://core.svn.wordpress.org/trunk@53676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 12:39:11 +00:00
audrasjb
02032a7562 Docs: Clarify wp-includes/update.php main docblock description.
Props costdev, audrasjb.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 09:15:12 +00:00
audrasjb
700787f0c5 Docs: Various docblock fixes in wp-includes/update.php, as per documentation standards.
This addresses some files modified in changeset [54113].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 08:58:09 +00:00
audrasjb
7c20a1d2d5 Docs: Various docblock fixes in Site Health related files, as per documentation standards.
This addresses some files modified in changeset [54113].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 08:47:08 +00:00
audrasjb
c7fe0f88d2 Coding Standards: Clarify time units for various timeout or expiration values.
This changeset implements a clearer and more consistent timeout/duration/expiration format. It updates time durations used in various files, as per WordPress coding standards:

- If the value can be represented as an integer (not a fractional) number of minutes (hours, etc.), use the appropriate constant (e.g.: `MINUTE_IN_SECONDS`) multiplied by that number.
- Otherwise, keep the value as is and add a comment with the units for clarity.

Follow-up to [11823], [13177], [21996], [37747], [53714].

Props hztyfoon, audrasjb, arrasel403, krupalpanchal, GaryJ, SergeyBiryukov, peterwilsoncc, rudlinkon, costdev, robinwpdeveloper.
Fixes #56293.
See #55647.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 08:16:18 +00:00
Peter Wilson
3c6cad73b2 Widgets: Store default options for uninitialized widgets.
Prevent unnecessary database queries on page load by initializing widget options. On sites with uninitialized widgets, this prevents one or two database queries per uninitialized widget on each page load.

Props Chouby, mvraghavan, costdev, peterwilsoncc, spacedmonkey, mukesh27.
Fixes #54677.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 02:19:10 +00:00
Peter Wilson
31c90342c9 Query: Improve WP_Query's cache key generation for taxonomy queries.
Modify how `WP_Query` determines whether a database query contains a taxonomy component and accounts for term changes when generating the cache key. This presents a stale cache been used under some circumstances.

Props Chouby, costdev, peterwilsoncc.
See #22176.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 02:06:09 +00:00
Peter Wilson
b8f713ab09 Cron API: Remove unnecessary optimization getting ready events.
Remove the check for future events prior iterating the array of crons in `wp_get_ready_cron_jobs()`. If there are no ready events, the `foreach` loop will break on the first iteration so the optimization is not required.

As WordPress Core adds a number of events by default, accounting for an empty array is not required in most instances.

Props lev0, jrf, SergeyBiryukov.
Fixes #56092.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 01:53:11 +00:00
audrasjb
5f55192c9a Twenty Fifteen: Increase the font size used for h5 headings.
This changeset ensures `h5` and `h5` heading levels don't use the same font size.

Follow-up to [29892].

Props poena, akabarikalpesh, hellofromTonya, afrid1719, aezazshekh, sabernhardt, anitanenova, viralsampat, alansyue, pratiweb, russel07.
Fixes #52028.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 23:57:12 +00:00
desrosj
1a573e1bfc Build/Test Tools: Use the default GITHUB_TOKEN instead of a personal access token.
Previously, it was not possible to use the default `GITHUB_TOKEN` token to create new workflow runs in an effort to prevent accidental recursive workflows.

This has changed, and the `workflow_dispatch` is now one of two exceptions to this rule. Using `GITHUB_TOKEN` is preferred whenever possible to avoid the need for a PAT (personal access token), which expires (when created using the recommended security best practices), and is tied to an individual user.

See https://github.blog/changelog/2022-09-08-github-actions-use-github_token-with-workflow_dispatch-and-repository_dispatch/.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 23:41:14 +00:00
audrasjb
ee5e12f906 Twenty Twenty: Add a missing border to button-style links with Outline style.
This changeset addresses an issue where button-style links with Outline style variation were not consistent with the corresponding variation of the Button block.

Props umesh84, sabernhardt, mrfoxtalbot, mohitdadhich10.
Fixes #55824.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 23:03:11 +00:00
audrasjb
c3227c3776 Twenty Nineteen: Add font smoothing to editor styles.
This brings consistency between editor and front-end typography.

Props laurelfulford, sabernhardt, audrasjb.
Fixes #45909.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 22:42:13 +00:00
Sergey Biryukov
ee5b219070 Global Styles: Add support for heading, button, and caption elements.
This enables themes to:
* Set style rules for all heading elements together rather than having to do it individually.
* Style captions in `theme.json` by adding this into your `theme.json` file:
{{{
{
	"styles": {
		"elements": {
			"caption": {
				"color": {
					"background": "red",
					"text": "yellow"
				}
			}
		}
	}
}
}}}

This commit backports the original PRs from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41981 #41981: Global Styles: Add support for heading elements]
* [https://github.com/WordPress/gutenberg/pull/41140 #41140: Global Styles: Add support for caption elements]

Follow-up to [50973].

Props cbravobernal, scruffian, madhudollu, mikachan, zieladam, bph, poena, andraganescu, ndiego, bgardner.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54105


git-svn-id: http://core.svn.wordpress.org/trunk@53664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 16:44:11 +00:00
Sergey Biryukov
be113df39d Editor: Update single default template description.
In order to add more template types we need to update some copy from the current default templates provided.

This updates the `single` template copy as it's needed to clear up the ambiguity between the single template that is the fallback for any custom post type (including `post`) and the menu item to be added in a subsequent commit, that will allow the creation the `single-post` template and any `single_$post_type` template.

This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41302 #41302: Site Editor: Update single default template copy]

Follow-up to [52062], [52331].

Props ntsekouras, bernhard-reiter, jameskoster, Mamaduka, scruffian.
Fixes #56534.
Built from https://develop.svn.wordpress.org/trunk@54104


git-svn-id: http://core.svn.wordpress.org/trunk@53663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 16:15:08 +00:00
Sergey Biryukov
25e697c948 Twenty Twenty-One: Remove spacer block styles.
The theme includes styles for the spacer block for the front which appears to be unnecessary:
* It adds `display: block` even though that is the default.
* It removes top and bottom margin, even though this is not needed in the post content because of collapsing margins between blocks.
* It uses a custom CSS property to force a specific height on mobile. This affects the patterns in the theme negatively.

It also causes styling problems:
* When the spacer block has a height set to `0` in the navigation block, as the theme forces this to be larger on smaller screens.
* When the block is horizontal. Horizontal was not an option when this style was added.

Consequences of removal:
* Removing the use of the custom CSS property will cause a style change for websites that have adjusted the spacing property.

Follow-up to [49216], [49574].

Props poena, mukesh27.
Fixes #56222.
Built from https://develop.svn.wordpress.org/trunk@54103


git-svn-id: http://core.svn.wordpress.org/trunk@53662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 15:48:08 +00:00
Sergey Biryukov
ffaf3da76f KSES: Allow more layout-related CSS properties.
Adds support for the following CSS properties considered safe for inline CSS:
* `flex-wrap`
* `gap`
* `column-gap`
* `row-gap`

Extends support for `margin` and `padding` to include logical properties:
* `margin-block-start`
* `margin-block-end`
* `margin-inline-start`
* `margin-inline-end`
* `padding-block-start`
* `padding-block-end`
* `padding-inline-start`
* `padding-inline-end`

Follow-up to [46235].

Props andrewserong, peterwilsoncc, ramonopoly, bernhard-reiter.
Fixes #56122.
Built from https://develop.svn.wordpress.org/trunk@54102


git-svn-id: http://core.svn.wordpress.org/trunk@53661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 15:06:09 +00:00
Sergey Biryukov
f6c2690313 Editor: Update duotone block supports to allow unset for preset colors.
This add the ability to unset duotone in themes with default duotone set.

This commit backports the original PRs from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/39564 #39564: Add ability to unset duotone in themes with default duotone set]
* [https://github.com/WordPress/gutenberg/pull/42020 #42020: Remove: Unrequired regex search on duotone supports]

Follow-up to [50929], [52757].

Props ajlende, jorgefilipecosta, Joen, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54101


git-svn-id: http://core.svn.wordpress.org/trunk@53660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 14:34:11 +00:00
Sergey Biryukov
b65fba9742 KSES: Allow min(), max(), minmax(), and clamp() values to be used in inline CSS.
Additionally, this commit updates `safecss_filter_attr()` to add support for nested `var()` functions, so that a fallback value can be another CSS variable.

Follow-up to [50923].

Props johnregan3, noisysocks, cbravobernal, uxl, isabel_brison, andrewserong, ramonopoly, joyously, bernhard-reiter, peterwilsoncc.
Fixes #55966.
Built from https://develop.svn.wordpress.org/trunk@54100


git-svn-id: http://core.svn.wordpress.org/trunk@53659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 13:26:14 +00:00
spacedmonkey
6542de4220 Posts, Post Types: Call update_post_author_caches function in WP_Posts_List_Table class.
Call the `update_post_author_caches` function in the `WP_Posts_List_Table` class to prime post author caches in a single database request.

Props spacedmonkey, thakkarhardik, desrosj. 
Fixes #56100.
Built from https://develop.svn.wordpress.org/trunk@54099


git-svn-id: http://core.svn.wordpress.org/trunk@53658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 10:17:12 +00:00
spacedmonkey
6d882a5dd9 Media: Call update_post_parent_caches function in WP_Media_List_Table class.
Call the `update_post_parent_caches` in `WP_Media_List_Table` class to prime parent caches in a single database request.

Props spacedmonkey, antpb, hellofromTonya, jeawhanlee, peterwilsoncc, alaca. 
Fixes #56036.
Built from https://develop.svn.wordpress.org/trunk@54098


git-svn-id: http://core.svn.wordpress.org/trunk@53657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 09:37:17 +00:00
Felix Arntz
610d2d6a44 Media: Generate WebP only for certain registered image sizes.
The existing filter `image_editor_output_format` receives an additional parameter `$size_name` which is populated whenever it controls the output format for a specific registered image size to create. Otherwise, it remains empty. In order to achieve this, a low level change has been added in bringing a new `$size_name` class property to the `WP_Image_Editor` base class, which is introduced in a backward compatible way that will not cause conflicts with custom implementations.

This parameter is then used in new logic inside the `wp_default_image_output_mapping()` callback function for the filter, controlling whether `image/jpeg` should map to `image/webp` output or not. By default, this is enabled for all WordPress core image sizes by default, and this list can be modified using a new `wp_image_sizes_with_additional_mime_type_support` filter, e.g. to remove core sizes or add custom sizes.

The customization per image size may be further enhanced by providing a more declarative API via a new parameter on the `add_image_size()` function.

Props eugenemanuilov, flixos90, adamsilverstein, joegrainger.

Fixes #56526.
See #55443, #56288.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 21:45:14 +00:00
John Blackbourn
fa8f9ebd85 Build/Test Tools: Always use the amd64 images for MariaDB and MySQL on the local development environment.
The `amd64/mysql` and `amd64/mariadb` official images from Docker are also compatible with an x64 host machine which means they can be used by default instead of only when the host uses ARM64.

Props bernhard-reiter, czapla, gmovr, withinboredom

Fixes #56528

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


git-svn-id: http://core.svn.wordpress.org/trunk@53655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 17:15:15 +00:00
Sergey Biryukov
b4331c7914 Tests: Correct magic methods in Basic_Object.
This is a test fixture (dummy class only used in a test context), which incorrectly implements the magic methods.

With the deprecation of dynamic properties in PHP 8.2, this needs to be fixed.

The new implementation represents a “proper” implementation of the magic methods for a class without non-`public` or typed properties.

Notes:

* Instead of relying on dynamic properties, the magic methods now store properties in a `private` `$arbitrary_props` array and retrieve them from there as well.
* The original `$foo` property, even though declared as `private`, was never `private` in practice due to the way the magic methods were originally implemented. In effect, it was fully publicly retrievable and modifiable without any (type) restrictions. With that in mind, the `foo` property has been moved into the `$arbitrary_props` array to keep the implementation of the magic methods as clean and straightforward as possible. With the adjusted magic methods, access to and modification of `$foo` will (on the surface) continue to work in the same way as before, while under the hood, it is no longer affected by the dynamic properties deprecation.
* Take note of the use of `array_key_exists()` instead of `isset()` in the `__get()` method. This is intentional and allows for `null` values to be stored and retrieved.
*  Also take note of `__set()` method no longer returning. `__set()` is supposed to be a `void` method. In practice, the return value would always be ignored due to how PHP handles magic methods, so in effect, this change will not make any difference and does not constitute a backward compatibility break.[[BR]][[BR]]
 > The return value of `__set()` is ignored because of the way PHP processes the assignment operator.

Alternatives considered:

* Instead of fixing the magic methods, they could have been removed instead and the class be made to `extend` `stdClass`. It has been chosen not to do so for two reasons:
 1. It’s kind of nice to have at least ''one'' correct implementation of magic methods in WP, which can be used as an example to point to as well.
 2. Extending `stdClass` would change the class hierarchy, which ''may'' or ''may not'' affect the tests using this fixture (depending on what’s being done with the class). Extending `stdClass` would also obfuscate what’s going on in the class and would require extensive documentation to prevent the extension being inadvertently removed at a future point in time.
* Instead of fixing the magic methods, the test fixture could have been deprecated and/or removed, with the few tests which use the fixture being updated to use `stdClass` for their test fixture instead. It has been chosen not to do so as there may well be external (plugin/theme) tests relying on this test fixture and evaluating whether that is so would be hard, as WP Directory cannot be used, since test code is normally not included in the code published on wp.org. Also note, there is still a (deprecated) `Basic_Subclass` fixture in the test suite, which extends this class.

These magic methods and the `Basic_Object` test fixture were originally introduced in [28480] and [28523]. The fixture was deprecated in [42381] and undeprecated again in [45807].

At this time, the test fixture is used in the `WP_Test_REST_Post_Meta_Fields` and the `Tests_REST_API` test classes.

References:
* [https://www.php.net/manual/en/language.oop5.overloading.php#object.set PHP Manual: Overloading: __set()]
* [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties]
* [https://github.com/php/php-src/issues/7786 php-src: #7786 PHP 8.2: unexpected deprecation for dynamic property set via magic method]

Follow-up to [28480], [28493], [28523], [42381], [45807].

Props jrf, costdev.
See #56514.
Built from https://develop.svn.wordpress.org/trunk@54095


git-svn-id: http://core.svn.wordpress.org/trunk@53654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 16:01:08 +00:00
Felix Arntz
42416cf392 Media: Move wp_default_image_output_mapping() filter callback to frontend scope.
While the `image_editor_output_format` filter is primarily used in WP Admin, it can also be executed in frontend scope, as the related `WP_Image_Editor` class and `wp_unique_filename()` function are being loaded in that scope.

Follow up to [54086].

See #55443, #56526.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 15:41:15 +00:00
Sergey Biryukov
ca1a756ff2 KSES: Revert [54092] for now to address unit test failures.
See #55966.
Built from https://develop.svn.wordpress.org/trunk@54093


git-svn-id: http://core.svn.wordpress.org/trunk@53652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 15:24:13 +00:00
Sergey Biryukov
a15d6fd15b KSES: Allow min(), max(), minmax(), and clamp() values to be used in inline CSS.
Follow-up to [50923].

Props johnregan3, uxl, isabel_brison, andrewserong, ramonopoly, noisysocks, joyously.
See #55966.
Built from https://develop.svn.wordpress.org/trunk@54092


git-svn-id: http://core.svn.wordpress.org/trunk@53651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 14:40:10 +00:00
Sergey Biryukov
96dd426d21 Tests: Remove redundant function_exists() check in a term_is_ancestor_of() test.
The function is available as of WordPress 3.4.

Follow-up to [19678], [493/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 14:07:12 +00:00
Sergey Biryukov
f00690c4a6 Tests: Use the factory method instead of the property.
This replaces all references to the `WP_UnitTestCase_Base::$factory` property with static function calls to the `WP_UnitTestCase_Base::factory()` method.

This is a consistency improvement for the test suite.

Follow up to [35225], [35242], [49603], [54087], [54088].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 22:11:10 +00:00
Clorith
6bf326e967 Site Health: Fix TypeError when copying debug information.
In [53164] the `clipboard.js` library was updated to from version 2.0.8 to 2.0.10, and in doing so caused a TypeError JavaScript error to be thrown when the copy button for debug information was used.

With the update, the `clipboard.js` library introduced an enhancement to its `.copy()` API, which now removes the fake DOM element used for copying content, which Site Health previously had to remove manually.

As this fake DOM element is now removed automatically, the copy function within the debug information screen can rely on the library performing the removal, instead of WordPress needing to do so manually.

Props hiren1094, costdev.
Fixes #56515.
Built from https://develop.svn.wordpress.org/trunk@54089


git-svn-id: http://core.svn.wordpress.org/trunk@53648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 22:06:19 +00:00
Sergey Biryukov
b245a374b8 Tests: Correctly use the factory method.
This replaces all non-static calls to the `WP_UnitTestCase_Base::factory()` method with static function calls, since the method is declared as static.

This is a consistency improvement for the test suite.

Follow up to [35225], [35242], [49603], [54087].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 22:05:10 +00:00
Sergey Biryukov
1f506d3211 Build/Test Tools: Remove magic methods from WP_UnitTestCase_Base (without a backward compatibility break).
These magic methods were introduced to prevent a backward compatibility break, but in actual fact:

1. ''Caused'' a backward compatibility break. The original `$factory` property was a `static` property and this declared property was replaced by the magic methods. Unfortunately, it was not realized at the time that these magic methods **''are not called for static property access''**.[[BR]][[BR]]
 > Property overloading only works in object context. These magic methods will not be triggered in static context.
 And as approaching a static property in a non-static manner is [https://3v4l.org/93HQL not supported in PHP], this effectively created a backward compatibility break instead of preventing it.

2. Were hiding errors in tests, as the magic methods would be invoked for non-existent properties and would return `null` (get) or `false` (isset). See [54040], [54041], and [54077] for bug fixes related to this.

3. Are problematic in relation to PHP 8.2, as the implementation is incomplete, does not protect against dynamic properties and hides PHP notices about undefined properties.

Now, there were several options to mitigate this:

1. Revert the original commit. This would be problematic, as the ''non-static'' version of these properties has now been supported for 7 years, so this would create a new backward compatibility break.

2. Improve the magic methods. With all the issues with magic methods (see the discussion in the [https://www.youtube.com/watch?v=vDZWepDQQVE livestream from August 16, 2022], this would probably cause more problems than it’s worth and would make for a much more complex implementation, which is over the top for this relatively simple functionality, especially in the context of a test suite.

3. Remove the magic methods without adding the property. This would again cause a backward compatibility break, though one for which the mitigation solution would be relatively straightforward, i.e. to replace property access using `$this->factory` with a function call `$this->factory()` (or `self::factory()`, as the method is declared as static).    While we can (and have in a subsequent commit) mitigate this for the WP Core test suite, mitigating this for plugin or theme integration tests is outside of our purview and they would still need to deal with this backward compatibility break.

4. The current solution: removing the magic methods, explicitly declaring the (non-static) property and setting it in the `set_up()` method. This does not constitute a backward compatibility break with the functionality as it was over the past 7 years. Setting the property in `set_up()` may be “late”, but that is the earliest place in which the property can be set as non-static. If the factory would be needed prior to `set_up()`, the (static) `WP_UnitTestCase_Base::factory()` method should be called directly. This is no different from how this functionality behaved over the past 7 years.

Note: The property is straight away marked as “deprecated”, since the method should be favored over the use of the property.

Reference: [https://www.php.net/manual/en/language.oop5.overloading.php#object.get PHP Manual: Property overloading: __get()]

Follow-up to [35225], [35242].

Props jrf, costdev.
See #56514.
Built from https://develop.svn.wordpress.org/trunk@54087


git-svn-id: http://core.svn.wordpress.org/trunk@53646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 22:02:09 +00:00
Adam Silverstein
897a9743be Media: Output WebP by default when uploading JPEGs.
Uploaded JPEGs will automatically be converted to WebP sub-sizes instead of JPEG, saving space and making sites faster.

The original JPEG upload is always retained and can be accessed by calling `wp_get_original_image_url`.

Props azaozz, flixos90.
Fixes #55443.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 21:15:08 +00:00
Adam Silverstein
4b5968aa9b Media: revert the multi-mime feature.
This feature isn't quite ready to land.

Reverts r53786, r53848, r53847, r53845, r53751.

Props flixos90, azaozz, dd32.
See #55443.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 21:13:12 +00:00
Sergey Biryukov
32b92a213a Block Editor: Preload settings and templates permissions.
This is a path for following changes in the Gutenberg plugin:
* [https://github.com/WordPress/gutenberg/pull/42209 #42209: Post Editor: Preload templates post type permissions]
* [https://github.com/WordPress/gutenberg/pull/42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 16:18:11 +00:00
Sergey Biryukov
6e26f8f8c7 REST API: Add the missing site_icon_url to the index.
The `site_icon_url` index was supposed to ship with WordPress 5.6, but was [https://github.com/WordPress/gutenberg/pull/22952 never backported to core].

This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/42957 #42957: REST API: Add the missing 'site_icon_url' to the index]

Follow-up to [52080].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 14:43:09 +00:00
Sergey Biryukov
5b2c18d295 Docs: Add a @since note for the update_network_meta_cache parameter of WP_Network_Query::__construct().
Follow-up to [54080].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 14:21:10 +00:00
Sergey Biryukov
df56131c6a Docs: Simplify a comment in WP_Network_Query::get_networks() and WP_Site_Query::get_sites().
This aims to improve readability. The arguments ignored are listed in the line directly below, so there is no need to mention them twice.

Follow-up to [41059], [41063], [53097], [53098], [54080].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 13:59:13 +00:00
spacedmonkey
8d1156f066 Networks and Sites: Use metadata api in `*_network_options functions.
Replace logic found in `get_network_option`, `update_network_option` and `delete_network_option` to use the metadata api. Using the metadata api has a number of benefits, such as consistency, default values and useful filters. This change also improves performance by priming the caches of all network options in a single database request. 

Props spacedmonkey, swissspidy, sc0ttkclark, johnjamesjacoby, flixos90, jeremyfelt, pento, peterwilsoncc, mukesh27, desrosj.
Fixes #37181
Built from https://develop.svn.wordpress.org/trunk@54080


git-svn-id: http://core.svn.wordpress.org/trunk@53639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 11:28:13 +00:00
noisysocks
4a5f783888 Script Loader: Pass startOfWeek setting to @wordpress/date
Allows the block editor to respect the site's Week Starts On setting by defining
`i10n.startOfWeek` when initialising the `@wordpress/date` module.

This is a backport of https://github.com/WordPress/gutenberg/pull/41648.

See #56467.
Props andrewserong.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 02:52:11 +00:00
Sergey Biryukov
50493b7405 Tests: Consistently create a post fixture in old date or slug redirect tests.
This affects:
* `Tests_Rewrite_OldDateRedirect`
* `Tests_Rewrite_OldSlugRedirect`

This commit updates the latter test class to create a post in the `wpSetUpBeforeClass()` method, for consistency with the former class. This ensures that both classes declare the `$post_id` property as `static`, to avoid a situation where non-static access is accidentally used when copying similar test cases from one class to the other.

Follow-up to [34659], [42587], [54077].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 01:27:08 +00:00
Sergey Biryukov
0562036947 Tests: Correct the cache invalidation tests for old date or slug redirect.
This affects:
* `Tests_Rewrite_OldDateRedirect::test_old_date_redirect_cache_invalidation()`
* `Tests_Rewrite_OldSlugRedirect::test_old_slug_redirect_cache_invalidation()`

In the former test, the `$post_id` property is declared as `static`, so can only be approached as static, even when used within the same class in which the property is declared.

Using non-static access will result in `null`. See: https://3v4l.org/93HQL

This PHP notice was hidden so far, due to the existence of magic methods in the `WP_UnitTestCase_Base class`.

All the same, the magic methods as they were, would also return `null` for this property. All in all, the post being updated for this test would never get the correct `post_id`.

Fixed by using static access to approach the `static` property.

On a related note, the described bug fix (using the actual `$post_id` instead of `null`) exposed that this test was as a matter of fact failing. This was just hidden by the first bug.

Based on the original commit introducing the test, an adjustment is now made which appears to be what the test actually ''intended'' to test. A similar change is made to the cache invalidation test for old slug redirects. While not strictly required, it brings some consistency between the two tests and ensures that both tests use a unique `post_name` value to avoid collisions with the previous values.

This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.

Follow-up to [53549].

Props jrf, costdev, SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54077


git-svn-id: http://core.svn.wordpress.org/trunk@53636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 01:01:12 +00:00
Sergey Biryukov
0ba70d8ad4 Tests: Correct the tests for Site Health SQL versions matching readme.html.
These tests should check the initial `$mysql_recommended_version` and `$mariadb_recommended_version` properties, as `WP_Site_Health::prepare_sql_data()` redefines the former with the latter to simplify further processing if MariaDB is used, leading to a test failure:
{{{
Tests_Site_Health::test_mysql_recommended_version_matches_readme_html
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'5.7'
+'10.3'
}}}

This commit uses the initial property values to ensure the correct versions are being compared.

Follow-up to [54069].

See #55791.
Built from https://develop.svn.wordpress.org/trunk@54076


git-svn-id: http://core.svn.wordpress.org/trunk@53635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 00:13:11 +00:00
Sergey Biryukov
dd176ecba4 Tests: Move Site Health unit test class to phpunit/tests/admin/.
Includes:
* Renaming the test class per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization naming conventions].
* Creating a `WP_Site_Health` instance in the `set_up()` method, instead of leaving that to each individual test.

This brings some consistency with the tests for other admin classes, e.g. `WP_Community_Events`.

Follow-up to [45802], [51639].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 22:27:08 +00:00
Sergey Biryukov
5d9ccf7fd1 Tests: Temporarily skip the test for recommended PHP version in readme.html.
This test verifies that the WordPress `readme.html` file recommends a PHP version that is actively supported. However, WordPress currently still recommends PHP 7.4 due to PHP 8.0/8.1 compatibility not being fully achieved, even though PHP 7.4 is end-of-life.

As things were, the assertion in the test was commented out, leading to this test being marked as “risky” for not performing any assertions.

Instead, let’s skip the test with a clear skip notification.

Follow-up to [52260].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 21:16:10 +00:00
Sergey Biryukov
7f92613e06 Tests: Prevent an Ajax test for IMAGE_EDIT_OVERWRITE from being marked as risky.
This affects `Tests_Ajax_MediaEdit::testImageEditOverwriteConstant()`.

In case the `$files_that_should_not_exist` file list is empty, the test would be marked as risky, since it would not perform any assertions.

This small tweak prevents that from happening.

Follow-up to [38113].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 19:24:11 +00:00
Sergey Biryukov
24050652e5 Build/Test Tools: Do not allow tests to fail for select PHP 8.1 test runs.
This affects the following test groups:
* Ajax tests
* ms-files tests
* External HTTP tests
* Xdebug tests

The tests being run in these particular test groups are passing on PHP 8.1, however, the test runs are still allowed to “continue on error”. This creates the risk that new PHP 8.1 incompatibilities will be introduced without anyone noticing.

By no longer allowing these test runs to “continue on error”, that risk is removed.

Follow-up to [51588], [51604], [53922].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 18:57:13 +00:00
Sergey Biryukov
c54960342b Coding Standards: Use more meaningful variable names for output in the admin.
This renames some variables for clarity, per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]:
> Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

* `$out` is renamed to `$output` in various list table methods and admin functions.
* `$sep` is renamed to `$separator` in various list table methods and admin functions.

This affects:
* `WP_Comments_List_Table::handle_row_actions()`
* `WP_List_Table::row_actions()`
* `WP_Media_List_Table::column_default()`
* `WP_MS_Sites_List_Table::site_states()`
* `WP_MS_Users_List_Table::column_blogs()`
* `WP_Terms_List_Table::column_name()`
* `_wp_dashboard_recent_comments_row()`
* `image_align_input_fields()`
* `image_size_input_fields()`
* `wp_doc_link_parse()`
* `_post_states()`
* `_media_states()`

Follow-up to [8653], [8692], [8864], [8910], [8911], [8916], [9103], [9153], [10607], [15491], [17793], [32644], [54070].

Props mukesh27, costdev.
See #56448, #55647.
Built from https://develop.svn.wordpress.org/trunk@54071


git-svn-id: http://core.svn.wordpress.org/trunk@53630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 17:19:09 +00:00
Sergey Biryukov
cdfb7d7ef0 Coding Standards: Use more meaningful variable names in WP_Users_List_Table.
This renames some variables for clarity, per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]:
> Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

* `$c` is renamed to `$columns` in `::get_columns()` and `::get_sortable_columns()`.
* `$r` is renamed to `$row` in `::single_row()`.

Follow-up to [3677], [5542], [6852], [8936], [15491], [16573].

Props burhandodhy, costdev, mukesh27, Presskopp.
See #56448, #55647.
Built from https://develop.svn.wordpress.org/trunk@54070


git-svn-id: http://core.svn.wordpress.org/trunk@53629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 16:02:09 +00:00
Sergey Biryukov
b43dcea01e Site Health: Bump the recommended MySQL and MariaDB versions.
* MySQL 5.6 has reached EOL (“End of Life”) in February 2021. The recommended minimum is bumped to 5.7 for now.
* MariaDB 10.2 has reached EOL in May 2022. The recommended minimum is bumped to 10.3 for now.

This commit brings the Site Health recommendations in line with `readme.html`.

Includes:
* Adding two unit tests to ensure the SQL server versions recommended by Site Health match `readme.html`.
* Consistently declaring the recommended and required versions as the `WP_Site_Health` class properties.
* Renaming some pre-existing private properties for clarity.

Follow-up to [44986], [52319], [52358], [52420], [52424], [53431], [53433], [53435], [meta11407], [meta11866].

See #55791, #meta5999, #meta6322.
Built from https://develop.svn.wordpress.org/trunk@54069


git-svn-id: http://core.svn.wordpress.org/trunk@53628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 15:20:09 +00:00
Sergey Biryukov
c6c02c9dc6 Tests: Consistently set the current user in the tests for retaining a sticky status.
This affects:
* `test_user_without_publish_posts_cannot_affect_sticky()`
* `test_user_without_publish_posts_cannot_affect_sticky_with_edit_post()`

In both tests, the user is now set after creating the post, not before. This aims to better match the intention of the tests, as they ensure that a sticky status is unaffected for a post that is ''edited'' by a user without the `publish_posts` capability, not necessarily ''created'' by that user.

Includes minor documentation updates for consistency.

Follow-up to [33096], [35183].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 14:33:08 +00:00
Sergey Biryukov
1949a52d9a Tests: Set the current user to Editor in test_utf8mb3_post_saves_with_emoji().
This avoids a "Sorry, you are not allowed to edit this post" error further in the test. The test is currently skipped on GitHub Actions, as only runs on older MySQL versions specifically with the `utf8` character set.

The user was previously set for all tests in the file in the `set_up()` method, however that is no longer the case, as it was not required for the majority of the tests. It is, however, necessary for the `edit_post()` call in this particular test.

Follow-up to [30346], [53785].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 14:06:12 +00:00
Peter Wilson
0301c933d4 Posts, Post Types: Allow bypassing of term classes in get_post_class().
Introduces the filter `wp_post_class_taxonomies` to allow developers to bypass the generation of term based classes with the `get_post_class()` function.

Developers can use this filter to reduce the number of taxonomies for which classes term classes are generated. This can improve performance on sites with a large number of custom taxonomies.

Props boonebgorges, bordoni, davidbaumwald, desrosj, invelity, mukesh27, sebastianpisula, steveo2000, swissspidy, system909, tlovett1, xparham.
Fixes #37114.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 05:45:14 +00:00
Sergey Biryukov
e5fd46da70 Site Health: Use $wpdb->db_server_info() to retrieve database server type.
This updates an older fragment in `WP_Site_Health::prepare_sql_data()` to use a dedicated `$wpdb` method introduced later in WordPress 5.5 specifically for retrieving the database server information.

Follow-up to [44986], [47451].

Props hilayt24, mukesh27, Clorith, SergeyBiryukov.
Fixes #56484.
Built from https://develop.svn.wordpress.org/trunk@54065


git-svn-id: http://core.svn.wordpress.org/trunk@53624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-04 14:40:14 +00:00
Sergey Biryukov
0eae4e0074 Tests: Restore @covers tags for PHP polyfill tests in phpunit/tests/compat/.
These tags were previously removed to avoid notices when generating the code coverage report on PHP versions where these functions are natively available and not user-defined:
{{{
"@covers ::array_key_first" is invalid
"@covers ::array_key_last" is invalid
"@covers ::hash_hmac" is invalid
"@covers ::is_countable" is invalid
"@covers ::is_iterable" is invalid
"@covers ::mb_strlen" is invalid
"@covers ::mb_substr" is invalid
"@covers ::str_contains" is invalid
"@covers ::str_ends_with" is invalid
"@covers ::str_starts_with" is invalid
}}}

It has been pointed out that those tests do cover the WP implementation of those functions and should be marked as such with a `@covers` tag. The reason PHPUnit displays notices about it, is that code coverage is only run on PHP 7.4 instead of multiple PHP versions.

For those PHP versions which don't natively contain the function, the WP polyfill is being tested and should be seen as covered by tests. The reason the tests are also run on PHP versions in which the function already exists in PHP natively, is to make sure that the polyfill test expectations line up with the PHP native behaviour, even though at that point, they are no longer testing the WP polyfill, but the PHP native function.

With the above in mind, while those PHPUnit notices add some noise to the code coverage report, in this case, they should be ignored and the `@covers` tags should be brought back.

As a potential future enhancement, the code coverage script could be updated to run against the highest and lowest supported PHP versions and with some variations of extensions enabled or disabled to ensure those tests actually test the polyfills.

Follow-up to [51852], [52038], [52039], [52040], [54049], [54060].

Props jrf.
See #39265, #55652.
Built from https://develop.svn.wordpress.org/trunk@54064


git-svn-id: http://core.svn.wordpress.org/trunk@53623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-03 14:47:13 +00:00
audrasjb
ac9f6594c4 Docs: Use third-person singular verbs for various function descriptions, as per docblocks standards.
This addresses various files modified in changeset [54062].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-02 06:58:09 +00:00
audrasjb
16bc8d38a6 Coding Standards: Use a consistent markup for line break tags across Core.
This changeset replaces `<br/>` with `<br />` on various places, as per WordPress Coding Standards.
See https://developer.wordpress.org/coding-standards/wordpress-coding-standards/html/#self-closing-elements

Props haritpanchal, costdev, audrasjb.
Fixes #56457.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-02 06:51:13 +00:00
Sergey Biryukov
ae709d1d31 Tests: Simplify and correct get_term_link() and get_edit_term_link() tests:
* Some assertions were unnecessarily duplicated. They aim to test the function behavior both when passing a term ID and term object, however that is already handled via the `$use_id` parameter of the `get_term()` helper in the same test class. The data providers already supply test cases both with a term ID and term object, so there is no need for a second assertion or a whole second test method with a term object.
* One `get_term_feed_link()` test was unnecessarily skipped half of the time, when term object was passed instead of term ID. Instead, it can use a dedicated data provider and avoid skipping.

Includes:
* Using more descriptive test method names to clarify the intention of the tests.
* Some documentation updates for clarity.

Follow-up to [52180], [52255], [52258], [52305], [53833], [53836].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-02 01:16:10 +00:00
Sergey Biryukov
f44ab3ab48 Tests: Add @coversNothing tag for PHP polyfill tests in phpunit/tests/compat/.
The `@covers` tags for these tests were previously removed to avoid notices when generating the code coverage report on PHP versions where these functions are natively available and not user-defined:
{{{
"@covers ::array_key_first" is invalid
"@covers ::array_key_last" is invalid
"@covers ::hash_hmac" is invalid
"@covers ::is_countable" is invalid
"@covers ::is_iterable" is invalid
"@covers ::mb_strlen" is invalid
"@covers ::mb_substr" is invalid
"@covers ::str_contains" is invalid
"@covers ::str_ends_with" is invalid
"@covers ::str_starts_with" is invalid
}}}

Explicitly including a `@coversNothing` annotation in this case appears to be a more appropriate option than not including any annotation at all.

Follow-up to [51852], [52038], [52039], [52040], [54049].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-02 00:13:10 +00:00
Sergey Biryukov
999c97dfda Tests: Correct the @covers tag in a WP_REST_URL_Details_Controller test for registered route.
`WP_REST_URL_Details_Controller::register_routes()` appears to be a better match than `WP_REST_Server::get_routes()`, and is also more consistent with other test classes.

Follow-up to [51973], [54056].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 23:13:09 +00:00
Sergey Biryukov
4ad26a6d16 Tests: Explicitly mark empty REST API tests as not performing any assertions.
WordPress core test suite uses PHPUnit's `beStrictAboutTestsThatDoNotTestAnything` option set to true, which marks a test as risky when no assertions are performed.

REST API test classes have some empty tests for non-implemented methods because these test classes extend the abstract `WP_Test_REST_Controller_Testcase` class, which requires several methods to be implemented that don't necessarily make sense for all REST API routes.

As these tests are intentionally empty, they were previously marked as skipped, so that they are not reported as risky.

This commit aims to further reduce noise in the test suite and effectively ignores these empty tests altogether, which seems like a more appropriate option at this time.

The `@doesNotPerformAssertions` annotation can be reconsidered in the future when the tests are either removed as unnecessary or updated to actually perform assertions related to their behavior.

Follow-up to [40534], [41176], [41228], [53921].

See #40538, #41463, #55652.
Built from https://develop.svn.wordpress.org/trunk@54058


git-svn-id: http://core.svn.wordpress.org/trunk@53617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 22:56:14 +00:00
Sergey Biryukov
fe35bf7222 Tests: Correct the @covers tag in a test for strip_ws() utility function.
This addresses a notice when generating the code coverage report:
{{{
"@covers ::test_strip_ws" is invalid
}}}

Follow-up to [53686], [54049], [54050], [54051], [54052], [54055], [54056].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 19:08:11 +00:00
Sergey Biryukov
46472cc493 Tests: Correct the @covers tag in a WP_REST_URL_Details_Controller test for registered route.
This addresses a notice when generating the code coverage report:
{{{
"@covers WP_REST_URL_Details_Controller::get_routes" is invalid
}}}

The `WP_REST_URL_Details_Controller` class does not have a `get_routes()` method, `WP_REST_Server` does.

Follow-up to [51973].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 18:59:09 +00:00
Sergey Biryukov
bed8ddc138 Tests: Correct the @covers tag in a WP_REST_Posts_Controller test for unique post slugs.
This addresses a notice when generating the code coverage report:
{{{
"@covers WP_REST_Request::create_item" is invalid
}}}

The `WP_REST_Request` class does not have a `create_item()` method, `WP_REST_Posts_Controller` is the class being tested here.

Includes fixing a typo in the test method name.

Follow-up to [53813].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 18:44:12 +00:00
Felix Arntz
7f4f1ead61 Site Health: Ensure persistent object cache check short-circuit filter also short-circuits multisite.
Follow up to [54053].

See #56040.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 17:47:09 +00:00
Felix Arntz
83e6ad6c9a Site Health: Refine persistent object cache check tests.
This changeset makes these tests more reliable by having them less affected by external environment factors, fixing occasional failures.

See #56040.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 17:06:10 +00:00
Sergey Biryukov
af466c7620 Tests: Correct the @covers tag syntax in a taxonomy_exists() test with non-string taxonomy.
This addresses a notice when generating the code coverage report:
{{{
"@covers :taxonomy_exists" is invalid
}}}

Follow-up to [53869].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 16:50:07 +00:00
Sergey Biryukov
6600b5b5f6 Tests: Correct some @covers tags in wp_html_split() and wptexturize() tests.
As `preg_split()` is not a user-defined function, it causes notices when generating the code coverage report:
{{{
"@covers ::preg_split" is invalid
}}}

Instead, it appears that the intention was to test the performance of these WordPress functions:

* `get_html_split_regex()`
* `_get_wptexturize_split_regex()`
* `_get_wptexturize_shortcode_regex()`

Follow-up to [34761], [53562].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 16:42:08 +00:00
Sergey Biryukov
426274d7a8 Tests: Correct the @covers tags in WP::send_headers() tests for feeds.
As this is a class method and not a global function, the correct annotation syntax is `@covers WP::send_headers`.

Follow-up to [53233].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 16:23:08 +00:00
Sergey Biryukov
5db90313f1 Tests: Remove @covers tags for native PHP functions in phpunit/tests/compat/.
As these are not user-defined functions, they cause notices when generating the code coverage report:
{{{
"@covers ::array_key_first" is invalid
"@covers ::array_key_last" is invalid
"@covers ::hash_hmac" is invalid
"@covers ::is_countable" is invalid
"@covers ::is_iterable" is invalid
"@covers ::mb_strlen" is invalid
"@covers ::mb_substr" is invalid
"@covers ::str_contains" is invalid
"@covers ::str_ends_with" is invalid
"@covers ::str_starts_with" is invalid
}}}

Follow-up to [51852], [52038], [52039], [52040].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 16:05:09 +00:00
desrosj
e69d717f37 Script Loader: Allow a priority to be passed to wp_enqueue_block_support_styles().
`wp_enqueue_block_support_styles()` attaches inline styles to the `wp_head` or `wp_footer` actions. This adds a priority parameter to the function to allow the styles to be given a loading order when necessary.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 15:45:09 +00:00
Sergey Biryukov
acf94cb859 Site Health: Some documentation and test improvements for WP_Site_Health:
* Add a `@coversDefaultClass` annotation to address `@covers ::get_test_page_cache" is invalid` notices.
* Rename data providers to start with the `data_` prefix and match the test method names, for consistency.
* Move data providers next to the test methods they are used in.
* Move `::get_test_page_cache()` closer to `::get_test_persistent_object_cache()`, for a bit more predictable placement.
* Fix a typo in `::get_test_persistent_object_cache()` description.

Follow-up to [53955], [54043], [54044], [54045].

See #56041.
Built from https://develop.svn.wordpress.org/trunk@54047


git-svn-id: http://core.svn.wordpress.org/trunk@53606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 15:28:16 +00:00
audrasjb
a05073bbdd Twenty Twenty: Improve word wrap in comments required message.
Because `.comments-notes` and `.logged-in-as` paragraphs are centered in Twenty Twenty, words were wrapping poorly to the next line, and even more often with "Edit your profile" displayed as visible text (see [53796]). This changeset ensures the required message is displayed on a new line.

Follow-up to [53796].

Props sabernhardt, audrasjb, mukesh27, nidhidhandhukiya.
Fixes #56397.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 06:12:15 +00:00
Sergey Biryukov
d6bb75e7c7 Tests: Increase the time difference for the expires header in Site Health page cache tests.
This aims to avoid a race condition in the Code Coverage Report, which takes longer than 10 minutes to run, and by the time the page cache test runs, the `expires` header that is supposed to be in the future is already in the past.

Follow-up to [54043].

Props Clorith, davidbaumwald, flixos90, desrosj, SergeyBiryukov.
See #56041.
Built from https://develop.svn.wordpress.org/trunk@54045


git-svn-id: http://core.svn.wordpress.org/trunk@53604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 01:36:13 +00:00
Sergey Biryukov
7a94e6c200 Site Health: Minor i18n cleanup in page cache and persistent object cache tests.
Includes:
* Moving leading and trailing spaces out of a translatable string.
* Using the established format for translator comments.
* Using a consistent typography for the apostrophe.

Follow-up to [53955], [54043].

See #56041.
Built from https://develop.svn.wordpress.org/trunk@54044


git-svn-id: http://core.svn.wordpress.org/trunk@53603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 00:19:18 +00:00
Felix Arntz
fab7a3bb92 Site Health: Introduce page cache check.
This changeset adds a new `page_cache` check which determines whether the site uses a full page cache, and in addition assesses the server response time. If no page cache is present and the server response time is slow, the check will suggest use of a page cache.

A few filters are included for customization of the check:
* `site_status_good_response_time_threshold` filters the number of milliseconds below which the server response time is considered good. The default value is based on the `server-response-time` Lighthouse audit and can be altered using this filter.
* `site_status_page_cache_supported_cache_headers` filters the map of supported cache headers and their callback to determine whether it was a cache hit. The default list includes commonly used cache headers, and it is filterable to support e.g. additional cache headers used by specific vendors.

Note that due to the nature of this check it is only run in production environments.

Props furi3r, westonruter, spacedmonkey, swissspidy, Clorith.
Fixes #56041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 22:46:11 +00:00
Felix Arntz
7322419ced Site Health: Update persistent object cache check documentation URL.
The anchor for the relevant documentation section had changed since the original code had been written.

Props furi3r.
See #56040.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 22:19:12 +00:00
Sergey Biryukov
ee9fd97241 Tests: Use correct post_author value in WP_Test_REST_Attachments_Controller.
The `$editor_id` property is declared as static, so can only be approached as static, even when used within the same class in which the property is declared.

Using non-static access will result in `null`. See: https://3v4l.org/93HQL

This PHP notice was hidden so far, due to the existence of magic methods in the `WP_UnitTestCase_Base` class.

All the same, the magic methods as they were, would also return `null` for this property. All in all, the attachment being created for this test would never get the correct `post_author`.

Fixed by using static access to approach the static property.

This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.

Follow-up to [38832].

Props jrf, costdev, johnbillion.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54041


git-svn-id: http://core.svn.wordpress.org/trunk@53600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 16:17:13 +00:00
Sergey Biryukov
1d71ca9ed8 Tests: Correctly back up and restore theme directories in Tests_Theme.
In the `set_up()` method, a copy would be made of the original value of the global `$wp_theme_directories` variable, with the intention to restore that original value in the `tear_down()` method after running each test. Unfortunately, this was not implemented correctly.

* The backup is made to a function local variable in `set_up()` and not stored somewhere where it is accessible from the `tear_down()` method.
* The restoring then references a non-existent property to restore, which would effectively set the `$wp_theme_directories` global to `null`.

Fixed by declaring and using a private property to store the original `$wp_theme_directories` value.

This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.

Follow-up to [38907].

Props jrf, costdev, johnbillion, swissspidy.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54040


git-svn-id: http://core.svn.wordpress.org/trunk@53599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 16:04:15 +00:00
desrosj
2534bb6554 Build/Test Tools: Correct the context variable being used when auto-retrying failed and cancelled workflows.
The correct variable here is `github.run_attempt`, which represents the unique number for each attempt of a particular workflow run in a repository.

The `github.run_number` currently being used represents the unique number for each run of a particular workflow in a repository.

Follow up to [53947].

Fixes #56407.
Built from https://develop.svn.wordpress.org/trunk@54039


git-svn-id: http://core.svn.wordpress.org/trunk@53598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 14:31:12 +00:00
Sergey Biryukov
76b0575b97 Coding Standards: Use more consistent formatting in wp-includes/class-json.php.
As an adopted library that does not follow the WordPress Coding Standards, the file ended with a mix of tab and spaces as part of maintenance updates over the years.

This commit standardizes on spaces for now, to bring some consistency while minimizing the number of changes.

Includes moving all the declared properties to the top of the class.

Follow-up to [11875], [11877], [23376], [32990], [46377], [54037].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 13:41:08 +00:00
Sergey Biryukov
b251f368e0 Code Modernization: Explicitly declare all properties in Services_JSON.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

In this case, the `$use` property, as set in the class constructor, falls in the “known property” category.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [11875], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952], [53953], [53954], [53957].

Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@54037


git-svn-id: http://core.svn.wordpress.org/trunk@53596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 13:07:11 +00:00
gziolo
f07974056f Tests: Increase coverage for translations applied to theme.json
Ensures that translations are correctly applied to the `title` field in the `theme.json` and all style variations located in the them inside the `styles` folder.

Follow-up #55495, [53038].
See also #54336.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 10:13:13 +00:00
Sergey Biryukov
0337f74a34 Plugins: Escape output in error messages.
Props tykoted, paulkevan, peterwilsoncc.
Built from https://develop.svn.wordpress.org/trunk@53960


git-svn-id: http://core.svn.wordpress.org/trunk@53519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-30 15:18:17 +00:00
Sergey Biryukov
a7edef876d General: Ensure bookmark query limits are numeric.
Props paulkevan, xknown.
Built from https://develop.svn.wordpress.org/trunk@53959


git-svn-id: http://core.svn.wordpress.org/trunk@53518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-30 15:17:08 +00:00
Sergey Biryukov
da3f89485a Posts, Post Types: Escape output within the_meta().
Convert markup to entities when displaying on the front end. Deprecates `the_meta()` in favor of `get_post_meta()`.

Props tykoted, martinkrcho, xknown, dd32, peterwilsoncc, paulkevan, timothyblynjacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-30 15:15:09 +00:00
Sergey Biryukov
fa76bbbb0b Code Modernization: Explicitly declare all properties in Gettext_Translations.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

In this case, the `$_nplurals` and `$_gettext_select_plural_form` properties, both being set in the class constructor, fall in the “known property” category.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [10584], [12079], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952], [53953], [53954].

Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53957


git-svn-id: http://core.svn.wordpress.org/trunk@53516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-30 13:57:15 +00:00
noisysocks
1d55913400 Editor: Ensure that timezone.offset passed to @wordpress/date is a float
Fixes inconsistent type of `timezone.offset` passed to `@wordpress/date`. It
should always be a float, never a string.

Props talldanwp.
Fixes #56459.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-30 01:04:12 +00:00
Felix Arntz
09369981e1 Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.

A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:

* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.

Note that due to the nature of this check it is only run in production environments.

Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 16:54:12 +00:00
Sergey Biryukov
644d8cd6f1 Code Modernization: Explicitly declare all properties in POMO_Reader et al.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

In this case, the `$is_overloaded` property and the `$_f` property fall in the “known property” category. In both cases, these are being set in the `__construct()` method of the class they apply to.

The `$_post` property appears to be a typo however. The `$_post` property looks to be unused, while there is an undeclared integer `$_pos` (“position”) property, which is used throughout the class and used by the child classes.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [11626], [12174], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952], [53953].

Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53954


git-svn-id: http://core.svn.wordpress.org/trunk@53513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 14:07:11 +00:00
Sergey Biryukov
2b8a847051 Code Modernization: Explicitly declare WP-specific property in WP_SimplePie_File.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown use of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

In this case, the `$timeout` property falls in the “known property” category.

Note: In contrast to the other properties being set in the constructor, this property is not declared on the parent class, so not inherited.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [10687], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952].

Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53953


git-svn-id: http://core.svn.wordpress.org/trunk@53512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 13:19:12 +00:00
Sergey Biryukov
a0163f91d4 Code Modernization: Explicitly declare all properties in WP_Ajax_Upgrader_Skin.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this case, the `$plugin_info` and `$theme_info` properties are set in `Plugin_Upgrader::bulk_upgrade()` and `Theme_Upgrader::bulk_upgrade()` specifically.

The `Bulk_Plugin_Upgrader_Skin` class and the `Bulk_Theme_Upgrader_Skin` class both already allow for this, but the `wp_ajax_update_plugin()` and `wp_ajax_update_theme()` functions also call the `*_Upgrader::bulk_upgrade()` methods, so the `WP_Ajax_Upgrader_Skin` class also needs to have these properties explicitly declared.

Includes adding proper DocBlocks for the pre-existing properties in the `Bulk_Plugin_Upgrader_Skin` and the `Bulk_Theme_Upgrader_Skin` classes.

Follow-up to [13686], [37714], [38199], [42677], [42873], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949].

Props jrf, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53952


git-svn-id: http://core.svn.wordpress.org/trunk@53511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:46:10 +00:00
Clorith
00fb102dae Site Health: Improve the fatal error handling text in multisite scenarios.
The fatal error handler is responsible for providing a more user-friendly page to visitors if a site would normally encounter a fatal error, informing them of the next steps to access recovery mode (where applicable).

Those next steps would be to check the email address for the site administrator, but this was only the case for single site installs; In a multisite scenario, no email is sent.

This changes the text to account for that, still informing site administrators to check their email if it is a single site, but for multisite directing users to reach out to their site administrator for further assistance, so that they may take appropriate action.

Props rkaiser0324, Clorith.
Fixes #48929.
Built from https://develop.svn.wordpress.org/trunk@53951


git-svn-id: http://core.svn.wordpress.org/trunk@53510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-28 19:51:09 +00:00
Clorith
7518c75208 Site Health: Don't show issue groups unless there are items in them.
The Site Health Status screen groups issues into the categories `good`, `recommended`, and `critical` when displaying them to the end user.

Initially, this screen would show `0 critical issues` while the checks were being performed, and then hide the group if no issues were discovered after all checks had completed, this not being an ideal user experience, as it is a better experience to show areas that have content, instead of hiding them after the fact.

This change makes the groups hidden by default, and also changes the logic to see if a group should be displayed when an item is added to the list (as opposed to the previous approach which only did this check once every single test had completed).

Props DavidAnderson, palmiak.
Fixes #47222.
Built from https://develop.svn.wordpress.org/trunk@53950


git-svn-id: http://core.svn.wordpress.org/trunk@53509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-28 19:17:11 +00:00
Sergey Biryukov
6f9dd431da Code Modernization: Explicitly declare all properties in WP_Test_Stream.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

The `WP_Test_Stream` class is a stream wrapper for use in the tests and must comply with the PHP requirements for such stream wrappers.

In this case, the class did not declare the required public `$context` property, which led to deprecation notices about the property being dynamically created from the `Tests_Image_Editor_Imagick::test_streams()` and `Tests_Image_Meta::test_stream()` tests.

Reference: [https://www.php.net/manual/en/class.streamwrapper.php#streamwrapper.props PHP Manual: streamWrapper: Properties].

Follow-up to [49230], [50771], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948].

Props jrf, antonvlasenko.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53949


git-svn-id: http://core.svn.wordpress.org/trunk@53508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-28 10:11:13 +00:00
Sergey Biryukov
13f618c449 Code Modernization: Explicitly declare all properties created in set_up() methods of various test classes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In each of the cases included in this commit, one or more properties are dynamically created in the `set_up()` method of the test class. This commit explicitly declares these properties.

As these properties are being declared on test classes, they are marked as private. Even though the original dynamic property was public, this should not be considered a backward compatibility break as this only involves test classes.

Notes:
* As these properties receive assignments during test runs or a one-time assignment, but the assignment uses a function call or variable access, these properties cannot be changed to class constants, but they should be declared explicitly as properties on the class.
* In `Tests_Theme_CustomHeader`, the `$customize_manager` property is given a default value of `null`, same as it was already being reset to `null` in the `tear_down()` method.
* In `Tests_Privacy_wpPrivacyProcessPersonalDataExportPage` and `Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile` classes, the property name had a leading `_` underscore. This is an outdated PHP 4 practice to indicate a private property. As PHP 4 is no longer supported, the property has been renamed to `$orig_error_level`.
* Along the same lines, in `Tests_Menu_Walker_Nav_Menu`, the property name also had a leading `_` underscore. The property has been renamed to `$orig_wp_nav_menu_max_depth`.
* In the `Tests_Shortcode` class, three properties were already being (re)set in the `set_up() `method, while three others were being set for most tests via the `shortcode_test_shortcode_tag()` method or in the tests themselves. It is ensured now that all six properties are given their initial `null` value in the `set_up()` method and are explicitly declared.

Additionally:
* In the `Tests_User_Session` class, the `set_up()` method is incorrect. No assertions should be executed in fixture methods, but the `set_up()` method contains two assertions. This has not been addressed yet as it is outside the scope of this commit, but should be addressed at a later point in time.

Follow-up to [12/tests], [218/tests], [374/tests], [384/tests], [986/tests], [1106/tests], [1239/tests], [28704], [29221], [29347], [32648], [36519], [37953], [38832], [40142], [40825], [43584], [43768], [44786], [45141], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-27 12:32:12 +00:00
desrosj
ca27343248 Build/Test Tools: Automatically rerun a workflow the first time it fails.
There are several common reoccurring issues that sometimes cause GitHub Action workflows to fail (connection timeouts to WordPress.org or the Docker container registry, `npm install` failures, Chromium issues, etc.). Except when there are service level outages, most of these issues can be resolved by simply rerunning the workflow.

This introduces a new step within each of Core’s GitHub Action workflows that attempts to rerun the failed jobs within the workflow that encountered a failure if they are running for the first time. Since a workflow is not allowed to restart itself, a new `failed-workflow.yml` callable workflow is being introduced.

Other related adjustments in this changeset:
- The `actions/github-script` 3rd-party action is also now updated to the latest version (v6.2.0).
- A new secret, `GHA_WORKFLOW_DISPATCH`, has been introduced. This will replace the current one in use (`GHA_OLD_BRANCH_DISPATCH`) with a less specific name.

Props jorbin, desrosj.
Fixes #56407.
Built from https://develop.svn.wordpress.org/trunk@53947


git-svn-id: http://core.svn.wordpress.org/trunk@53506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-26 19:21:11 +00:00
antpb
6a03ea5001 Coding Standards: Use strict comparisons in path_is_absolute().
This patch adjusts conditions to use strict comparisons when comparing `realpath()` in `path_is_absolute()`.

Props jrf.
See #36308.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-26 18:59:13 +00:00
Sergey Biryukov
893fd396da Code Modernization: Remove unused dynamic property in WP_Test_REST_Pages_Controller.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this case, it appears that the dynamically created `$has_setup_template` property is not actually used. It is unclear what the original intention was, but since it is undeclared and unused, it can be safely removed.

Follow-up to [38832], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942].

Props jrf, antonvlasenko.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53945


git-svn-id: http://core.svn.wordpress.org/trunk@53504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-26 11:45:11 +00:00
Peter Wilson
ba9dd1d7d7 Cache API, Docs: Remove private delegation from cache priming functions.
Remove the private delegation from the following cache priming functions for various object types:

- `_prime_post_caches()`
- `_prime_term_caches()`
- `_prime_comment_caches()`
- `_prime_network_caches()`
- `_prime_site_caches()`
- `_get_non_cached_ids() `

Plugins and themes are now encouraged to use these functions to improve the performance of their code by reducing the number of database queries.

Props robinwpdeveloper, desrosj, SergeyBiryukov, mukesh27, costdev.
Fixes #56386.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-26 01:03:14 +00:00
mcsf
668a2ec9ff Block Patterns: Add new Footers category
Quoting poena from the ticket: "[...] To make it easier for users to find these
patterns, a new block pattern category should be added. The patterns have
already been built to include the new category, with the slug "footer" [to]
match the existing Headers category"

Props poena.

Fixes #56416.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-25 15:42:10 +00:00
Sergey Biryukov
2a2a865310 Code Modernization: Explicitly declare all properties in various tests.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In each of the cases included in this commit, one or more individual tests set a property to allow a filter or action access to certain information.

This commit:
* Explicitly declares these properties and documents in which tests they are being used.
* Adds a reset to the default value of the property to a pre-existing `tear_down()` method or adds that method specifically for that purpose. This ensures that tests do not accidentally “taint” each other.

As these properties are being declared on test classes, they are marked as private. Even though the original dynamic property was public, this should not be considered a backward compatibility break as this only involves test classes.

Includes:
* In the `Tests_Post_Query` class, there were two tests assigning a value to an undeclared `$post_id` property, but subsequently not using the property, so those assignments should have been to a local variable (if they should be assignments at all).
* In the `Test_User_Capabilities` class, the property name had a leading `_` underscore. This is an outdated PHP 4 practice to indicate a private property. As PHP 4 is no longer supported, the leading underscore is removed from the property name.
* In the `Tests_User_Capabilities` class, an unused `$_role_test_wp_roles_role` property was declared somewhere in the middle of the class. That property is now removed in favor of `$_role_test_wp_roles_init`, which appears to be the intended name, previously misspelled.

Follow-up to [27294], [36277], [36750], [37712], [38571], [39082], [40290], [43049], [44628], [48328], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-25 15:36:13 +00:00
Peter Wilson
790e806e3f Query: Cache post ID database query within WP_Query.
Add object caching to the first database query in `WP_Query`, ie the database query for post IDs that match the desired result. Randomly ordered queries remain uncached as they are not intended to return consistent results.

Caching of ID queries is enabled by default, per the post object, term and meta caches.

Props spacedmonkey, aaroncampbell, batmoo, chriscct7, costdev, dd32, drewapicture, johnbillion, mukesh27, nacin, ocean90, peterwilsoncc, ryan, scribu, sergeybiryukov, tillkruss.
Fixes #22176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-25 04:23:13 +00:00
desrosj
105a3d9782 Build/Test Tools: Update third-party GitHub Actions to latest versions.
Updated actions:
- `actions/cache`
- `actions/github-script`
- `actions/setup-node`
- `bubkoo/welcome-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`

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


git-svn-id: http://core.svn.wordpress.org/trunk@53499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 16:32:13 +00:00
desrosj
a81704ed5f Docs: Correct typo in wp_maybe_clean_new_site_cache_on_update() parameter description.
Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53939


git-svn-id: http://core.svn.wordpress.org/trunk@53498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 15:26:12 +00:00
Sergey Biryukov
c45366a8ce Code Modernization: Remove dynamic properties in Tests_Comment_Walker.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this test file, the `Tests_Comment_Walker::set_up()` method created a dynamic `$post_id` property, which should have been explicitly declared.

Along the same lines, the `Comment_Callback_Test::__construct()` method also assigned values to two undeclared properties.

This is now fixed by explicitly declaring the properties in both classes.

Includes renaming the `Comment_Callback_Test` class to `Comment_Callback_Test_Helper` as it does not contain any test methods and its only purpose is as a “helper” class for the `Tests_Comment_Walker::test_has_children()` test.

Follow-up to [28824], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 14:05:13 +00:00
Sergey Biryukov
930975efaf Code Modernization: Remove dynamic properties in WP_UnitTestCase_Base.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the `scandir()` method sets a dynamic `$matched_dirs` property, which is subsequently used in the `delete_folders()` method.

This commit removes the need for the property. Effectively, this changes the `scandir()` method to return an array of the matched directories instead of setting the property by using recursion in the method itself in an optimized manner.

Note the `array_merge()` not being in the loop itself, but at the very end of the function. This is for performance reasons, see [https://github.com/dseguy/clearPHP/blob/master/rules/no-array_merge-in-loop.md clearPHP: No array_merge() In Loops] for a more detailed explanation of this.

It has been verified in detail that the actual results of the previous version of the method and this version match, even when the paths passed are more complex and have deeper nested subdirectories.

Follow-up to [30658], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936].

Props jrf, johnbillion, markjaquith, SergeyBiryukov.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53937


git-svn-id: http://core.svn.wordpress.org/trunk@53496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 13:51:12 +00:00
Sergey Biryukov
ecc308e729 Code Modernization: Remove dynamic properties in WP_Test_REST_Users_Controller.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In these particular cases, individual tests set a couple of properties (`$author_id`, `$post_id`) that are never used outside of the context of the test in which they are created.

In other words: these should never have been properties, but should be local variables instead.

Follow-up to [38832], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 13:20:13 +00:00
Sergey Biryukov
ede8eb333a Code Modernization: Remove dynamic properties in WP_Test_REST_Posts_Controller.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the `test_create_update_post_with_featured_media()` method creates an attachment and writes the ID of the attachment to a dynamic (undeclared) property to be used as a flag to determine whether attachments need to be cleaned up after the test in the `tear_down()` method.

As the actual ''value'' of the property is irrelevant for the cleaning up and the property is realistically being used as a “flag”, this is now fixed as follows:

* Have an actual “flag” property declared with a descriptive name — `$attachments_created` — to make the code in the `tear_down()` more easily understandable.
* As for the actual ID of the attachment, save that to a test method local variable as that is the only place where it has any relevance.

Includes moving the `tear_down()` method up to be directly below the `set_up()` method.

Follow-up to [38832], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 13:11:13 +00:00
antpb
0406a3ffd7 Media: Account for Windows when normalizing file paths.
Previously, Windows paths in the `path_is_absolute` function resulted in incorrect URIs. This patch adjusts for forward slashes and adds tests for the `get_attached_file` function.
Props Whissi, SergeyBiryukov, desrosj, stevenlinx, birgire, davidbaumwald, costdev, peterwilsoncc, audrasjb, hellofromTonya, johnbillion.
Fixes #36308.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 19:59:14 +00:00
Sergey Biryukov
69fe3c1aff Themes: Add support for Update URI header.
This allows third-party themes to avoid accidentally being overwritten with an update of a theme of a similar name from the WordPress.org Theme Directory.

Additionally, introduce the `update_themes_{$hostname}` filter, which third-party themes can use to offer updates for a given hostname.

If set, the `Update URI` header field should be a URI and have a unique hostname.

Some examples include:

* `https://wordpress.org/themes/example-theme/`
* `https://example.com/my-theme/`
* `my-custom-theme-name`

`Update URI: false` also works, and unless there is code handling the `false` hostname, the theme will never get an update notification.

If the header is present, the WordPress.org API will currently only return updates for the theme if it matches the following format:

* `https://wordpress.org/themes/{$slug}/`
* `w.org/theme/{$slug}`

If the header has any other value, the API will not return a result and will ignore the theme for update purposes.

Follow-up to [50921].

Props dd32, meloniq, costdev, audrasjb, DavidAnderson, markjaquith, DrewAPicture, mweichert, design_dolphin, filosofo, sean212, nhuja, JeroenReumkens, infolu, dingdang, joyously, earnjam, williampatton, grapplerulrich, markparnell, apedog, afragen, miqrogroove, rmccue, crazycoders, jdgrimes, damonganto, joostdevalk, jorbin, georgestephanis, khromov, GeekStreetWP, jb510, Rarst, juliobox, Ipstenu, mikejolley, Otto42, gMagicScott, TJNowell, GaryJ, knutsp, mordauk, nvartolomei, aspexi, chriscct7, benoitchantre, ryno267, lev0, gregorlove, dougwollison, leemon, SergeyBiryukov.
See #14179, #23318, #32101.
Built from https://develop.svn.wordpress.org/trunk@53933


git-svn-id: http://core.svn.wordpress.org/trunk@53492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 17:48:15 +00:00
gziolo
972e7f2a95 Editor: Backport bug fixes from Gutenberg into Core for WP 6.0.2 RC
This brings a new version of the Gutenberg code from the [https://github.com/WordPress/gutenberg/tree/wp/6.0 wp/6.0 branch] into core.

- @wordpress/block-directory@3.4.14
 - @wordpress/block-editor@8.5.10
 - @wordpress/block-library@7.3.14
 - @wordpress/customize-widgets@3.3.14
 - @wordpress/edit-post@6.3.14
 - @wordpress/edit-site@4.3.14
 - @wordpress/edit-widgets@4.3.14
 - @wordpress/editor@12.5.10
 - @wordpress/format-library@3.4.10
 - @wordpress/reusable-blocks@3.4.10
 - @wordpress/widgets@2.4.10

Props SergeyBiryukov.
Fixes #56414.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 15:42:33 +00:00
Sergey Biryukov
08f5675e1c Editor: Ensure get_block_templates() returns unique templates or template parts.
The function was using the `array_column()` PHP function on an array of objects, which works as expected on PHP 7 or later, but not on PHP 5.6.

This resulted in customized templates being listed multiple times on the Templates and Template Parts screens, and being repeatedly added between lists when switching between the screens.

The issue is now resolved by replacing `array_column()` with the `wp_list_pluck()` WordPress core function, which provides consistent behavior beetween PHP versions.

Reference: [https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L626 PHP 7.0 Upgrade Notes: array_column()].

Props uofaberdeendarren, antonvlasenko, ironprogrammer, jonmackintosh, costdev, hellofromTonya, swissspidy, rudlinkon.
Fixes #56271.
Built from https://develop.svn.wordpress.org/trunk@53927


git-svn-id: http://core.svn.wordpress.org/trunk@53486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 14:52:12 +00:00
Sergey Biryukov
cf54dd1b24 Help/About: Improve vertical alignment in the Additional Design Tools section.
This makes a transparent circle SVG smaller by removing empty space to match the height of other images in the same section, so that all three columns are aligned correctly.

Follow-up to [53339].

Props sabernhardt, weboccults, ironprogrammer, webcommsat, marybaum, oglekler.
Fixes #56210.
Built from https://develop.svn.wordpress.org/trunk@53924


git-svn-id: http://core.svn.wordpress.org/trunk@53483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 13:48:10 +00:00
Sergey Biryukov
dabe0df577 Build/Test Tools: Enable running the tests on PHP 8.2.
PHP 8.2 is expected to be released at the end of November 2022.

Enabling the tests to run in CI on PHP 8.2 allows WordPress core to start getting ready.

As an interim measure, while working through the PHP 8.1 and 8.2 issues, builds against these PHP versions are allowed to fail, so that they don't block PR merges in the Gutenberg project.

Notes:
* The `composer install` command for PHP 8.1 was still using the `--ignore-platform-reqs` option, while that has not been needed anymore for quite a while, so the condition is now reused for PHP 8.2.
* The `--ignore-platform...` option used for the install is now made more specific:
 * Composer 2.0 added a `--ignore-platform-req=...` option to selectively ignore platform requirements.
 * Composer 2.2 then added the ability to only ignore the upper bound of platform requirements by adding the `+` sign.
* Xdebug-related tests will not be run on PHP 8.2 at this time as the Docker image for PHP 8.2 does not contain Xdebug yet. Once a stable release of Xdebug 3.2.0 is available, it can be added to the Docker image and the test step can then be enabled for PHP 8.2.

References:

* [https://github.com/WordPress/wpdev-docker-images/pull/87 wpdev-docker-images PR #87: Add PHP 8.2 containers]
* [https://github.com/composer/composer/releases/tag/2.0.0 Composer 2.0 changelog]
* [https://github.com/composer/composer/releases/tag/2.2.0 Composer 2.2 changelog]
* [https://xdebug.org/announcements/2022-07-20 Xdebug 3.2.0alpha1 release notes]
* [https://xdebug.org/announcements/2022-07-25 Xdebug 3.2.0alpha2 release notes]

Follow-up to [49077], [49162], [50299], [51588], [51604].

Props jrf, desrosj.
See #56009.
Built from https://develop.svn.wordpress.org/trunk@53922


git-svn-id: http://core.svn.wordpress.org/trunk@53481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 13:09:12 +00:00
Sergey Biryukov
16ed809c04 Tests: Consistently skip tests for non-implemented methods in REST API test classes.
WordPress core test suite uses PHPUnit's `beStrictAboutTestsThatDoNotTestAnything` option set to `true`, which marks a test as risky when no assertions are performed.

REST API test classes have some empty tests for non-implemented methods because these test classes extend the abstract `WP_Test_REST_Controller_Testcase` class, which requires several methods to be implemented that don't necessarily make sense for all REST API routes.

Some of these empty tests were already marked as skipped, but not in a consistent manner. Since skipping these tests is intentional for the time being, this commit aims to bring some consistency and adjust them all to be more accurately reported as skipped instead of risky.

The skipping can be reconsidered in the future when the tests are either removed as unnecessary or updated to actually perform assertions related to their behavior.

Follow-up to [40534], [41176], [41228].

Props Mte90, tomepajk, johnbillion, zieladam, SergeyBiryukov.
See #40538, #41463, #55652.
Built from https://develop.svn.wordpress.org/trunk@53921


git-svn-id: http://core.svn.wordpress.org/trunk@53480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-22 22:44:14 +00:00
Sergey Biryukov
1ae368f3f2 Tests: Clean up test image before performing assertions in image tests.
This makes sure there are no leftover images in case of a test failure.

Applies to: `test_wp_calculate_image_srcset_no_date_uploads()`.

Includes renaming the `$int` variable to `$int_size` for consistency with some other tests.

Follow-up to [34855], [35412], [35751], [53463].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-22 19:52:13 +00:00
Sergey Biryukov
2699a5fd2e Tests: Correct MariaDB version check in database charset tests.
MariaDB version is reported differently between PHP versions:
* PHP 8.0.16 or later: `10.6.8-MariaDB`
* PHP 8.0.15 or earlier: `5.5.5-10.6.8-MariaDB`

The latter includes PHP 7.4.x and PHP 5.6.x as well, where the version is also reported with the `5.5.5-` prefix.

This commit makes an adjustment to the `Tests_DB_Charset` class to check for the correct version.

References:
* [https://github.com/php/php-src/issues/7972 php-src: #7972: MariaDB version prefix 5.5.5- is not stripped]
* [https://github.com/php/php-src/pull/7963 php-src: PR #7963 Fix GH-7932: MariaDB version prefix not always stripped]

Follow-up to [53918].

Fixes #53623.
Built from https://develop.svn.wordpress.org/trunk@53919


git-svn-id: http://core.svn.wordpress.org/trunk@53478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-22 16:42:11 +00:00
Sergey Biryukov
fab7d60c64 Database: Account for utf8 being renamed to utf8mb3 in newer MariaDB and MySQL versions.
From [https://mariadb.com/kb/en/mariadb-1061-release-notes/ MariaDB 10.6.1 release notes]:
> The `utf8` [https://mariadb.com/kb/en/character-sets/ character set] (and related collations) is now by default an alias for `utf8mb3` rather than the other way around. It can be set to imply `utf8mb4` by changing the value of the [https://mariadb.com/kb/en/server-system-variables/#old_mode old_mode] system variable ([https://jira.mariadb.org/browse/MDEV-8334 MDEV-8334]).
From [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-30.html#mysqld-8-0-30-charset MySQL 8.0.30 release notes]:
> **Important Change:** A previous change renamed character sets having deprecated names prefixed with `utf8_` to use `utf8mb3_` instead. In this release, we rename the `utf8_` collations as well, using the `utf8mb3_` prefix; this is to make the collation names consistent with those of the character sets, not to rely any longer on the deprecated collation names, and to clarify the distinction between `utf8mb3` and `utf8mb4`. The names using the `utf8mb3_` prefix are now used exclusively for these collations in the output of `SHOW` statements such as `SHOW CREATE TABLE`, as well as in the values displayed in the columns of Information Schema tables including the `COLLATIONS` and `COLUMNS` tables.

This commit adds `utf8mb3_bin` and `utf8mb3_general_ci` to the list of safe collations recognized by `wpdb::check_safe_collation()`. The full list is now as follows:
* `utf8_bin`
* `utf8_general_ci`
* `utf8mb3_bin`
* `utf8mb3_general_ci`
* `utf8mb4_bin`
* `utf8mb4_general_ci`

The change is covered by existing database charset unit tests: six tests which previously failed on MariaDB 10.6.1+ or MySQL 8.0.30+ now pass.

Includes:
* Adjusting the expected test results based on MariaDB and MySQL version.
* Using named data providers for the affected tests to make test output more descriptive.
* Adding a failure message to each assertion when multiple assertions are used in the test.

References:
* [https://mariadb.com/kb/en/mariadb-1061-release-notes/ MariaDB 10.6.1 release notes]
* [https://jira.mariadb.org/browse/MDEV-8334 MDEV-8334 Rename utf8 to utf8mb3]
* [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-30.html#mysqld-8-0-30-charset MySQL 8.0.30 release notes]
* [https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)]

Follow-up to [30345], [32162], [37320].

Props skithund, ayeshrajans, JavierCasares, SergeyBiryukov.
Fixes #53623.
Built from https://develop.svn.wordpress.org/trunk@53918


git-svn-id: http://core.svn.wordpress.org/trunk@53477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-22 15:39:13 +00:00
Sergey Biryukov
eb822d7fef External Libraries: Upgrade PHPMailer to version 6.6.4.
This is a maintenance release with minor changes:

* Add `text/csv` MIME type.
* Fix DKIM when sending to anonymous group via `mail()`.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.4

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.6.3...v6.6.4

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500], [53535].

Props jrf, Synchro.
Fixes #56016.
Built from https://develop.svn.wordpress.org/trunk@53917


git-svn-id: http://core.svn.wordpress.org/trunk@53476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-22 12:26:12 +00:00
Sergey Biryukov
9f48903eec Code Modernization: Remove dynamic properties in theme tests.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular group of test files, the test classes contain a `set_up()` method which sets a few dynamic (not explicitly declared) properties.

For those properties which were set using a function call or variable access, the property has been explicitly declared on the class now.

For those properties which were set using a constant scalar expression and for which the value is not changed by any of the tests, the property setting has been removed in favor of declaring a class constant.

Includes removing one unused dynamic property declaration: `$this->queries` in `Test_Block_Supports_Layout`, which appears to be a copy/paste from `Tests_Theme_wpThemeJsonResolver`.

Follow-up to [40/tests], [260/tests], [598/tests], [50960], [52675], [53085], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-21 16:57:13 +00:00
Sergey Biryukov
107f660a7e Coding Standards: Simplify the logic in wp_not_installed().
The function to check whether WordPress is not installed has evolved over time, ending up with duplicate conditionals.

This commit combines two conditionals into a single one and includes an early return.

Follow-up to [672], [676], [725], [1184], [1401], [1980], [2171], [2467], [2468], [2486], [2703], [3011], [3670], [12688], [12732], [12762], [13253], [29599], [30581], [34828].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-20 00:32:10 +00:00
Sergey Biryukov
6ceef39b2d Coding Standards: Check for deprecated options before wp_installing().
This is a micro-optimization that makes the conditional several times faster for non-deprecated options by avoiding an unnecessary function call.

Functions affected:
* `get_option()`
* `update_option()`
* `add_option()`

Follow-up to [48575].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-20 00:27:12 +00:00
joedolson
806336ce27 Taxonomy: Associate field descriptions with fields.
Use `aria-describedby` to associate the field descriptions and instructions with the form fields when creating or editing taxonomy terms.

Props afercia.
Fixes #55651.
Built from https://develop.svn.wordpress.org/trunk@53913


git-svn-id: http://core.svn.wordpress.org/trunk@53472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 23:06:09 +00:00
joedolson
82f3535083 Embeds: Fix missing labels and duplicate IDs.
Add `aria-label` and `aria-describedby` to provide embed form fields with accessible names and ensure each embed has a unique ID attribute to prevent duplicate IDs.

Props afercia, swissspidy.
Fixes #55664.
Built from https://develop.svn.wordpress.org/trunk@53912


git-svn-id: http://core.svn.wordpress.org/trunk@53471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 22:06:09 +00:00
joedolson
f5ca26cd24 Permalinks: Fix aria-live text when removing custom structure.
Change the notification announced when a custom structure is removed. Previously, the notification incorrectly indicated that the structure was added for both actions. This changes the notification to correctly announce removals when structures are removed.

Props joedolson, kebbet, SergeyBiryukov.
Fixes #56230.
Built from https://develop.svn.wordpress.org/trunk@53911


git-svn-id: http://core.svn.wordpress.org/trunk@53470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 21:00:09 +00:00
desrosj
594f5ae8c1 Docs: Remove incorrect default value for $path argument of admin_url().
Props joyously, costdev.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53910


git-svn-id: http://core.svn.wordpress.org/trunk@53469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 19:48:15 +00:00
Sergey Biryukov
15fe8be299 Tests: Assign created fixtures to the dedicated class properties in some test classes.
This affects:
* `WP_Test_REST_Categories_Controller`
* `WP_Test_REST_Comments_Controller`
* `WP_Test_REST_Tags_Controller`

and brings consistency with:
* `WP_Test_REST_Posts_Controller`
* `WP_Test_REST_Users_Controller`

These test classes were previously updated to improve performance by creating less fixtures and reusing them where possible. While the pagination tests for categories and comments still passed due to enough items being created, the pagination test for tags did not work as expected and did not perform any assertions due to trying to iterate over an empty array of results.

This is now corrected by assigning the properties as intended and adding more assertions to the affected test.

Follow-up to [46657].

Props johnregan3, costdev, johnbillion.
See #54662.
Built from https://develop.svn.wordpress.org/trunk@53909


git-svn-id: http://core.svn.wordpress.org/trunk@53468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 16:15:09 +00:00
Sergey Biryukov
9c95525ad8 Themes: Include a hyphen in the Block Themes tab key on Add Themes screen.
This better matches the tab name and changes the associated action hooks to:

* `install_themes_pre_block-themes` (fires before the tab is rendered)
* `install_themes_block-themes` (fires at the top the tab)

While including a mix of underscores and hyphens in a hook name is not quite typical for core, it does have a precedent and brings more consistency with similar filters on Add Plugin screen:

* `install_plugins_pre_plugin-information`
* `install_plugins_plugin-information`

Follow-up to [53906], [53907].

Fixes #56283.
Built from https://develop.svn.wordpress.org/trunk@53908


git-svn-id: http://core.svn.wordpress.org/trunk@53467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-19 13:11:14 +00:00
Sergey Biryukov
cd2cb1e306 Coding Standards: Remove a one-time variable in themes.view.Installer.browse.
Alphabetize the list of possible hook name in `install_themes_pre_*` and `install_themes_*` filters.

Follow-up to [53906].

See #56283.
Built from https://develop.svn.wordpress.org/trunk@53907


git-svn-id: http://core.svn.wordpress.org/trunk@53466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-18 14:09:15 +00:00
audrasjb
1b50325a5b Themes: Add a Block Themes filter in Theme Install Screen.
The Theme Directory on wordpress.org recently got updated to show a shortcut for filtering block themes. This changeset adds a "Block Themes" filter when adding a new theme from WordPress administration.

It also introduces two new action hooks: `install_themes_pre_blockthemes` (fires before the tab is rendered) and `install_themes_blockthemes` (fires at the top the tab).

Follow-up to [meta11963].

Props luminuu, audrasjb, SergeyBiryukov, rafiahmedd.
Fixes #56283.
See #meta6330.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-18 11:45:12 +00:00
audrasjb
37cc6aacc1 Docs: Use third-person singular verbs for function descriptions in WP_Tax_Query class, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-18 11:28:12 +00:00
audrasjb
183165304f Script Loader: Remove default DNS prefetch entry for s.w.org.
A default DNS prefetch entry for s.w.org was previously included to save a few ms in case an emoji is used that is not supported by the browser. It appears this use case doesn't justify a prefetch to s.w.org on every WordPress website.

This changesets removes `emoji_svg_url` prefetch from `wp_resource_hints()`. It also updates unit tests in `Tests_General_wpResourceHints` by removing `test_should_have_defaults_on_frontend()` entirely and removing s.w.org prefetch from expected output of ten other test functions.

Plugin authors can use the `wp_resource_hints` filter if they need to re-add the DNS prefetch entry for s.w.org.

Follow-up to [37920], [38122].

Props joelhardi, superpoincare, jhabdas, garrett-eclipse, sabernhardt, SergeyBiryukov.
Fixes #40426.
See #37387.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-18 08:45:12 +00:00
Sergey Biryukov
431a8d5414 Build/Test Tools: Only define WP_PLUGIN_DIR when running core tests.
This takes into account plugin or theme test suites that rely on `WP_PLUGIN_DIR` being set to a custom path.

Follow-up to [49236], [49269], [49566], [53874].

Props aaemnnosttv, flixos90.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@53902


git-svn-id: http://core.svn.wordpress.org/trunk@53461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-17 21:05:12 +00:00
Sergey Biryukov
d89482b22d Query: Cast the meta key to BINARY for case-sensitive key comparisons in WP_Meta_Query.
This addresses an error on MySQL 8.0.22 or later:
{{{
Character set 'utf8mb4_unicode_520_ci' cannot be used in conjunction with 'binary' in call to regexp_like
}}}

From the [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html MySQL 8.0.22 changelog]:
> Regular expression functions such as `REGEXP_LIKE()` yielded inconsistent results with binary string arguments. These functions now reject binary strings with an error. ([https://bugs.mysql.com/bug.php?id=98951 Bug #98951], [https://bugs.mysql.com/bug.php?id=98950 Bug #98950])

WordPress meta queries use the `BINARY` data type for case-sensitive meta key comparisons using regular expressions. By explicitly casting the meta key to `BINARY`, we can make sure the values being compared use the same character set and produce consistent results.

The change is covered by existing meta query unit tests: three tests which previously failed on MySQL 8.0.22 or later now pass.

References:
* [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html MySQL 8.0.22 changelog]
* [https://bugs.mysql.com/bug.php?id=104387 Bug #104387 CHARACTER_SET_MISMATCH issue with regex comparisons]

Follow-up to [46188].

Fixes #51740.
Built from https://develop.svn.wordpress.org/trunk@53901


git-svn-id: http://core.svn.wordpress.org/trunk@53460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-17 14:00:13 +00:00
desrosj
fa9c62915f Mail: Prevent the last character of names in “From” headers from being trimmed.
When extracting the email and name from a “From” header, the last character of the name is incorrectly trimmed when a space is not included between the name and the opening `<`.

Though the space is required for the header to be compliant with RFC5322 (see https://www.rfc-editor.org/rfc/rfc5322#section-3.4), the absence of a space can be ignored here. PHPMailer accepts the name and email as separate parameters and constructs the header correctly later on.

Props hakanca, mikehansenme, SergeyBiryukov, kovshenin, mattyrob, drewapicture, desrosj.
Fixes #19847.
Built from https://develop.svn.wordpress.org/trunk@53900


git-svn-id: http://core.svn.wordpress.org/trunk@53459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-16 18:18:14 +00:00
desrosj
01f73a3bd7 Build/Test Tools: Increase the Dependabot pull request limit for GitHub Actions.
This ensures updates for all 3rd party actions will be flagged when updates exist simultaneously.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-16 17:24:12 +00:00
Sergey Biryukov
f8c9068b79 Upgrade/Install: Make WP_Filesystem_FTPext::size() return false on failure.
While `WP_Filesystem_Base::size()` is documented to return `false` on failure, `ftp_size()` returns -1, and the method documentation was recently updated to reflect that.

This commit restores the previous `@return` tag and corrects the actual return value instead, to bring consistency with all the other `WP_Filesystem_*::size()` methods:
* `WP_Filesystem_Base::size()`
* `WP_Filesystem_Direct::size()`
* `WP_Filesystem_ftpsockets::size()`
* `WP_Filesystem_SSH2::size()`
{{{
@return int|false Size of the file in bytes on success, false on failure.
}}}

This better matches the purpose of the API to provide a consistent interface for various filesystem implementations.

Follow-up to [6779], [30678], [45226], [53860], [53862].

Fixes #51170.
Built from https://develop.svn.wordpress.org/trunk@53898


git-svn-id: http://core.svn.wordpress.org/trunk@53457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-16 13:41:14 +00:00
Sergey Biryukov
b90c2adb7f Database: Ignore display width for integer data types in dbDelta() on MySQL 8.0.17 or later.
MySQL 8.0.17 deprecated the display width attribute for integer data types:
> As of MySQL 8.0.17, the `ZEROFILL` attribute is deprecated for numeric data types, as is the display width attribute for integer data types. You should expect support for `ZEROFILL` and display widths for integer data types to be removed in a future version of MySQL. Consider using an alternative means of producing the effect of these attributes. For example, applications can use the `LPAD()` function to zero-pad numbers up to the desired width, or they can store the formatted numbers in `CHAR` columns.

In practice, this means that display width is removed for integer types when creating a table:
* `BIGINT(20)` → `BIGINT`
* `INT(11)` → `INT`
* `MEDIUMINT(9)` → `MEDIUMINT`
* `SMALLINT(6)` → `SMALLINT`
* `TINYINT(4)` → `TINYINT`

Note: This only applies specifically to MySQL 8.0.17 or later. In MariaDB, display width for integer types is still available and expected.

This commit ensures that `dbDelta()`, which relies on the `DESCRIBE` SQL command to get the existing table structure and field types, when running on MySQL 8.0.17 or later, does not unnecessarily attempt to convert `BIGINT` fields back to `BIGINT(20)`, `INT` back to `INT(11)`, etc. When comparing the field type in the query with the existing field type, if display width is the only difference, it can be safely ignored to match MySQL behavior.

The change is covered by existing `dbDelta()` unit tests:
* A test for not altering `wp_get_db_schema()` queries on an existing install using MySQL 8.0.17+ now passes.
* More than twenty tests which previously failed on PHP 8.0.x + MariaDB due to incorrect expectations, caused by MariaDB version reporting not being consistent between PHP versions, now pass.

References:
* [https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html MySQL: Nymeric Type Attributes]
* [https://mariadb.com/kb/en/data-types-numeric-data-types/ MariaDB: Numeric Data Types]

Follow-up to [1575], [18899], [37525], [47183], [47184].

Props SergeyBiryukov, pbearne, leewillis77, JavierCasares, desrosj, costdev, johnbillion.
Fixes #49364. See #51740.
Built from https://develop.svn.wordpress.org/trunk@53897


git-svn-id: http://core.svn.wordpress.org/trunk@53456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-15 13:18:13 +00:00
Sergey Biryukov
0e6a976c0a Coding Standards: Restore correct regex formatting in dbDelta().
An earlier regex for normalizing index definitions disables the PHPCS check for extra padding in order to keep a more readable indentation. However, this was missed for index columns regex.

Follow-up to [37583], [42228], [42249], [42343].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-14 02:14:12 +00:00
John Blackbourn
8a9a20c3ee Build/Test Tools: Move the Memcached container into the Docker Compose config.
This allows a developer to use the persistent Memcached object cache on their local development environment via the `LOCAL_PHP_MEMCACHED` environment variable.

Enable the memcached config via `LOCAL_PHP_MEMCACHED=true` in the `.env` file and then restart the environment with `npm run env:restart`.

Fixes #55700

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


git-svn-id: http://core.svn.wordpress.org/trunk@53454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 23:25:08 +00:00
John Blackbourn
b8cfc0b45e Taxonomy: Add a test file that was missed in [53893].
See #56215

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


git-svn-id: http://core.svn.wordpress.org/trunk@53453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 22:46:08 +00:00
John Blackbourn
85306e1fd6 Taxonomy: Introduce the is_term_publicly_viewable() function.
This is the taxonomy term counterpart to the `is_post_publicly_viewable()` function. Although the logic for terms is more straight forward this serves the same purpose as introducing the corresponding function for posts -- to centralise and reduce the logic needed to validate a term and determine if it's publicly viewable.

Props peterwilsoncc, costdev, johnbillion

Fixes #56215

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


git-svn-id: http://core.svn.wordpress.org/trunk@53452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 22:44:09 +00:00
John Blackbourn
e8a05d5082 Editor: Document the arguments for registering a block style.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 22:38:09 +00:00
John Blackbourn
11a3a91511 Query: Be better at forcing data types for query vars.
Several query vars only accept a scalar value and pass the value through functions that assume a scalar value. Adding extra guard conditions to the types of query vars doesn't affect their functionality but does remove PHP notices and warnings that can otherwise be generated when a non-scalar value such as an array is present in a query var.

Props juliobox, xknown, SergeyBiryukov, dave1010, nacin, tellyworth, dd32, audrasjb, johnregan3

Fixes #17737

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


git-svn-id: http://core.svn.wordpress.org/trunk@53450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 22:31:11 +00:00
Sergey Biryukov
fadf5c5fe9 Tests: Bring some consistency to serialization tests.
There were two sets of tests for `is_serialized()`:
* One in the `functions.php` file, based on the same file name in core.
* One in a separate class in the `functions` directory.

To avoid confusion and make it easier to decide where new tests should go in the future, the existing tests are now combined in the latter location.

Includes:
* Moving `is_serialized()` and `maybe_serialize()` tests into their own classes.
* Using named data providers to make test output more descriptive.
* Combining test cases and removing duplicates.

Follow-up to [278/tests], [279/tests], [328/tests], [32631], [45754], [47452], [49382], [53886], [53889].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 12:11:11 +00:00
Sergey Biryukov
2f1cac50d3 Tests: Use named data provider for is_serialized_string() tests.
This makes the output when using the `--testdox` option more descriptive and is helpful when trying to debug which data set from a data provider failed the test.

Follow-up to [37357], [44478].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 13:24:10 +00:00
audrasjb
e7d91b8017 General: Add required fields helper functions for better reusability.
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens.

Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov.
Fixes #54394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 12:11:09 +00:00
audrasjb
32879ad1e6 Docs: Use third-person singular verbs for function descriptions in wp-includes/functions.php, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 09:53:11 +00:00
audrasjb
05f7d32a83 Formatting: Add support for Enums in is_serialized().
This changeset adds support for Enums in `is_serialized()`. It also adds new unit tests for this function.

Props ayeshrajans, konradyoast, peterwilsoncc, costdev, dennisatyoast, mukesh27.
Fixes #53299.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 09:26:12 +00:00
Peter Wilson
0161ef8f72 Media: Cache parent posts in query-attachments AJAX endpoint.
Prime the parent post objects `wp_ajax_query_attachments()` to reduce the number of database queries in the query-attachments admin-ajax endpoint.

Props albatross10.
Fixes #56037.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 00:17:07 +00:00
Sergey Biryukov
d7f5fe1283 Login and Registration: Introduce is_login_screen() function.
This should help determine whether the current request is for the login screen.

While it does not save a lot of lines of code, including this function in core aims to save developers some time that would otherwise be spent investigating the most reliable way to solve this problem.

Implementation details:
* By checking `wp_login_url()`, the function accounts for custom login locations set via the `login_url` filter.
* By checking `$_SERVER['SCRIPT_NAME']` directly, instead of `did_action( 'login_form_login' )` or `$pagenow` global, the function can work as early as possible, for example in a must-use plugin.

Follow-up to [2481], [6412], [12393], [12732], [15558], [15481], [15746].

Props dcowgill, scribu, donmhico, iandunn, wonderboymusic, nacin, robmiller, kitchin, chriscct7, tazotodua, davidbaumwald, SergeyBiryukov.
Fixes #19898.
Built from https://develop.svn.wordpress.org/trunk@53884


git-svn-id: http://core.svn.wordpress.org/trunk@53443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 21:51:08 +00:00
John Blackbourn
20edeb6e09 Posts, Post Types: Prevent categories from being overwritten when updating a post using wp_insert_post().
This prevents existing category relationships being overridden with the default category when none is provided in the post data.

Props markoheijnen, leewillis77, desrosj

Fixes #19954

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


git-svn-id: http://core.svn.wordpress.org/trunk@53442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 20:00:10 +00:00
John Blackbourn
c1db3198ce Application Passwords: Allow a Super Admin to set an application password on a site they're not a member of.
This removes the requirement that a Super Admin must be a member of the current site when they attempt to set an application password within the admin area of an individual site on the network.

Props TimothyBlynJacobs, ilovecats7, johnbillion, georgestephanis, johnjamesjacoby

Fixes #53224

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


git-svn-id: http://core.svn.wordpress.org/trunk@53441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 18:24:09 +00:00
John Blackbourn
41b3519fbe XML-RPC: Correct the documented arguments for XML-RPC server methods.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 15:00:08 +00:00
desrosj
e539bb94dc Bundled Themes: Remove closing PHP tag at the end of files.
To help avoid issues with trailing whitespace, omitting the closing PHP tag at the end of a file is preferred.

Props netweb, dd32, yahil, milindmore22, vishalkakadiya, NomNom99, manishsongirkar36, sabernhardt, audrasjb, desrosj.
See #40039.
Built from https://develop.svn.wordpress.org/trunk@53880


git-svn-id: http://core.svn.wordpress.org/trunk@53439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:46:09 +00:00
John Blackbourn
1cf5a0351f Docs: Revert two changes that need to instead be made upstream in the Gutenberg repo.
Partially reverts [53877].

See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:33:10 +00:00
John Blackbourn
77bf28a1b7 Docs: Miscellaneous inline documentation improvements.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:11:08 +00:00
John Blackbourn
1d4e72c798 Docs: Correct and improve the documented types for various functions and hooks.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:03:09 +00:00
John Blackbourn
bbdc255d50 Docs: Remove code tags from WordPress function names within inline documentation.
Removing these code tags means the function name will be automatically linked on the developer.wordpress.org reference, which is more useful than just seeing the function name.

See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 13:55:08 +00:00
desrosj
8f513bba30 Twenty Eleven: Correct inline translator comment.
Props sabernhardt.
See #40039.
Built from https://develop.svn.wordpress.org/trunk@53875


git-svn-id: http://core.svn.wordpress.org/trunk@53434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 13:06:09 +00:00
Pascal Birchler
bb9f57429a I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$locale` parameter to `load_textdomain()` to specify the locale the translation file is for.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have caught this issue earlier.
* Adds a new test plugin and theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Previously added in [49236] and reverted in [49236] to investigate concerns which are now addressed here.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@53874


git-svn-id: http://core.svn.wordpress.org/trunk@53433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 12:39:12 +00:00
audrasjb
50e3e21cb2 Docs: Clarify that register_taxonomy() only accepts lowercase values for the $taxonomy parameter.
This brings consistency with docblock used in `register_post_type()`.

Props audrasjb, bengreeley, dipakparmar443.
Fixes #56352
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-10 13:54:12 +00:00
Sergey Biryukov
c3783c9f3a Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods.
This aims to bring more clarity to the code, and applies to methods where the path can be a file or a directory:

* `WP_Filesystem_*::exists()`
* `WP_Filesystem_*::is_writable()`

Follow-up to [6779], [25560].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 11:33:10 +00:00
audrasjb
60d0586c27 Docs: Various docblock fixes in Core Taxonomy API, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 10:41:10 +00:00
Dominik Schilling
7799eafcd0 Docs: Consistently document the $excluded_terms variable in get_adjacent_post().
The variable `$excluded_terms` is an array of excluded term IDs or empty string if none were provided.

Props grapplerulrich, costdev.
Fixes #56348.
Built from https://develop.svn.wordpress.org/trunk@53870


git-svn-id: http://core.svn.wordpress.org/trunk@53429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 10:31:09 +00:00
audrasjb
f63d34e3e3 Taxonomy: Prevent non string taxonomy names generating warnings or errors.
This changeset adds an `is_string( $taxonomy )` check to the condition in `taxonomy_exists()`, to ensure `false` is returned when the `$taxonomy` is not a string.

Follow-up to [35718].

Props costdev, peterwilsoncc, mukesh27.
Fixes #56338.
See #56336.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 10:23:13 +00:00
Peter Wilson
f627535216 Administration: Improve performance of List Tables.
Improve the performance of `WP_List_Table::get_column_info()` by adding the primary column to the cached header values. This reduces the number of calls to the `WP_List_Table::get_primary_column_name()` method to once per table in line with the other header getter functions.

Props bobbingwide, chaion07, costdev, mikeschroder, mukesh27, peterwilsoncc, shetheliving, spacedmonkey.
Fixes #34564.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 00:33:11 +00:00
Andrew Ozz
3f12697795 Build/Test Tools: Update @covers tags for the load tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53867


git-svn-id: http://core.svn.wordpress.org/trunk@53426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 23:44:12 +00:00
Andrew Ozz
a656ba3f5c Build/Test Tools: Add @covers tags to the l10n and i18n tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53866


git-svn-id: http://core.svn.wordpress.org/trunk@53425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 23:41:13 +00:00
Andrew Ozz
46dbe91667 Build/Test Tools: Add @covers tags to the options tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53865


git-svn-id: http://core.svn.wordpress.org/trunk@53424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 23:35:09 +00:00
Andrew Ozz
4b5f556d69 Build/Test Tools: Add @covers tags to the import tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53864


git-svn-id: http://core.svn.wordpress.org/trunk@53423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 23:24:10 +00:00
Andrew Ozz
8367a96af8 Build/Test Tools: Add @covers tags to the comments tests.
Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53863


git-svn-id: http://core.svn.wordpress.org/trunk@53422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 23:14:12 +00:00
Sergey Biryukov
7f0fc452b1 Docs: Improve @since notes for some WP_Filesystem_* methods:
* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_FTPext::size()`
* `WP_Filesystem_ftpsockets::exists()`

The `::exists()` methods were previously using the FTP `NLST` command, which works for directories, but is not intended to be applied to a file. This only worked most of the time due to many FTP servers being permissive and allowing to execute `NLST` on files, which cannot be guaranteed and appears to not be the case in newer versions of Pure-FTPd (1.0.48 or later).

With a recent change in [53860], both methods were updated for compatibility with RFC 959:

* Both methods check if the path is a directory that can be changed into (and therefore exists).
* `WP_Filesystem_FTPext` uses `ftp_rawlist()` (FTP `LIST` command) to check for file existence.
* `WP_Filesystem_ftpsockets` uses file size to check for file existence.

Reference: [https://www.ietf.org/rfc/rfc959.txt RFC 959: File Transfer Protocol (FTP)]

Follow-up to [6779], [11821], [25274], [33648], [34733], [35944], [35946], [53860].

See #51170.
Built from https://develop.svn.wordpress.org/trunk@53862


git-svn-id: http://core.svn.wordpress.org/trunk@53421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 17:14:13 +00:00
Sergey Biryukov
6e38153854 Tests: Improve the test for not throwing a warning on malformed date queries.
* Make it specifically about `wp_resolve_numeric_slug_conflicts()`, the function that was throwing an `Undefined array key "year"` PHP warning for malformed date requests.
* Move the test under the `rewrite` component and make its name a bit more descriptive.
* Check the return result of the function instead of performing a dummy assertion.
* Use named array keys in the data provider for clarity.
* Add missing `@covers` tag.

Follow-up to [32648], [53857].

Props costdev, peterwilsoncc, 1naveengiri, mukesh27, SergeyBiryukov.
See #52252, #45513.
Built from https://develop.svn.wordpress.org/trunk@53861


git-svn-id: http://core.svn.wordpress.org/trunk@53420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 14:40:10 +00:00
audrasjb
6a5506304e Filesystem: Rewrite FTP/FTP Sockets exists() methods to implement a more stable check.
WordPress FTP file checking was previously based upon `ftp_nlist()`. This function can be problematic at scale with a directory containing a large number of files. The same issue occurred using it with ftpsockets.

This changeset rewrites the FTP `exists()` functions to utilize a more efficient and stable check.

Props giox069, desrosj, mkox, afragen, costdev, pbiron, peterwilsoncc.
Fixes #51170.
See #53318, #39781.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 12:41:13 +00:00
audrasjb
af08ed758d Docs: Various docblock fixes in wp-includes/blocks.php, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 08:33:09 +00:00
audrasjb
ba7b41113c Editor: Safeguard has_blocks() against fatal errors.
This changeset ensures `has_blocks()` doesn't return a fatal error when `$post` is not a valid post. If the post can't be retrieved, the function now returns `false`.

Props Howdy_McGee, costdev, colonelphantom, audrasjb, dlh, peterwilsoncc.
Fixes #55705.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 08:22:12 +00:00
Peter Wilson
51346d566a Rewrite rules: Prevent malformed date requests throwing notices.
Ensure that date queries contain each component before attempting to use them. This prevents http requests triggering notices if a portion of the date is missing. For example a request containing a day and year but no month, a request containing a month bu not year.

Props ovidiul, dd32, peterwilsoncc, costdev, johnbillion, SergeyBiryukov, desrosj, tremidkhar, hellofromTonya.
Fixes #52252.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 23:05:10 +00:00
Sergey Biryukov
7b6f526942 Code Modernization: Let MockClass extend stdClass.
This allows for arbitrary properties to be declared on it.

Alternatively, the `MockClass` could be deprecated altogether in favor of directly using `stdClass` where needed.

Follow-up to [53/tests], [65/tests], [53557], [53558], [53850], [53851], [53852], [53853], [53854].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 16:55:07 +00:00
Sergey Biryukov
bbf21ea549 Code Modernization: Remove unused $undefined property in Tests_WP_Customize_Manager.
This appears to be a copy/paste from the `Tests_WP_Customize_Setting` class, and is not actually used in `WP_Customize_Manager` tests.

Follow-up to [31329], [32658], [53851].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 16:38:09 +00:00
Sergey Biryukov
cf9f373c8c Code Modernization: Remove dynamic properties in Tests_File.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this case, as the `$badchars` property never changes, declaring this as a class constant is the sensible option.

As for the `$dir` property (which cannot be turned into a constant due to the function call), this is used in multiple tests, so making this property explicit makes sense.

Follow-up to [139/tests], [53557], [53558], [53850], [53851], [53852], [53853].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 14:50:09 +00:00
Sergey Biryukov
15df935777 Code Modernization: Remove dynamic properties in Tests_Post_Revisions.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets the `$post_type` property, which is ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting this property in the `set_up()` is an unnecessary overhead and the property should be changed to a class constant.

Follow-up to [1212/tests], [52389], [53557], [53558], [53850], [53851], [53852].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 14:43:08 +00:00
Sergey Biryukov
ab15c41a07 Code Modernization: Remove dynamic properties in Tests_Media_GetPostGalleries.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets the `$img_meta` property, which is ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting this property in the `set_up()` is an unnecessary overhead and the property should be changed to a class constant.

Includes renaming the test class to match the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization naming conventions].

Follow-up to [52190], [53557], [53558], [53850], [53851].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 14:34:10 +00:00
Sergey Biryukov
d93e9a04bf Code Modernization: Remove unused dynamic property in Tests_WP_Customize_*.
The dynamically created `$undefined` property appears to be a copy/paste from the `Tests_WP_Customize_Setting` class, and is not actually used in other test classes:

* `Tests_WP_Customize_Manager`
* `Tests_WP_Customize_Panel`
* `Tests_WP_Customize_Section`

Follow-up to [31329], [32658].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 14:22:10 +00:00
Sergey Biryukov
82373729ee Code Modernization: Remove dynamic properties in Tests_POMO_PO.
In this particular case, the test class contains a `set_up()` method which sets properties only used by select tests, while the fixture method is being run for all tests.

There were a few ways this could be fixed:
* As the values do not change across tests, use `set_up_before_class()` to set (static) properties instead.
* For those values which are set up without a function call or variable interpolation, set the values in class constants.
* Or set these values as local variables for those tests which actually use them.

The implemented solution is a combination of options 2 and 3.

Follow-up to [1106/tests], [53557], [53558].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-07 13:58:12 +00:00
Sergey Biryukov
f881308496 Tests: Rename the test class for wp_preload_resources() tests.
This matches the name of the function being tested.

Follow-up to [53846].

See #42438.
Built from https://develop.svn.wordpress.org/trunk@53849


git-svn-id: http://core.svn.wordpress.org/trunk@53408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-06 00:04:10 +00:00
Adam Silverstein
66372143a1 Media: use original image size data for full size secondary mime generation.
Correct an issue where the secondary mime type full size image would not be properly resized (and `-scaled` added to the name) when the original upload is over the `big_image_size_threshold` dimensions.

Props mukesh27.
See #55443.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 22:16:13 +00:00
Adam Silverstein
4b0450af4f Media: correct a misnamed variable when creating sub sizes with multi_resize.
Props mehulkaklotar, mukesh27.
See #55443.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 18:58:12 +00:00
Adam Silverstein
2c7cae5cd9 Script loader: enable resource preloading with rel='preload'.
Add a `wp_preload_resources` filter that developers can use to add resource preloading.

Preloading helps the browser discover and prioritize important resources earlier during the page load. This ensures that they are available earlier and are less likely to block the page's render.

Props nico23, swissspidy, igrigorik, westonruter, azaozz, furi3r, aristath, spacedmonkey, peterwilsoncc, mihai2u, gziolo. 
Fixes #42438.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 18:26:08 +00:00
Adam Silverstein
c1862616c2 Media: remove unused _wp_image_belongs_to_attachment function.
Remove the `_wp_image_belongs_to_attachment` function which was left over from a an unused branch and added inadvertently as part of r53751.

Props mukesh27.
Fixes #56333.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 16:12:13 +00:00
audrasjb
efbd56d13b Plugins: Properly encode query string s parameter in plugin search.
This ensures special characters like `&` are properly encoded when passed as URL parameter.

Props praful2111, audrasjb, costdev.
Fixes #56339.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 14:12:11 +00:00
audrasjb
6996204bab Docs: Various docblock fixes in wp-admin/includes/image.php class, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 14:07:09 +00:00
Sergey Biryukov
5e6acb229d Revisions: Use wp_get_latest_revision_id_and_total_count() where appropriate.
The function executes an optimized query to get the last revision ID and total count. It was originally introduced for `WP_REST_Posts_Controller::prepare_links()`, and is now used in a few more places in core:

* `register_and_do_post_meta_boxes()`
* `wp_get_post_revisions_url()`
* `wp_update_custom_css_post()`

Follow-up to [53759], [53769], [53778], [53779], [53841].

Props peterwilsoncc, mukesh27, SergeyBiryukov.
Fixes #56279.
Built from https://develop.svn.wordpress.org/trunk@53842


git-svn-id: http://core.svn.wordpress.org/trunk@53401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 13:39:11 +00:00
Sergey Biryukov
b6198f330f Revisions: Use latest_id as the array key for the latest revision ID.
This updates `wp_get_latest_revision_id_and_total_count()` and its usage to be a bit more descriptive and a bit less repetitive, e.g. `$revisions['latest_id']` instead of `$revision['revision']`.

Includes updating the `@return` tag to explain when the function returns a `WP_Error`.

Follow-up to [53759], [53769], [53778], [53779].

See #55857.
Built from https://develop.svn.wordpress.org/trunk@53841


git-svn-id: http://core.svn.wordpress.org/trunk@53400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 13:02:13 +00:00
audrasjb
233089c138 Coding standards: Properly escape URLs returned by self_admin_url() calls.
This address some other echoed instances missed by [53839].

Fixes #56329.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 06:12:10 +00:00
audrasjb
b79e2df684 Coding standards: Properly escape URLs returned by self_admin_url() calls.
Props krishaweb, audrasjb, SergeyBiryukov.
Fixes #56329.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 06:00:09 +00:00
Peter Wilson
6219eb95bf Sitemaps: Prevent invalid provider names throwing errors.
Validate the requested sitemap is a string before attempting to use it in a provider. This prevents `WP_Sitemaps_Registry::get_provider()` from triggering a fatal error in more recent versions of PHP.

The errors can be triggered by items outside the site owner or developers control (such as a user visiting `?sitemap[foo]=bar`) so the code fails silently to avoid filling error logs with unfixable errors.

Props costdev, dd32.
Fixes #56336.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 05:49:11 +00:00
audrasjb
301ac6bf38 Docs: Provide a more accurate @return type for get_pages() function.
Props malthert, audrasjb, johnbillion, jigar-bhanushali.
Fixes #56330.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 05:46:10 +00:00
Sergey Biryukov
a0944f075a Tests: Combine test classes for get_edit_term_link() tests.
There were two sets of tests for the function:
* One in the `link` directory, based on the `link-template.php` file name.
* One in the `term` directory, based on the component name.

To avoid confusion and make it easier to decide where new tests should go in the future, the existing tests are now combined in the former location.

Includes:
* Setting the current user in `::set_up()` instead of each individual test method.
* Changing the custom taxonomy name to `wptests_tax` for consistency with other tests.
* Moving `::register_custom_taxonomy()` and `::get_term()` helpers to the beginning of the class.

Follow-up to [32954], [36646], [52180], [52255], [53833].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 18:30:09 +00:00
Sergey Biryukov
b0c086417e Tests: Use named data provider for WP_Object_Cache::is_valid_key() test.
This makes the output when using the `--testdox` option more descriptive and is helpful when trying to debug which data set from a data provider failed the test.

Follow-up to [53818], [53821], [53822], [53834].

See #56198.
Built from https://develop.svn.wordpress.org/trunk@53835


git-svn-id: http://core.svn.wordpress.org/trunk@53394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 17:49:10 +00:00
Sergey Biryukov
962607928e Tests: Add more test cases for WP_Object_Cache::is_valid_key().
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, a string that becomes empty after `trim()` should not be considered a valid cache key.

Follow-up to [53818], [53821], [53822].

Props tillkruess.
See #56198.
Built from https://develop.svn.wordpress.org/trunk@53834


git-svn-id: http://core.svn.wordpress.org/trunk@53393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 17:33:08 +00:00
Sergey Biryukov
e2024bd466 Tests: Correct data providers for get_term_link() and get_edit_term_link() tests.
* The tests use named data providers which include a flag for passing either a term ID or term object to the test, but the values for the flag were the opposite of what the array key says.
* Some array keys were duplicated, which means the earlier test case with the same name did not actually run.

Follow-up to [52180], [52255], [52258], [52305].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 17:20:08 +00:00
Sergey Biryukov
215a5fd1b7 Coding Standards: Reorder global cache groups alphabetically for some consistency.
Follow-up to [53823], [53824].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 16:29:10 +00:00
Sergey Biryukov
e88c783a0d Docs: Remove obsolete comment in object cache tests.
The comment mentioned creating two cache objects with a shared cache directory, which was no longer the case.

Follow-up to [5/tests] [170/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 15:51:11 +00:00
Sergey Biryukov
5bb069bda8 Tests: Move wp_cache_replace() test to a more appropriate place.
This matches the location of other `wp_cache_*()` tests following the respective `WP_Object_Cache` method tests.

Follow-up to [1275/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 15:44:10 +00:00
Sergey Biryukov
707cf6aaa6 Tests: Remove the list of non-persistent groups in Memcached implementation used in the test suite.
This list was not up to date, and does not appear to be required, as `WP_UnitTestCase_Base::flush_cache()` adds the correct list of groups, which is up to date.

Follow-up to [1332/tests], [8068], [37613], [40561], [52976], [53826], [53828].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 15:39:10 +00:00
Sergey Biryukov
b7cabd9c88 Tests: Make the comment cache group persistent in WP_UnitTestCase_Base::flush_cache().
This brings the list of persistent groups when running the test suite in line with core.

Follow-up to [1332/tests], [37613], [52976].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 15:18:09 +00:00
John Blackbourn
79db573265 Docs: Various corrections and improvements to inline documentation.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 14:52:11 +00:00
Sergey Biryukov
9c75453606 Tests: Remove the list of global groups in Memcached implementation used in the test suite.
This list was not up to date, and does not appear to be required, as `WP_UnitTestCase_Base::flush_cache()` adds the correct list of groups, which is up to date.

Follow-up to [1332/tests], [40343], [40561], [53823], [53824].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 14:48:12 +00:00
desrosj
0d62f02303 Posts, Post Types: Change variable name in wp_set_post_terms() for clarity.
This changes the `$tags` variable used within `wp_set_post_terms()` to `$terms`.

While the default for the `$taxonomy` argument is `post_tag`, the function can be used to assign terms to a post for any taxonomy. When a different taxonomy is passed, `$tags` is an inaccurate name and could be confusing.

Props hilayt24, costdev, SergeyBiryukov, krishaweb, desrosj.
Fixes #56331.
Built from https://develop.svn.wordpress.org/trunk@53825


git-svn-id: http://core.svn.wordpress.org/trunk@53384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 14:09:23 +00:00
Sergey Biryukov
68e50c583c Tests: Simplify the list of global groups in object cache tests.
This list was not up to date due to missing `blog_meta` group, and does not appear to be required for the tests to pass, as `WP_UnitTestCase_Base::flush_cache()` adds the same list of groups, which is up to date.

Follow-up to [946/tests], [1332/tests], [40343], [42836], [53823].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 14:04:34 +00:00
Sergey Biryukov
309ff9c4ba Coding Standards: Wrap long lines with global cache groups for better readability.
Follow-up to [946/tests], [1060/tests], [https://mu.trac.wordpress.org/changeset/1784 mu1784], [https://mu.trac.wordpress.org/changeset/2032 mu2032] [https://mu.trac.wordpress.org/changeset/2029 mu2029], [7986], [12128], [12603], [12688], [12732], [12755], [13125], [14009], [15482], [21403], [22092], [31347], [31348], [36258], [36393], [36413], [37918], [40343], [40347], [42836].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 13:33:12 +00:00
Sergey Biryukov
1a460d5155 Tests: Add a test case with a float value for WP_Object_Cache::is_valid_key().
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, float values should not be considered a valid cache key.

Follow-up to [53818], [53821].

Props tillkruess, malthert, spacedmonkey.
See #56198.
Built from https://develop.svn.wordpress.org/trunk@53822


git-svn-id: http://core.svn.wordpress.org/trunk@53381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 12:37:21 +00:00
Sergey Biryukov
39821528b4 Tests: Add a unit test for WP_Object_Cache::is_valid_key().
A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string.

Follow-up to [53818].

See #56198.
Built from https://develop.svn.wordpress.org/trunk@53821


git-svn-id: http://core.svn.wordpress.org/trunk@53380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 12:11:19 +00:00
audrasjb
39903f841e Twenty Eleven: Remove a useless CSS comment after [53819].
This comment does not apply anymore. Follow-up to [53819].

See #56297.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 17:17:10 +00:00
audrasjb
f05709ac51 Twenty Eleven: Use more specific CSS selectors for .required styles.
This changeset adds more specific CSS selectors so third-parties fields are not targeted by the related CSS rules.

Props umesh84, sabernhardt, costdev.
Fixes #56297.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 17:12:13 +00:00
Sergey Biryukov
df054f2dae Cache API: Validate cache key in WP_Object_Cache methods.
Some plugins may call the `wp_cache_*()` functions with an empty string, `false`, or `null` as cache key, usually as a result of not checking the return value of another function that's used as the key.

Previously, this was silently failing, leading to odd behavior at best and often breakage due to key collisions.

A valid cache key must be either an integer number or a non-empty string.

This commit introduces a quick type check on the given cache keys and adds a `_doing_it_wrong()` message that should help plugin developers to notice these issues quicker.

Includes:
* A check in `update_user_caches()` and `clean_user_cache()` to make sure user email is not empty before being cached or removed from cache, as it is technically possible to create a user with empty email via `wp_insert_user()`.
* Some minor cleanup in unit tests where the email was passed to `wp_insert_user()` incorrectly or was unintentionally reset.

Props tillkruess, malthert, dd32, spacedmonkey, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #56198.
Built from https://develop.svn.wordpress.org/trunk@53818


git-svn-id: http://core.svn.wordpress.org/trunk@53377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 14:36:12 +00:00
Sergey Biryukov
de97f21367 Coding Standards: Remove extra space in two conditionals.
This fixes WPCS errors in `WP_Site_Health::get_test_plugin_version()` and `::get_test_theme_version()`:

* `Expected exactly one space between closing parenthesis and opening control structure; " " found.`
* `Expected 1 space(s) after closing parenthesis; found 2`

Follow-up to [53816].

See #56134.
Built from https://develop.svn.wordpress.org/trunk@53817


git-svn-id: http://core.svn.wordpress.org/trunk@53376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 14:32:12 +00:00
Sergey Biryukov
1f39318123 Site Health: Improve the wording in plugin and theme version tests.
This displays a more appropriate message in case the site does not have any active plugins or installed themes.

Follow-up to [44986], [45099], [45336].

Props Presskopp, costdev, martin.krcho, Clorith, SergeyBiryukov.
Fixes #56134.
Built from https://develop.svn.wordpress.org/trunk@53816


git-svn-id: http://core.svn.wordpress.org/trunk@53375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 13:09:09 +00:00
audrasjb
66d425d86a Administration: Change default site tagline to an empty string.
This changeset replaces the default "Just another WordPress site" tagline with an empty string for new installations. The reasoning is:

1. Not all themes display the tagline;
2. Not everyone changes the default tagline;
3. When people don't see the tagline in their theme, they may not realize it is still visible in some places, like feeds.

The string "Just another WordPress site" and the related multisite string: "Just another {NETWORK} site" are now only used as a placeholder for the tagline admin option.

Props markjaquith, Denis-de-Bernardy, westi, RyanMurphy, kovshenin, SergeyBiryukov, chriscct7, tyxla, hyperbrand, karmatosed, lukecavanagh, melchoyce, boemedia, khag7, sabernhardt, audrasjb, peterwilsoncc, costdev, martinkrcho, rafiahmedd.
Fixes #6479.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 12:20:16 +00:00
audrasjb
ef0c9211ca Docs: Use third-person singular verbs for function descriptions in WP_REST_Posts_Controller, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 10:07:13 +00:00
audrasjb
2692f4a0be Posts, Post Types: Force unique slugs for draft posts.
This fixes a behavior where a draft created with the same slug as an existing post would set the existing post to a 404.

`wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts, so to ensure that a unique slug is generated, this changeset adds the post data with the 'publish' status to `wp_unique_post_slug()`.

Props Toro_Unit, h2ham, peterwilsoncc, costdev, antonvlasenko, azaozz, ironprogrammer, audrasjb, hellofromTonya.
Fixes #52422.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 09:03:14 +00:00
Sergey Biryukov
d7d371b840 Database: Suppress errors when checking the validity of table prefix during installation.
There are some table prefixes (for example, `7e1_`), which the database will try and parse as values unless they are quoted in backticks. Because not everyone remembers to quote their table names, WordPress discourages use of such prefixes during setup.

To test if the table prefix is valid, WordPress executes a query deliberately trying to generate an error:
> `Unknown column 'wp_' in 'field list'`
which means the prefix is safe to use, as the database was not able to parse it as a value.

Previously, this error would not be displayed to the user in a typical configuration, but would be logged on the server via `wpdb::print_error()`, and in some cases could block the installation.

This commit makes sure the error is still checked to display a proper message in case the prefix needs to be edited, but otherwise is silently discarded instead of being logged.

Follow-up to [37581], [41631], [51582].

Props pento, lazam786, Velochicdunord, irecinius, mikemanzo, dd32, blackawxs, codewhy, psykro, burgiuk, mdrago, maythamalsudany, peterwilsoncc, sumitsingh, deksar, SergeyBiryukov.
Fixes #42362.
Built from https://develop.svn.wordpress.org/trunk@53812


git-svn-id: http://core.svn.wordpress.org/trunk@53371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-02 16:34:13 +00:00
audrasjb
46c1425601 Docs: Improve the description of param $list in wp_list_sort() docblock.
Props audrasjb, rherault.
Fixes #56324.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-02 14:50:12 +00:00
Peter Wilson
0008d2a443 Date/Time: Increase test coverage of wp_date().
Props costdev, pbearne, rarst.
Fixes #53485.
See #55652.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-01 22:50:15 +00:00
Sergey Biryukov
a3a299ce1e Docs: Improve description for doing_filter() and doing_action().
This corrects a note about `did_action()` return type, and brings more consistency between the two DocBlocks.

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

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


git-svn-id: http://core.svn.wordpress.org/trunk@53368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-01 11:15:14 +00:00
Sergey Biryukov
7c316c4f1a Tests: Move the test for action callback representations to the general action tests file.
A separate file in the `actions` directory may have seemed like a good location at the time, but this is the only test left there. For consistency, it is now moved with the other action tests.

Follow-up to [1294/tests], [53806].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 21:37:13 +00:00
Sergey Biryukov
6feee39137 Tests: Update a transients test to account for terminology changes in MockAction.
Follow-up to [33110], [53805].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 16:51:07 +00:00
Sergey Biryukov
97565d4a0d Tests: Move the test for actions using closures to the general action tests file.
This was previously moved to a separate file to be excluded when running the tests on PHP 5.2.x.

Now that WordPress supports PHP 5.6.x or later, this can be moved back with the other action tests.

Follow-up to [299/tests], [301/tests], [862/tests], [866/tests], [963/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 16:43:09 +00:00
Sergey Biryukov
f2138f29a8 Tests: Update the terminology used for action or filter names in MockAction class.
This replaces the "tag" wording with "hook name" where appropriate, to match the core function signatures.

Includes:
* Introducing a `::get_hook_names()` method instead of `::get_tags()`, keeping the latter as an alias.
* Adding a `hook_name` key to the `::$events` property, keeping `tag` for backward compatibility for now.
* Adding missing `@since` tags for class methods.

Follow-up to [24/tests], [62/tests], [70/tests], [50807], [53804].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 16:27:09 +00:00
Sergey Biryukov
6e4bc189f5 Tests: Update the terminology used for action or filter names in hook tests.
This replaces the `$tag` variables with `$hook_name`, to match the core function signatures.

Follow-up to [24/tests], [62/tests], [866/tests], [1294/tests], [38571], [50807].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 15:05:10 +00:00
Sergey Biryukov
bf067ce93a Plugins: Introduce did_filter() function.
While most of the action functions are aliases for the respective filter functions, using `did_action()` to detect whether a filter has been run is not possible, as it only works specifically for actions.

This is now resolved by introducing a new function, `did_filter()`, which retrieves the number of times a filter has been applied during the current request, bringing parity with `did_action()`.

Follow-up to [4630], [6318], [27294].

Props mordauk, chriscct7, andykeith, nacin, dd32, markparnell, SergeyBiryukov.
Fixes #35357.
Built from https://develop.svn.wordpress.org/trunk@53803


git-svn-id: http://core.svn.wordpress.org/trunk@53362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 14:20:12 +00:00
Sergey Biryukov
5a9b1a44a1 Tests: Correct alignment in has_filter() unit test.
Follow-up to [100/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-31 13:10:14 +00:00
Sergey Biryukov
f53c815b6e Coding Standards: Use more meaningful variables names in some Ajax functions.
This renames `$tax` to `$taxonomy_object` and `$s` to `$search` for clarity. The latter is only renamed when used as an internal variable and not referring to the `$s` global.

The list of affected functions:
* `wp_ajax_ajax_tag_search()`
* `wp_ajax_add_link_category`
* `wp_ajax_add_tag()`
* `wp_ajax_get_tagcloud()`
* `wp_ajax_inline_save_tax()`
* `wp_ajax_find_posts()`

Follow-up to [6542], [8901], [10222], [12833], [16771], [16992], [22723], [38698].

Props azouamauriac.
Fixes #55098.
Built from https://develop.svn.wordpress.org/trunk@53801


git-svn-id: http://core.svn.wordpress.org/trunk@53360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-30 15:16:08 +00:00
Sergey Biryukov
75ff07ccbf Docs: Use more inclusive language in PHPCS configuration files.
Follow-up to [42346], [43348], [45455], [46290], [46820], [48121], [48477].

See #55646, #55647.
Built from https://develop.svn.wordpress.org/trunk@53800


git-svn-id: http://core.svn.wordpress.org/trunk@53359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-30 14:11:08 +00:00
audrasjb
35ab933067 Docs: Fix $feature parameter type in block_has_support().
In `block_has_support()` docblock, the `$feature` parameter is an array, not a string.

Props Soean, audrasjb.
Fixes #56307.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-30 14:09:10 +00:00
audrasjb
9ddff60ecd Docs: Various docblock fixes in WP_Date_Query class, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-30 14:01:13 +00:00
audrasjb
1cfcf1791e Twenty Twenty: Ensure comments section links are identifiable as links.
Links should look like links. This changeset makes sure that links displayed in the comments section of Twenty Twenty are identifiable as links.

Props audrasjb, whaze, sabernhardt, mukesh27.
Fixes #56269.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 20:26:12 +00:00
audrasjb
37c514cc62 Comments: Improve accessibility of the "Logged in as" link in comment form.
This changeset ensures the "Logged in as" link conveys the information about its purpose ("Edit your profile") while the information "Logged in as Jane Doe" is only a simple text.

Props juliemoynat, SergeyBiryukov, joedolson, audrasjb, lopo.
Fixes #55718.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 17:06:15 +00:00
Sergey Biryukov
221b68fe4b Tests: Simplify some function calls in Tests_Media.
The remaining assertions using `preg_match_all()` do actually pass a regex, but the third parameter `$matches` is never used.

This third parameter became optional in PHP 5.4, so we may as well remove it.

Reference: [https://www.php.net/manual/en/function.preg-match-all.php PHP Manual: preg_match_all()]

Follow-up to [711/tests], [53558], [53790].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 14:35:13 +00:00
audrasjb
9a517ac7ae Docs: Various docblock improvements in Importer Administration API, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 09:22:10 +00:00
audrasjb
698e0466a0 Themes: Allow remote pattern registration in theme.json when core patterns are disabled.
In 6.0 there is now a functionality that allows to register selected remote patterns (from the Pattern Directory) via `theme.json`. However, it requires to fully enable all core and remote patterns. This can be a blocker for user adoption.

Many theme authors want to have all core and remote patterns disabled by default using `remove_theme_support( 'core-block-patterns' )`. This changeset ensures they are serving only patterns relevant to their theme.

This changeset removes theme support check from the function that registers remote patterns specified in `theme.json`. This allows theme authors to disable core patterns but then selectively register the ones they want from the Pattern Directory. If a theme author intentionally specifies patterns in `theme.json`, they probably intend for them to be present in the pattern inserter and the check is not required.

This change will make the Pattern Directory more appealing/usable from the theme author's perspective.

Props ndiego, ryelle.
Fixes #56112.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 08:31:10 +00:00
audrasjb
d853d1ece2 Docs: Various docblock improvements in Export Administration API, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 08:14:12 +00:00
Peter Wilson
839d20f9c5 Cron API: Modify _get_cron_array() to always return an array.
Change the return type of `_get_cron_array()` to an empty array if the `cron` option is either missing or of an 
unexpected type.

This change ensures the return value for no registered events is consistently an empty array. Previously the return 
value could be either an empty array or `false`.

Props thakkarhardik, jrf, costdev.
Fixes #53940.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 03:34:13 +00:00
Sergey Biryukov
9646cd2a77 Tests: Simplify some assertions in Tests_Media.
A number of assertions are checking for the number of times a hard-coded substring existed in a larger `$haystack`.

These assertions were using `preg_match_all()` to do so, but without actually using a regex.

In these cases, it is more performant (and simpler) to use the PHP native `substr_count()` function, which will yield the same result, without the overhead of regex parsing.

Reference: [https://www.php.net/manual/en/function.substr-count.php PHP Manual: substr_count()]

Follow-up to [711/tests], [38838], [42694], [53558].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-28 22:38:13 +00:00
Sergey Biryukov
ac02adfaec Tests: Use named data providers in some wp_insert_post() tests.
Follow-up to [42380], [49125], [53521], [53785], [53787], [53788].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-27 16:29:07 +00:00
Sergey Biryukov
8e51578146 Tests: Don't unnecessarily randomize the post type in some wp_insert_post() tests.
Follow-up to [33041], [52389], [53785], [53787].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-27 16:09:12 +00:00
Sergey Biryukov
2786e0f54d Tests: Don't unnecessarily set the author in some wp_insert_post() tests.
This aims to make the tests more specific. Setting the author appears to be redundant, as the as the authorship is out of scope for these particular tests.

Follow-up to [66/tests], [84/tests], [167/tests], [296/tests], [412/tests], [496/tests], [1026/tests], [1323/tests], [25554], [33041], [34762], [35183].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-27 15:43:11 +00:00
Felix Arntz
b39a441f3a Media: Add information about additional MIME type sources to attachments REST endpoints.
This changeset is a follow-up to [53751] which ensures the additional `sources` information stored in attachment metadata are available under `media_details` for each image size in the REST API responses for attachments.

Props mukesh27, eugenemanuilov, mitogh, flixos90, aaemnnosttv.
See #55443.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-27 15:15:15 +00:00
Sergey Biryukov
c6235a37c7 Tests: Move wp_insert_post() tests to their own file.
Now that there is a separate test class for `wp_insert_post()` tests, some of the pre-existing tests from the general `Tests_Post` class can be moved there.

Includes:
* Removal of unnecessarily setting the current user to Editor for all tests.
* Removal of unnecessarily setting the cron option to an empty array for all tests.

Follow-up to [496/tests], [36607], [53782], [53783].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-27 15:01:14 +00:00
gziolo
db37be017f Site Editor: Pass correct context into get_block_categories
Site Editor passed incorrectly global $post as a context when setting up block categories. Instead, it should pass $block_editor_context, since global $post is null in this file.

Props Mamaduka.
Fixes #56284.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-27 12:27:16 +00:00
Sergey Biryukov
7af37ed1ad Tests: Move wp_publish_post() tests to their own file.
Now that there is a separate test class for `wp_publish_post()` tests, some of the pre-existing tests from the general `Tests_Post` class can be moved there.

Follow-up to [1039/tests], [1174/tests], [46969], [49000].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-26 14:30:14 +00:00
Sergey Biryukov
3df4fd7679 Tests: Bring some modernization to wp_insert_post() tests.
Includes:
* Using `assertIsInt()` instead of `assertIsNumeric()` for post IDs.
* Using consistent variable names for post data and retrieved posts.
* Removing added filters before performing assertions, not after.
* Removing unused `Tests_Post::$post_ids` property.
* Correcting the order of arguments in some assertions.
* Converting some `foreach()` loops to data providers.
* Wrapping long lines for better readability.

Follow-up to [13/tests], [14/tests], [167/tests], [496/tests], [1174/tests], [1246/tests], [1287/tests], [1307/tests], [1326/tests], [30510], [33261], [33630], [34762], [46279], [50012], [51438].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-26 13:55:14 +00:00
audrasjb
49ace608dc Taxonomy: Allow filtering Ajax term search results in quick edit.
This changeset introduces the `ajax_term_search_results` hook which can be used to filter the term search results returned by the AJAX term query.

Props grandeljay, costdev, ironprogrammer, audrasjb, SergeyBiryukov.
Fixes #55606.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-26 13:23:14 +00:00
audrasjb
82edcc17f5 Docs: Improve parameter descriptions in render_block and render_block_* filters.
The former `$block_content` parameter descriptions were too opinionated as block content can be appended, prepended, nested, removed, etc.

Props milana_cap.
Fixes #56286.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-26 13:00:16 +00:00
Sergey Biryukov
87464289c3 Revisions: Update the "last revision" wording to "latest revision" in various files.
This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.

This affects:
* `wp_save_post_revision()`
* `wp_prepare_revisions_for_js()`
* `WP_Customize_Manager::filter_revision_post_has_changed()`

Follow-up to [53759], [53769], [53778].

Props peterwilsoncc.
Fixes #55857.
Built from https://develop.svn.wordpress.org/trunk@53779


git-svn-id: http://core.svn.wordpress.org/trunk@53338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 19:30:09 +00:00
Sergey Biryukov
adb5ff451c Revisions: Rename the function for retrieving the latest revision ID and total count.
The new name is `wp_get_latest_revision_id_and_total_count()`.

This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.

Follow-up to [53759], [53769].

Props peterwilsoncc.
See #55857.
Built from https://develop.svn.wordpress.org/trunk@53778


git-svn-id: http://core.svn.wordpress.org/trunk@53337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 19:20:07 +00:00
audrasjb
a85bde79df Media: Prevent URLs from overflowing their container in the media editor.
This changeset also introduces the `.word-wrap-break-word` class which can be used to apply `word-wrap: break-word` to admin elements when needed.

Props mitogh, costdev, kapilpaul, alamgircsebd, sabernhardt, anantajitjg, afercia, circlecube, SergeyBiryukov, rafiahmedd, audrasjb.
Fixes #55393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 18:11:08 +00:00
audrasjb
b6fad3a241 Docs: Remove an obsolete function description in addslashes_gpc().
- Usage of `get_magic_quotes_gpc()` was removed from `addslashes_gpc()` in [46105] / #47783.
- A similar description fragment was removed from `wp_parse_str()` in that changeset, but this one was missed.
- The `get_magic_quotes_gpc()` function itself was deprecated in PHP 7.4 and removed in PHP 8.0.

Props mitweka, audrasjb, SergeyBiryukov.
Fixes #56233.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 17:28:09 +00:00
audrasjb
83da7ca360 Docs: Refine @return docblock mentions for esc_sql(), wp_slash() and wp_unslash().
Props malthert, SergeyBiryukov, johnbillion, desrosj, byohann6.
Fixes #53946.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 15:43:09 +00:00
Sergey Biryukov
46cf3ecda4 Tests: Declare custom-logo theme support for custom logo tests.
This addresses failures in `has_custom_logo()` and `get_custom_logo()` tests when being run separately:
{{{
1) Tests_General_Template::test_has_custom_logo
Custom logo should not be set after removal.
Failed asserting that true is false.
tests/phpunit/tests/general/template.php:291

2) Tests_General_Template::test_get_custom_logo
Custom logo should not be set after removal.
Failed asserting that a string is empty.
tests/phpunit/tests/general/template.php:336
}}}

Specifically, this ensures that the `site_logo` option gets deleted in `_delete_site_logo_on_remove_theme_mods()`, which in turn prevents the `core/site-logo` block filters from affecting the custom logo tests.

Alternatively, these filters could be removed instead:
{{{
remove_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );
remove_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
}}}

Follow-up to [36905], [51091], [51421], [52042].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 13:48:10 +00:00
Sergey Biryukov
a39042b237 Tests: Add failure messages for site icon and custom logo tests.
This makes the assertions more helpful, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.

Follow-up to [33181], [36905].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 13:33:12 +00:00
Peter Wilson
276d3b34ca REST API: Prime post caches in comments endpoint.
Prevent each call to `get_post()` triggering a seperate database query by priming the cache of each comment's post in 
the REST API's comments endpoint.

Props spacedmonkey, timothyblynjacobs.
Fixes #56272.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 02:53:13 +00:00
Sergey Biryukov
ae807463ac Posts, Post Types: Check if the post type exists in wp_insert_post().
This avoids an `Attempt to read property "cap" on null` PHP warning when checking an unregistered post type's `publish_posts` capability to disallow contributors setting the post slug for pending posts.

Follow-up to [9055], [42380].

Props Chouby, mukesh27, rafiahmedd, SergeyBiryukov.
Fixes #55877.
Built from https://develop.svn.wordpress.org/trunk@53771


git-svn-id: http://core.svn.wordpress.org/trunk@53330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-24 13:26:12 +00:00
Sergey Biryukov
a7d02201ea Docs: List the expected type first in a few functions:
* `is_allowed_http_origin()`
* `doing_filter()`
* `wp_get_post_revisions_url()`

Follow-up to [28010], [28889], [30674], [46696], [47060], [48068], [49929], [49963], [52095], [51286], [52111].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 16:57:09 +00:00
Sergey Biryukov
e5fca86316 Revisions: Correct the function name for retrieving the last revision ID and total count.
Includes:
* Renaming the function to `wp_get_last_revision_id_and_total_count()`.
* Making the default value for `$post` consistent with `wp_get_post_revisions()`.
* Making `WP_Error` codes more specific and using them in test assertions.
* Adjusting the function description per the documentation standards.

Follow-up to [53759].

Props JustinSainton, SergeyBiryukov.
See #55857.
Built from https://develop.svn.wordpress.org/trunk@53769


git-svn-id: http://core.svn.wordpress.org/trunk@53328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 15:42:16 +00:00
Sergey Biryukov
729ab2c971 Docs: Document that the $file_format parameter of metadata filters can be null.
This affects the `wp_read_video_metadata` and `wp_read_audio_metadata` filters.

Follow-up to [41746], [53764].

See #55646, #55828.
Built from https://develop.svn.wordpress.org/trunk@53768


git-svn-id: http://core.svn.wordpress.org/trunk@53327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 15:06:10 +00:00
Sergey Biryukov
d61b862297 Cache API: Make the placement of wp_cache_flush_group() more consistent.
Includes:
* Placing `WP_Object_Cache::flush_group()` next to `::flush()`.
* Placing `wp_cache_supports_group_flush()` next to `wp_cache_flush_group()`.
* Placing the `wp_cache_flush_group()` unit test next to the `::flush()` method test.
* Removing test name from assertion messages, as it is already mentioned directly above in case of failure.
* Adjusting function descriptions per the documentation standards.

Follow-up to [52706], [53763].

See #55647, #4476.
Built from https://develop.svn.wordpress.org/trunk@53767


git-svn-id: http://core.svn.wordpress.org/trunk@53326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 14:58:12 +00:00
audrasjb
85e2d1df55 Docs: Add function description and @since mention for get_upload_iframe_src().
Follow-up to [14015].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 09:00:11 +00:00
audrasjb
007726602e Docs: Fix indentation issues in wp_read_video_metadata and wp_read_audio_metadata docblocks.
Follow-up to [53764].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 08:19:11 +00:00
audrasjb
32cc05a7c0 Media: Allow filtering audio file metadata in wp_read_audio_metadata().
This changeset introduces the `wp_read_audio_metadata` hook which allows to filter metadata extracted from an uploaded audio file.

This brings consistency with corresponding filters available for image and video file types:

- `wp_read_image_metadata` added in [6313] / #5162.
- `wp_read_video_metadata` added in [41746] / #35218.

Props luigipulcini, SergeyBiryukov, mukesh27.
Fixes #55828.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 08:13:11 +00:00
spacedmonkey
71cfaa9a5a Cache API: Add wp_cache_flush_group function.
Add a new plugable function called `wp_cache_flush_group`, that will allow developers to clear whole cache groups with a single call. Developers can detect if their current implementation of an object cache supports flushing by group, by calling `wp_cache_supports_group_flush` which returns true if it is supported. If the developers of the object cache drop-in has not implemented `wp_cache_flush_group` and `wp_cache_supports_group_flush`, these functions are polyfilled and `wp_cache_supports_group_flush` defaults to false.

Props Spacedmonkey, filosofo, ryan, sc0ttkclark, SergeyBiryukov, scribu, Ste_95, dd32, dhilditch, dougal, lucasbustamante, dg12345, tillkruess, peterwilsoncc, flixos90, pbearne.
Fixes #4476.
Built from https://develop.svn.wordpress.org/trunk@53763


git-svn-id: http://core.svn.wordpress.org/trunk@53322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 20:52:12 +00:00
desrosj
11511cea38 Bundled Themes: Update NPM dependencies for Twenty Twenty and Twenty Nineteen.
There are no changes to any built files after updating.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 17:11:08 +00:00
desrosj
4d35a8e4b4 Twenty Twenty-One: Update NPM dependencies.
This updates the NPM dependencies for the Twenty Twenty-One theme to the latest versions.

Modifications to the built files are included in this commit, which are a result of updating the `sass` dependency to the latest version.

Previously, trailing loud comments (`/* ... */`) were pushed to the next line,. Now the comment location is preserved, resulting in the built CSS files more closely resembling the theme’s SCSS files.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 16:42:08 +00:00
spacedmonkey
16dfb05173 REST API: Avoid unnecessarily preparing item links.
Do not call the `prepare_links` methods in core REST API controllers, unless the `_links` or `_embedded` fields are requested. There is no need to prepare links if they are never returned in the response. This saves resources, as many calls to `prepare_links` methods perform database queries. 

Props Spacedmonkey, timothyblynjacobs, rachelbaker, desrosj, dlh, hellofromTonya.
Fixes #52992.
Built from https://develop.svn.wordpress.org/trunk@53760


git-svn-id: http://core.svn.wordpress.org/trunk@53319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 14:00:12 +00:00
spacedmonkey
ee12e8acc0 REST API: Use wp_get_lastest_revision_id_and_total_count function in WP_REST_Posts_Controller class.
Add new function called `wp_get_lastest_revision_id_and_total_count`, that performs an optimized query to get the last revision and total and use it in `WP_REST_Posts_Controller` class. 

Props Spacedmonkey, timothyblynjacobs, furi3r, peterwilsoncc.
Fixes #55857.
Built from https://develop.svn.wordpress.org/trunk@53759


git-svn-id: http://core.svn.wordpress.org/trunk@53318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 13:24:20 +00:00
Sergey Biryukov
acbd857a4c Administration: Correct the escaping in documentation lookup for plugin and theme editor.
This brings consistency to similar code fragments that evolved in slightly different ways over the years:

* A check that the list of functions is not empty now exists in both editors.
* "Function Name..." is an option label, not an attribute, so `esc_html__()` is the correct function here.
* `esc_attr( urlencode( $function ) )` in the theme editor is replaced with `esc_attr( $function )`.
* `htmlspecialchars( $function )` in the theme editor is replaced with `esc_html( $function )`.

Follow-up to [10607], [10879], [11110], [11173], [11204], [11671], [14989].

Props aristath, justinahinon, poena, audrasjb, pratiweb, SergeyBiryukov.
Fixes #56007.
Built from https://develop.svn.wordpress.org/trunk@53758


git-svn-id: http://core.svn.wordpress.org/trunk@53317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 11:33:10 +00:00
audrasjb
d217368c6a Docs: Provide a more accurate description for wp_is_theme_directory_ignored().
This function doesn't filter theme directories, it rather determines whether a directory should be ignored during export.

Props audrasjb, nareshbheda.
Fixes #56257.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 07:18:13 +00:00
Sergey Biryukov
30d9a61fe2 Coding Standards: Use __DIR__ instead of ABSPATH in wp-db.php.
If the file is included directly outside of WordPress core, `ABSPATH` may not be defined.

Follow-up to [53749], [53750], [53755].

See #56268, #55647.
Built from https://develop.svn.wordpress.org/trunk@53756


git-svn-id: http://core.svn.wordpress.org/trunk@53315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 22:45:11 +00:00
Sergey Biryukov
1cf37b12ae Coding Standards: Check if the _deprecated_file() function exists in wp-db.php.
This avoids a fatal error if the file is included directly outside of WordPress core, e.g. by HyperDB.

Additionally, replace `WPINC` with `wp-includes`, as the constant may not be defined yet in that context.

Follow-up to [53749], [53750].

See #56268, #55647.
Built from https://develop.svn.wordpress.org/trunk@53755


git-svn-id: http://core.svn.wordpress.org/trunk@53314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 21:39:08 +00:00
audrasjb
f7921555ca Formatting: Normalize to Unicode NFC encoding before converting accent characters in remove_accents().
This changeset adds Unicode sequence normalization from NFD to NFC, via the `normalizer_normalize()` PHP function which is available with the recommended `intl` PHP extension.

This fixes an issue where NFD characters were not properly sanitized. It also provides a unit test for NFD sequences (alternate Unicode representations of the same characters).

Props NumidWasNotAvailable, targz, nacin, nunomorgadinho, p_enrique, gitlost, SergeyBiryukov, markoheijnen, mikeschroder, ocean90, pento, helen, rodrigosevero, zodiac1978, ironprogrammer, audrasjb, azaozz, laboiteare, nuryko, virgar, dxd5001, onnimonni, johnbillion.
Fixes #24661, #47763, #35951.
See #30130, #52654.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 21:11:12 +00:00
Adam Silverstein
0bbca2a3ab Upgrade/Install: track php extensions and image library support for WebP and AVIF.
Add the loaded php extensions as well as whether the server's image libraries support WebP and AVIF image formats to the data payload sent during upgrade checks. Collecting this data with the WordPress.org API will help the project make more data driven decisions about feature support. Note that all data can still be filtered with the `core_version_check_query_args` filter for privacy reasons.

Props dd32, SergeyBiryukov, mikeschroder, pbiron. 
Fixes #48116.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 20:22:09 +00:00
audrasjb
6b06b2cc25 Application Passwords: Link a more accurate documentation page in User profile edit screen.
This changeset replaces a HelpHub link with more accurate DevHub link about environment types in User profile edit screen.

Props greg24, whaze.
Fixes #56267.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 19:32:12 +00:00
Adam Silverstein
71ca314193 Media: enable generating multiple mime types for image uploads; specifically WebP versions for JPEG images by default.
This changeset adds the capability for core media uploads to generate sub sized images in more than a single mime type. The output formats for each mime type can be controlled through a filter. WebP is used as an additional output format for JPEG images by default to improve front end performance.

When generating additional mime types, only images which are smaller than the respective original are retained. By default, additional mime type images are only generated for the built-in core image sizes and any custom sizes that have opted in.

Image meta is updated with a new 'sources' array containing file details for each mime type. Each image size in the 'sizes' array also gets a new 'sources' array that contains the image file details for each mime type.

This change also increases image upload retries to accommodate additional image sizes. It also adds a `$mime_type` parameter to the `wp_get_missing_image_subsizes` function and filter.

This change adds three new filters to enable full control of secondary mime image generation and output:

* A new filter `wp_image_sizes_with_additional_mime_type_support` that filters the sizes that support secondary mime type output. Developers can use this to control the output of additional mime type sub-sized images on a per size basis.
* A new filter `wp_upload_image_mime_transforms` that filters the output mime types for a given input mime type. Developers can use this to control generation of additional mime types for a given input mime type or even override the original mime type.
* A new filter `wp_content_image_mimes` which controls image mime type output selection and order for frontend content. Developers can use this to control the mime type output preference order for content images. Content images inserted from the media library will use the available image versions based on the order from this filter.

Thanks to the many contributors who helped develop, test and give feedback on this feature.

A haiku to summarize:

Upload a JPEG
Images of all sizes
Output as WebPs

Props flixos90, MatthiasReinholz, studiolxv, markhowellsmead, eatingrules, pbiron, mukesh27, joegrainger, mehulkaklotar, tweetythierry, akshitsethi, peterwilsoncc, eugenemanuilov, mitogh, shetheliving, clarkeemily, codekraft, mikeschroder, clorith, kasparsd, spacedmonkey, trevorpfromsandee, jb510, scofennellgmailcom, seedsca, cagsmith, karinclimber, dainemawer, baxbridge, grapplerulrich, sobatkras, chynnabenton, tonylocalword, barneydavey, kwillmorth, garymatthews919, olliejones, imarkinteractive, jeffpaul, feastdesignco, webbeetle, masteradhoc.

See #55443.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 18:03:13 +00:00
Sergey Biryukov
23e60ed765 Coding Standards: Replace the old wp-db.php filename in phpcompat.xml.dist.
This ensures the correct file is allowlisted for use of `mysql_` extension in PHP < 7.0.

Follow-up to [53749].

See #56268, #55647.
Built from https://develop.svn.wordpress.org/trunk@53750


git-svn-id: http://core.svn.wordpress.org/trunk@53309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 16:09:12 +00:00
Sergey Biryukov
8484c7babb Coding Standards: Move wp-includes/wp-db.php to wp-includes/class-wpdb.php.
This renames the file containing the `wpdb` class to conform to the coding standards.

This commit also includes:
* A new `wp-db.php` that loads the new file, for anyone that may have been including the file directly.
* Replacing references to the old filename with the new filename.

Fixes #56268. See #55647.
Built from https://develop.svn.wordpress.org/trunk@53749


git-svn-id: http://core.svn.wordpress.org/trunk@53308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 16:00:15 +00:00
audrasjb
0ccc01839a Docs: Update do_action() docblock code example.
This changeset fixes an issue with the code example provided: `do_action()` doesn't return any value.

Props leogermani, thakkarhardik.
Fixes #55977.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 14:32:12 +00:00
Sergey Biryukov
ee4f7d7415 Coding Standards: Adjust the logic slightly in wp_ajax_replyto_comment().
This aims to bring more consistency to the function logic by separating the comment content and type checks from the user existence check.

Follow-up to [8720], [9098], [29758].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 10:59:10 +00:00
audrasjb
49dd15fb6b Docs: Add missing function description in wp-admin/includes/template.php.
This changeset also includes a few docblock standards fixes in the same file.

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 09:24:10 +00:00
audrasjb
70f9851fda Administration: Add labels to read-only form fields.
This changeset improves admin forms accessibility by adding labels to the following read-only form fields:

- Network setup screen: new visible label to the four textareas for code users need to paste into their wp-config file and the server configuration file (web.config or .htaccess).
- `setup-config.php`: new visible label to one textarea for code to include in the `wp-config` file manually.
- Admin toolbar: adds an `arial-label` attribute to the old "shortlink" feature (not used anymore but still activable by plugins).

Props sabernhardt, audrasjb, ryokuhi, joedolson.
Fixes #54302.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 09:04:14 +00:00
Peter Wilson
02f3628e20 Embeds: Add Pocket Casts as a trusted oEmbed provider.
Props mattwondra, peterwilsoncc, pento, audrasjb.
Fixes #55860.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 04:25:13 +00:00
audrasjb
4770e926ab Docs: Use third-person singular verbs for function descriptions in wp-admin/includes/comment.php, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 22:15:10 +00:00
audrasjb
0df025d2bd Docs: Add missing function description in wp-admin/includes/comment.php.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 22:12:09 +00:00
audrasjb
bcf4ff0c3f Themes: Add a hook to filter theme header image URL.
This changeset introduces the `get_header_image` filter, which can be used to modify header image URL returned by `get_header_image()`, in themes that support the Header Image feature. 

Props hztyfoon, audrasjb, mukesh27, SergeyBiryukov, costdev.
Fixes #56180.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 21:13:09 +00:00
audrasjb
63d113e62c Docs: Use third-person singular verbs for function descriptions in general-template.php, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 20:37:07 +00:00
desrosj
3e1fd05600 Twenty Twenty-One: Rebuild the IE specific stylesheet.
This was missed in [53517].

See #55989.
Built from https://develop.svn.wordpress.org/trunk@53739


git-svn-id: http://core.svn.wordpress.org/trunk@53298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 19:20:11 +00:00
desrosj
8e91a8f995 Build/Test Tools: Add tag pattern matching for the testing NPM workflow.
This workflow was missed in [50298].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 18:52:10 +00:00
desrosj
44412840a8 Build/Test Tools: Make the GitHub Action pattern matching for tags more specific.
This improves the tag pattern matching for GitHub Action workflows to be more specific. The `*` wildcard in the current patterns matches any character except slash (`/`). While this correctly matches a version like `X.Y.Z`, it could also match non-numeric characters.

This changes patterns to use the `+` character, which matches one or more of the preceding characters (`[0-9]` in this case).

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


git-svn-id: http://core.svn.wordpress.org/trunk@53295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 18:41:11 +00:00
desrosj
cfe7d795f5 Build/Test Tools: Correctly detect the first workflow run for a branch or tag.
When trying to determine the outcome of the previous run for a GitHub Action workflow, the current run is included in the list fetched from the GitHub API.

This adjusts the logic checking for the previous run to account for that and fixes notifications for the first workflow runs of a new branch or tag.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 17:43:13 +00:00
Sergey Biryukov
486602cfca Docs: Add a @since note for get_post_permalink() returning false on failure.
Follow-up to [53733].

See #45329.
Built from https://develop.svn.wordpress.org/trunk@53734


git-svn-id: http://core.svn.wordpress.org/trunk@53293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 15:46:09 +00:00
Sergey Biryukov
4bfc1358a0 Posts, Post Types: Correct the check for non-existing post in get_post_permalink().
The function was erroneously calling `is_wp_error()` on the result of a `get_post()` call, which returns `null` on failure, and never returns a `WP_Error` object.

Previously, passing a non-existing post ID to the function would result in a home URL being returned and a few `Attempt to read property "post_type, post_name, hierarchical..." on null` PHP warnings.

This commit ensures `get_post_permalink()` returns `false` on failure, which brings parity with `get_permalink()`.

Includes a unit test to confirm the correct behavior.

Follow-up to [12923], [13023], [32606].

Props renegeuze, manzoorwani.jk.
Fixes #45329.
Built from https://develop.svn.wordpress.org/trunk@53733


git-svn-id: http://core.svn.wordpress.org/trunk@53292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 15:41:09 +00:00
Sergey Biryukov
d77d8384ad Tests: Correct the test for passing all expected parameters to the preprocess_comment filter.
Previously, `assertSame()` was replaced with `assertSameSets()`, which does not preserve the array keys. `assertSameSetsWithIndex()` should have been used instead.

Follow-up to [36038], [48937], [53729], [53730].

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53732


git-svn-id: http://core.svn.wordpress.org/trunk@53291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 14:49:12 +00:00
desrosj
04cea1d615 Administration: Remove unused CSS selectors related to old format menu icons.
This removes all CSS definitions related to the `.icon16` class. Research shows that current ecosystem usage of this class is extremely minimal.

This selector was used for the Welcome Panel and Welcome Screen in WordPress 3.3 (see [19163] and [19197]. The icons were removed for WordPress 3.5 in [22018], but the related CSS remained, and were also included when the MP6 admin re-skinning was merged in [26072].

Props afercia, mmaumio, isabel_brison, sabernhardt, audrasjb, desrosj.
Fixes #35717.
Built from https://develop.svn.wordpress.org/trunk@53731


git-svn-id: http://core.svn.wordpress.org/trunk@53290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 14:39:09 +00:00
Sergey Biryukov
c0065475f3 Coding Standards: Remove extra comma in a compact() call.
This fixes a PHP compatibility error in `wp_handle_comment_submission()`:

* `Trailing comma's are not allowed in function calls in PHP 7.2 or earlier`

Follow-up to [53729].

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53730


git-svn-id: http://core.svn.wordpress.org/trunk@53289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 14:22:08 +00:00
Sergey Biryukov
e2a5b8684e Coding Standards: Standardize on user_id when passing data to comment functions.
The `wp_new_comment()`, `wp_update_comment()`, and `wp_filter_comment()` functions already normalize the `user_ID` parameter internally to `user_id`, which matches the database field name.

This commit aims to bring some consistency when passing the parameter in core.

The corresponding `$user_ID` variable is also renamed to `$user_id` to match the other variables when not referring to the `$user_ID` global, which has an exception in the WordPress coding standards.

Follow-up to [8543], [8720], [12267], [12300], [26491], [28915], [28922], [34799], [49303].

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53729


git-svn-id: http://core.svn.wordpress.org/trunk@53288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 14:14:09 +00:00
audrasjb
917e850008 Docs: Use third-person singular verbs for function descriptions in block-template.php and block-template-utils.php.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 13:21:08 +00:00
audrasjb
6d9424f138 Docs: Fix indentation issues in block-template-utils.php docblocks, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 13:14:10 +00:00
audrasjb
79c4babf39 Plugins: Improve color contrast on plugins screen when recovery mode is activated.
This changeset replaces `#d63638` (contrast ratio: 4.40) with `#b32d2e` (contrast ratio: 5.87) in Plugins screen row action links when the site is in recovery mode.

Props kebbet, mukesh27, joedolson, audrasjb.
Fixes #56190.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 11:37:15 +00:00
desrosj
866abfda9f External Libraries: Update the Moment library to version 2.29.4.
This is a minor bug fix release.

Props dilipbheda.
Fixes #56031.
Built from https://develop.svn.wordpress.org/trunk@53725


git-svn-id: http://core.svn.wordpress.org/trunk@53284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 19:43:25 +00:00
Sergey Biryukov
81b7b229ed Coding Standards: Use consistent placement for ::prepare_links() methods.
This moves the `::prepare_links()` methods in REST API classes next to `::prepare_item_for_response()` where they are used, to bring some consistency across the classes and make code navigation easier.

Includes wrapping some long lines for better readability.

Follow-up to [52079], [52051], [52342], [53721], [53722].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 16:22:09 +00:00
Sergey Biryukov
69a8ecce33 Coding Standards: Rename $comment_post_ID and $comment_author_IP variables in various files.
This fixes two WPCS warnings:
* `Variable "$comment_post_ID" is not in valid snake_case format`
* `Variable "$comment_author_IP" is not in valid snake_case format`

While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.

Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:

* `edit_comment`
* `comment_id_not_found`
* `comment_closed`
* `comment_on_trash`
* `comment_on_draft`
* `comment_on_password_protected`
* `pre_comment_on_post`

The change does not affect parameters for functions receiving an array of comment data:

* `wp_insert_comment()`
* `wp_new_comment()`
* `wp_update_comment()`
* `wp_handle_comment_submission()`

The associated array keys still match the database fields: `comment_post_ID` and `comment_author_IP`.

Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53723


git-svn-id: http://core.svn.wordpress.org/trunk@53282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 16:19:11 +00:00
spacedmonkey
31c061e89d REST API: Add prepare_links method to WP_REST_Taxonomies_Controller class.
Move logic to from `prepare_item_for_response` to `prepare_links` method to bring `WP_REST_Taxonomies_Controller` class inline with other REST API controllers.

Props Spacedmonkey, timothyblynjacobs, dlh.
Fixes #56020.
Built from https://develop.svn.wordpress.org/trunk@53722


git-svn-id: http://core.svn.wordpress.org/trunk@53281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 14:54:08 +00:00
spacedmonkey
070bc9b5ea REST API: Add prepare_links method to WP_REST_Post_Types_Controller class.
Move logic to from `prepare_item_for_response` to `prepare_links` method to bring `WP_REST_Post_Types_Controller` class inline with other REST API controllers.

Props Spacedmonkey, timothyblynjacobs, dlh.
Fixes #56019.
Built from https://develop.svn.wordpress.org/trunk@53721


git-svn-id: http://core.svn.wordpress.org/trunk@53280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 14:49:08 +00:00
Sergey Biryukov
9fbd3b5403 Coding Standards: Remove unused variable in wp-trackback.php.
This was present in the initial import of b2 files, but appears to have never been used in WordPress core.

Follow-up to [3], [636], [637], [1616].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 14:17:09 +00:00
Sergey Biryukov
f14f6a162a Coding Standards: Improve variable names in wp-trackback.php.
This fixes a `Variable "$comment_post_ID" is not in valid snake_case format` WPCS warning.

`$comment_post_ID`, while matching the database field of the same name, does not follow the WordPress coding standards, so the variable is now renamed to `$comment_post_id`.

Additionally, these variables are renamed for clarity:

* `$tb_id` to `$post_id` (this was not the trackback ID)
* `$tb_url` to `$trackback_url`

Follow-up to [172], [637], [1616], 

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53719


git-svn-id: http://core.svn.wordpress.org/trunk@53278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 14:02:10 +00:00
gziolo
fdcb34fad3 Editor: Fix register_block_type does not recognise ancestor block setting
When registering block through PHP, using `register_block_type` function, newly introduced `ancestor` block setting in `block.json` was not recognised. It worked though, when block is registered from JavaScript.

Props lovor, annezazu.
Fixes #56184.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 13:24:12 +00:00
audrasjb
31a5eaf174 Upgrade/Install: Improve plugin update icon alignment.
This changeset improves the vertical alignment of the plugin update button in the Plugins screen.

Props Presskopp, sabernhardt, costdev, eherman24.
Fixes #56123.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 09:25:13 +00:00
audrasjb
e1dfa87a88 Twenty Twenty-One: Add block type suggestions to block patterns.
When using a given block, patterns which use that block can be suggested. This changeset adds `blockType` suggestion for several Twenty Twenty-One bundled patterns.

Props ryelle, poena, audrasjb.
Fixes #53647.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 08:56:14 +00:00
Sergey Biryukov
1069ac4afd Posts, Post Types: Standardize on $post parameter name where appropriate.
This renames the `$post_id` or `$id` parameters to `$post` for functions that accept a post ID or post object:

* `get_sample_permalink()`
* `get_sample_permalink_html()`
* `wp_check_post_lock()`
* `wp_set_post_lock()`
* `get_the_tags()`
* `comment_class()`
* `get_comment_class()`
* `get_comments_link()`
* `get_comments_number()`
* `comments_number()`
* `get_comments_number_text()`
* `comments_open()`
* `pings_open()`
* `comment_form()`
* `do_trackbacks()`
* `pingback()`
* `post_permalink()`
* `get_post_permalink()`
* `get_edit_post_link()`
* `edit_post_link()`
* `get_delete_post_link()`
* `post_class()`
* `get_post_class()`
* `the_attachment_link()`
* `wp_get_attachment_link()`
* `wp_list_post_revisions()`
* `check_and_publish_future_post()`
* `add_ping()`
* `get_pung()`
* `get_to_ping()`
* `wp_get_post_revisions()`
* `wp_get_post_revisions_url()`

Additionally, `$revision_id` is renamed to `$revision` in:

* `wp_restore_post_revision()`
* `wp_delete_post_revision()`

Includes minor documentation improvements for consistency and code layout fixes for better readability.

Follow-up to [1599], [1794], [2881], [3303], [3851], [5302], [6633], [6716], [6985], [7103], [7149], [7747], [8011], [8638], [8643], [8695], [9138], [9273], [11425], [11922], [11956], [12284], [12810], [12923], [13023], [13171], [25567], [27156], [27473], [28558], [28602], [33659], [38852], [47276], [47366], [48622], [49544], [49597], [52095].

See #56243, #55647.
Built from https://develop.svn.wordpress.org/trunk@53715


git-svn-id: http://core.svn.wordpress.org/trunk@53274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-18 17:37:17 +00:00
Sergey Biryukov
4e0b801910 Coding Standards: Use MINUTE_IN_SECONDS where appropriate.
This aims to clarify the time units for some timeout or expiration values.

Follow-up to [11823], [13177], [21996], [37747].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-17 02:18:09 +00:00
Sergey Biryukov
0eff79af37 Coding Standards: Use a single input array on Permalink Settings screen.
This reduces the amount of code to edit in case of any changes to the default permalink structures.

Follow-up to [53706], [53710].

See #55647, #55498.
Built from https://develop.svn.wordpress.org/trunk@53713


git-svn-id: http://core.svn.wordpress.org/trunk@53272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-17 01:38:08 +00:00
Sergey Biryukov
74b2659ce4 Permalinks: Use home_url() to set the URL base on Permalink Settings screen.
This brings more consistency with how the home URL is retrieved elsewhere in the admin.

Follow-up to [1567], [1664], [2746], [3029], [4144], [53710].

Props sabernhardt.
Fixes #56235.
Built from https://develop.svn.wordpress.org/trunk@53712


git-svn-id: http://core.svn.wordpress.org/trunk@53271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-17 01:06:13 +00:00
Sergey Biryukov
82ee734e8b Permalinks: Add a guiding paragraph on the Permalink Settings screen.
This is intended as an introduction to permalink structure selection.

Props kebbet, costdev, hasanuzzamanshamim, mukesh27.
Fixes #55947.
Built from https://develop.svn.wordpress.org/trunk@53711


git-svn-id: http://core.svn.wordpress.org/trunk@53270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-16 20:13:10 +00:00
Sergey Biryukov
033728a0b7 Coding Standards: Improve readability of wp-admin/options-permalink.php.
Includes: 
* Wrapping longer lines and reducing alignment levels to fit more data on the screen.
* Restoring `esc_attr()` for input values, which may include translatable parts.
* Adding comments to closing `</div>` tags and PHP `endif` statements.
* Reducing the context switching between HTML and PHP.
* Balancing PHP conditionals to better reflect the structure.
* Removing repeated function calls to improve performance.
* Renaming some variables for clarity and consistency.

Follow-up to [470], [601], [963], [1227], [1664], [2746], [3029], [6976], [7230], [11350], [14051], [14553], [21891], [34691], [34749], [37747], [38066], [41182], [41986], [42343], [43571], [48710], [50830], [51892], [53706].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-16 16:20:10 +00:00
joedolson
a65abecc15 Administration: Audible messages on AJAX error cases.
Issues appropriate audible messages via `wp.a11y.speak()` when `ajax-response.js` generates an error via `wp_die()`.

Props afercia, alexstine.
Fixes #54483.
Built from https://develop.svn.wordpress.org/trunk@53709


git-svn-id: http://core.svn.wordpress.org/trunk@53268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-16 01:08:10 +00:00
joedolson
9f851abc3f Coding Standards: Missed space in code indentation in [53707].
Fixes code style issue from [53707].

Follow up to [53707].

See #54483.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 23:59:09 +00:00
joedolson
38a13f94ba Login: Explicitly associate errors with input fields.
Add an `aria-describedby` relationship between login email/password input fields and displayed login error messages.

Props patrickgroot, rollybueno, afercia.
Fixes #54483.
Built from https://develop.svn.wordpress.org/trunk@53707


git-svn-id: http://core.svn.wordpress.org/trunk@53266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 23:40:10 +00:00
joedolson
1d101bada0 Permalinks: Label and describe permalink settings fields.
Restructure the permalink settings fields so URL formats are communicated to screen readers through `aria-describedby` relationships, avoid the usage of implicitly labeled input fields, labeling the custom permalink format correctly, and clarifying values. Make settings `table` element presentational.

Props rishishah, sabernhardt, kebbet.
Fixes #55498.
Built from https://develop.svn.wordpress.org/trunk@53706


git-svn-id: http://core.svn.wordpress.org/trunk@53265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 22:42:10 +00:00
Sergey Biryukov
35c65333bd Docs: Correct @since tags introduced in WordPress 6.0.1.
The associated changes were backported to the 6.0 branch, so the version should be 6.0.1 instead of 6.1.0.

This affects:
* `@since` tag for the `block-templates` feature in `create_initial_theme_features()`.
* `@since` tag for the `show_on_front`, `page_on_front`, and `page_for_posts` options on the REST API settings endpoint.

Follow-up to [53590], [53661].

Props tommusrhodus, johnbillion.
Fixes #56225.
Built from https://develop.svn.wordpress.org/trunk@53704


git-svn-id: http://core.svn.wordpress.org/trunk@53263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 16:00:10 +00:00
Sergey Biryukov
cd6e4451f1 Docs: Document that allowed_tags() is no longer used in core as of WordPress 4.4.
Previously, it was used in core and older bundled themes to display the list of allowed tags in the comment form.

Follow-up to [709], [2009], [2012], [2032], [2040], [13030], [14365], [32858], [34316], [34351].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 14:15:08 +00:00
Sergey Biryukov
0eb9abd1fe Coding Standards: Rename the $user_id parameter of get_user_locale() to $user for accuracy.
Since the parameter accepts not only a user's ID, but also a `WP_User` object, `$user` is a more appropriate name, which better aligns with the `$post` parameter of functions that accept a post ID or a `WP_Post` object.

The pre-existing internal `$user` variable which contained a `WP_User` object is renamed to `$user_object` for clarity.

Follow-up to [38955].

Props aristath, poena, afercia, SergeyBiryukov.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53702


git-svn-id: http://core.svn.wordpress.org/trunk@53261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 13:45:11 +00:00
Sergey Biryukov
ccba239e04 Tests: Use a consistent way of setting the Administrator role in Ajax tests.
This removes some duplicate code in favor of calling the `WP_Ajax_UnitTestCase::_setRole()` method created specifically for this purpose and used in other tests.

Follow-up to [500/tests], [37288].

Props martin.krcho.
See #56203.
Built from https://develop.svn.wordpress.org/trunk@53701


git-svn-id: http://core.svn.wordpress.org/trunk@53260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-14 14:28:09 +00:00
Sergey Biryukov
749720d897 Text Changes: Improve consistency of punctuation in some strings.
* Move the colon inside the `<strong>` tags in some `Error:` prefixes, to match other strings.
* Move the full stop at the end of some sentences outside of the `<strong>` tags used for individual phrases.

Follow-up to [11669], [23844], [53118], [53458], [53476].

Props NekoJonez, Presskopp.
Fixes #56027.
Built from https://develop.svn.wordpress.org/trunk@53700


git-svn-id: http://core.svn.wordpress.org/trunk@53259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-14 14:10:11 +00:00
Sergey Biryukov
5a59007323 I18N: Remove code from a translatable string in wp-includes/ms-default-constants.php.
This replaces the `VHOST` and `SUBDOMAIN_INSTALL` constant names in a message in `ms_subdomain_constants()` with placeholders, as they don't need to be translated.

Follow-up to [36773].

Props weboccults, hztyfoon, pratiweb.
Fixes #56216.
Built from https://develop.svn.wordpress.org/trunk@53699


git-svn-id: http://core.svn.wordpress.org/trunk@53258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-14 13:35:13 +00:00
John Blackbourn
5dc1150ea2 Users: Allow conditional supression of the email notifications that are sent when a new user account is registered.
This introduces the following new filters:

* `wp_send_new_user_notification_to_admin`
* `wp_send_new_user_notification_to_user`

Props janthiel, costdev, audrasjb, peterwilsoncc

Fixes #54874

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


git-svn-id: http://core.svn.wordpress.org/trunk@53257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-12 21:05:16 +00:00
Sergey Biryukov
2cc9f73523 Editor: Include user's name in the wp_refresh_post_lock() response.
This ensures that the post lock data returned by the Heartbeat API is consistent.

Previously, `wp_check_locked_posts()` was updated to return the name of the user currently editing the post, but the `wp_refresh_post_lock()` response did not get a similar change.

Follow-up to [53070].

Props nathan.noom.
Fixes #56197.
Built from https://develop.svn.wordpress.org/trunk@53692


git-svn-id: http://core.svn.wordpress.org/trunk@53251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-11 18:18:13 +00:00
Sergey Biryukov
a5cc224b3c Docs: Correct the type of the $number parameter in ngettext* filters.
This applies to:
* `ngettext`
* `ngettext_{$domain}`
* `ngettext_with_context`
* `ngettext_with_context_{$domain}`

Follow-up to [25565], [48136].

Props cyrillbolliger.
Fixes #56187.
Built from https://develop.svn.wordpress.org/trunk@53691


git-svn-id: http://core.svn.wordpress.org/trunk@53250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-10 00:07:16 +00:00
Sergey Biryukov
9177df1ee7 Docs: Improve description for wp_plugin_update_rows() and wp_theme_update_rows().
Follow-up to [53689].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-09 12:59:11 +00:00
audrasjb
4f41d38512 Docs: Add missing function descriptions in wp-admin/includes/update.php.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-08 20:13:12 +00:00
gziolo
4e3b22546f Tools: Automate backporting core blocks from Gutenberg to Core
Syncing stable blocks from the Gutenberg repository to wordpress-develop was a manual process, but it got automated with the script that runs together with syncing WordPress packages changed in the Gutenberg package.

Props zieladam.
Fixes #56179.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-08 12:34:14 +00:00
Sergey Biryukov
b50ec525ac Tests: Remove @uses tags from the test suite.
* These were not used consistently, with only four instances across all the tests.
* Using this tag in combination with the `beStrictAboutCoversAnnotation="true"` setting will mark a test as "Risky" if code is executed during the test which is not annotated via `@covers` or `@uses` tags. That would make the maintainance of the tags very fiddly, while adding little additional value for the test code base.

Follow-up to [32995], [39914], [42636], [53682].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-08 00:13:12 +00:00
Sergey Biryukov
ef2bce73e2 Tests: Separate the tests in basic.php for clarity.
There were two kinds of tests in this file:

* Tests for content of some files in the root directory:
 * `license.txt`
 * `SECURITY.md`
 * `package.json`
* Tests for some utility functions of the test framework itself:
 * `strip_ws()`
 * `test_mask_input_value()`

The latter are now moved to their own file, `utils.php`.

Follow-up to [22/tests], [81/tests], [103/tests], [25240], [26940], [28064], [28480], [28493], [28523], [28631], [42381], [47403], [53683].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 23:57:13 +00:00
Andrew Ozz
8091de83b5 Media:
- Deprecate `wp_get_attachment_thumb_file()`.
- Make `wp_get_attachment_thumb_url()` an alias of `wp_get_attachment_image_url()`. This fixes it to return the proper thumbnail URL and fall back to returning the URL to `image_meta['thumb']` if only that exists.

Props: markhowellsmead, mukesh27, csesumonpro, SergeyBiryukov, mikeschroder, killua99, joemcgill, mashukushibiki, mfgmicha, swissspidy, romulodl, nacin, JoshuaAbenazer, wonderboymusic, lonnylot, azaozz.
Built from https://develop.svn.wordpress.org/trunk@53685


git-svn-id: http://core.svn.wordpress.org/trunk@53244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 23:32:11 +00:00
Andrew Ozz
b8b2693bdb Build/Test Tools: Add @covers tags to the taxonomy and category test groups.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53684


git-svn-id: http://core.svn.wordpress.org/trunk@53243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 23:02:09 +00:00
Andrew Ozz
9a7c53ac4c Build/Test Tools: Add @coversNothing tags to the tests for some content in documentation and settings files.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53683


git-svn-id: http://core.svn.wordpress.org/trunk@53242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 22:55:10 +00:00
Andrew Ozz
48dbe8c3f0 Build/Test Tools: Add @covers tags to the url test group.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 22:45:11 +00:00
Andrew Ozz
bdc1bbac2d Tests: Remove duplicate testcase test_get_privacy_policy_url_should_return_empty_when_privacy_policy_page_not_set() from Tests_Url_GetPrivacyPolicyUrl.
See: #39265.
Built from https://develop.svn.wordpress.org/trunk@53681


git-svn-id: http://core.svn.wordpress.org/trunk@53240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 22:22:11 +00:00
Andrew Ozz
590b9278ff Build/Test Tools: Add and fix @covers tags to the attachments and block-supports test groups.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53680


git-svn-id: http://core.svn.wordpress.org/trunk@53239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 21:08:13 +00:00
audrasjb
a5f489189d Docs: Misc. docblock enhancements in WP_REST_Menu_Items_Controller class, as per docblock standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 12:32:12 +00:00
audrasjb
e17247c78b REST API: Consolidate menu item type_label schema declaration.
This changeset removes a duplicate definition of the `type_label` property and consolidates the description of this property.

Props dlh, SergeyBiryukov.
Fixes #56072.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-07 12:21:14 +00:00
desrosj
b5a14f47bb Themes: Properly escape home_url() when changing and updating themes.
Props obayedmamur, hurayraiit, costdev, shraboni, msnewas.
Fixes #56145.
Built from https://develop.svn.wordpress.org/trunk@53677


git-svn-id: http://core.svn.wordpress.org/trunk@53236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 19:46:10 +00:00
desrosj
7f43cc5d3a Coding Standards: Apply some alignment fixes after composer format.
Follow up to [53485].

See #55674.
Built from https://develop.svn.wordpress.org/trunk@53676


git-svn-id: http://core.svn.wordpress.org/trunk@53235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 19:31:14 +00:00
audrasjb
8de9cf1d8b Docs: Convert "Application Passwords" to lowercase in WP_Application_Passwords docblocks, for better consistency.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 11:55:11 +00:00
audrasjb
09f8333b0b Docs: Typo correction in WP_Application_Passwords docblocks.
Props im_niloy.
Fixes #56155.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 10:38:07 +00:00
Sergey Biryukov
3796360ba0 Coding Standards: Simplify the logic for setting DB host and port in wpdb::parse_db_host().
This removes an extra `foreach` loop and the only variable variable (`$$component`) in core.

Follow-up to [20088,28342,28736-28747], [41629], [41820], [42226], [53670].

Props johnjamesjacoby.
See #54877, #55647.
Built from https://develop.svn.wordpress.org/trunk@53671


git-svn-id: http://core.svn.wordpress.org/trunk@53230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 10:32:12 +00:00
Peter Wilson
d7d9adbf02 Database: Ensure MySQL port numbers are numeric in wpdb.
Ensure the database port number is recorded as an integer or `null` (the default port) when parsing the database host.

This is to prevent PHP/MySQLi throwing an exception caused by ports represented as numeric strings.

Props audrasjb, azouamauriac, chaion07, costdev, johnjamesjacoby, jrf, sergeybiryukov.
Fixes #54877.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 05:33:17 +00:00
Peter Wilson
1ace1a4d2b Taxonomy: Retain default term option when unregistering taxos.
No longer delete the default term option in `unregister_taxonomy()` to improve database performance.

Since taxonomies are registered at runtime and can't be unregistered unless they're already registered, prior to this 
change the option was created and deleted on each request.

Deleting the option should occur on a one-time opperation such as plugin deactivation.

Follow up to [48480].

Props dlh.
Fixes #54472.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 05:11:12 +00:00
Sergey Biryukov
228bbf3f7f Block Patterns: Update the value used for keywords.
Patterns on the [https://wordpress.org/patterns/ Pattern Directory] can have keywords for better discoverability while searching. The way these are stored [69548ff1f0 was changed from a taxonomy to meta value], but the `/wp/v2/pattern-directory/patterns` endpoint was still pulling from that old value.

The correct property to use for this field is `meta.wpop_keywords`, which returns a single string with comma-separated keywords.

Props ryelle, TimothyBlynJacobs.
See #56126.
Built from https://develop.svn.wordpress.org/trunk@53665


git-svn-id: http://core.svn.wordpress.org/trunk@53224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 16:03:13 +00:00
Sergey Biryukov
3d05e52827 Themes: Revert the change of theme preview width on Add Themes screen.
The intention was for the preview ratio to remain accurate for the user's screen size when the sidebar is open, but this appears to have caused unintended side effects to the preview alignment.

Follow-up to [52647].

Props superbthemescom, Presskopp.
Fixes #56097. See #54764.
Built from https://develop.svn.wordpress.org/trunk@53663


git-svn-id: http://core.svn.wordpress.org/trunk@53222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 15:36:12 +00:00
desrosj
3ff86728e5 External Libraries: Update the Moment library to version 2.29.3.
This is a minor bug fix release.

Props dilipbheda.
Fixes #56031.
Built from https://develop.svn.wordpress.org/trunk@53662


git-svn-id: http://core.svn.wordpress.org/trunk@53221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 15:21:26 +00:00
desrosj
2ab810d14c External Libraries: Update the Underscore library to version 1.13.4.
This is a minor documentation and bug fix release.

Props christinavoudouris, dilipbheda.
Fixes #56030.
Built from https://develop.svn.wordpress.org/trunk@53660


git-svn-id: http://core.svn.wordpress.org/trunk@53219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 15:01:25 +00:00
Sergey Biryukov
f9e979a74c Themes: Register the block-templates theme feature.
This ensures the feature is included in the `theme_supports` REST API data for the active theme.

Follow-up to [48171].

Props grantmkin, TimothyBlynJacobs, addiestavlo.
Fixes #55681.
Built from https://develop.svn.wordpress.org/trunk@53659


git-svn-id: http://core.svn.wordpress.org/trunk@53218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 14:59:16 +00:00
Sergey Biryukov
6d78a736ee Editor: Update block editor packages for WordPress 6.0.1.
This brings a new version of the Gutenberg code from the [https://github.com/WordPress/gutenberg/tree/wp/6.0 wp/6.0 branch] into core.

Original PR from Gutenberg repository:
* #GB42131 Post Comments Form: Fix warning i18n

The following packages were updated:
* `@wordpress/block-directory` to `3.4.13`
* `@wordpress/block-library` to `7.3.13`
* `@wordpress/customize-widgets` to `3.3.13`
* `@wordpress/edit-post` to `6.3.13`
* `@wordpress/edit-site` to `4.3.13`
* `@wordpress/edit-widgets` to `4.3.13`

Props zieladam, bernhard-reiter, tobifjellner.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53657


git-svn-id: http://core.svn.wordpress.org/trunk@53216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 14:38:33 +00:00
desrosj
9635543e0f General: Properly escape home_url() links in wp_page_menu().
Props sabbirmc, tushar284, costdev.
Fixes 56148.
Built from https://develop.svn.wordpress.org/trunk@53656


git-svn-id: http://core.svn.wordpress.org/trunk@53215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 14:14:21 +00:00
spacedmonkey
6e619966a6 Users: Prime user meta in WP_User_Query class.
When querying 'fields' equal to 'all' using the `WP_User_Query` class, this returns an array of `WP_User` objects. A `WP_User` object requires user meta to be primed, as the user's role is stored in user meta. Ensure that all users meta is primed in a single request by calling the `cache_users` function when querying 'fields' equal to 'all'. Soft deprecate fields equal to `all_with_meta` as it now acts the same as 'fields' equal to 'all'.

Props Spacedmonkey, peterwilsoncc, mehulkaklotar, timothyblynjacobs, furi3r.
Fixes #55594.
Built from https://develop.svn.wordpress.org/trunk@53655


git-svn-id: http://core.svn.wordpress.org/trunk@53214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 09:28:13 +00:00
audrasjb
0f3b3218c2 Menus: Use more appropriate escaping functions in class Walker_Nav_Menu_Edit.
This changeset replaces `esc_attr` escaping function with `esc_url` as it is more appropriate in the context of a link's `href` attribute.

Props audrasjb, aniketpatel.
Fixes #56108.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 08:06:17 +00:00
Peter Wilson
2c768f7c9d Cron API: Make wp-cron non-blocking for LiteSpeed LSAPI.
This should make cron spawning faster on LSAPI by ensuring that cron requests return immediately.

To avoid code repetition, the no caching headers are relocated and always sent. Caching plugins attempting to set these 
headers later will replace those set by WordPress Core.

Follow up to [44488].

Props maximej, johnbillion.
Fixes #54668.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 03:14:14 +00:00
Peter Wilson
e54b4ad284 Media: Add tests for wp_img_tag_add_decoding_attr().
Add new tests skipped in original commit. Follow up to [53480].

Fixes #53232.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 00:48:14 +00:00
Sergey Biryukov
0ea522b7a8 Help/About: Add help tab info for the "Send password reset" row action on Users screen.
This adds a description in the "Available Actions" help tab for the "Send password reset" quick action when hovering over a username in the user list.

Follow-up to [50129].

Props kebbet, costdev.
Fixes #55801.
Built from https://develop.svn.wordpress.org/trunk@53651


git-svn-id: http://core.svn.wordpress.org/trunk@53210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 00:25:13 +00:00
Sergey Biryukov
8f37ef9daa Docs: Update the version in which Meetup.com was removed as an oEmbed source.
Meetup.com was previously removed as an oEmbed source, since they have deprecated their endpoint. The block has also been removed from the editor, see #GB35085.

This commit updates the associated changelog entry for the `oembed_providers` filter to version 6.0.1, as the change is being backported to the 6.0 branch.

Follow-up to [53540].

See #55997.
Built from https://develop.svn.wordpress.org/trunk@53646


git-svn-id: http://core.svn.wordpress.org/trunk@53205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 18:15:15 +00:00
Sergey Biryukov
0705b9daed Editor: Update block editor packages for WordPress 6.0.1.
This brings a new version of the Gutenberg code from the [https://github.com/WordPress/gutenberg/tree/wp/6.0 wp/6.0 branch] into core.

The following packages were updated:
* `@wordpress/block-directory` to `3.4.12`
* `@wordpress/block-editor` to `8.5.9`
* `@wordpress/block-library` to `7.3.12`
* `@wordpress/components` to `19.8.5`
* `@wordpress/customize-widgets` to `3.3.12`
* `@wordpress/edit-post` to `6.3.12`
* `@wordpress/edit-site` to `4.3.12`
* `@wordpress/edit-widgets` to `4.3.12`
* `@wordpress/editor` to `12.5.9`
* `@wordpress/format-library` to `3.4.9`
* `@wordpress/icons` to `8.2.3`
* `@wordpress/interface` to `4.5.6`
* `@wordpress/list-reusable-blocks` to `3.4.5`
* `@wordpress/nux` to `5.4.5`
* `@wordpress/plugins` to `4.4.3`
* `@wordpress/preferences` to `1.2.5`
* `@wordpress/reusable-blocks` to `3.4.9`
* `@wordpress/server-side-render` to `3.4.6`
* `@wordpress/widgets` to `2.4.9`

Props zieladam.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53644


git-svn-id: http://core.svn.wordpress.org/trunk@53203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 12:06:43 +00:00
Sergey Biryukov
e70ac7004c Coding Standards: Escape the home URL in the "Background updated. Visit your site" message.
This affects `Custom_Background::admin_page()`.

Follow-up to [13041], [45662], [53642].

Props robinwpdeveloper, sajjad67, rudlinkon, hztyfoon, costdev.
Fixes #56133.
Built from https://develop.svn.wordpress.org/trunk@53643


git-svn-id: http://core.svn.wordpress.org/trunk@53202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 10:14:14 +00:00
Sergey Biryukov
eb08ad9160 Coding Standards: Escape the home URL in the "Header updated. Visit your site" message.
This affects `Custom_Image_Header::step_1()`.

Follow-up to [12890], [45654].

Props jakariaistauk, rudlinkon, hztyfoon, costdev.
Fixes #56132.
Built from https://develop.svn.wordpress.org/trunk@53642


git-svn-id: http://core.svn.wordpress.org/trunk@53201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 10:11:12 +00:00
audrasjb
7c94f45bb0 Docs: Use third-person singular verbs for function descriptions in WP_Comments_List_Table class, as per docblock standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 08:20:15 +00:00
audrasjb
ec9b9bee76 Comments: Use more appropriate escaping functions in class WP_Comments_List_Table.
This changeset replaces `esc_attr` escaping function with `esc_html` as it is more appropriate in this context.

Props chintan1896, afragen, peterwilsoncc, SergeyBiryukov.
Fixes #56101.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 08:16:16 +00:00
audrasjb
a72203aa54 Docs: Add missing docblock description for install_themes_upload().
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 08:00:15 +00:00
Sergey Biryukov
5cfb35a5f2 Docs: Add @since tags for _doing_it_wrong() and deprecation notice handlers in the PHPUnit test suite.
This affects methods in the `WP_UnitTestCase_Base` class:
* `::expectDeprecated()`
* `::expectedDeprecated()`
* `::setExpectedException()`
* `::deprecated_function_run()`
* `::doing_it_wrong_run()`

Follow-up to [25402], [25408], [25785], [37861], [40536], [40539], [40872], [51872], [53637].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-03 17:30:09 +00:00
Sergey Biryukov
b8da90698c Build/Test Tools: Include the actual _doing_it_wrong() message or deprecation notice in the output.
This aims to provide better context and more details if an unexpected `_doing_it_wrong()` message or deprecation notice is encountered during a test run.

Previously, this would display a message like `Unexpected incorrect usage notice for [...]`, but without any further details, making it harder to track down the actual issue.

Follow-up to [25402], [25408], [25785], [37861], [51872].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-03 16:41:14 +00:00
John Blackbourn
c29d3d8142 Build/Test Tools: Enable loopback requests to work on the local development environment.
This maps `localhost` to the host machine so the requests get routed to the web server container.

Props sandrasanzdev, hasanuzzamanshamim

Fixes #52708

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


git-svn-id: http://core.svn.wordpress.org/trunk@53195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-02 22:54:12 +00:00
Sergey Biryukov
d7efd9a793 Docs: Add @since tags for wp_die() handlers in the PHPUnit test suite.
Follow-up to [289/tests], [28797], [41966], [53634].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-02 18:29:11 +00:00
Sergey Biryukov
6ee60c3ebe Build/Test Tools: Add support for WP_Error in the test suite's wp_die() handlers.
This brings parity with WordPress core `wp_die()` handlers and ensures that if a `WP_Error` object is passed as the `$message` argument to `wp_die()`, the PHPUnit test suite displays the error message correctly.

Previously, this would cause a silent fatal error: `Object of class WP_Error could not be converted to string`, leading to just displaying `wp_die called` without any further details.

Follow-up to [28797], [41966], [44666], [45160], [47882].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-02 18:07:11 +00:00
Sergey Biryukov
9bea9ddfc9 Editor: Alphabetize block lists in various places.
This affects:
* `wp-includes/blocks/index.php`
* `tools/webpack/blocks.js`
* `_unhook_block_registration()` in `tests/phpunit/includes/functions.php`

Follow-up to [47250], [52069], [52730], [53157], [53278].

Fixes #56131.
Built from https://develop.svn.wordpress.org/trunk@53633


git-svn-id: http://core.svn.wordpress.org/trunk@53192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-02 17:46:13 +00:00
Sergey Biryukov
354545bc3e Editor: Register the Comments Query Loop block from metadata.
This ensures that the block title and description can be translated.

Follow-up to [53157].

Props cbravobernal, bernhard-reiter, adamziel, gziolo, peterwilsoncc, audrasjb, mukesh27, SergeyBiryukov.
Fixes #56093. See #55809.
Built from https://develop.svn.wordpress.org/trunk@53631


git-svn-id: http://core.svn.wordpress.org/trunk@53190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-02 14:35:14 +00:00
Sergey Biryukov
1f87125366 Widgets: Add a comment in WP_Nav_Menu_Widget::form() to clarify the esc_attr() usage.
The URL to create a new menu from the the Navigation Menu widget can be a `javascript:` link to the Customizer Menus panel, so `esc_attr()` is used here instead of `esc_url()`.

Follow-up to [53092].

Props hztyfoon.
Fixes #56128.
Built from https://develop.svn.wordpress.org/trunk@53630


git-svn-id: http://core.svn.wordpress.org/trunk@53189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-01 20:01:15 +00:00
John Blackbourn
c3188a2566 Build/Test Tools: Remove an unused build configuration file.
This is a configuration file for Apache Ant that is no longer used.

Fixes #52604

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


git-svn-id: http://core.svn.wordpress.org/trunk@53188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-01 19:56:16 +00:00
John Blackbourn
f5cbb5585a Build/Test Tools: Run the PHP container with PID > 1 so Ctrl+C works correctly.
This allows for cancellation of operations in the PHP container, such as a PHPUnit test suite run.

Fixes #55702

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


git-svn-id: http://core.svn.wordpress.org/trunk@53187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-01 19:37:14 +00:00
John Blackbourn
d50fbb4469 Taxonomy: Pass the $args parameter to all actions and filters in wp_insert_term() and wp_update_term().
This allows actions and filters to access potentially useful contextual information when terms are inserted and updated.

Props mboynes

Fixes #55441

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


git-svn-id: http://core.svn.wordpress.org/trunk@53186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-01 19:09:14 +00:00
Sergey Biryukov
3e622b1d75 Twenty Eleven: Replace deprecated function calls on theme options page.
This includes:
* Removing the deprecated `screen_icon()` function call.
* Replacing the deprecated `get_current_theme()` function call with `get_option( 'current_theme' )`.
* Using `wp_get_theme()->display( 'Name' )` explicitly instead of relying on `WP_Theme`'s `__toString()` method, for clarity.

Follow-up to [6334], [20039], [20040], [20042], [20508], [26537], [41274].

Props Presskopp, cu121, viralsampat, costdev, tomjdv, sabernhardt, SergeyBiryukov.
Fixes #54833.
Built from https://develop.svn.wordpress.org/trunk@53626


git-svn-id: http://core.svn.wordpress.org/trunk@53185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-01 14:26:15 +00:00
Sergey Biryukov
580d991349 Editor: Ensure only the main query is modified when resolving template for new posts.
This adds a check for the main query in `_resolve_template_for_new_post()` to fix a 404 response when resolving template for new posts or pages caused by the wrong query being modified.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/40799 #40799: Ensure only the main query is modified when resolving template for new posts]

Follow-up to [52316].

Props petitphp, zieladam, poena, ndiego, gziolo, kebbet, Mamaduka, manfcarlo.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53593


git-svn-id: http://core.svn.wordpress.org/trunk@53181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-30 15:48:15 +00:00
desrosj
296c363bc1 Build/Test Tools: Correct some GitHub Action workflow inline documentation.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53592


git-svn-id: http://core.svn.wordpress.org/trunk@53180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-30 15:09:15 +00:00
desrosj
856cee1568 Build/Test Tools: Remove the workflow_run event from the Slack notification workflow.
The `workflow_run` event was added to restore Slack notifications for older branches (5.8 and older) without having to backport any changes while alternate approaches were explored.

The workflow has been tested and refined as a reusable one in `trunk`, and this approach is superior to the `workflow_run` event in several ways.

Primarily, the `workflow_run` event results in a separate workflow run being created for sending Slack notifications after the completion of each workflow triggered by `push`. When called as a reusable workflow, this does not happen and the additional jobs are instead added to the initial workflow. This makes which jobs are sending notifications for the current workflow more clear, and reduces the amount of noise (less workflow runs overall).

The `workflow_run` event also makes some data available in different ways than `push` events. By removing it, much of the logic within the workflow can be simplified.

See #56095.
Built from https://develop.svn.wordpress.org/trunk@53591


git-svn-id: http://core.svn.wordpress.org/trunk@53179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-30 14:07:14 +00:00
Sergey Biryukov
78d4db9924 REST API: Use the integer type for page_on_front and page_for_posts options.
This adjusts the newly added options in the settings endpoint to use the `integer` type instead of `number`. Since these are page IDs and are not supposed to be floats, `integer` is the correct type.

Follow-up to [53588].

See #56058.
Built from https://develop.svn.wordpress.org/trunk@53589


git-svn-id: http://core.svn.wordpress.org/trunk@53177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-29 14:17:16 +00:00
Sergey Biryukov
126de33a0d REST API: Add missing options to the settings endpoint.
This adds the `show_on_front`, `page_on_front`, and `page_for_posts` options to the settings endpoint that were missed during WP 6.0 backports.

Related PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/38607 #38607 Page for Posts: Display notice in template panel]

Props Mamaduka, spacedmonkey, gziolo, jameskoster.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53588


git-svn-id: http://core.svn.wordpress.org/trunk@53176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-29 13:48:14 +00:00
audrasjb
46eb690e8f Help/About: Typo correction in the Media Library help tab text.
Follow-up to [53586].

Props SergeyBiryukov.
Fixes #55800.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-29 13:39:14 +00:00
audrasjb
e170038ca1 Help/About: Add help tab info for available row actions in the Media Library.
This changeset fills the existing help tab with more detailed information about available row actions in the Media Library, when using the List view.

Props kebbet, audrasjb, costdev, SergeyBiryukov, mukesh27.
Fixes #55800.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-28 20:47:11 +00:00
audrasjb
d5971fc876 Docs: Misc fixes in Shortcode API function and hook descriptions, as per documentation standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-28 20:37:15 +00:00
Sergey Biryukov
98beaad58d Docs: Adjust some DocBlocks in wpdb per the documentation standards.
Includes:
* Wrapping long single-line comments to multi-line for better readability.
* Formatting code blocks to display correctly on the Code Reference.
* Other minor edits for consistency.

This applies to:
* `wpdb::$allow_unsafe_unquoted_parameters`
* `wpdb::escape_identifier()`
* `wpdb::_escape_identifier_value()`
* `wpdb::prepare()`
* `wpdb::has_cap()`

Follow-up to [53575].

See #52506, #55646.
Built from https://develop.svn.wordpress.org/trunk@53584


git-svn-id: http://core.svn.wordpress.org/trunk@53172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-28 11:27:14 +00:00
desrosj
f210e677f1 Build/Test Tools: Update the actions/cache action.
This correctly updates the `actions/cache` action. [53581] updated the inline comment to the latest version but did not update the actual SHA value correctly.

Follow up to [53581].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-27 19:25:15 +00:00
desrosj
5f51f82e46 Build/Test Tools: Update 3rd party GitHub Actions.
This updates the following GitHub Actions to the latest versions:

- `actions/checkout`
- `actions/cache`
- `actions/github-script`
- `actions/setup-node`
- `codecov/codecov-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`

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


git-svn-id: http://core.svn.wordpress.org/trunk@53170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-27 18:58:13 +00:00
desrosj
9930476af2 Build/Test Tools: Update NPM devDependencies to their latest versions.
This updates the following `devDependencies` to newer versions:

- `dotenv` from `16.0.0` to `16.0.1`.
- `grunt` from `1.5.2` to `1.5.3`.
- `grunt-contrib-qunit` from `6.0.0` to `6.2.0`.
- `grunt-contrib-uglify` from `5.2.1` to `5.2.2`.
- `qunit` from `2.18.2` to `2.19.1`.
- `sass` from `1.51.0` to `1.53.0`.
- `sinon` from `13.0.2` to `14.0.0`.
- `uglify-js` from `3.15.4` to `3.16.1`.

Additionally, `npm audit fix` has been run to update dependencies with vulnerabilities.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-27 18:53:29 +00:00
Sergey Biryukov
729831b40f General: Revert an earlier define of the WPINC constant in src/index.php.
This avoids a `Constant WPINC already defined in src/wp-settings.php on line 16` PHP warning, which happens when running a WordPress install out of the `src` directory after `npm run build:dev`.

Add a comment to clarify the check for built assets and the direct mention of `wp-includes`.

Follow-up to [53518].

Props aristath.
See #54233.
Built from https://develop.svn.wordpress.org/trunk@53579


git-svn-id: http://core.svn.wordpress.org/trunk@53168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-27 10:20:19 +00:00
Sergey Biryukov
79efd59bca Upgrade/Install: Add a conditional to facilitate testing of the Rollbacks feature project.
The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-update-failure/ Rollback Update Failure feature project] creates a temporary backup of plugins and themes before updating. This aims to make the update process more reliable and ensure that if a plugin or theme update fails, the previous version can be safely restored.

If the [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure plugin] is installed, `WP_Upgrader::install_package()` will use the `move_dir()` function from there for better performance. Instead of copying a directory from one location to another, it uses the `rename()` PHP function to speed up the process, which is instrumental in creating a temporary backup without a delay. If the renaming failed, it falls back to `copy_dir()` WP function.

This conditional aims to facilitate broader testing of the feature. It is temporary, until the plugin is merged into core.

Props afragen, pbiron, costdev, davidbaumwald, audrasjb, jrf, SergeyBiryukov.
Fixes #56057. See #51857, #54166.
Built from https://develop.svn.wordpress.org/trunk@53578


git-svn-id: http://core.svn.wordpress.org/trunk@53167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-26 12:37:18 +00:00
Sergey Biryukov
d533b76ef8 Tests: Remove multiple $wpdb::placeholder_escape() calls in wpdb tests.
This aims to improve performance of the tests by reducing the number of function calls.

Since `$wpdb::placeholder_escape()` saves the result in a static variable on the first run, there is no need for repeated function calls during the same request or test run, as the result would still be the same.

Follow-up to [42056].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-25 14:45:12 +00:00
davidbaumwald
c2fbb4950d Comments: Add contextual autocomplete attributes to comment form fields.
For accessibility, input fields should identify their "purpose".  The HTML5 attribute `autocomplete` allows for various user data to be quickly autofilled while adding context for some assistive technologies.

This commit adds the appropriate autofill purposes for an author's name, email, and website URL in the comment form template.

Props juliemoynat, bhrugesh96, sabernhardt.
Fixes #55779.
Built from https://develop.svn.wordpress.org/trunk@53576


git-svn-id: http://core.svn.wordpress.org/trunk@53165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 21:26:12 +00:00
davidbaumwald
e7a9fe918c Database: Add %i placeholder support to $wpdb->prepare to escape table and column names.
WordPress does not currently provide an explicit method for escaping SQL table and column names. This leads to potential security vulnerabilities, and makes reviewing code for security unnecessarily difficult.  Also, static analysis tools also flag the queries as having unescaped SQL input.

Tables and column names in queries are usually in-the-raw, since using the existing `%s` will straight quote the value, making the query invalid.

This change introduces a new `%i` placeholder in `$wpdb->prepare` to properly quote table and column names using backticks.

Props tellyworth, iandunn, craigfrancis, peterwilsoncc, johnbillion, apokalyptik.
Fixes #52506.
Built from https://develop.svn.wordpress.org/trunk@53575


git-svn-id: http://core.svn.wordpress.org/trunk@53164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 20:35:14 +00:00
Sergey Biryukov
178bd65605 Tests: Replace esc_url_raw() calls with sanitize_url().
Previously committed in [53455], appears to be accidentally reverted in [53562].

Follow-up to [51597], [53452], [53455], [53562].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 15:09:11 +00:00
Sergey Biryukov
dc8416e7c2 Tests: Use more consistent wording when referring to PHP deprecation notices.
Previously committed in [53492], appears to be accidentally reverted in [53564].

Follow-up to [51619], [51695], [53492], [53563].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 15:04:10 +00:00
Sergey Biryukov
d0588e2f1b Tests: Give the tests for adding empty post meta values more consistent names.
One of these was previously renamed to mention `update_metadata_by_mid()`.

While `update_metadata_by_mid()` is indeed called in `wp_ajax_add_meta()` to update an existing meta value, the functionality change that the test intended to verify was in the latter function.

Follow-up to [44153], [53561].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 14:43:11 +00:00
Sergey Biryukov
816325b9b8 Tests: Put @covers tags before @params in Ajax and Formatting groups.
This makes the placement more consistent with the rest of the test suite.

Follow-up to [53561], [53562].

See #39265.
Built from https://develop.svn.wordpress.org/trunk@53571


git-svn-id: http://core.svn.wordpress.org/trunk@53160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 14:20:13 +00:00
Sergey Biryukov
7abd4bc951 Media: Use correct escaping function for URLs in some legacy media functions.
This affects:
* `get_image_send_to_editor()`
* `image_link_input_fields()`

Follow-up to [7092], [7874], [8653], [11109], [11204], [11383], [12051], [12199], [19982].

Props smit08, mukesh27.
Fixes #56064.
Built from https://develop.svn.wordpress.org/trunk@53570


git-svn-id: http://core.svn.wordpress.org/trunk@53159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 13:52:13 +00:00
Sergey Biryukov
bb92e303d7 Editor: Add utility classnames back to blocks that have layout attributes specified.
[https://github.com/WordPress/gutenberg/issues/38719 In 5.9 these utility classnames were removed], which removed the ability for theme/plugin authors to assign their own custom CSS related to specific layout selections. This was mostly related to the Button block.

This commit adds these classes dynamically based on attributes, rather than saving them to the serialized content.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41487 #41487 Add utility classnames back to blocks that have layout attributes specified]

Props glendaviesnz, peterwilsoncc, andrewserong, zieladam, matveb, samikeijonen.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53568


git-svn-id: http://core.svn.wordpress.org/trunk@53157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 23:09:09 +00:00
audrasjb
9a2ae08812 Application Passwords: Ensure long passwords don't break the "new password" notice.
This changeset adds a `word-wrap: break-word` CSS declaration to avoid text overflow in the "new application password" notice.

Props Presskopp, hasanuzzamanshamim, yannielsen, audrasjb.
Fixes #54581.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 23:04:09 +00:00
audrasjb
a33fd9fc55 Docs: Use third-person singular verbs for function descriptions in Bookmark related files, as per docblock standards.
This changeset updates `bookmark.php` and `bookmark-template.php` files.

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 22:57:12 +00:00
Sergey Biryukov
a5ab6b8d8b Tests: Correct the expected result for wp_ajax_replyto_comment() test with a draft post.
The "Error:" prefix was previously removed and accidentally re-added with `@covers` tags.

Follow-up to [53337], [53561].

See #39265.
Built from https://develop.svn.wordpress.org/trunk@53565


git-svn-id: http://core.svn.wordpress.org/trunk@53154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 21:38:12 +00:00
Andrew Ozz
4c9bf00e9c Build/Test Tools: Add missing @covers tags and fix the docs for the Cron test group.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 20:43:13 +00:00
Andrew Ozz
54ba73b9ca Build/Test Tools: Fix erroneous file name, from convertInvalidEntries.php to convertInvalidEntities.php.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53563


git-svn-id: http://core.svn.wordpress.org/trunk@53152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 20:36:13 +00:00
Andrew Ozz
d7b34a5287 Build/Test Tools, Formatting group:
- Add and update @covers tags.
- Add and improve docs and inline comments.

Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53562


git-svn-id: http://core.svn.wordpress.org/trunk@53151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 20:29:09 +00:00
Andrew Ozz
c5a5234941 Build/Test Tools: Add missing @covers tags for the AJAX test group.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53561


git-svn-id: http://core.svn.wordpress.org/trunk@53150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 19:47:10 +00:00
John Blackbourn
5dd1936fdb Themes: Add actions to template loading to assist with collecting debug info.
This introduces the following new actions which wrap the process of loading a template file:

* `wp_before_load_template`
* `wp_after_load_template`

Props rmccue, tabrisrp, peterwilsoncc

Fixes #54541

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


git-svn-id: http://core.svn.wordpress.org/trunk@53149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 18:59:09 +00:00
Aaron Jorbin
a457e3498e Editor: Universalize functions for checking block editor status.
`use_block_editor_for_post_type` and `use_block_editor_for_post` can be very useful in more contexts than wp-admin, especially when a site is in transition. For example, you may want to do things on init that are different.

Neither function depends on other functions that are available only in wp-admin (other than use_block_editor_for_post() relying on use_block_editor_for_post_type() and an admin-referrer check that's historically gated by a query variable and now also gated by is_admin), therefore  moving them to wp-includes seems both feasible and beneficial

Props ethitter, jorbin.
Fixes #51819.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 18:48:13 +00:00
Sergey Biryukov
fe941574c3 Code Modernization: Remove dynamic properties in Tests_Media.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.

Notes:
* As the `$img_html` property, which was previously being set, is not actually used in any of the tests, that property has not been converted to a constant.
* The values which were previously being set using a heredoc, now use a nowdoc (supported since PHP 5.3), as they don't contain any interpolation.
* The use of constant scalar expressions (`IMG_URL`) and constant arrays (`IMG_META`) in class constants is supported since PHP 5.6.

Follow-up to [711/tests], [1260/tests], [34855], [41724], [53557].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 15:03:15 +00:00
Sergey Biryukov
86865fcbdd Code Modernization: Remove dynamic properties in Tests_*_Slashes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test classes contain a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but the values of these properties are never ''changed'' by the tests.

In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.

Follow-up to [1041/tests], [1071/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 14:26:13 +00:00
Sergey Biryukov
fb93f0ecc1 Tests: Improve the test for sticky posts not being moved to the front in sitemaps.
* Give the test method a most descriptive name.
* Use a single assertion for the URL list instead of a `foreach` loop to provide more context in case of failure.
* Add a failure message to each assertion, as there are multiple assertions used in the test.

Follow-up to [53548].

See #55633.
Built from https://develop.svn.wordpress.org/trunk@53556


git-svn-id: http://core.svn.wordpress.org/trunk@53145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 16:52:11 +00:00
Sergey Biryukov
5d2e8afebd Code Modernization: Use the integer portion of an item position in add_submenu_page().
This fixes an `Implicit conversion from float to int loses precision` PHP 8.1 deprecation notice when adding a new admin menu item with a `float` value passed as the `$position` parameter.

This change is covered by existing unit tests and addresses 8 errors when running the test suite on PHP 8.1.

References:
* [https://php.watch/versions/8.1/deprecate-implicit-conversion-incompatible-float-string PHP 8.1: Implicit incompatible float to int conversion is deprecated]
* [https://wiki.php.net/rfc/implicit-float-int-deprecate PHP RFC: Deprecate implicit non-integer-compatible float to int conversions]

Follow-up to [52569], [53104].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 14:55:11 +00:00
desrosj
9e3dc52d45 Build/Test Tools: Return an error when uploading a test coverage report fails.
`true` is now passed to the `fail_ci_if_error` input when the `codecov/codecov-action` action is used.

When uploading a code coverage report is unsuccessful, the action will now fail and return an error. This will help avoid situations like #56022 where the report was suddenly failing to upload even though the workflow itself appeared to be successful.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 00:20:11 +00:00
desrosj
5aae4a4c10 Build/Test Tools: Allow changes to the code coverage workflow to run on pull request.
This adds the `pull_request` event to the Code Coverage Report workflow, allowing changes to be verified in a pull request before being committed.

The `branches` and `paths` filters are used to limit when the workflow runs to pull requests with:

- A base branch of `trunk`.
- Changing specific files that can potentially affect the way a coverage report is generated.

Reports generated on `pull_request` events are for testing purposes only and are not submitted to Codecov.

The `docker-compose.yml` file has also been added to the `paths` filter for both `push` and `pull_request` events. Changes to this file could potentially affect the environment used to generate the report (such as the ones in [53552]).

Props afragen, johnbillion, desrosj.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53553


git-svn-id: http://core.svn.wordpress.org/trunk@53142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 00:01:13 +00:00
desrosj
df27445253 Build/Test Tools: Configure Xdebug modes in the local Docker environment.
One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.

When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.

This change adds the `XDEBUG_MODE` environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the `xdebug.mode` setting, but will not change the value of the `xdebug.mode` setting.

The `LOCAL_PHP_XDEBUG_MODE` environment variable has been added to the `.env` file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the `coverage` mode, which is required for generating a test coverage report.

By default, `debug` and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.

Props afragen, johnbillion, desrosj.
Fixes #56022.
Built from https://develop.svn.wordpress.org/trunk@53552


git-svn-id: http://core.svn.wordpress.org/trunk@53141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 23:47:13 +00:00
audrasjb
29cfbec0ba Docs: Add missing @since mention in get_posts_query_args().
Follow-up to [53548].
See #55633.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:48:12 +00:00
audrasjb
d3cf4fb243 Docs: Use third-person singular verbs for function descriptions in Tests_Sitemaps_wpSitemapsPosts, as per docblock standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:45:09 +00:00
spacedmonkey
ac6ce3e026 Posts, Post Types: Add caching to _find_post_by_old_slug and _find_post_by_old_date functions.
Cache result of database queries in `_find_post_by_old_slug` and `_find_post_by_old_date` functions. This means that repeated requests to a url where the page is not found, will result in hitting a cache for sites running persistent object caching. 

Props Spacedmonkey, dd32, mukesh27, pbearne, flixos90.
Fixes #36723.
Built from https://develop.svn.wordpress.org/trunk@53549


git-svn-id: http://core.svn.wordpress.org/trunk@53138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:34:13 +00:00
audrasjb
ea5c6469c9 Sitemaps: Remove duplicate sticky Posts from Sitemap Post Query.
This changeset sets the `ignore_sticky_posts` parameter to `true` in the default arguments passed to `wp_sitemaps_posts_query_args`.

Props RavanH, pbiron, swissspidy, audrasjb, SergeyBiryukov.
Fixes #55633.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:18:10 +00:00
Sergey Biryukov
b8290da037 Docs: Improve documentation for WP_Image_Editor::save() and related functions.
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

This affects:
 * `wp_generate_attachment_metadata()`
 * `wp_get_attachment_metadata()`
 * `WP_Image_Editor::save()`
 * `WP_Image_Editor_GD::save()` and `::_save()`
 * `WP_Image_Editor_Imagick::save()` and `::_save()`

Follow-up to [22094], [22619], [52837], [53546].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:18:17 +00:00
Sergey Biryukov
b352d32d8a Docs: Correct the return type for wp_save_image_file().
Since WordPress 3.5, `wp_save_image_file()` uses `WP_Image_Editor` classes under the hood to save the images.

While the `save()` method in those instances returns `array|WP_Error` and is documented as such, the return type of the `wp_save_image_file()` function was still left as `bool`.

A better solution would be to adjust the function to return the documented boolean type. However, doing that after 20+ major WP releases would be a backward compatibility break, so the documentation is now updated instead.

Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$image` parameter expecting a `WP_Image_Editor` instance.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

Follow-up to [22094], [22619], [52837].

Props jrf, SergeyBiryukov.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53546


git-svn-id: http://core.svn.wordpress.org/trunk@53135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:16:17 +00:00
Sergey Biryukov
f8e00d59ae Tests: Move assertQueryTrue() closer to the other custom assertions in WP_UnitTestCase_Base.
Follow-up to [109/tests], [26005].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:14:22 +00:00
spacedmonkey
65b78390ee REST API: Move all links to prepare_links method in theme REST API controller.
Move logic to generate link to global styles to the `prepare_links` method in theme REST API controller. This way all logic to generate links is within the `prepare_links` method, bringing this controller inline with other REST API controllers.

Props SergeyBiryukov, Spacedmonkey.
Fixes #56018.
Built from https://develop.svn.wordpress.org/trunk@53544


git-svn-id: http://core.svn.wordpress.org/trunk@53133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 10:48:21 +00:00
John Blackbourn
721877d3d2 I18N: Correct and improve inline docs and tests for functionality related to nooped plurals.
See #55646, #55652

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


git-svn-id: http://core.svn.wordpress.org/trunk@53132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:57:16 +00:00
Sergey Biryukov
a07f85a464 Docs: Use third-person singular verbs for function descriptions in Tests_Image_Functions, per the documentation standards.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53542


git-svn-id: http://core.svn.wordpress.org/trunk@53131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:26:16 +00:00
Sergey Biryukov
db04949ca0 Tests: Further improve Tests_Image_Functions::test_wp_crop_image*() tests.
Includes:
* Making the test method names more specific.
* Converting one-off helper methods to static closures.
* Adding a failure message to each assertion when multiple assertions are used in the test.

Follow-up to [1126/tests], [1201/tests], [53292], [53495], [53522], [53538].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:06:18 +00:00
audrasjb
78bc43e7f8 Embeds: Remove Meetup as an oEmbed source since the related endpoint has been deprecated.
This changeset removes Meetup as an oEmbed source, since Meetup.com have deprecated their oEmbed endpoint. The block has already been removed from the editor, see GB#35085.

Props peterwilsoncc, audrasjb, swissspidy.
Fixes #55997.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 21:48:15 +00:00
audrasjb
fa3ed002e1 Docs: Use third-person singular verbs for function descriptions in the Feed API, as per docblock standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 21:46:16 +00:00
Sergey Biryukov
30836ec0bd Tests: Improve Tests_Image_Functions::test_wp_crop_image*() tests.
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.

Follow-up to [1126/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531], [53537].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 21:37:15 +00:00
Sergey Biryukov
26561d6b94 Tests: Refactor Tests_Image_Functions::test_load_directory() to split the tests and use a data provider.
This one test was testing three different situations. When one assertion fails, the rest of the test would not be executed, so this leads to hiding one error behind another.

Splitting the test into three distinct test methods still allows for testing each situation, but tests each one in isolation and won't hide errors.

The third part of the test, dealing with image editor engine classes, will also now use a data provider.

Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
* Reusing an existing data provider with the available image editor engine classes.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 19:36:20 +00:00
Sergey Biryukov
306f53a798 Tests: Always include the error message in assertNotWPError() and assertNotIXRError().
Previously, in case of failure, `WP_UnitTestCase_Base::assertNotWPError()` displayed the actual error message from the passed `WP_Error` object, but only if the `$message` parameter was empty.

This made the assertion less helpful, as the actual error message was lost in case there was a non-empty `$message` parameter passed to the method, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.

This commit ensures that the actual error message is always displayed, in addition to the passed `$message` parameter.

The same applies to `WP_UnitTestCase_Base::assertNotIXRError()`.

Follow-up to [34638], [40417].

Props jrf, SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53536


git-svn-id: http://core.svn.wordpress.org/trunk@53125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 17:29:17 +00:00
Sergey Biryukov
75f689766f External Libraries: Upgrade PHPMailer to version 6.6.3.
This is a maintenance release with minor CS improvements.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.3

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.6.2...v6.6.3

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500].

Props jrf, Synchro.
Fixes #56016.
Built from https://develop.svn.wordpress.org/trunk@53535


git-svn-id: http://core.svn.wordpress.org/trunk@53124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 15:04:11 +00:00
desrosj
cb93e6ba63 Build/Test Tools: Adjust Slack notifications logic to account for expected non push events.
This adjusts the logic used to determine the outcome of the previous workflow run of the current one to account for `schedule` and `workflow_dispatch` events.

In the current state, only workflows triggered by `push` events are examined. This is causing failures when trying to post Slack notifications for the Test Coverage workflow, and inconsistent results for `workflow_dispatch` events when testing older branches on a schedule.

Follow up to [53466] and [53468].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53534


git-svn-id: http://core.svn.wordpress.org/trunk@53123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 15:00:15 +00:00
Sergey Biryukov
5b4e5235ed Tests: Use consistent punctuation in failure messages in Tests_Image_Functions.
Follow-up to [53523], [53524], [53525], [53526], [53529], [53530], [53531].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 12:50:14 +00:00
Sergey Biryukov
162bffa8b5 Tests: Consistently check that an image was loaded in image saving tests.
Don't unnecessarily load the image twice in `test_inferred_mime_types_when_saving_an_image()`.

Follow-up to [1061/tests], [1151/tests], [1157/tests], [29834].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 17:28:11 +00:00
Sergey Biryukov
5f344cee00 Tests: Refactor Tests_Image_Functions::test_inferred_mime_types() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Adding a skip annotation for unsupported mime types.
* Making the test method name more specific.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 17:12:07 +00:00
Sergey Biryukov
13b24017be Tests: Refactor Tests_Image_Functions::test_mime_overrides_filename() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Making the test method name more specific.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 16:53:08 +00:00
Sergey Biryukov
de017e6a7e Tests: Refactor Tests_Image_Functions::test_wp_save_image_file() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.
* Adding a skip annotation for unsupported mime types.
* Adding a failure message to each assertion.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 16:41:12 +00:00
Sergey Biryukov
3abb5d4a83 Tests: Reorder is_gd_image() test methods for consistency.
This moves the test for valid types first, to match `file_is_valid_image()` and `file_is_displayable_image()` tests.

Follow-up to [48798], [53527].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 16:05:09 +00:00
Sergey Biryukov
b01fc042dc Tests: Rename some test methods in Tests_Image_Functions for consistency.
This matches the names of the functions being tested:
* `file_is_valid_image()`
* `file_is_displayable_image()`

Follow-up to [184/tests], [53523], [53524], [53525], [53526].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:45:13 +00:00
Sergey Biryukov
d53738ce7c Tests: Refactor Tests_Image_Functions::test_is_displayable_image_negative() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.

Follow-up to [184/tests], [53495], [53497], [53521], [53523], [53524], [53525].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:36:11 +00:00
Sergey Biryukov
40abfe84c7 Tests: Refactor Tests_Image_Functions::test_is_displayable_image_positive() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.

Follow-up to [184/tests], [42780], [53495], [53497], [53521], [53523], [53524].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:30:08 +00:00
Sergey Biryukov
3d4dce5320 Tests: Refactor Tests_Image_Functions::test_is_image_negative() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.

Follow-up to [184/tests], [53495], [53497], [53521], [53523].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:21:08 +00:00
Sergey Biryukov
35bb74740a Tests: Refactor Tests_Image_Functions::test_is_image_positive() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.

Follow-up to [184/tests], [42780], [53495], [53497], [53521].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:15:08 +00:00
Sergey Biryukov
3183f77ce7 Tests: Move the filter_image_editor_output_format() helper method next to the test it's used in.
Follow-up to [53292], [53495].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 12:49:12 +00:00
Sergey Biryukov
6e12ff3b89 Tests: Add a helper method for for creating named data providers in WP_UnitTestCase_Base.
This introduces a new test helper function which allows for turning a single-level array containing text strings into a data provider with named data sets, where the value of the data set will also be used as the name of the data set.

The function contains safeguards to ensure that it is only used with data compatible with this principle and will throw generic PHP exceptions when the data is incompatible. These type of exceptions will be displayed before the tests even start running and will stop the test run when they occur.

While generally speaking, all test cases ''should'' extend the base `WP_UnitTestCase_Base` class, this is still made a `public static` method to allow for a test, which by exception directly extends the PHPUnit base `TestCase` or the `PHPUnit_Adapter_TestCase`, to also be able to use this method.

Typical usage of this method:
{{{
public function data_provider_for_test_name() {
	$array = array(
		'value1',
		'value2',
	);

	return $this->text_array_to_dataprovider( $array );
}
}}}
The returned result will look like:
{{{
array(
	'value1' => array( 'value1' ),
	'value2' => array( 'value2' ),
)
}}}

Props jrf, hellofromTonya, adamsilverstein.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53521


git-svn-id: http://core.svn.wordpress.org/trunk@53110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-18 21:30:13 +00:00
Sergey Biryukov
481da1b9f4 Docs: Consistently declare the $wp_query global in link template functions.
This ensures that the global is explicitly declared and documented in:
* `get_next_posts_link()`
* `get_posts_nav_link()`
* `get_the_posts_navigation()`
* `get_the_posts_pagination()`
* `get_next_comments_link()`

Follow-up to [30065].

Props mt8.biz, sabernhardt.
Fixes #43164.
Built from https://develop.svn.wordpress.org/trunk@53520


git-svn-id: http://core.svn.wordpress.org/trunk@53109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-18 15:38:15 +00:00
Sergey Biryukov
c70a5c547f Coding Standards: Fix WPCS issue in [53518].
This fixes an "Concat operator must be surrounded by a single space" error.

See #54233.
Built from https://develop.svn.wordpress.org/trunk@53519


git-svn-id: http://core.svn.wordpress.org/trunk@53108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-17 11:33:08 +00:00
Sergey Biryukov
a0215f6e9d General: Use WPINC as a shorter reference to wp-includes in some files.
This brings more consistency with similar `require_once` statements and `_deprecated_file()` calls in other files.

Follow-up to [601], [628], [36693], [44359], [45663], [45678], [52026], 

Props malthert.
See #54233.
Built from https://develop.svn.wordpress.org/trunk@53518


git-svn-id: http://core.svn.wordpress.org/trunk@53107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-17 11:20:13 +00:00
audrasjb
4947604b66 Twenty Twenty-One: Ensure custom text color is reflected in the Editor for Quote block.
This changes removes an hardcoded CSS color value for the Quote block in Twenty Twenty-One's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.

Props jyolsna, evildon, kajalgohel, audrasjb.
Fixes #55989.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:43:09 +00:00
audrasjb
bac638e610 Docs: Use third-person singular verbs for function descriptions in the Taxonomy Administration API.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:39:08 +00:00
audrasjb
cfd6d327ad Twenty Nineteen: Ensure custom text color is reflected in the Editor for Quote block.
This changes removes an hardcoded CSS color value for the Quote block in Twenty Nineteen's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.

Props nithi22, evildon, SergeyBiryukov, audrasjb.
Fixes #55992.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:17:08 +00:00
audrasjb
8ea403e9bb Docs: Use third-person singular verbs for function descriptions in the WP_Screen API.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:10:10 +00:00
Sergey Biryukov
2a1e9e1dd8 Docs: Add @since notes for html5 theme feature changes in add_theme_support():
* As of WordPress 3.6.1, the `html5` feature requires an array of types to be passed. Defaults to `comment-list`, `comment-form`, `search-form` for backward compatibility.
* As of WordPress 6.0, the previously added `_doing_it_wrong()` notice is actually displayed as expected.

Follow-up to [25193], [25235], [25785], [49344], [49354], [52828].

Props bobbingwide.
See #51657, #55646.
Built from https://develop.svn.wordpress.org/trunk@53513


git-svn-id: http://core.svn.wordpress.org/trunk@53102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 15:21:15 +00:00
spacedmonkey
e5e61f3095 Tests: Re-enable failing REST API test for update_post_parent_caches().
Ensure that that attachment objects are not primed in cache so that test passes when object caching is enabled. 

Follow-up to [53506].

Props SergeyBiryukov.
See #55593.
Built from https://develop.svn.wordpress.org/trunk@53512


git-svn-id: http://core.svn.wordpress.org/trunk@53101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 19:34:12 +00:00
Sergey Biryukov
cbca7c4fb9 Tests: Temporarily disable the failing REST API test for update_post_parent_caches().
This needs more investigation to address the test failure with persistent object cache.

Follow-up to [53506].

Props hellofromTonya.
See #55593.
Built from https://develop.svn.wordpress.org/trunk@53511


git-svn-id: http://core.svn.wordpress.org/trunk@53100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 15:39:08 +00:00
Sergey Biryukov
0c2ced37c3 Tests: Use assertSameSets() in some newly introduced tests.
This ensures that not only the array values being compared are equal, but also that their type is the same.

Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.

Follow-up to [48939], [51137], [51943], [53499], [53504], [53506], [53509].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 14:44:11 +00:00
Sergey Biryukov
43f0f88b15 Tests: Some improvements for REST API cache priming tests:
* Give the test methods more specific names and move them closer together.
* Correct the `@covers` tags.

Follow-up to [53499], [53504], [53506], [53507], [53508].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 14:09:08 +00:00
Sergey Biryukov
a42b89fc71 REST API: Some documentation and test improvements for update_menu_item_cache():
* Make the function description more specific, for consistency with other similar functions.
* Add a `@since` note for the `$update_menu_item_cache` parameter of `WP_Query::parse_query()`.
* Add missing `@covers` tags for the unit tests.

Follow-up to [53504].

See #55620.
Built from https://develop.svn.wordpress.org/trunk@53508


git-svn-id: http://core.svn.wordpress.org/trunk@53097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 13:37:10 +00:00
Sergey Biryukov
84a8194200 REST API: Some documentation and test improvements for update_post_parent_caches():
* Make the function description more specific, for consistency with `update_post_author_caches()`.
* Add missing `@covers` tags for the unit test.

Follow-up to [53506].

See #55593.
Built from https://develop.svn.wordpress.org/trunk@53507


git-svn-id: http://core.svn.wordpress.org/trunk@53096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 13:19:10 +00:00
spacedmonkey
2c8a6170af REST API: Prime caches for post parents in post REST API controller.
Prime caches for all post parents in the post REST API controller using the `_prime_post_caches` function. Post parent objects are required as part of the `check_read_permission` method’s permission check in post REST API controller. 

Props spacedmonkey, furi3r, peterwilsoncc, mitogh, madpixels. 
Fixes #55593.
Built from https://develop.svn.wordpress.org/trunk@53506


git-svn-id: http://core.svn.wordpress.org/trunk@53095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:43:10 +00:00
Sergey Biryukov
ab5cc35046 Database: Don't translate the "WordPress database error" message in the error log.
When using multilingual websites, this string could end up with multiple different translations in the error log, making it less actionable.

Unlike errors displayed to the user, a general consensus for software is that errors in logs should always be in English. Since MySQL errors are also returned in English, this brings more consistency to the logs.

Follow-up to [6391], [8168], [19760].

Props malthert.
Fixes #53125.
Built from https://develop.svn.wordpress.org/trunk@53505


git-svn-id: http://core.svn.wordpress.org/trunk@53094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:36:09 +00:00
spacedmonkey
991acc48d4 REST API: Prime caches for linked objects in menu item REST API controller.
Add a new parameter to `WP_Query` called `update_menu_item_cache` that when set to true, primes the caches for linked terms and posts for menu item post objects. This change moves logic 
found in `wp_get_nav_menu_items` into a new function called `update_menu_item_cache`.  Update the menu item REST API controller, to pass the `update_menu_item_cache` parameter to the 
arguments used for the  `WP_Query` run to get menu items. 

Props furi3r,  TimothyBlynJacobs, spacedmonkey, peterwilsoncc, mitogh.
Fixes #55620.

 --This line, and those below, will be ignored--

M    src/wp-includes/class-wp-query.php
M    src/wp-includes/nav-menu.php
M    src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
M    tests/phpunit/tests/post/nav-menu.php

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


git-svn-id: http://core.svn.wordpress.org/trunk@53093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:20:13 +00:00
Sergey Biryukov
73a2d87eae Docs: Add a comment for stripping the leading AND from SQL clauses in some query classes.
Follow-up to [30084], [34529], [34542], [36598], [37477], [37572], [43010].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 16:17:08 +00:00
Sergey Biryukov
cacf46f12b Docs: Add a missing word in pre_months_dropdown_query filter description.
Follow-up to [50163].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 15:07:10 +00:00
Sergey Biryukov
3f74637dfe I18N: Use a translatable string for displaying a user's first name and last name.
That allows locales to switch the order of the first name and last name, should they prefer to do so.

The string was previously used in `wp_insert_user()` and is now reused in other places for consistency:

* `WP_MS_Users_List_Table::column_name()`​
* `WP_Users_List_Table::column_name()​`
* `wp_list_authors()`
* `wp_list_users()`

Note: This also removes the `wp_list_author_full_name` filter, introduced for the same purpose in `wp_list_authors()`, as redundant for now.

Follow-up to [53486].

See #17025.
Built from https://develop.svn.wordpress.org/trunk@53501


git-svn-id: http://core.svn.wordpress.org/trunk@53090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 14:43:12 +00:00
desrosj
cc05e7b608 External Libraries: Upgrade PHPMailer to version 6.6.2.
Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.2.

For a full list of changes in this update, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v6.6.0...v6.6.2.

Props ayeshrajans, jrf.
Fixes #55976.
Built from https://develop.svn.wordpress.org/trunk@53500


git-svn-id: http://core.svn.wordpress.org/trunk@53089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 14:38:10 +00:00
spacedmonkey
77f62c11db REST API: Prime caches for featured images in post controller.
Ensure that featured image caches are primed for post collections in the post REST API controller, by calling the `update_post_thumbnail_cache` function. 

Props Spacedmonkey, TimothyBlynJacobs, mitogh.
Fixes #55592. 


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


git-svn-id: http://core.svn.wordpress.org/trunk@53088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 13:10:10 +00:00
spacedmonkey
7df9ba26b2 REST API: Avoid duplicated query in post collections.
Avoid duplicated query when retrieving empty posts collections by adding a check if the page is more than 1. 

Props furi3r, gdetassigny, TimothyBlynJacobs, spacedmonkey. 
Fixes #55677.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 12:42:10 +00:00
Sergey Biryukov
c7ab92451a Tests: Remove redundant skip call in Tests_Image_Functions::get_image_editor_engine_classes().
The test bootstrap requires GD to be available, so this test skip condition will never be matched.

Also, test skipping from within a helper method, which may be used in a data provider, can lead to test runtime errors.

Follow-up to [49009], [49014], [49535], [49571], [51415].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 11:46:09 +00:00
spacedmonkey
47a8b2f5de Taxonomy: Fix caching issues in WP_Term_Query class.
Introduced [52836] when passing `child_of` or `pad_counts` parameters to `get_terms` or `WP_Term_Query` class, the array of terms received by the query, was not correctly cached. This 
change simplifies the logic in `WP_Term_Query` and ensures terms are correctly cached. This change also, improves performance, by only caching an array of term ids where possible.  

Props denishua, spacedmonkey, oztaser, peterwilsoncc, SergeyBiryukov, georgestephanis, jnz31, knutsp, mukesh27, costdev.
Fixes #55837.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 11:43:13 +00:00
Sergey Biryukov
e3e0bb1183 Tests: Move helper functions in Tests_Image_Functions to more appropriate places.
* Move a non-test specific helper function used by multiple tests up to the top of the class to make it more easily discoverable.
* Move a test-specific helper function used by only one test to be directly below the test using the helper function and make the link with the test explicit by adding a `@see` tag.

Follow-up to [1201/tests], [51415].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 16:44:10 +00:00
Sergey Biryukov
30a9e469b8 Tests: Rename classes in phpunit/tests/option/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651], [51860], [52264], [52265], [53489].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 15:26:10 +00:00
Sergey Biryukov
ca2e67d1b0 Tests: Add a unit test for PHP 8.1 deprecation notice in wp_user_settings().
This ensures that PHP 8.1 "passing null to non-nullable" deprecation notice is not thrown for the `$domain` parameter of `setcookie()` calls in the function.

Follow-up to [53490].

See #54914.
Built from https://develop.svn.wordpress.org/trunk@53493


git-svn-id: http://core.svn.wordpress.org/trunk@53082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 15:22:10 +00:00
Sergey Biryukov
e3e07d2751 Tests: Use more consistent wording when referring to PHP deprecation notices.
Follow-up to [51619], [51695].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 14:53:11 +00:00
Sergey Biryukov
c12b446f41 Tests: Use a consistent URL in HTTP response cookie tests.
Follow-up to [34369], [35734], [38164].

See #51568.
Built from https://develop.svn.wordpress.org/trunk@53491


git-svn-id: http://core.svn.wordpress.org/trunk@53080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-12 15:18:10 +00:00
Sergey Biryukov
6151fddb6c Code Modernization: Pass correct default value to setcookie() in wp_user_settings().
The `wp_user_settings()` function calls the PHP native `setcookie()` function, the fifth parameter of which is the ''optional'' `$domain` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.

In this case, this function call yielded a `setcookie(): Passing null to parameter #5 ($domain) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without a backward compatibility break.

References:
* [https://www.php.net/manual/en/function.setcookie.php PHP Manual: setcookie()]
* [https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg PHP RFC: Deprecate passing null to non-nullable arguments of internal functions]

Follow-up to [29478].

Props ocean90, shenyanzhi, meysamnorouzi, jrf.
Fixes #54914.
Built from https://develop.svn.wordpress.org/trunk@53490


git-svn-id: http://core.svn.wordpress.org/trunk@53079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-12 11:11:11 +00:00
Sergey Biryukov
97eff9b7b2 Tests: Rename classes in phpunit/tests/user/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651], [51860], [52264], [52265].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-11 15:50:08 +00:00
Sergey Biryukov
df324b9ff6 Tests: Re-initialize WP_Rewrite before running wp_list_authors() tests.
This ensures that the expected results use the default permalink structure, not affected by other tests.

Follow-up to [27550], [27684], [53487].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-11 15:36:13 +00:00
Sergey Biryukov
193a959806 Tests: Rename the test file and class for wp_list_authors() tests.
This matches the name of the function being tested.

Follow-up to [27550].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-11 13:43:13 +00:00
audrasjb
df0d910007 Query: Add a hook to filter author full name from wp_list_authors().
This changeset introduces the `wp_list_author_full_name` hook to allows developers to filter author full name, which by default is a combinaison of the author first and last name, separated by a space.

Props kevinB, wonderboymusic, DrewAPicture, nacin, Mte90, jorbin, afercia, rafiahmedd.
Fixes #17025.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 18:23:18 +00:00
spacedmonkey
c8f31dc0c0 REST API: Improve post cache priming in WP_REST_Post_Search_Handler class.
In the `WP_REST_Post_Search_Handler` class, ensure that post, post meta and term caches are correctly primed when performing a search.

Props furi3r, spacedmonkey, TimothyBlynJacobs, audrasjb, peterwilsoncc. 
Fixes #55674.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:47:08 +00:00
Sergey Biryukov
a29c6663fd Docs: Use typed array notation in some post function DocBlocks:
* `wp_queue_posts_for_term_meta_lazyload()`
* `_prime_post_caches()`

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


git-svn-id: http://core.svn.wordpress.org/trunk@53073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:22:11 +00:00
Sergey Biryukov
9e01bd8adc Query: Some documentation and test improvements for update_post_author_caches():
* Make the descriptions for `update_post_author_caches()` and `update_post_caches()` more specific.
* Move the unit test into its own file, for consistency with `update_post_cache()` tests. This also allows for using shared fixtures in case more tests are added in the future.

Follow-up to [53482].

See #55716.
Built from https://develop.svn.wordpress.org/trunk@53483


git-svn-id: http://core.svn.wordpress.org/trunk@53072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:17:10 +00:00
spacedmonkey
2237f67458 Prime users cache in WP_Query and post REST API controller.
For a call to `WP_Query` or a post REST API request that contains posts from multiple authors, call the `cache_users` function, to ensure that all user data for post authors is primed in 
a single database query. This results in far fewer database queries on multiple author sites. 

Props spacedmonkey, timothyblynjacobs, peterwilsoncc.
Fixes #55716.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 13:39:11 +00:00
Sergey Biryukov
558cd4c353 Media: Some documentation and test improvements for wp_img_tag_add_decoding_attr():
* Add a `@since` note for the `decoding` attribute in `wp_get_attachment_image()`.
* Adjust `wp_img_tag_add_decoding_attr()` DocBlocks per the documentation standards.
* Wrap some long `sprintf()` calls in unit tests for better readability. In at least one case, `the_content` was unnecessarily passed to `sprintf()` as an extra (unused) parameter.

Follow-up to [53480].

See #53232.
Built from https://develop.svn.wordpress.org/trunk@53481


git-svn-id: http://core.svn.wordpress.org/trunk@53070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-09 16:21:14 +00:00
Peter Wilson
b8e44627c8 Media: Add decoding="async" to image attributes.
Dynamically add `decoding="async"` to image tags on the front end of a site to instruct browsers to download them in parallel.

Modifies `wp_get_attachment_image()`, `get_avatar()` to include the attribute by default. Modifies `wp_filter_content_tags()` to add the attribute during the front-end render of the site.

Introduces `wp_img_tag_add_decoding_attr()` to take an image tag and modify it to include the attribute. Introduces the filter `wp_img_tag_add_decoding_attr` used to define the default value for the attribute.

Props adamsilverstein, ayeshrajans, costdev, flixos90, hellofromtonya, isaumya, michaelbourne, mihai2u, mitogh, sergiomdgomes, spacedmonkey, westonruter, peterwilsoncc.
Fixes #53232.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-09 05:31:12 +00:00
Sergey Biryukov
cf5df71b88 Tests: Correct an assertion in wp_rand() tests.
The function returns non-negative integers, which includes zero.

Follow-up to [53473], [53477].

See #55194.
Built from https://develop.svn.wordpress.org/trunk@53479


git-svn-id: http://core.svn.wordpress.org/trunk@53068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-08 13:19:14 +00:00
Sergey Biryukov
4b286c4f77 Tests: Move the tests for individual pluggable functions into their own directory.
This aims to make the tests more discoverable and easier to expand.

Follow-up to [50790], [53473], [53477].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 14:45:12 +00:00
Sergey Biryukov
e380ff685d Tests: Use more descriptive names for wp_rand() test methods.
This aims to clarify the intention of the tests.

Follow-up to [53473].

Props mlajo, costdev, acoulombe, azouamauriac, swissspidy, tobifjellner, peterwilsoncc, audrasjb, marekdedic, SergeyBiryukov.
See #55194.
Built from https://develop.svn.wordpress.org/trunk@53477


git-svn-id: http://core.svn.wordpress.org/trunk@53066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 12:03:12 +00:00
audrasjb
7821fe08db Text Changes: Improve consistency of admin error notices in wp-admin/options.php.
This changeset replaces <strong>Error</strong>: with <strong>Error:</strong>, for better consistency.

Follow-up to [53458].

Fixes #50785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:30:13 +00:00
audrasjb
2029a33158 Twenty-Twenty: Fix a width/alignement issue on "Wide Line" Separator style variation.
This change fixes an alignement issue on the "Wide Line" Separator style variation on front-end, especially when used inside a column block. It changes the block `width` value from `120rem` to `100%` to avoid container overflowing.

Props kjellr, matthiaspabst, sabernhardt, audrasjb.
Fixes #53643.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:23:09 +00:00
audrasjb
20c003e842 Docs: Use third-person singular verbs for function descriptions in the Core Translation API.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:18:13 +00:00
audrasjb
56d7437f59 General: Ensure wp_rand() returns 0 when $min and $max values are equal to 0.
This changeset ensures `wp_rand()` returns zero instead of a random number when both `$min` and `$max` values are equal to zero.

Fixes #55194.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 22:50:10 +00:00
audrasjb
0ab9c4ee4b Docs: Various fixes in wp-includes/pluggable.php docblocks, as per documentation standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 22:35:10 +00:00
audrasjb
312f7d4b76 Twenty-Twenty: Fix paragraph block alignment issues when used on a RTL website.
Twenty Twenty's `style.css` file has `/*rtl:ignore*/` for the `.has-text-align-left` class, but that was previously missing from the `.has-text-align-right` class. As a result, the theme overrides block library styles on the front-end (and not in the editor). This changeset adds the missing declaration.

Props amirkamizi, mayankmajeji, ianbelanger, sabernhardt, hasanuzzamanshamim.
Fixes #49447.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 21:42:13 +00:00
audrasjb
5d96ddab10 Twenty-Twenty: Improve Quote block style consistency between front and back-end.
This changeset updates the `font-style` value of the Quote block in the block editor to ensure styles are consistent between the editor and the front-end.

Props kajalgohel, iamjaydip, audrasjb, whaze, mukesh27.
Fixes #55931.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 13:31:15 +00:00
Sergey Biryukov
a29a0e05d1 Docs: Correct method reference format in some DocBlocks.
This ensures that the methods are recognized by the WordPress Code Reference parser.

Follow-up to [7994], [25567], [27156], [28887], [49672], [52226].

Props dd32, audrasjb.
Fixes #55928.
Built from https://develop.svn.wordpress.org/trunk@53469


git-svn-id: http://core.svn.wordpress.org/trunk@53058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 10:51:12 +00:00
desrosj
1ce3b1ae3b Build/Test Tools: Correctly confirm the previous workflow run was triggered by a push event.
This fixes the code added in [53466] to look at the correct workflow object when determining the outcome of the previous workflow run.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-05 19:45:15 +00:00
Sergey Biryukov
6c79e4b29b Tests: Update the URL to the documentation on GitHub Actions environment variables.
Follow-up to [49264].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-05 14:06:11 +00:00
desrosj
6a7de2d74a Build/Test Tools: Prevent inaccurate “fixed” notifications in Slack.
When searching for previous workflow runs by branch, GitHub currently includes matches within forks.

If a contributor opens a pull request from their fork with a `head_ref` matching a Core branch that triggers a workflow on `push` event, the outcomes of the workflows associated with that pull request are currently used to determine if the previous workflow run had failed.

The result is a false “fixed” notifications when a commit immediately follows a failed workflow run from the pull request.

This adds a check to skip any workflow runs not triggered by a `push` event to prevent these inaccurate notifications.

Props SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53466


git-svn-id: http://core.svn.wordpress.org/trunk@53055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-05 09:31:13 +00:00
Sergey Biryukov
5a2b984cc0 Tests: Don't overwrite image metadata in a wp_calculate_image_srcset() test for zero width.
This was unnecessarily replacing the original image metadata with a scaled version, leading to a few leftover images with the `-scaled` suffix in the `wp-content/uploads` directory.

Follow-up to [35412].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 18:05:08 +00:00
Sergey Biryukov
61b7a2a3e2 Tests: Consistently pass the $force_delete parameter to wp_delete_attachment().
Convert some `wp_delete_post()` calls to `wp_delete_attachment()` to avoid an extra function call.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 13:41:08 +00:00
Sergey Biryukov
854a06a4ad Tests: Clean up test images before performing assertions in image resize tests.
This makes sure there are no leftover images in case of a test failure.

Follow-up to [161/tests], [1255/tests].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 12:57:10 +00:00
audrasjb
343af672af Docs: Replace "updated" with "deleted" in wpdb::delete @return description.
Props audrasjb, cadlec.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 12:15:12 +00:00
Sergey Biryukov
3fec80568e Tests: Add some test cases for path_join() with Windows paths.
Follow-up to [6984], [53457], [53460].

Props joyously.
See #55897.
Built from https://develop.svn.wordpress.org/trunk@53461


git-svn-id: http://core.svn.wordpress.org/trunk@53050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-03 15:07:21 +00:00
Sergey Biryukov
1d2e969b50 General: Remove redundant ltrim() from path_join().
If the path starts with a slash, it will be considered absolute and returned as is earlier in the function.

It it's not absolute, then it does not start with a slash, so there is nothing to trim.

This change is covered by existing unit tests.

Follow-up to [6984], [53457].

Props karlijnbk.
See #55897.
Built from https://develop.svn.wordpress.org/trunk@53460


git-svn-id: http://core.svn.wordpress.org/trunk@53049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 15:31:08 +00:00
audrasjb
e05a38f0a5 Twenty-Twenty: Alignment fix on Separator Block editor styles.
This changeset fixes an issue with some CSS rules of the "Wide Line" variation of the Separator Block’s editor stylesheet, for small, medium and large screens.

Props umesh84, iamjaydip, mukesh27, larrach.
Fixes #55896.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 15:10:10 +00:00
audrasjb
bbe60d66c3 Text Changes: Improve consistency of admin error notices.
This changeset replaces `<strong>Error</strong>:` with `<strong>Error:</strong>`, for better consistency.

Props transl8or, mihaidumitrascu, audrasjb.
Fixes #50785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 15:05:13 +00:00
Sergey Biryukov
6f2e2a33be Tests: Add unit tests for path_join().
Props karlijnbk.
See #55897.
Built from https://develop.svn.wordpress.org/trunk@53457


git-svn-id: http://core.svn.wordpress.org/trunk@53046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 15:00:13 +00:00
audrasjb
a6539b8cfb Docs: Use third-person singular verbs for method descriptions in wp-includes/post.php, as per docs standards.
Props whaze.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 10:55:11 +00:00
Sergey Biryukov
01d172b581 General: Replace all esc_url_raw() calls in core with sanitize_url().
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.

Follow-up to [11383], [13096], [51597], [53452].

Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
Fixes #55852.
Built from https://develop.svn.wordpress.org/trunk@53455


git-svn-id: http://core.svn.wordpress.org/trunk@53044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-01 18:14:10 +00:00
Sergey Biryukov
3be126b751 Tests: Require the zip PHP extension in block templates export file test.
This avoids a test failure if the `ZipArchive` class is missing.

Additionally, this commit replaces an inline check for the `ZipArchive` class in personal data export file tests with a `@requires` annotation, for consistency with similar PHP extension requirements in other tests.

Follow-up to [44786], [51415], [52286].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-01 14:18:10 +00:00
Sergey Biryukov
f2a7f4a387 I18N: Use consistent context for the "Add New" string when referring to media.
This replaces the only instance of the `add new media` context with `file`, used in other instances of the string.

Follow-up to [9198], [10680], [21948].

Props benjgrolleau, tobifjellner, SergeyBiryukov.
Fixes #55876.
Built from https://develop.svn.wordpress.org/trunk@53453


git-svn-id: http://core.svn.wordpress.org/trunk@53042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-31 18:39:10 +00:00
Sergey Biryukov
d0712f35d4 Formatting: Make sanitize_url() the recommended function for sanitizing a URL.
A general security rule is "Sanitize when you save, escape when you echo".

In WordPress 5.9, `sanitize_url()` was un-deprecated in order to better align with the naming of other sanitizing functions, while still being an alias for `esc_url_raw()`.

This commit reverses the order and turns `esc_url_raw()` into a wrapper for `sanitize_url()`, making the latter the canonical function call and aiming to improve performance by reducing the number of function calls required when using the recommended technique.

Follow-up to [11383], [13096], [51597].

Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
See #55852.
Built from https://develop.svn.wordpress.org/trunk@53452


git-svn-id: http://core.svn.wordpress.org/trunk@53041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-31 15:17:14 +00:00
Sergey Biryukov
9268ef9788 Media: Add support for WebP images in the Thickbox library.
This ensures that `.webp` images are properly recognized and displayed in the modal as expected.

Follow-up to [50810], [51227], [52073].

Props ilunabar, graham73may, sabernhardt, mukesh27, SergeyBiryukov.
Fixes #55786.
Built from https://develop.svn.wordpress.org/trunk@53451


git-svn-id: http://core.svn.wordpress.org/trunk@53040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-30 14:53:11 +00:00
Sergey Biryukov
d842b3b5c3 Docs: Explicitly declare some globals for clarity.
This aims to improve developer experience by making it clear that these variables are defined elsewhere.

Props ravipatel, davidbaumwald, hellofromTonya, costdev, SergeyBiryukov.
Fixes #51439.
Built from https://develop.svn.wordpress.org/trunk@53450


git-svn-id: http://core.svn.wordpress.org/trunk@53039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-29 15:35:11 +00:00
Sergey Biryukov
9a2a423eb6 Quick/Bulk Edit: Check the show_in_quick_edit taxonomy property when processing the data for bulk edited posts.
Previously, setting the `show_in_quick_edit` property to `false` removed the taxonomy from the inline edit form, but several taxonomy-related database queries were still being performed in `bulk_edit_posts()` when building the arguments to pass to `wp_update_post()`, even though terms were not modified.

This commit improves performance by avoiding unnecessary database queries when `show_in_quick_edit` is `false`, and mirrors a similar check in the `get_inline_data()` function.

Follow-up to [13535], [14580], [31307], [52841], [53368].

Props Chouby, sabernhardt, costdev, nalininonstopnewsuk, webcommsat, marybaum, meher, wparslan, SergeyBiryukov.
Fixes #42474.
Built from https://develop.svn.wordpress.org/trunk@53449


git-svn-id: http://core.svn.wordpress.org/trunk@53038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-27 15:51:12 +00:00
Peter Wilson
290742cada Budled themes: Revert the Twenty Ten theme version to 3.6.
No functional changes were made to Twenty Ten during the WordPress 6.0 release cycle so the theme version bump is not needed. The "tested up to" header change is maintained.

Follow up to and partial revert of [53418].

Props desrosj, ravipatel, costdev.
Fixes #55810.
See #55754.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-25 02:51:09 +00:00
Peter Wilson
cf5cf75f09 Help/About: Add cache busting string to video thumbnail.
Append `?ver=6.0` to the image used for linking to the video to break the cache in browsers, proxy servers and on the CDN.

A new version of the image has been uploaded and replaced the file in the original location.

Props annezazu, critterverse, ryelle, costdev, ironprogrammer, dd32.
Fixes #55808.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-25 02:19:17 +00:00
Peter Wilson
5214e469df Help/About: Finalise links on about page.
Wrap up about page for 6.0 release.

Props ryelle, mukesh27, hellofromTonya, SergeyBiryukov, peterwilsoncc.
Fixes #55775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 23:53:13 +00:00
Sergey Biryukov
d0e055e68f Coding Standards: Correct alignment in various files.
This fixes an `Equals sign not aligned correctly` WPCS warning.

Additionally, this commit sets the `svn:eol-style` property for the `phpunit/tests/ajax/wpAjaxCropImage.php` file and corrects line endings, so that the output of `composer format` is clean.

Follow-up to [53027], [53217], [53404].

Props hellofromTonya, SergeyBiryukov.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53441


git-svn-id: http://core.svn.wordpress.org/trunk@53030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 20:40:14 +00:00
Sergey Biryukov
653a3af0d4 Upgrade/Install: Update $_old_files for 6.0.
Props hellofromTonya, JeffPaul, SergeyBiryukov.
Fixes #55794.
Built from https://develop.svn.wordpress.org/trunk@53439


git-svn-id: http://core.svn.wordpress.org/trunk@53028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 17:02:16 +00:00
ryelle
c07f05ab86 Administration: Fix image overlap in Dashboard welcome panel.
Use longhand positioning properties (top, right, etc) so that the rtlcss build process can correctly adjust the layout for the RTL CSS.

Props ryelle, costdev, ironprogrammer, hellofromtonya.
Fixes #55793.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 16:48:15 +00:00
Sergey Biryukov
6e15f7fc9a Docs: Use third-person singular verbs for method descriptions in wp-includes/class-wp-roles.php, per the documentation standards.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53436


git-svn-id: http://core.svn.wordpress.org/trunk@53025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 15:01:12 +00:00
Sergey Biryukov
b2869c1e62 General: Bump the recommended MariaDB version in readme.html.
MariaDB 10.2 has reached EOL in May 2022. The recommended minimum is bumped to 10.3 for now.

Follow-up to [52319], [52358], [52420], [52424], [53431], [53433], [meta11866].

Props hellofromTonya.
Fixes #55791. See #meta6322.
Built from https://develop.svn.wordpress.org/trunk@53435


git-svn-id: http://core.svn.wordpress.org/trunk@53024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 14:22:10 +00:00
Sergey Biryukov
538587ef1d Tests: Improve the assertions in recommended MySQL and MariaDB version tests.
Comparing human-readable dates instead of numeric timestamps gives identical results, but makes the message more clear in case of failure.

Follow-up to [33946], [52418], [52421], [52424].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 14:09:12 +00:00
hellofromTonya
59d78a1dd4 Build/Test Tools: Temporarily skip MariaDB version test.
TEMPORARY COMMIT.

MariaDB version 10.2 is no longer supported as of 23 May 2022. This commit temporarily skips the version test. Why? To avoid test failures during this period, i.e. until the version is bummped and `readme.html` file changed.

See #55791, [https://meta.trac.wordpress.org/ticket/5999 Meta5999].
Built from https://develop.svn.wordpress.org/trunk@53431


git-svn-id: http://core.svn.wordpress.org/trunk@53020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 13:32:07 +00:00
hellofromTonya
fd34524107 Build/Test Tools: Fix comments odd/even instabilities (test leaks).
The odd / even class attribute global variables are causing issues in comments tests when a new test is added or an existing test is modified. To stabilize the odd / even comment tests, the comment global variables are added to the base test class' `tear_down()` using the same patterns as the other global resets. This change ensures each comment test starts at the same state. In doing so, the expected odd / even class attributes are no longer affected by previous tests, i.e. test leaks.

Follow-up to [53172].

Props hellofromTonya, zieladam, peterwilsoncc.
See #54725.
Built from https://develop.svn.wordpress.org/trunk@53430


git-svn-id: http://core.svn.wordpress.org/trunk@53019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 11:56:13 +00:00
Sergey Biryukov
f6412575c8 Query: Check if $wp_query is set in query loop functions.
This avoids a PHP fatal error if any of these functions are called too early:

* `have_posts()`
* `in_the_loop()`
* `rewind_posts()`
* `the_post()`
* `have_comments()`
* `the_comment()`

bringing some consistency with conditional tags: `is_single()`, `is_home()`, etc.

This commit also removes unnecessary `return` from `the_comment()`, for consistency with `the_post()`. As `WP_Query::the_comment()` does not have a return value, this statement did not have any effect in practice.

Follow-up to [4934], [8807], [16947], [17068], [17083], [49147], [53395], [53396], [53400].

Props vdankbaar, thijso, teunvgisteren, timkersten655, SergeyBiryukov.
Fixes #55722.
Built from https://develop.svn.wordpress.org/trunk@53429


git-svn-id: http://core.svn.wordpress.org/trunk@53018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-22 15:17:14 +00:00
Sergey Biryukov
f4af743ea7 Docs: Correct the type for WP_Post::$post_category and ::$tags_input.
These properties are arrays of category IDs and tag names, respectively, not a single integer or string.

Follow-up to [21651], [31127], [32729], [48941].

Props omaeyusuke.
Fixes #55785.
Built from https://develop.svn.wordpress.org/trunk@53428


git-svn-id: http://core.svn.wordpress.org/trunk@53017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-21 12:07:13 +00:00
desrosj
766a38f2fb Build/Test Tools: Link to a specific run attempt in GitHub Action Slack notifications.
This adjusts the workflow run URLs included in Slack notifications to link to the specific attempt being reported on making it easier for someone to see the proper context of a specific notification.

Additionally, this eliminates the need for a contributor to share the reason for a failure in Slack before restarting the workflow, as the link will always be to that specificattempt. When a “fixed” notification occurs for a subsequent run attempt, the link will be to the new, successful run attempt.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 17:42:09 +00:00
Sergey Biryukov
40fc19024f Code Modernization: Replace phpversion() function calls with PHP_VERSION constant.
`phpversion()` return value and `PHP_VERSION` constant value are identical, but the latter is several times faster because it is a direct constant value lookup compared to a function call.

Props ayeshrajans, jrf, mukesh27, costdev, hellofromTonya, SergeyBiryukov.
Fixes #55680.
Built from https://develop.svn.wordpress.org/trunk@53426


git-svn-id: http://core.svn.wordpress.org/trunk@53015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 17:38:14 +00:00
gziolo
59c970101f Docs: Add missing documentation for fallback_gap_value param
Follow-up for [53420]. 

Props SergeyBiryukov.
See #55567.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 15:35:14 +00:00
gziolo
cbcf19d09d Editor: Update WordPress packages for 6.0 RC 4
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 RC 3.

Props zieladam.
See #55567.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 14:32:40 +00:00
gziolo
b020766e3d Editor: Fix opinionated block styles loading in editor
Related changes in Gutenberg: https://github.com/WordPress/gutenberg/pull/40937.

Backport for WordPress 6.0 RC 4.

Props jffng.
See #55567.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 11:42:19 +00:00
Peter Wilson
55a5dbcf27 Bundled themes: Bump versions for WordPress 6.0 release.
Bump bundled theme version numbers in preparation for the WordPress 6.0 release. Each theme's _tested up to_ file header has been increased to indicate WordPress 6.0 support.

The new version numbers are:

* Twenty Ten: 3.7
* Twenty Eleven: 4.1
* Twenty Twelve: 3.7
* Twenty Thirteen*: 3.7
* Twenty Fourteen: 3.4
* Twenty Fifteen*: 3.2
* Twenty Sixteen*: 2.7
* Twenty Seventeen*: 3.0
* Twenty Nineteen: 2.3
* Twenty Twenty: 2.0
* Twenty Twenty-One: 1.6

An asterisk indicates the theme includes assets requiring a manual version bump, this is set to the reverse date format of the release day: `20220524`.

Follow up to [53286] in which the Twenty Twenty-Two theme version was bumped to 1.2.

Props peterwilsoncc, desrosj, costdev, mehedi890.
Fixes #55754.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 01:49:16 +00:00
Peter Wilson
ec3b0158d8 Themes: Accept valid block themes.
Updates theme validation to accept block themes. This replaces the requirement for an `index.php` with a requirement for either an `index.php`, `/templates/index.html` or the deprecated `/block-templates/index.html`.

Validation is updated for theme uploads, within `WP_Theme::__construct` and `validate_current_theme()`. 

A block theme using the deprecated file structure is now included in the unit tests.

Props peterwilsoncc, sergeybiryukov, hellofromtonya, costdev, azaozz, gziolo, FlorianBrinkmann, Boniu91, aristath, poena, audrasjb.
Fixes #55754.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 00:49:18 +00:00
Sergey Biryukov
4b46629139 Accessibility: List Tables: Hide the Comments column icon and title attribute from screen readers.
The element already has non-visual text, making the icon and the `title` attribute redundant for assistive technologies.

Follow-up to [22439], [27548], [31513], [32991], [50804].

Props sabernhardt, ryokuhi, afercia, karlgroves, SergeyBiryukov.
Fixes #55555. See #24766.
Built from https://develop.svn.wordpress.org/trunk@53414


git-svn-id: http://core.svn.wordpress.org/trunk@53003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-19 15:54:15 +00:00
Peter Wilson
08c5dbc7e9 Site Editor: Include style parameter in home template redirect.
When redirecting the site editor to the home template include the `style` querystring parameter if it is set. This ensures the style panel opens if the user expects it.

Props grantmkin, mamaduka, peterwilsoncc.
Fixes #55752.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-19 02:27:13 +00:00
Sergey Biryukov
6d0b0d9a4b Docs: Add missing documentation for some Customize class properties:
* `WP_Customize_Background_Image_Control::$type`
* `WP_Customize_Background_Image_Setting::$id`
* `WP_Customize_Header_Image_Setting::$id`

Follow-up to [21037], [21053], [30885].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-18 15:24:14 +00:00
audrasjb
d4f6347b94 Twenty Twenty-Two: Fix typo in Dark Footer pattern docblock.
Props passoniate, audrasjb.
Fixes #55772.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-18 12:57:12 +00:00
Peter Wilson
88f38062e2 Help/About: Ensure about page shows current header.
Add a query string parameter to the about page header images to ensure the cache is broken in browsers and CDNs.

Props ryelle.
Fixes #55750.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-18 03:01:13 +00:00
Sergey Biryukov
2972db4ba5 Users: Fail gracefully when checking mapped capabilities without providing the required object ID.
This avoids an `Undefined array key 0` PHP warning for `current_user_can()` capability checks that require a specific object to check against but an object ID was not passed.

A `_doing_it_wrong()` notice is also added, so that developers and site administrators are aware that the capability mapping is failing in the absence of the required object ID.

The list of mapped capabilities that require an object ID:

* `delete_post` / `delete_page`
* `edit_post` / `edit_page`
* `read_post` / `read_page`
* `publish_post`
* `edit_(post|comment|term|user)_meta` / `delete_*_meta` / `add_*_meta`
* `edit_comment`
* `edit_term` / `delete_term` / `assign_term`

Follow-up to [34091], [34113], [47178].

Props jeherve, peterwilsoncc, henry.wright, johnbillion, mattheweppelsheimer, hellofromTonya, JeffPaul, azouamauriac, Ninos Ego, TobiasBg, wpsmith, GaryJ, nacin, johnstonphilip, azaozz, SergeyBiryukov.
Fixes #44591.
Built from https://develop.svn.wordpress.org/trunk@53408


git-svn-id: http://core.svn.wordpress.org/trunk@52997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-17 19:01:20 +00:00
gziolo
571e1e01b3 Editor: Return additional block patterns to server-generated settings
Reverts changes from [53155] to ensure backward compatibility.

Companion to Gutenberg changes https://github.com/WordPress/gutenberg/pull/40818. That makes sure that patterns registered with `admin_init` or `current_screen` hooks are not lost.

Props jsnajdr, zieladam, peterwilsoncc, johnstonphilip.
See #55567.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-17 14:38:14 +00:00
gziolo
58dfeaa86f Editor: Update WordPress packages for 6.0 RC 3
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 RC 2.

Props zieladam, ndiego.
See #55567.



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


git-svn-id: http://core.svn.wordpress.org/trunk@52992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-17 13:30:31 +00:00
gziolo
102004b505 Theme: Use a better method to determine the theme name during export
See the same change in the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/40829.

Props scruffian, davidbaumwald, jeremyfelt.
See #55567.



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


git-svn-id: http://core.svn.wordpress.org/trunk@52991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-17 12:10:14 +00:00
audrasjb
c03decd0cb Users: Fix misalignment of new user password toggle button on mobile.
This fixes an issue where the password hide/show button was misaligned when creating a new user on small screens.

Props kebbet.
Fixes #55558.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-16 22:37:12 +00:00
Sergey Biryukov
aeb3b7530a Tests: Use a data provider in the test for conditional tags returning early if $wp_query is not set.
Follow-up to [53395], [53396].

Props peterwilsoncc.
See #55104.
Built from https://develop.svn.wordpress.org/trunk@53400


git-svn-id: http://core.svn.wordpress.org/trunk@52989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-16 14:11:12 +00:00
audrasjb
e3def96108 Twenty Twenty-One: Add a missing HTML comment to indicate the end of .post-thumbnail section.
Props haritpanchal.
Fixes #55724.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-15 22:34:08 +00:00
audrasjb
c29c6885c0 Coding Standards: Fix params indentation in pre_get_network_by_path hook docblock.
See #55647.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-15 20:32:08 +00:00
audrasjb
200283a99e Docs: Use third-person singular verbs for function descriptions in the WP_Network class.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-15 20:28:07 +00:00
Sergey Biryukov
313f6f8fe0 Tests: Expand the test for conditional tags returning early if $wp_query is not set.
When called too early, conditional query tags should throw a `_doing_it_wrong()` notice and return `false`. This commit verifies that behavior not only for `is_main_query()`, but for all the other conditional tags too.

Follow-up to [16947], [17068], [17083], [18699], [37985], [53395].

See #55104.
Built from https://develop.svn.wordpress.org/trunk@53396


git-svn-id: http://core.svn.wordpress.org/trunk@52985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-15 15:57:13 +00:00
Sergey Biryukov
a5db52030f Query: Check if $wp_query is set in is_main_query().
This avoids a PHP fatal error and triggers a `_doing_it_wrong()` notice if `is_main_query()` is called too early, bringing consistency with all the other `is_*()` conditionals: `is_single()`, `is_home()`, etc.

Follow-up to [16947], [17068], [17083], [18699], [37985].

Props vdankbaar, nhadsall, johnbillion, costdev, thijsoo, teunvgisteren, timkersten655, SergeyBiryukov.
Fixes #55104.
Built from https://develop.svn.wordpress.org/trunk@53395


git-svn-id: http://core.svn.wordpress.org/trunk@52984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-14 15:10:14 +00:00
Sergey Biryukov
04f9d9bdf6 Database: Use generic references to a database server in ms_not_installed().
This replaces the references to “MySQL” with “your host’s database server” on the “Error establishing a database connection” page when Multisite could not be loaded. The generic “database server” term can refer to MySQL or MariaDB. Additionally, this brings some consistency with a similar error message in `wpdb::db_connect()`.

Follow-up to [52367], [52423].

Props tj692, hansjovisyoast, tobifjellner.
Fixes #55701.
Built from https://develop.svn.wordpress.org/trunk@53394


git-svn-id: http://core.svn.wordpress.org/trunk@52983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-13 12:21:13 +00:00
Sergey Biryukov
2130878354 Docs: Replace Codex URL with a corresponding HelpHub article in the Additional CSS section in Customizer.
Follow-up to [45674-45677], [46740], [49912].

Props stevenlinx, audrasjb.
Fixes #55710. See #48987.
Built from https://develop.svn.wordpress.org/trunk@53393


git-svn-id: http://core.svn.wordpress.org/trunk@52982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-12 17:57:17 +00:00
audrasjb
96c26acafd Taxonomy: Set use_desc_for_title to false by default in wp_list_categories()
This change removes the default `title` attribute of category links returned by `wp_list_categories()`, for better accessibility.

Props just0nequestion, joyously, andrija, audrasjb, sabernhardt.
Fixes #55530.
See #24766.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-12 14:06:21 +00:00
Sergey Biryukov
f4d9778c98 Menus: Replace "drop down" (noun) with "dropdown" in a few strings.
This makes the spelling more consistent with other instances of the word in core.

Follow-up to [23844], [27676].

Props NekoJonez, mukesh27, SergeyBiryukov.
Fixes #55661.
Built from https://develop.svn.wordpress.org/trunk@53391


git-svn-id: http://core.svn.wordpress.org/trunk@52980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-11 13:22:15 +00:00
audrasjb
3a48bc354d Twenty Twenty-One: i18n fix for privacy policy section title.
This change makes the Twenty Twenty-One privacy policy section title translatable.

Props nlpro.
Fixes #55709.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-11 08:46:17 +00:00
hellofromTonya
88a16c0ad7 Editor: Use stricter assertions in comment template tests.
Backport of the remaining Comment Template block tests from Gutenberg:

* `assertEquals()` replaced with `assertSameSetsWithIndex()`.
* assertion's argument order changed to ensure expected and then actual.

Follow-up to [53353], [53298], [53172], [53138].

Props bernhard-reiter.
Fixes #55708.
Built from https://develop.svn.wordpress.org/trunk@53388


git-svn-id: http://core.svn.wordpress.org/trunk@52977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 21:30:11 +00:00
ryelle
e8c02840a7 Administration: Update design of the Dashboard welcome panel.
This updates the panel to match the 6.0 About page styles, with the 6.0 graphic changing color based on the selected admin color scheme.

Props fcoveram, critterverse, joedolson, SergeyBiryukov.
Fixes #55532.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 16:45:08 +00:00
ryelle
8817bba1bf Help/About: Update the About section for 6.0.
Switch the images to use the s.w.org CDN. Update the font style and spacing on the About page. Update the header images for Credits, Freedoms, and Privacy.

Props fcoveram, peterwilsoncc, SergeyBiryukov.
Fixes #55434.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 16:33:08 +00:00
gziolo
8f952495a7 Editor: Update WordPress packages for 6.0 RC 2 (part 2)
Includes cherry-picked commit from the Gutenberg plugin that fix a bug discovere just before WordPress 6.0 RC 2.

Props hellofromtonya, zieladam, kebbet.
See #55567.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 15:57:28 +00:00
gziolo
6a989e83f6 Editor: Update WordPress packages for 6.0 RC 2
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovere after WordPress 6.0 RC 1.

Props zieladam, ndiego, hellofromtonya.
See #55567.



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


git-svn-id: http://core.svn.wordpress.org/trunk@52966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 14:49:35 +00:00
Sergey Biryukov
cb2d81f6df Coding Standards: Restore the $pieces variable for SQL clauses in query classes.
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.

Follow-up to [52974], [53175], [53370], [53375].

Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53376


git-svn-id: http://core.svn.wordpress.org/trunk@52965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 11:21:09 +00:00
Sergey Biryukov
4959a268c3 Coding Standards: Restore the $pieces variable in WP_Query::get_posts().
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.

Follow-up to [52974], [53175], [53370].

Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53375


git-svn-id: http://core.svn.wordpress.org/trunk@52964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 11:17:14 +00:00
Peter Wilson
1dff8e7973 Users: Improve WP_User_Query tests following [53362].
Props SergeyBiryukov.
See #53177.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 05:49:11 +00:00
Peter Wilson
8545c4493b Media: Remove error suppression in wp_filesize().
Replace error suppressing in `wp_filesize()` with a `file_exists()` check before calling the native PHP `filesize()` function.

Follow up to [52837].

Props Cybr, johnbillion, spacedmonkey, antpb, azouamauriac, ironprogrammer, mukesh27, costdev, audrasjb, dlh.
Fixes #55678.
See #49412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 05:02:11 +00:00
Sergey Biryukov
6aa2e2c123 Tests: Move get_inline_data() tests to a more appropriate place.
Since this is an admin template function and the tests check for specific output with certain taxonomy parameters, placing the tests along with other tests for the functions in the same file should make them easier to find and extend than when placed between general taxonomy registration tests.

Follow-up to [52841], [53368].

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


git-svn-id: http://core.svn.wordpress.org/trunk@52960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-09 17:58:13 +00:00
Sergey Biryukov
ad517e9c12 Query: Restore late compact() call for the posts_clauses_request filter.
This addresses a backward compatibility break where `posts_join_request` and other filters were applied, but their results were subsequently discarded and earlier values were used instead.

Follow-up to [52974], [53175].

Props 5um17, johnbillion, SergeyBiryukov.
Fixes #55699.
Built from https://develop.svn.wordpress.org/trunk@53370


git-svn-id: http://core.svn.wordpress.org/trunk@52959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-09 13:51:15 +00:00
Peter Wilson
a5e2970995 Quick/Bulk Edit: Additional tests for showing taxonomies.
Additional tests to ensure taxonomies show in the quick/bulk edit froms based on the `show_in_quick_edit` setting rather than the the `show_ui` setting.

Follow up to [52841,31307].

Props figureone, costdev, audrasjb.
Fixes #49701.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-09 00:34:11 +00:00
Peter Wilson
70e7eec175 Script Loader: Explain why i18n prevents concatenation.
Add inline comment to `WP_Scripts::do_item()` explaining why the definition of a text domain prevents concatenation.

Follow up to [53360].

Fixes #55628.
Props SergeyBiryukov.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-08 23:59:11 +00:00
Sergey Biryukov
32c0cfe3b3 Code Modernization: Rename parameters to match native PHP functions in wp-includes/compat.php.
This ensures that parameter names for PHP polyfills in WordPress core 100% match the native PHP parameter names. Otherwise using named parameters with those functions could cause fatal errors for installs where the polyfills kick in.

This commit:
* Renames the `$string` parameter to `$message` in `_()` polyfill.
* Renames the `$str` parameter to `$string` in `mb_substr()` and `mb_strlen()` polyfills.
* Renames the `$raw_output` parameter to `$binary` in `hash_hmac()` polyfill.
* Renames the `$a` and `$b` parameters to `$known_string` and `$user_string` in `hash_equals()` polyfill.
* Renames the `$var` parameter to `$value` in `is_countable()` and `is_iterable()` polyfills.
* Renames the `$arr` parameter to `$array` in `array_key_first()` and `array_key_last()` polyfills.

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].

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


git-svn-id: http://core.svn.wordpress.org/trunk@52954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-08 00:29:14 +00:00
Sergey Biryukov
8c8b0a203a Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/template.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 `$parent` parameter to `$parent_page` in `parent_dropdown()`.

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].

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


git-svn-id: http://core.svn.wordpress.org/trunk@52953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-07 17:16:13 +00:00
Sergey Biryukov
8f805f4ddd Coding Standards: Remove extra space in wp-admin/admin-ajax.php.
Props rajeshraval786, costdev.
Fixes #55692.
Built from https://develop.svn.wordpress.org/trunk@53363


git-svn-id: http://core.svn.wordpress.org/trunk@52952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-07 16:21:18 +00:00
Peter Wilson
f6ef37b050 Users: Allow any DB field to be returned by WP_User_Query.
Restore behaviour of `fields` parameter in `WP_User_Query` to allow developers to specify any database field to be returned either individually or as part of a subset. Add these fields to the documentation.

When a subset of `fields` includes the `id` paramater, include it in the results in both upper and lowercase to maintain backward compatibility.

Follow up to [53327].

Props dd32, pbearne, kraftbj, peterwilsoncc.
Fixes #53177.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-07 03:32:11 +00:00
Peter Wilson
b27a924101 Script Loader: Fix i18n edge case breaking dependencies.
Prevent concatenation of scripts if the text domain is defined to ensure the dependency order is respected. 

This accounts for an edge case in which replacing a core script via a plugin and a lack of translations (eg, for a US English site) could cause the JavaScript files to be ordered incorrectly.

Follow up to [52937].

Props audrasjb, boniu91, chaion07, costdev, hellofromtonya, jsnajdr, mukesh27, ndiego, ugyensupport.
Fixes #55628.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-07 02:53:11 +00:00
John Blackbourn
9afce5d0af Build/Test Tools: Allow the local development environment to run on Apple M1 machines without requiring local configuration changes.
The `amd64/mysql` and `amd64/mariadb` official images from Docker are compatible with x86 running on the ARM64v8 architecture of M1 machines.

Props afragen, justinahinon, desrosj, talldanwp, antonvlasenko, gziolo, aristath, johnbillion

Fixes #52356

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


git-svn-id: http://core.svn.wordpress.org/trunk@52947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-06 17:16:11 +00:00
Sergey Biryukov
b230f10cf5 Tests: Improve the logic of the SECURITY.md test to check all supported versions.
This avoids a test failure if the list of supported WordPress versions is updated before the trunk version is bumped for a new major release.

Follow-up to [47403], [53347].

Fixes #55667.
Built from https://develop.svn.wordpress.org/trunk@53357


git-svn-id: http://core.svn.wordpress.org/trunk@52946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-06 11:11:15 +00:00
Sergey Biryukov
7997df84a8 Site Health: Remove unused variables in WP_Site_Health::get_test_plugin_version().
Follow-up to [44986].

Props david.binda, mukesh27.
Fixes #55683.
Built from https://develop.svn.wordpress.org/trunk@53355


git-svn-id: http://core.svn.wordpress.org/trunk@52944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-05 16:29:08 +00:00
ryelle
686a22802b Help/About: Add link to 6.0 Field Guide, fix missing placeholder in string.
Props audrasjb.
Follow-up to [53339].
See #55434.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-05 15:35:10 +00:00
hellofromTonya
7acc6d1682 Editor: Add unit test for Comment Template block.
Backport of 2 tests from Gutenberg for the Comment Template block:

* test line and paragraph breaks are converted into HTML tags.
* test rendering of unapproved comment preview.

Follow-up to [53298], [53172], [53138].

Props bernhard-reiter, darerodz, gziolo, peterwilsoncc, hellofromTonya. 
Fixes #55643.
See #55634.
Built from https://develop.svn.wordpress.org/trunk@53353


git-svn-id: http://core.svn.wordpress.org/trunk@52942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-05 15:29:16 +00:00
Peter Wilson
a34abb93b7 Quick/Bulk Edit: Remove duplicate HTML IDs.
Rename `#inline-edit-legend` to avoid duplicate HTML IDs. These have been renamed `#quick-edit-legend` and `#bulk-edit-legend` for the quick and bulk editors respectively.

This HTML ID is not required by the quick editor duplicated via JavaScript so is removed as part of the duplication process.

Follow up to [53096].

Props azaozz, costdev, greglone, hellofromtonya, ironprogrammer, joedolson, sabernhardt.
Fixes #55575.
See #35483.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-05 03:26:16 +00:00
Sergey Biryukov
18c2eaa8c0 Build/Test Tools: Pass GitHub Actions environment variables to the Docker container.
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to the `GITHUB_REF` and `GITHUB_EVENT_NAME` variables, so that some tests can be skipped when appropriate.

Additionally, account for renaming the `master` branch to `trunk` in November 2021.

Follow-up to [40241], [46999], [49264], [49267], [51868].

Fixes #55668.
Built from https://develop.svn.wordpress.org/trunk@53349


git-svn-id: http://core.svn.wordpress.org/trunk@52938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-04 00:40:11 +00:00
hellofromTonya
0ea8ac36ba Build/Test Tools: Ensure version number is in 'X.X' format after float math: Tests_Basic::test_security_md().
After subtracing `0.1` from a `X.1` current version, the result was a single digit without the `.0` decimal. Using `number_format()` ensures each current version has a decimal before appending the `.x` before the test.

This commit also reverts [55346] which was a temporary workaround.

Follow-up to [55346], [47403].
Fixes #55667.
Built from https://develop.svn.wordpress.org/trunk@53347


git-svn-id: http://core.svn.wordpress.org/trunk@52936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 18:57:08 +00:00
Sergey Biryukov
68bcc2cbef Tests: Temporarily disable the test for "Supported Versions" section of GitHub Security Policy.
The test needs to be adjusted to handle major version changes correctly.
Built from https://develop.svn.wordpress.org/trunk@53346


git-svn-id: http://core.svn.wordpress.org/trunk@52935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 18:16:08 +00:00
Sergey Biryukov
9cf0633789 Build/Test Tools: Add the 6.0 branch to the workflow for testing branches.
Built from https://develop.svn.wordpress.org/trunk@53345


git-svn-id: http://core.svn.wordpress.org/trunk@52934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 17:44:08 +00:00
Sergey Biryukov
c583043223 Trunk is now 6.1-alpha.
Built from https://develop.svn.wordpress.org/trunk@53344


git-svn-id: http://core.svn.wordpress.org/trunk@52933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 17:40:10 +00:00
Sergey Biryukov
61f74edbb3 Security: Update the Security Policy to include WordPress 6.0.
Built from https://develop.svn.wordpress.org/trunk@53342


git-svn-id: http://core.svn.wordpress.org/trunk@52931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 17:34:09 +00:00
Sergey Biryukov
9efd001e48 Post WordPress 6.0 RC1 version bump.
Built from https://develop.svn.wordpress.org/trunk@53341


git-svn-id: http://core.svn.wordpress.org/trunk@52930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 17:15:10 +00:00
Sergey Biryukov
638a31b8d3 WordPress 6.0 RC1
Built from https://develop.svn.wordpress.org/trunk@53340


git-svn-id: http://core.svn.wordpress.org/trunk@52929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 16:46:09 +00:00
ryelle
7bd9548322 Help/About: Update the About section for 6.0.
This is the start of the WordPress 6.0 about page, introducing new content and a first pass of the new style.

Props fcoveram, estelaris, JeffPaul, critterverse, chanthaboune, dansoschin, webcommsat, annezazu, marybaum, cbringmann, eidolonnight, laurlittle, sergeybiryukov.
See #55434.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 16:28:09 +00:00
hellofromTonya
e9267bf3ee Editor: Update WordPress packages for 6.0 RC1.
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 Beta 4.

Props gziolo, zieladam, ndiego.

See #55567.
Built from https://develop.svn.wordpress.org/trunk@53338


git-svn-id: http://core.svn.wordpress.org/trunk@52927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 15:00:36 +00:00
audrasjb
4de4330b17 General: Add missing strong tag to some error messages.
This changeset adds missing `strong` tag to some error messages and updates some AJAX messages, for better consistency.

Follow-up to [53118].

Props NekoJonez, audrasjb, ocean90.
Fixes #54437.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 14:53:09 +00:00
hellofromTonya
7b880889bc Editor: Sets 'paged' query arg only when there are comments: build_comment_query_vars_from_block().
A SQL syntax error happened when a post has no comments and "Break comments into pages" is checked in Settings > Discussion. The fix sets the `'paged'` query arg only when there are comments. When there are no comments, `WP_Comment_Query` sets the default `'paged'` value to `1`.

Props bernhard-reiter, luisherranz, czapla, cbravobernal, davidbaumwald, hellofromTonya.

Follow-up to [53142], [53138].
Fixes #55658.
Built from https://develop.svn.wordpress.org/trunk@53336


git-svn-id: http://core.svn.wordpress.org/trunk@52925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 14:33:12 +00:00
Sergey Biryukov
0c9c1d5297 Post WordPress 6.0 Beta 4 version bump.
Built from https://develop.svn.wordpress.org/trunk@53335


git-svn-id: http://core.svn.wordpress.org/trunk@52924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 16:44:10 +00:00
Sergey Biryukov
26d851eefe WordPress 6.0 Beta 4.
Built from https://develop.svn.wordpress.org/trunk@53334


git-svn-id: http://core.svn.wordpress.org/trunk@52923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 16:10:10 +00:00
hellofromTonya
1cca8be49f REST API: Fixes /wp/v2/pattern-directory/patterns endpoint response for slug parameter.
[53218] introduced a bug of a wrong response from the `wp/v2/pattern-directory/patterns` endpoint with a `slug` parameter. As the response is cached, it can result in an incorrect list of available patterns supported by the current theme.

This commit resolves by:

* Limiting the `slug` to an `array` in the query parameters.
* When set, parsing and sorting the slug(s) and then serializing the sorted query args as part of the hashed transient keys.

Props antonvlasenko, timothyblynjacobs, spacedmonkey, costdev, hellofromTonya.

Follow-up to [53218], [53152], [51208].
Fixes #55617.
Built from https://develop.svn.wordpress.org/trunk@53333


git-svn-id: http://core.svn.wordpress.org/trunk@52922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 14:00:09 +00:00
audrasjb
9d10c963ff Docs: Correct parameter types for serialize_block() and serialize_blocks().
This changeset clarifies the expected type for the first parameter passed to `serialize_block()` and `serialize_blocks()` functions.

Props manooweb.
Fixes #55648.
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 13:32:08 +00:00
Sergey Biryukov
9c76c77398 Docs: Remove @return void from various DocBlocks.
Per the documentation standards, it should not be used outside of the default bundled themes.

Follow-up to [38767], [47055], [49697], [50956], [51003], [52069], [53255].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@53331


git-svn-id: http://core.svn.wordpress.org/trunk@52920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 13:13:08 +00:00
Sergey Biryukov
056bbc95ea Docs: Improve plugin_install_action_links filter's docs.
Refer developers to `plugins_api()` for array of plugin data.

Follow-up to [53074], [53328].

Props afragen, pbiron.
See #55480.
Built from https://develop.svn.wordpress.org/trunk@53330


git-svn-id: http://core.svn.wordpress.org/trunk@52919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 13:07:14 +00:00
gziolo
afd35d1958 Editor: Update WordPress packages for 6.0 Beta 4
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovere after WordPress 6.0 Beta 3.

Props zieladam, ndiego, darerodz.
See #55567.



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


git-svn-id: http://core.svn.wordpress.org/trunk@52918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 10:39:04 +00:00
Peter Wilson
0fcdd744c1 Plugins: Improve plugin_install_description filter's docs.
Refer developers to `plugins_api()` for array of plugin data.

Props afragen, pbiron, SergeyBiryukov, costdev.
Fixes #55480.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 02:46:11 +00:00
Peter Wilson
4a7bcc14e4 Users: Validate WP_User_Query's fields argument.
Improve validation of `WP_User_Query`'s `fields` argument when passed as an array to ensure it only accepts permitted values. This prevents the invalid values being included in the generated database query.

Expand unit tests to include passing invalid values as part of an array, the lower case value `id`. Correct earlier unit tests to limit database query to one result.

Follow up to [53255].

Props felipeelia.
Fixes #53177.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 00:14:29 +00:00
Sergey Biryukov
8267fdc9a2 Tests: Add unit tests for some XML-RPC functions:
* `xmlrpc_getposttitle()`
* `xmlrpc_getpostcategory()`
* `xmlrpc_removepostdata()`

Props pbearne, audrasjb, costdev, SergeyBiryukov.
Fixes #53490.
Built from https://develop.svn.wordpress.org/trunk@53326


git-svn-id: http://core.svn.wordpress.org/trunk@52915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 00:13:12 +00:00
audrasjb
403f9d53f1 Coding standards: Remove extra spaces in docblocks of the Walker_PageDropdown class.
Follow-up to [51779].

See #54728.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-01 22:01:10 +00:00
audrasjb
df39328035 Docs: Clarify the name and description of some parameters in the Walker class.
Follow-up to [53323].
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-01 21:47:10 +00:00
audrasjb
9df9561ce9 Docs: Docblock adjustements in the Walker class.
This changeset ensures third-person singular verbs are used for function descriptions in the `Walker` class, and adjusts some non-standard docblock descriptions for various properties and methods of the class.

See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-01 21:41:12 +00:00
Sergey Biryukov
c36f700fda Coding Standards: Remove extra alignment level in the data provider for wp_validate_boolean() tests.
Follow-up to [46159], [46224], [52775], [52776], [52777].

See #54725, #54728.
Built from https://develop.svn.wordpress.org/trunk@53322


git-svn-id: http://core.svn.wordpress.org/trunk@52911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-01 16:24:14 +00:00
Sergey Biryukov
83c7440590 Tests: Add unit tests for wp_fuzzy_number_match().
Props pbearne, costdev, mukesh27, hellofromTonya, SergeyBiryukov.
Fixes #54239.
Built from https://develop.svn.wordpress.org/trunk@53321


git-svn-id: http://core.svn.wordpress.org/trunk@52910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-01 16:13:19 +00:00