Commit Graph

33808 Commits

Author SHA1 Message Date
Sergey Biryukov
b23baf4ce7 Tests: Delete Link Manager plugin after running REST API plugins controller tests.
After running the multisite PHPUnit test suite, the following files remained, contributing towards a dirty working copy:
{{{
tests/phpunit/data/plugins/link-manager/link-manager.php
tests/phpunit/data/plugins/link-manager/readme.txt
}}}
These files should be deleted after running the tests.

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

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

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


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

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

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

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


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

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

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

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

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


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

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


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

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

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


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

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

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

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


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

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


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

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


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

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

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


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

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

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


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

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

Follow-up to [52042].

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


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

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

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

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


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

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

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


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


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


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

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

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

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


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

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


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

See #55646

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


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

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


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

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

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


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


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


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

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


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

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


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

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

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

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


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

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

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

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


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

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

Follow-up to [48141].

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


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

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

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


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

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

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

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

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


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

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


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

Follow-up to [54211].

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

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


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

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

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

Follow up to [54234].

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


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


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

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

Follow up to [53560].

Props johnjamesjacoby, johnbillion.
Fixes #54541.


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


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

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

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

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

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

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

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

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

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

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

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

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

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


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

Props kebbet.
Fixes #56405.

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


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

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


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