Commit Graph

20100 Commits

Author SHA1 Message Date
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