Commit Graph

50355 Commits

Author SHA1 Message Date
Aaron Jorbin df9b79e4cd Bootstrap/Load: Prevent loopback scraping errors when there is no key or nonce.
For error detection and rollback functions WordPress also starts a loopback request to the homepage. This loopback request is made with special parameters that when they don't match, generates an erorr. This hardens that flow by exiting out of the check if the nonce or key is missing or the nonce is not saved in the DB. It further hardens it by not caching the failures and asking search engines not to index the url with the failures.

Props georgwordpress, swissspidy, jorbin.
Fixes #62105.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 17:36:16 +00:00
Felix Arntz 245dde2107 Build/Test Tools: Resolve access failure to continue sending commit performance data to Code Vitals dashboard.
This originally broke in [58165] and unfortunately went unnoticed for a while because the failing request to send the data did not cause the GitHub workflows to fail. This changeset resolves the underlying access problem, which was happening because reusable GitHub workflows do not automatically receive secrets from the calling workflow. More concretely, the relevant `CODEVITALS_PROJECT_TOKEN` was not being explicitly passed to the reusable workflow.

The changeset also includes a change so that in the future a failing request would cause the workflow to fail, which ensures a similar problem further down the road wouldn't go unnoticed.

Props joemcgill, flixos90, swissspidy, mukesh27, sergeybiryukov
Fixes #62153.
See #61213.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 16:26:12 +00:00
desrosj 8e0fa6ebc7 Build/Test Tools: Clean up PR comments after action is taken.
There’s now a number of automated comments left on pull requests to help contributors that a PR can easily be overridden with activity.

Some of the comments are only relevant until a specific action is taken. One such comment is for informing the PR author that a link to a Trac ticket is a requirement for considering any suggested changes.

This updates the pull request comment workflow to remove the comment once a link to a Trac ticket is properly included.

Props debarghyabanerjee.
Fixes #61567.
Built from https://develop.svn.wordpress.org/trunk@59169


git-svn-id: http://core.svn.wordpress.org/trunk@58564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 15:37:14 +00:00
desrosj a5ad3c3b4b Build/Test Tools: Enable testing for PHP 8.4.
With PHP 8.4 due out in November later this year, contributors have been working on ensuring WordPress 6.7 is as compatible as possible. Enough progress has been made during this release cycle where PHPUnit tests now run successfully with no failures reported.

This change enables PHP 8.4 testing throughout Core’s GitHub Action workflows to ensure no new problems are introduced going forward.

There are two exceptions to this:
- The Importer plugin has some compatibility issues that produce test failures. There is an open pull request upstream, but these problematic tests have been marked skipped when running on PHP 8.4 until that PR is merged.
- Since no stable versions of xDebug with PHP 8.4 support have been published, these tests are also skipped for now.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 14:09:17 +00:00
desrosj fa4a735408 Build/Test Tools: Limit when install testing runs.
In most cases, running the installation testing workflow in forked repositories is unnecessary and wasteful. This adds conditions to that workflow to prevent the tests from running on forks unless a pull request is being made back to that fork.

This pattern is already used across other workflows.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 13:24:12 +00:00
desrosj 3b57824722 Coding Standards: Committing changes after `composer format`.
This commits some minor changes made when running `composer format`.

Follow up to [58975], [59011], [59115].
See #61103, #62014, #61648.
Built from https://develop.svn.wordpress.org/trunk@59166


git-svn-id: http://core.svn.wordpress.org/trunk@58561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 13:19:17 +00:00
Sergey Biryukov 331ebada37 Docs: Use typed array notation for the `$attrs` parameter in `links_add_base_url()`.
Follow-up to [8540], [32590], [46596].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 11:04:17 +00:00
dmsnell 4f3db72338 WP_Debug_Data: Normalize visibility of new methods.
In ongoing work to modularize the `WP_Debug_Data` class, several methods were added with `public` visibility. This patch sets the new methods to `private` as a measure to ensure optionality as the changes progress, since it's easier to move from private to public than the other way around.

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

Follow-up to [58830], [58855], [58964], [59002], [59011], [59060], [59100].

Props apermo, jonsurrell.
Fixes #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 00:11:19 +00:00
Sergey Biryukov 3208c28c07 Tests: Bring some consistency to `links_add_base_url()` and `links_add_target()` tests.
Includes:
* Correcting the test class name as per the naming conventions.
* Documenting data provider values using hash notation.
* Passing the `$attrs` parameter to the function if not `null`.

Follow-up to [26328], [55563], [59162].

See #61530.
Built from https://develop.svn.wordpress.org/trunk@59163


git-svn-id: http://core.svn.wordpress.org/trunk@58558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-03 23:44:19 +00:00
Peter Wilson 0c217f9cf3 Tests/Build Tools: Introduce tests for `links_add_base_url()`.
Props pbearne, rajinsharwar, jorbin, mukesh27, aristath, desrosj, ironprogrammer.
Fixes #60389.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-03 23:18:19 +00:00
joedolson 3de3fb8c83 Administration: Switch core post type labels to `add_new_item`.
In [56515], the default value of `Add New` was changed to "Add New Post / Add New Page". This caused problems with post types where `add_new` was not declared.

Change core usage to reference the `add_new_item` value and revert the default value of `add_new` back to "Add New / Add New". This retains the accessibility advantages without creating counter intuitive usage of the `add_new` key.

With this change, post types registered with no `add_new` key will be unimpacted in core, and post types registered with no `add_new_item` key will use the default "Add New Post", which is not a change from the current state.

Props smerriman, afercia, rcreators, joedolson, eclev91, johnbillion.
Fixes #60045.
Built from https://develop.svn.wordpress.org/trunk@59161


git-svn-id: http://core.svn.wordpress.org/trunk@58556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-03 22:46:15 +00:00
joedolson 9fd5f24d73 Administration: A11y: Clarify settings in discussion options.
Fix several settings groups in the discussion options that were written in a compound/sentence structure format. These formats are difficult to parse for screen reader users and have significant layout problems in mobile viewports.

Change settings to use independent labeling.

Props Cheffheid, anthakkar08, DrewAPicture, afercia, jwgoedert, sannevndrmeulen, sudipatel007, tirth03, joedolson.
See #31354.
Built from https://develop.svn.wordpress.org/trunk@59160


git-svn-id: http://core.svn.wordpress.org/trunk@58555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-03 21:28:18 +00:00
Peter Wilson 92d9e70f84 General: Expand use of `wp_get_wp_version()`.
Expands the use of `wp_get_wp_version()` to get an unmodified value of the current WordPress version in various locations in which it would be unhelpful if a plugin has modified the global `$wp_version`.

This includes:

* Theme and plugin compatibility tests
* During the upgrade process of WP Core
* Debug and site health data reports of the current version
* Version number display in the dashboard
* Block theme export and caching utilities
* The `WPDB` class

Props peterwilsoncc, hellofromtonya.
See #61627.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-03 00:25:15 +00:00
Sergey Biryukov 49ed36d717 Twenty Fourteen: Fix various PHPCS issues.
* Inline comments must end in full stops, exclamation marks, or question marks.
* There must be exactly one blank line after the file comment.

Follow-up to [24832], [25023], [25088], [25090], [25213], [51045].

Props pitamdey, dhruvang21, aristath.
Fixes #62098.
Built from https://develop.svn.wordpress.org/trunk@59158


git-svn-id: http://core.svn.wordpress.org/trunk@58553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-02 19:03:19 +00:00
Pascal Birchler f63068d5ba I18N: Do not load translations directly in `load_*_textdomain`.
In [59127], `_doing_it_wrong` warnings were added if plugins or themes load translations too early, either through a manual function call or just-in-time loading.

Because many plugins and themes still manually call `load_plugin_textdomain()`, `load_theme_textdomain()` or `load_muplugin_textdomain()`, even though they don't have to anymore, that caused a lot of warnings.

With this new approach, these functions merely register the translations path in the existing `WP_Textdomain_Registry` and do not immediately try to load the translations anymore. The loading is all handled by the just-in-time functionality.

This way, warnings will only be emitted if triggering the just-in-time loading too early, greatly improving the developer experience and to a degree also performance.

Props swissspidy, sergeybiryukov, mukesh27.
See #44937.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-02 13:44:17 +00:00
joedolson 9a1570e024 Revert [59139] due to broad side effects in media library.
The change in [59139] caused all media modal menus to disappear.

Unprops joedolson.
See #60666.
Built from https://develop.svn.wordpress.org/trunk@59156


git-svn-id: http://core.svn.wordpress.org/trunk@58551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 18:46:16 +00:00
Sergey Biryukov 46b25e1302 Site Health: Adjust display of the `DB_COLLATE` and `WP_ENVIRONMENT_TYPE` constants.
Includes: 
* Simplifying the logic and bringing some consistency to how the values are checked and displayed.
* Correcting the debug value for `DB_COLLATE`. This should be the actual contents of the constant, and empty if it is indeed empty, as the debug data that's copied and shared should represent the raw value, and does not need to be in a user-readable format.

Follow-up to [45782], [52021], [54239], [59147].

Props Clorith, SergeyBiryukov.
See #58265.
Built from https://develop.svn.wordpress.org/trunk@59155


git-svn-id: http://core.svn.wordpress.org/trunk@58550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 17:59:17 +00:00
cbravobernal 18f992af83 Script Modules: prevent broken links by using includes_url.
[59083] introduced an issue where Script Modules registered src does not correctly respect the includes path.

Before that change, script modules were registered using includes_url. The patch used a hard-coded path which breaks when sites are not served from the root, e.g. the site root is https://example.com/wp instead of https://example.com/.

Follow-up to [59083].

Props nendeb55, jonsurrell, cbravobernal.

Fixes #62146.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 17:25:14 +00:00
czapla 9b1e0766f7 Interactivity API: Fix code formatting and add better types in docstrings.
Follow-up to [62136].

Props swissspidy.
Fixes #62149.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 17:21:20 +00:00
noisysocks 3dfff23c24 Post WordPress 6.7 Beta 1 version bump.
Built from https://develop.svn.wordpress.org/trunk@59152


git-svn-id: http://core.svn.wordpress.org/trunk@58547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 04:39:16 +00:00
Peter Wilson ad49ea6424 Bundled Themes: Follow up import of Twenty Twenty-Five.
Add additional references to the new default theme required in various locations of the code base, build steps and unit tests.

Follow up to [59146].

Props afragen, dd32, desrosj, davidbaumwald, jorbin, courane01, kirasong.
See #62103.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 03:27:15 +00:00
noisysocks 261188f723 WordPress 6.7 Beta 1.
Built from https://develop.svn.wordpress.org/trunk@59149


git-svn-id: http://core.svn.wordpress.org/trunk@58545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 02:17:17 +00:00
noisysocks 0e5b9a0eb4 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@59148


git-svn-id: http://core.svn.wordpress.org/trunk@58544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 01:18:28 +00:00
Aaron Jorbin 9171d921f4 Site Health: Note when DB_COLLATE is defined but empty.
Right now, for example if DB_COLLATE is defined as '', the value will not be shown in the WordPress Constants list, there's just an empty space. This adds a message so it's clearer when the constant is empty.

Props Presskopp, brobken, Clorith.
Fixes #58265.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-01 01:12:17 +00:00
Peter Wilson 6c1b7e5db8 Bundled Themes: Initial import of the Twenty Twenty-Five default theme.
It's a new dawn, it's a new day.
It's a new default theme for 2025.
And I'm feeling good.

Props poena, karmatosed, onemaggie, juanfra, garethelwell, joen, beafialho, richtabor, noruzzaman, shailu25, kishanjasani, up1512001, ajlende, huzaifaalmesbah, kafleg, dballari, lastsplash, jennifarhat, amjadr360, rejaulalomkhan, oncecoupled, devmuhib, tanvirul, arkenon, elfu98, erichmond, kardi420, ktaron, melchoyce, maneshtimilsina, jorbin, ritterml, eherman24, vcanales, ikamal, bobbyleenoblestudios, germanfrelo, kraftbj, mcrisp1972, peterwilsoncc, luminuu, eliorivero, jeherve, fac3less, alexandrebuffet.
Fixes #62103.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 23:58:16 +00:00
Adam Silverstein 28cc273c2b Media: improve support for lossless WebP.
When uploading lossless WebP images, WordPress now correctly outputs lossless WebP with both the Imagick and GD image editors.

Props: adamsilverstein, martinkrcho.
Fixes #60291.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 23:56:19 +00:00
Peter Wilson 0d0634dbc9 Formatting: Improve parenthesis handling in `make_clickable()`.
Improve the regular expression for making links clickable to account for parenthesis in links containing an extension, for example: `http://wordpress.org/my-image(2).jpg`.

Props coquardcyr, hellofromtonya, parthvataliya, rhellewellgmailcom.
Fixes #62037.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 23:29:13 +00:00
Sergey Biryukov eba0127372 External Libraries: Correct the case for `wp-includes/SimplePie/src/Gzdecode.php`.
The file should be named `Gzdecode.php` (with the capital G), to avoid autoloading problems on case-sensitive file systems (*nix).

Follow-up to [59141].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 23:27:19 +00:00
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