Commit Graph

37324 Commits

Author SHA1 Message Date
Sergey Biryukov ed37f855ce External Libraries: Update the SimplePie library to version 1.8.0.
The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility ([https://github.com/simplepie/simplepie/pull/875 PR 875], [https://github.com/simplepie/simplepie/pull/888 PR 888]) from the `one-dot-eight` branch of SimplePie, which is expected to be [https://github.com/simplepie/simplepie/pull/886 released as SimplePie 1.8.1] soon.

References:
* [https://github.com/simplepie/simplepie/releases/tag/1.8.0 SimplePie 1.8.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.7.0 SimplePie 1.7.0 release notes]
* [https://github.com/simplepie/simplepie/releases/tag/1.6.0 SimplePie 1.6.0 release notes]
* [https://github.com/simplepie/simplepie/compare/1.5.8...1.8.0 Full list of changes in SimplePie 1.8.0]

Follow-up to [47733], [49176], [52393], [52413].

Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See #55604.
Built from https://develop.svn.wordpress.org/trunk@59141


git-svn-id: http://core.svn.wordpress.org/trunk@58537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 22:50:19 +00:00
desrosj e86563760f Upgrade/Install: Indicate JPEG XL support when checking upgrades.
This adds tracking of the JPEG XL image type support alongside WebP, HEIC, and AVIF image types when requesting an upgrade from WordPress.org.

This will check for JPEG XL support in both ImageMagick and GD, even though GD technically does not yet have support for JPEG XL.

Props deepakrohilla, swissspidy, dd32, ayeshrajans, samiamnot, joemcgill.
Fixes #62050.
Built from https://develop.svn.wordpress.org/trunk@59140


git-svn-id: http://core.svn.wordpress.org/trunk@58536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 22:33:15 +00:00
joedolson 0768f8071b Media: Hide sidebar in Create Gallery when no actions available.
Check whether the media frame menu has action items. If not, hide the sidebar. Prevents showing a sidebar that looks interactive but contains no controls that are interactive. When in Create Gallery mode, the only action available is 'Create Gallery', and it is always active.

Props ukdrahul, ababir, ruchirj, nhrrob, joedolson, shailu25, mukesh27, sudipatel007, dhrumilk.
Fixes #60666.
Built from https://develop.svn.wordpress.org/trunk@59139


git-svn-id: http://core.svn.wordpress.org/trunk@58535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 22:22:17 +00:00
joedolson df3ba33621 Login and Registration: Add descriptive `h1` on login screens.
Add an `h1` heading with the existing `login_header()` text string on each view of the login screen. Mark the existing `h1`, used to wrap the WordPress logo, with `role="presentation"`, to remove it from the headings hierarchy.

Props roytanck, joedolson, ryokuhi, sabernhardt, pamprn, nagpai, mukesh27.
Fixes #51786.
Built from https://develop.svn.wordpress.org/trunk@59138


git-svn-id: http://core.svn.wordpress.org/trunk@58534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 19:12:14 +00:00
desrosj 3d8e08adf8 Build/Test Tools: Regenerate `script-loader-packages.min.php`.
Follow up to [59135].

See #62137.
Built from https://develop.svn.wordpress.org/trunk@59137


git-svn-id: http://core.svn.wordpress.org/trunk@58533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 18:48:19 +00:00
desrosj 755ed721c2 Build/Test Tools: Update/Audit NPM dependencies.
This updates several `devDependencies` to their latest versions:
- `autoprefixer` (`10.4.20`)
- `cssnano` (`7.0.6`)
- `grunt-contrib-qunit` (`10.1.1`)
- `grunt-webpack` (`7.0.0`)
- `postcss` (`8.4.47`)
- `qunit` (`2.22.0`)
- `sass` (`1.79.4`)
- `uuid` (`10.0.0`)
- `wait-on` (18.0.1`)

Also included are two minor updates to bundled dependencies:
- `json2php` (`0.0.9`)
- `wicg-inert` (`3.1.3`).

After applying these updates, `npm audit fix` and `grunt precommit:css` were run.

See #62137.
Built from https://develop.svn.wordpress.org/trunk@59135


git-svn-id: http://core.svn.wordpress.org/trunk@58531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 18:36:17 +00:00
joedolson 0a4679908b Quick/Bulk Edit: Add notice if no items selected.
Add an error notice if a user attempts to apply bulk edits with no items selected. Applies to post lists, comments, taxonomies, and plugins screens.

Props garrett-eclipse, nrqsnchz, sumitsingh, nihar007, royho, sabernhardt, oglekler, quadthemes, ankit-k-gupta, fnpen, ukdrahul, joedolson.
Fixes #45006, #58479.
Built from https://develop.svn.wordpress.org/trunk@59134


git-svn-id: http://core.svn.wordpress.org/trunk@58530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 18:24:13 +00:00
hellofromTonya 543ac83971 Canonical: Revert redirect when front page's paginated states not found.
r59091 introduced a backward compatibility (BC) break for a static homepage that includes a shortcode's or block's with paginated content that uses the `'paged'` query var, e.g. bbPress.

In this use case, attempting to navigate the shortcode / block's pagination causes a canonical redirect, rather than navigating to the next page of content within that shortcode or block.

Follow-up to [59091].

Props davidbinda, jjj.
See #50163, #meta5184.
Built from https://develop.svn.wordpress.org/trunk@59133


git-svn-id: http://core.svn.wordpress.org/trunk@58529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 18:18:16 +00:00
Felix Arntz fbcb084305 Editor: Allow registering PHP manifest file for block metadata collections for enhanced performance.
Typically, when registering a new block type, its metadata is read from the provided `block.json` file. The more block types are registered on a site, the more costly becomes this process, as it involves filesystem reads and parsing JSON.

WordPress Core's built-in blocks have in the past worked around that by having a auto-generated PHP manifest file that includes the already parsed JSON data for all blocks. This changeset effectively allows plugins to do the same, by introducing a new API function `wp_register_block_metadata_collection()`. The WordPress Core block manifest is now handled using this API as well, rather than custom logic baked into `register_block_type_from_metadata()`.

The `wp_register_block_metadata_collection()` function requires two parameters:
* `$path`: The base path in which block files for the collection reside.
* `$manifest`: The path to the manifest file for the collection.

Every `block.json` file that is supposed to be part of the collection must reside within the provided `$path`, within its own block-specific directory matching the block name (without the block namespace). For example, for a collection `$path` of `/wp-content/plugins/test-plugin` and a block `test-plugin/testimonial`, the block file could be `/wp-content/plugins/test-plugins/blocks/testimonial/block.json`.

It is recommended that plugins use the new API function for enhanced performance, especially if they register several block types. However, the use of the function is entirely optional. Not using it will not result in any difference in user-facing behavior.

Props mreishus, flixos90, gziolo, spacedmonkey, azaozz, mukesh27.
Fixes #62002.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 17:08:26 +00:00
czapla 5e72f32f5c Interactivity API: Add `wp_interactivity_get_element()` function.
Introduces the `wp_interactivity_get_element()` function to the Interactivity API, analogous to the `getElement()` function in the `@wordpress/interactivity` JavaScript module. This function allows access to the current element being processed during directive processing.

The function returns an array containing the `attributes` property, which includes only the originally defined attributes present on the element. Attributes added or modified by directive processing are not included. This is intended for use in derived state properties inside `wp_interactivity_state()`, similar to how `wp_interactivity_get_context()` is used.

Example usage:

```php
wp_interactivity_state( 'myPlugin', array(
    'buttonText' => function() {
        $context = wp_interactivity_get_context();
        $element = wp_interactivity_get_element();
        return isset( $context['buttonText'] )
          ? $context['buttonText']
          : $element['attributes']['data-default-button-text'];
    },
) );
```

Includes unit tests to cover the new functionality.

Props darerodz, swissspidy, cbravobernal, czapla.
Fixes #62136.
Built from https://develop.svn.wordpress.org/trunk@59131


git-svn-id: http://core.svn.wordpress.org/trunk@58527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 17:07:13 +00:00
czapla 245519d952 Interactivity API: Move interactivity-router i18n strings to Script Module data.
Moves the 'loading' and 'loaded' i18n strings for the `interactivity-router` to the script module data via the `script_module_data_@wordpress/interactivity-router` filter.

Key changes:

- Add the `filter_script_module_interactivity_router_data()` method, hooked into the `script_module_data_@wordpress/interactivity-router` filter, to set the `i18n` data with the 'loading' and 'loaded' messages.
- Rename the `print_router_loading_and_screen_reader_markup()` method to `print_router_markup()` and remove the screen reader markup from it because it's no longer needed.
- Deprecate the `print_router_loading_and_screen_reader_markup()` method.
- Remove the `loading` and `loaded` strings from the `core/router` store state because they're no longer needed.
- Initialize the `core/router` store with a minimal navigation object to prevent errors in the interactivity-router script module when the store is not properly initialized.
- Update corresponding unit tests to reflect these changes.

This change ensures that the `interactivity-router` i18n messages are localized in a single place and removes the need to initialize them in the `core/router` store state.

Props jonsurrell, swissspidy, czapla, gziolo.
See #60647.
Built from https://develop.svn.wordpress.org/trunk@59130


git-svn-id: http://core.svn.wordpress.org/trunk@58526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 16:18:17 +00:00
desrosj c2580f3c20 External Libraries: Update the Moment library to version `2.30.1`.
The Moment.js project is in maintenance mode, so the changes in this update are minor.

Props manooweb, rishit30g.
Fixes #60516.
Built from https://develop.svn.wordpress.org/trunk@59129


git-svn-id: http://core.svn.wordpress.org/trunk@58525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 16:14:22 +00:00
Pascal Birchler b771c0ddc9 I18N: Switch locale to admin locale when sending admin notifications.
If sending an email to the site administrator's email address, look up if a user with the same email exists and switch to that user's locale.
If not, falls back to the site locale as usual.

Props benniledl, swissspidy, mukesh27.
Fixes #61518.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 15:52:15 +00:00
Pascal Birchler 48f12f72df I18N: Emit warnings if loading translations too early.
Some plugins and themes load translations too early, before the current user is known.
This happens either explicitly or through just-in-time translation loading.

If the current user (and thus their locale) is not known, WordPress might attempt to load translations in the wrong locale.

This change adds `_doing_it_wrong` messages to warn about such cases. It also helps avoiding accidentally trying to load translations twice (once just-in-time and once manually).

Projects triggering such a message are encourage to load translations no earlier than the `after_setup_theme` hook.

Props garrett-eclipse, Kau-Boy, swissspidy, johnbillion, alanfuller. rodelgc.
Fixes #44937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 15:30:20 +00:00
Pascal Birchler ed16539779 I18N: Fix script languages path for themes.
Remove hardcoded path added in [57922] which ignored the fact that themes can also use script translations.
They should not be affected even if plugins are installed outside the typical `wp-content/plugins` location. 

Props itapress, swissspidy.
Fixes #62016.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 14:59:18 +00:00
Sergey Biryukov 251e520c33 Docs: Add a `@since` note to `map_meta_cap()` for `edit_block_binding` capability.
Follow-up to [59122].

See #61608.
Built from https://develop.svn.wordpress.org/trunk@59125


git-svn-id: http://core.svn.wordpress.org/trunk@58521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 13:48:16 +00:00
Bernhard Reiter 1b6e00c306 Block Hooks: Respect `"multiple": false` in hooked blocks.
If a prospective hooked block has its `multiple` block-supports field set to `false` (thus allowing only one instance of the block to be present), ensure that:

1. Only one instance of the block will be inserted if it's not yet present in the current context.
2. The block will not be inserted at all if an instance of it is already present in the current context.

As always in Block Hooks parlance, "context" denotes the containing template, template part, pattern, or navigation post that a hooked block is supposed to be inserted into.

The markup of a webpage that uses a Block Theme typically comprises a number of such contexts -- one template and any number of template parts, patterns, and navigation posts. Note that the limitation imposed by this changeset only applies on a per-context basis, so it's still possible that the resulting page contains more than one instance of a hooked block with `"multiple": false` set, as each context could contribute up to one such instance.

Props bernhard-reiter, jonsurrell, gziolo.
Fixes #61902.
Built from https://develop.svn.wordpress.org/trunk@59124


git-svn-id: http://core.svn.wordpress.org/trunk@58520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 12:23:17 +00:00
John Blackbourn 6cf0577be8 Role/Capability: Introduce the `user_can_for_blog()` function.
This complements the existing user capability checking functions and enables checking a capability of any user on any site on a Multisite network.

Props tmanoilov, rajinsharwar, n8finch, johnbillion

Fixes #45197
Built from https://develop.svn.wordpress.org/trunk@59123


git-svn-id: http://core.svn.wordpress.org/trunk@58519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 11:05:15 +00:00
cbravobernal 81a6eddf77 Block bindings: Add canUpdateBlockBindings editor setting.
Adds a `canUpdateBlockBindings` editor setting that allows to decide if the user is able to create and modify bindings through the UI. By default, only admin users can do it, but it can be overridden with `block_editor_settings_all` filter.

Props santosguillamot, gziolo, jorbin, noisysocks, matveb, cbravobernal, youknowriad, mamaduka, timothyblynjacobs, peterwilsoncc, drivingralle.
Fixes #61945.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 06:49:18 +00:00
Peter Wilson 76afc20e4e General: Delete `tests/phpunit/tests/formatting/wpTargetedLinkRel.php`.
Really delete `tests/phpunit/tests/formatting/wpTargetedLinkRel.php` this time rather than leaving it hanging around as an empty file.

Follow up to [59120].

Props noisysocks.
See #53843


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


git-svn-id: http://core.svn.wordpress.org/trunk@58517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 05:29:17 +00:00
Peter Wilson 8c3dd2eb88 General: Remove `noopener` from links opening in a new tab.
Removes the automatic addition of `rel="noopener noreferrer"` from links targeting a new tab or window, `target='_blank'`. Since this was introduced, supported browsers have changed their security policies and no longer allow the opened link to have JavaScript access to the previous tab.

Deprecates:

* `wp_targeted_link_rel()`
* `wp_targeted_link_rel_callback()`
* `wp_init_targeted_link_rel_filters()`: converted to a noop function
* `wp_remove_targeted_link_rel_filters()`: converted to a noop function

The deprecated functions are retained in `formatting.php` as in `SHORTINIT` mode the file is included while `deprecated.php` is not.

This also removes the `noopener` from links hard coded within the WordPress dashboard linking to documentation and other resources.

Props audrasjb, azaozz, dhruval04, dorzki, neo2k23, presskopp, sabernhardt, swissspidy, tobiasbg.
Fixes #53843.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 05:19:16 +00:00
noisysocks cf877c686b Editor: Update packages for 6.7 Beta 1.
Syncs `@wordpress/*` packages to the `wp-6.7` npm tag.

See #61906.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 05:11:31 +00:00
Peter Wilson b7d4ca5298 Media: Add short-circuit filter to `attachment_url_to_postid()`.
Introduces the filter `pre_attachment_url_to_postid` to allow developers to short-circuit the function `attachment_url_to_postid()`.

The return values are expected to be an attachment ID, zero (`0`) to indicate no attachment was found or `null` to indicate the function should proceed as usual.

The function performs an expensive database query so developers making use of the function frequently may wish to use a custom table with appropriate indexes to reduce the load on their database server.

Props antpb, apermo, audrasjb, joedolson.
Fixes #61383.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 03:19:17 +00:00
Peter Wilson a03401429b Editor: Prevent direct access to `/wp-includes/blocks/index.php`.
Adds a check for `ABSPATH` to the top of the `/wp-includes/blocks/index.php` file and prevents the file from loading if it is not defined.

This prevents the file from throwing errors when accessed directly.

Props khokansardar, mukesh27.
Fixes #62108.
See #60352.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 01:56:14 +00:00
Peter Wilson 849b0c0e5e Build/Test Tools: Re-order assertion parameters query block tests.
Corrects the order of the expected and actual values in several tests of the `build_query_vars_from_query_block()` function.

See #61530.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 01:31:17 +00:00
Peter Wilson 998a74eb6f REST API/Editor: Support post formats in Query Block & Posts API.
Introduces post format support for both the Query Block with the new parameter `format`. In the `build_query_vars_from_query_block()` function, this is converted to a `post_format` taxonomy query passed to `WP_Query`.

Also introduces the `format` parameter to the REST API's Posts controller to support the feature in the Query block. The parameter type is an enumerated  string accepted the post formats supported by each post type.

Props poena, mukesh27, mamaduka, noisysocks, TimothyBlynJacobs.
Fixes #62014.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 01:19:16 +00:00
Sergey Biryukov 8838465b5e Date/Time: Use numeric input for `touch_time()` fields.
This aims to make it easier to enter digits in datetime text fields on mobile devices, instead of opening the full keyboard.

Follow-up to [43], [1506], [2998], [3648], [6078], [6989], [7285], [7338], [20168], [20217], [28730], [32945], [49283].

Props sabernhardt.
Fixes #62109.
Built from https://develop.svn.wordpress.org/trunk@59114


git-svn-id: http://core.svn.wordpress.org/trunk@58510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-29 22:49:16 +00:00
joedolson 1d13bc7bff Accessibility: Clarify `aria-label` in pagination links.
Change posts and comments pagination `nav` regions to have an aria-label of "Posts pagination" and "Comments pagination", respectively. This provides improved context for the numeric links contained within these regions and differentiates between posts navigation regions and posts pagination regions.

Props michaelbourne, sabernhardt, afercia, xyulex, webmandesign, tirth03, joedolson.
Fixes #54260.
Built from https://develop.svn.wordpress.org/trunk@59113


git-svn-id: http://core.svn.wordpress.org/trunk@58509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-28 23:36:13 +00:00
joedolson 0820aefa32 Code Standards: Correct @since reference in `get_user()`.
Change `@since` from 6.7 to 6.7.0, per coding standards. Follow-up to [59111].

Props joedolson, peterwilsoncc.
See #35124.
Built from https://develop.svn.wordpress.org/trunk@59112


git-svn-id: http://core.svn.wordpress.org/trunk@58508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-28 23:20:17 +00:00
joedolson dfa14f95bb Users: Add `get_user()` alias.
Add `get_user()` as an alias for `get_user_by( 'id', $user_id )`. Add `get_user()` to `user.php` so it is not a pluggable function. Bring parity with other standard `get_` functions for a more intuitive developer experience.

Props sc0ttkclark, kushang78, joedolson, peterwilsoncc.
Fixes #35124.
Built from https://develop.svn.wordpress.org/trunk@59111


git-svn-id: http://core.svn.wordpress.org/trunk@58507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-28 23:08:18 +00:00
Sergey Biryukov cfc609eb3e Twenty Fifteen: Document the `$more` parameter in `twentyfifteen_excerpt_more()`.
Follow-up to [30237], [30569].

Props pitamdey, sabernhardt.
See #62079.
Built from https://develop.svn.wordpress.org/trunk@59110


git-svn-id: http://core.svn.wordpress.org/trunk@58506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-28 15:09:17 +00:00
hellofromTonya 029f97976d Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation in TestXMLParser::parse().
PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing).
The recommended replacements are either to use exceptions or to do a hard `exit`.

As this is a test-only class, do not have to take BC-breaks into account.

Also, as this is a test helper, throwing a exception is the most appropriate solution.

Reference:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error

Follow-up to [25002].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 20:00:16 +00:00
hellofromTonya b6b862529b Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation in WP_Test_Stream::open().
PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing).
The recommended replacements are either to use exceptions or to do a hard `exit`.

As this is a test-only class, do not have to take BC-breaks into account.

Also, as this is a test helper, throwing a exception is the most appropriate solution.

Reference:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error

Follow-up to [49230].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 19:53:22 +00:00
hellofromTonya 9160482cf3 Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation in wp_trigger_error().
PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing). The recommended replacements are either to use exceptions or to do a hard `exit`.

WP has its own `wp_trigger_error()` function, which under the hood calls `trigger_error()`. If passed `E_USER_ERROR` as the `$error_level`, this will hit the PHP 8.4 deprecation.

Now, there were basically three options:
* Silence the deprecation until PHP 9.0 and delay properly solving this until then. This would lead to an awkward solution, as prior to PHP 8.0, error silencing would apply to all errors, while, as of PHP 8.0, it will no longer apply to fatal errors. It also would only buy us some time and wouldn't actually solve anything.

* Use `exit($status)` when `wp_trigger_error()` is called with `E_USER_ERROR`. This would make the code untestable and would disable handling of these errors via custom error handlers, which makes this an undesirable solution.

* Throw an exception when `wp_trigger_error()` is called with `E_USER_ERROR`. This makes for the most elegant solution with the least BC-breaking impact, though it does open it up to the error potential being "caught" via a `try-catch`. That's not actually a bad thing and is likely to only happen for those errors which can be worked around, in which case, it's a bonus that that's now possible.

The third option is implemented which:
* Introduces a new `WP_Exception` class.
* Starts using `WP_Exception` in the `wp_trigger_error()` function when the `$error_level` is set to `E_USER_ERROR`.

This change is covered by pre-existing tests, which have been updated to expect the exception instead of a PHP error.

Why not use `WP_Error`?

Well, for one, this would lead to completely different behaviour (BC).

As `WP_Error` doesn't extend `Exception`, the program would not be stopped, but would continue running, which would be a much bigger breaking change and carries security risks. `WP_Error` also doesn't natively trigger displaying/logging of the error message, so in that case, it would still need an `exit` with the error message, bringing us back to point 2 above.

Introducing `WP_Exception` provides (essentially) the same behaviour in that it retains the fatal error and error message displaying/logging behaviors. It also introduces a base Exception class, from which future exception classes can extend.

References:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
* https://www.php.net/manual/en/migration80.incompatible.php

Follow-up to [56530].

Props jrf, hellofromTonya.
See #62061.
Built from https://develop.svn.wordpress.org/trunk@59107


git-svn-id: http://core.svn.wordpress.org/trunk@58503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 19:28:14 +00:00
hellofromTonya e97af52b4f Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation in Text_Diff_Op::reverse().
PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing).
The recommended replacements are either to use exceptions or to do a hard `exit`.

This is an unmaintained external dependency; thus, the fix is made in the WP specific copy of the dependency.

As `trigger_error()` call looks to be a remnant of the PHP 4 era before a class could be declared as `abstract`, fixed by making both the method as well as the class `abstract` and removing the call to `trigger_error()`.

Ref:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
* https://www.php.net/manual/en/migration80.incompatible.php

Follow-up to [7747].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 18:19:17 +00:00
hellofromTonya 65d27642af Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation in Text_Diff::_check().
PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing). The recommended replacements are either to use exceptions or to do a hard `exit`.

This is an unmaintained external dependency; thus, the fix is made in the WP specific copy of the dependency.

Now, there were basically three options:
* Silence the deprecation until PHP 9.0 and delay properly solving this until then.
    This would lead to an awkward solution, as prior to PHP 8.0, error silencing would apply to all errors, while, as of PHP 8.0, it will no longer apply to fatal errors.
    It also would only buy us some time and wouldn't actually solve anything.
* Use `exit($status)`.
    This would make the code untestable and would disable handling of these errors via custom error handlers, which makes this an undesirable solution.
* Throw an exception.
    This makes for the most elegant solution with the least BC-breaking impact.

The third option is implemented which:
* Introduces a new `Text_Exception` class.
* Starts using that in the `Text_Diff::_check()` method in all applicable places.
* Adds tests for the first two error conditions.

References:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
* https://www.php.net/manual/en/migration80.incompatible.php

Follow-up to [59070], [52978], [7747].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 17:53:19 +00:00
dmsnell c41e36b3c4 WP_Debug_Data: Formatting update to code in `wp-dropins` method.
Resolves an indentation issue introduced while extracting the `wp-dropins` data into a separate method from the main `debug_data()` method.

Developed in https://github.com/wordpress/wordpress-develop/pull/7446
Discussed in https://core.trac.wordpress.org/ticket/61648

Follow-up to [59100].

Props mukesh27.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 16:37:18 +00:00
Sergey Biryukov 11e422b785 Twenty Nineteen: Remove trailing spaces in DocBlocks.
Follow-up to [59102].

Props mukesh27.
See #62112.
Built from https://develop.svn.wordpress.org/trunk@59103


git-svn-id: http://core.svn.wordpress.org/trunk@58499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 16:25:14 +00:00
Sergey Biryukov d6a8139302 Twenty Nineteen: Add more missing documentation for helper function parameters.
Follow-up to [59090].

Props viralsampat.
See #62112.
Built from https://develop.svn.wordpress.org/trunk@59102


git-svn-id: http://core.svn.wordpress.org/trunk@58498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 16:13:22 +00:00
Bernhard Reiter 020fde0d1d Block Hooks: `apply_block_hooks_to_content` in Patterns, Templates.
In the Patterns registry, use `apply_block_hooks_to_content` (introduced in [58291])  instead of the `WP_Block_Patterns_Registry` class's private `get_content` method. (The latter is removed as part of this changeset.)

In a similar vein, use `apply_block_hooks_to_content` in the `_build_block_template_result_from_file` and `_build_block_template_result_from_post` functions, respectively.

For that to work, `apply_block_hooks_to_content` is amended to inject the `theme` attribute into Template Part blocks, even if no hooked blocks are present.

This kind of centralization is required as a preparation for #61902.

Props bernhard-reiter, jonsurrell.
See #61902.
Built from https://develop.svn.wordpress.org/trunk@59101


git-svn-id: http://core.svn.wordpress.org/trunk@58497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 09:20:18 +00:00
dmsnell c73731e74e WP_Debug_Data: Extract `wp-dropins` data into separate method.
This is the seventh part in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other.

This patch separates the seventh of twelve groups, the `wp-dropins` info, into a separate method focused on that data.

This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code.

Developed in https://github.com/wordpress/wordpress-develop/pull/7418
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 05:58:18 +00:00
dmsnell ed654177cd HTML API: Switch to HTML namespace when entering Integration Points.
When encountering inline SVG and MathML content in an HTML document, there are certain "integration points" which transition back into the HTML parsing ruleset. Previously, the HTML API was incorrectly switching into the namespace of the element transitioning into that ruleset.

In this patch, the correct transition is made, where all integration points refer to HTML rules, while non-integration points refer to the rules of the namespace corresponding to the token itself.

Developed in https://github.com/wordpress/wordpress-develop/pull/7425
Discussed in https://core.trac.wordpress.org/ticket/61576

Props dmsnell, jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-27 00:44:19 +00:00
czapla d5c6e455e8 Revert [59097] because it was renaming a public method that should be deprecated instead.
Built from https://develop.svn.wordpress.org/trunk@59098


git-svn-id: http://core.svn.wordpress.org/trunk@58494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-26 19:37:22 +00:00
czapla 8786fe5da6 Interactivity API: Move interactivity-router i18n strings to Script Module data.
Moves the 'loading' and 'loaded' i18n strings for the `interactivity-router` to the script module data via the `script_module_data_@wordpress/interactivity-router` filter.

Key changes:

- Add the `filter_script_module_interactivity_router_data()` method, hooked into the `script_module_data_@wordpress/interactivity-router` filter, to set the `i18n` data with the 'loading' and 'loaded' messages.
- Rename the `print_router_loading_and_screen_reader_markup()` method to `print_router_markup()` and remove the screen reader markup from it because it's no longer needed.
- Remove the `loading` and `loaded` strings from the `core/router` store state because they're no longer needed.
- Initialize the `core/router` store with a minimal navigation object to prevent errors in the interactivity-router script module when the store is not properly initialized.
- Update corresponding unit tests to reflect these changes.

This change ensures that the `interactivity-router` i18n messages are localized in a single place and removes the need to initialize them in the `core/router` store state.

Props jonsurrell, swissspidy, czapla. 
See #60647.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-26 17:55:13 +00:00
Sergey Biryukov 8f95d7bc14 Administration: Escape the WordPress.org URL in `wp-admin/admin-footer.php`.
Follow-up to [5892], [5955], [10976], [17879], [21366], [27469], [45927].

Props ramswarup, narenin, swissspidy.
Fixes #62118.
Built from https://develop.svn.wordpress.org/trunk@59096


git-svn-id: http://core.svn.wordpress.org/trunk@58492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-26 15:41:14 +00:00
cbravobernal 23e8ce70f0 Block bindings: Ensure block receives __default bindings when render.
Fixes an issue with the image block when using pattern overrides, where the image block with overrides enabled was not outputting all the expected image attributes. Ensures that the `process_block_bindings` method returns any updates to the block's binding metadata along with other computed attributes.

Props talldanwp, cbravobernal, santosguillamot, mukesh27, gziolo.

Fixes #62069.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-26 14:51:18 +00:00
audrasjb 5e4a97f589 Help/About: Add plugin dependencies help tab on Plugins screen.
This changeset adds a help tab added about plugin dependencies on the Plugins screen.

Follow-up to [57545].

Fixes #60466.
See #22316.
Props desrosj, swissspidy, adarshposimyth, audrasjb, NekoJonez, DorZki, Boniu91, Ankit-K-Gupta, sigurdwatt.
Built from https://develop.svn.wordpress.org/trunk@59094


git-svn-id: http://core.svn.wordpress.org/trunk@58490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-26 13:50:16 +00:00
gziolo c338d57273 Editor: Default attribute value not used with `get_block_wrapper_attributes`
Ensures that the default values defined in the schema for block attributes are used when rendering the output of the block with `get_block_wrapper_attributes` helper.

Props gziolo, jonsurrell, youknowriad, ryelle.
Fixes #62114.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-26 12:47:16 +00:00
Andrew Ozz a8af90bcd1 Administration: Fix increasing of the frequency of Heartbeat API requests.
Props peterwilsoncc, azaozz.
Fixes #61960.
Built from https://develop.svn.wordpress.org/trunk@59092


git-svn-id: http://core.svn.wordpress.org/trunk@58488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-25 20:51:14 +00:00
hellofromTonya 0f1eaa6ca3 Canonical: Redirect when front page's paginated states not found.
Perform a canonical redirect for an invalid pagination request of a static front page.

When a site has a static front page assigned and that page has a `<!--nextpage-->` within its content, previously accessing non-existing pages (e.g. `example.com/page/3/`) did not redirect or return a 404 or 301. This changeset resolves that issue by performing a canonical redirect.

Unit tests are also included for this specific use case and to ensure the fix does not affect a blog listing home page.

Follow-up to [47738], [47727], [34492].

Props dd32, audrasjb, chaion07, hellofromTonya, joemcgill, lukecarbis, Mte90, mukesh27, peterwilsoncc, rajinsharwar, SergeyBiryukov. 
Fixes #50163.
See meta#5184.
Built from https://develop.svn.wordpress.org/trunk@59091


git-svn-id: http://core.svn.wordpress.org/trunk@58487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-25 19:37:19 +00:00