Commit Graph

37561 Commits

Author SHA1 Message Date
Andrew Ozz 847bac4a16 General: Do not use the new `wp_get_wp_version()` in `update-core.php` and `class-core-upgrader.php`.
All functions that are used there must be present in both the previous version being upgraded from, and the later version that's being installed (e.g. when rolling back Core) as these files are used in both.

Props djennez, SergeyBiryukov, jorbin, peterwilsoncc, azaozz.
Fixes #62165.
See 61627.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 22:51:16 +00:00
joedolson 22e082f627 Menus: Remove redundant `title` attributes.
Omit `title` attributes if they are defined but are the same text as the menu item title, either before or after filtering. If a navigation menu filter makes significant changes to the menu title without changing the title attribute, this will still remove them. The cases where this occurs and the title attribute is still a useful value will be very uncommon, however.

Props hareesh-pillai, audrasjb, sabernhardt, afercia, sergeybiryukov, tirth03, joedolson.
Fixes #51299.
Built from https://develop.svn.wordpress.org/trunk@59179


git-svn-id: http://core.svn.wordpress.org/trunk@58574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 22:31:09 +00:00
joedolson 80bc458694 Revert [59177].
This was the wrong version of the patch.

Unprops @joedolson.
Built from https://develop.svn.wordpress.org/trunk@59178


git-svn-id: http://core.svn.wordpress.org/trunk@58573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 22:29:19 +00:00
joedolson ebe4e43d1c Menus: Remove redundant `title` attributes.
Omit `title` attributes if they are defined but are the same text as the menu item title, either before or after filtering. If a navigation menu filter makes significant changes to the menu title without changing the title attribute, this will still remove them. The cases where this occurs and the title attribute is still a useful value will be very uncommon, however.

Props hareesh-pillai, audrasjb, sabernhardt, afercia, sergeybiryukov, tirth03, joedolson.
Fixes #51299.
Built from https://develop.svn.wordpress.org/trunk@59177


git-svn-id: http://core.svn.wordpress.org/trunk@58572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 22:10:17 +00:00
dmsnell c729cbf501 WP_Debug_Data: Extract `wp-themes` data into separate methods.
This is the last 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 findal set of twelve groups, the `wp-active-theme`, `wp-parent-theme`, and `wp-themes-inactive` info, into a separate methods focused on those 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/7507
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
Fixes #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 19:23:15 +00:00
dmsnell f2282f68c0 WP_Debug_Data: Extract `wp-paths-sizes` data into separate methods.
This is the tenth 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 eleventh of twelve groups, the `wp-paths-sizes` 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/7445
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 16:28:14 +00:00
dmsnell 761869935d WP_Debug_Data: Extract `wp-core` data into separate methods.
This is the ninth 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 tenth of twelve groups, the `wp-core` 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/7357
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 15:59:17 +00:00
Sergey Biryukov b970720c83 Twenty Sixteen: Fix PHPCS issues.
There must be exactly one blank line after the file comment.

Follow-up to [40851].

Props pitamdey, umeshsinghin, sabernhardt, mukesh27, nithins53, deepakrohilla, viralsampat.
Fixes #62160.
Built from https://develop.svn.wordpress.org/trunk@59173


git-svn-id: http://core.svn.wordpress.org/trunk@58568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-05 09:45:17 +00:00
dmsnell 510017d313 WP_Debug_Data: Extract `wp-plugins` data into separate methods.
This is the eighth 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 eighth and ninth of twelve groups, the `wp-plugins-active` and `wp-plugins-inactive` info, into separate methods focused on that data.

Unlike the other patches in this series, the plugins data comes from a single source and is separated out into separate debug sections, so the active and inactive methods call a new shared method which provides raw data for both. Optimizations and refactors may occur in follow-up tickets.

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/7458
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-04 22:12:17 +00:00
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
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
Sergey Biryukov 254251d7c6 Twenty Nineteen: Add missing documentation for helper function parameters.
Follow-up to [43808], [44149], [47214], [47242].

Props pitamdey.
Fixes #62112.
Built from https://develop.svn.wordpress.org/trunk@59090


git-svn-id: http://core.svn.wordpress.org/trunk@58486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-25 18:08:17 +00:00
czapla 7f7d48df61 Script Loader: Add `@wordpress/a11y` as a Script Module.
The Script Module has the same API as the `wp-a11y` WP Script.

Key changes:
- Add `@wordpress/a11y` to the list of Script and Module dual packages.
- Update `script-modules-packages.min.php` to include the a11y module.
- Modify `WP_Script_Modules` class to track and handle a11y module availability.
- Add method to print required HTML markup for a11y `speak()` functionality.

See #60647.
Props jonsurrell, gziolo, czapla.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-25 16:51:16 +00:00
czapla 621d0a47e8 Revert [59087] due to empty commit message
Built from https://develop.svn.wordpress.org/trunk@59088


git-svn-id: http://core.svn.wordpress.org/trunk@58484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-25 16:34:16 +00:00
czapla d8e532f388 Built from https://develop.svn.wordpress.org/trunk@59087
git-svn-id: http://core.svn.wordpress.org/trunk@58483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-25 15:57:15 +00:00
Sergey Biryukov 9178c75ac6 Build/Test Tools: Only require the WordPress Importer plugin when running core tests.
This allows other users of the WordPress unit test suite framework to run their own unit tests without needing the WordPress Importer plugin, which should only be a requirement if running core tests.

Follow-up to [59085].

Props bjorsch.
Fixes #62106.
Built from https://develop.svn.wordpress.org/trunk@59086


git-svn-id: http://core.svn.wordpress.org/trunk@58482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-24 19:17:13 +00:00
Sergey Biryukov 970609c393 Build/Test Tools: Check if the WordPress Importer plugin is installed in test bootstrap.
If a hard requirement for the test suite is not fulfilled, running the tests should be blocked from the test bootstrap. A test should only fail when it doesn't produce the expected result.

Since the WordPress Importer plugin is considered a hard requirement for the test suite at this time, this commit moves the check whether the plugin is installed from individual tests to the test bootstrap.

Includes defining a global constant for the path to the file for reuse in the tests.

Reference: [https://make.wordpress.org/core/handbook/contribute/git/#unit-tests Core Contributor Handbook: The Code Repository (Git): Unit Tests].

Follow-up to [40531], [40532], [41090], [41169], [48592], [49535], [49571].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-24 18:11:16 +00:00
TimothyBlynJacobs e612354728 App Passwords: Don't prevent non-unique App Password names.
In [50030] we enforced that Application Passwords have unique names. This was done with the assumption that applications would not connect to a user multiple times. However, in practice we've seen applications run into issues with the unique name constraint. Depending on the app, they may not know if they've been authorized before, or they may intentionally allow connecting multiple times. To prevent friction, App developers need to make their App Name unique, and in doing so often include things like the current date & time, which is already included in the App Passwords list table.

This commit removes this requirement to simplify usage of the Authorize Application flow.

Props mark-k, Boniu91, timothyblynjacobs, peterwilsoncc.
Fixes #54213.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-24 16:40:17 +00:00
gziolo 0dd5a7eb4e Build: Prepare for more Script Modules
This is a companion to https://github.com/WordPress/gutenberg/pull/65460 that requires syncing in WordPress Core. Namely, the block-library changes require registration with their updated script module IDs so that the blocks continue to work correctly.

They key improvement is script modules registration is handled in one central place, and a combined asset file is used to improve the performance by avoiding multiple disk operations for every individual file.

Props jonsurrell, gziolo, wildworks, noisysocks.
See #60647, #59462.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-24 07:35:17 +00:00
Sergey Biryukov 682c23179a Build/Test Tools: Prevent Composer lock file from being created.
Composer 1.10.0 introduced a `lock` config option, which, when set to `false` will prevent a `composer.lock` file from being created and will ignore it when one exists.

This is a useful option for packages like WordPress where the `lock` file has no meaning.

It also makes life more straightforward for contributors as they don't have to remember that for this repo they should use `composer update` instead of `composer install`. Both will now work the same.

Reference: [https://getcomposer.org/doc/06-config.md#lock Composer Documentation: Config: lock].
 
Follow-up to [51543].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-23 22:17:17 +00:00
gziolo 24ca39bf89 Comments: Pass $page as argument to comments functions
Removes query alteration from `build_comment_query_vars_from_block` by introducing a new way to pass the `$page` as argument to functions handling pagination for the comments.

Props cybr, santosguillamot, bernhard-reiter, gziolo.
Fixes #60806.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-23 12:50:15 +00:00
gziolo 71a4092291 Block Bindings: Adds context needed by sources during its processing
Extends block context during block bindings processing. This implies that the context is extended ONLY for the blocks where bindings are defined and only when rendered on the page.

Props santosguillamot, gziolo, artemiosans, cbravobernal.
Fixes #61642.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-23 12:35:15 +00:00
noisysocks 3bb03c7654 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@59079


git-svn-id: http://core.svn.wordpress.org/trunk@58475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-23 06:52:26 +00:00
Sergey Biryukov 82c0168bbd Editor: Respect `show_avatars` option in block editor and Customizer.
This adds checks for the `show_avatars` option before setting the avatar for post lock modals in the block editor and the Customizer.

Follow-up to [41839], [53070].

Props ffffelix.
Fixes #62081.
Built from https://develop.svn.wordpress.org/trunk@59078


git-svn-id: http://core.svn.wordpress.org/trunk@58474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-22 22:50:18 +00:00
Sergey Biryukov d2c835af27 Editor: Optimize `is_callable()` checks in `traverse_and_serialize_blocks()`.
This aims to improve performance by reducing the number of function calls.

Follow-up to [56644].

Props welcher, Cybr, mukesh27, aristath.
Fixes #62063.
Built from https://develop.svn.wordpress.org/trunk@59077


git-svn-id: http://core.svn.wordpress.org/trunk@58473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-21 14:41:17 +00:00
dmsnell 5b3b3f7df2 HTML API: Add `normalize()` to give us the HTML we always wanted.
HTML often appears in ways that are unexpected. It may be missing implicit tags, may have unquoted, single-quoted, or double-quoted attributes, may contain duplicate attributes, may contain unescaped text content, or any number of other possible invalid constructions. The HTML API understands all fo these inputs, but downline parsers may not, and HTML snippets which are safe on their own may introduce problems when joined with other HTML snippets.

This patch introduces the `serialize()` method on the HTML Processor, which prints a fully-normative HTML output, eliminating invalid markup along the way. It produces a string which contains every missing tag, double-quoted attributes, and no duplicates. A `normalize()` static method on the HTML Processor provides a convenient wrapper for constructing a fragment parser and immediately serializing.

Subclasses relying on the `serialize_token()` method may perform structural HTML modifications with as much security as the upcoming `\Dom\HTMLDocument()` parser will, though these are not
able to provide the full safety that will eventually appear with `set_inner_html()`.

Further work may explore serializing to XML (which involves a number of other important transformations) and adding constraints to serialization (such as only allowing inline/flow/formatting elements and text).

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

Props dmsnell, jonsurrell, westonruter.
Fixes #62036.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-20 22:32:17 +00:00
dmsnell 00dd23da6a HTML API: Add `get_full_comment_text()` method.
Previously, there were a few cases where the modifiable text read from an HTML comment differs slightly from the parsed value of its inner text in a browser. This is due to the specific way that invalid HTML syntax tokens become "bogus comments."

This patch introduces a new method to the Tag Processor to allow differentiating these specific cases, such as when copying or serializing HTML from one source to another. Similar code has already been in use in the html5lib tests, and this patch simplifies the test runner, evidencing the fact that this method was already needed.

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

Props dmsnell, jonsurrell.
See #62036.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-20 20:23:15 +00:00
Sergey Biryukov 5959fb256f Editor: Restore the merging of TinyMCE settings in `wp_tinymce_inline_scripts()`.
This ensures that the function applies the `wp_editor_settings` filter and merges the resulting array with the rest of TinyMCE init settings.

Includes a unit test to verify that the settings are merged correctly after adding the assignment of `array_merge()` result that was missed in the initial commit.

Follow-up to [44265], [59033].

Props kkmuffme, akshat2802, davidbaumwald, SergeyBiryukov.
Fixes #61754.
Built from https://develop.svn.wordpress.org/trunk@59074


git-svn-id: http://core.svn.wordpress.org/trunk@58470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-20 14:09:18 +00:00
noisysocks ef2b22c001 Editor: Add plugin template registration API and improve theme overrides for plugin-registered templates
This commit introduces a new API to allow plugins to easily register block
templates with `wp_register_block_template()` and the
`WP_Block_Templates_Registry` class, addressing the complexity of hooking into
multiple filters. It also ensures plugin-registered templates overridden by
themes fall back to the plugin-provided title and description when the theme
doesn't define them.

See https://github.com/WordPress/gutenberg/pull/61577.
See https://github.com/WordPress/gutenberg/pull/64610.

Fixes #61804.
Props aljullu, peterwilsoncc, antonvlasenko, azaozz, youknowriad, noisysocks.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-20 02:07:12 +00:00
noisysocks f6df3fba16 Editor: Update packages for 6.7 Beta 1.
Syncs `@wordpress/*` packages to the `wp-6.7` npm tag.

Fixes #61906.
Props peterwilsoncc, gziolo, kevin940726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-20 01:55:35 +00:00
Peter Wilson 2086230339 External Libraries: Test registered script versions match package.json.
Expands tests to ensure the version number of packages updated via NPM matches the version number used for registering the script in the script loader.

This adds tests for (by their registered name in WordPress):

* backbone
* clipboard
* hoverIntent
* hoverintent-js
* imagesloaded
* jquery-color
* jquery-core
* jquery-form
* masonry
* react-jsx-runtime
* underscore
* wp-polyfill-dom-rect
* wp-polyfill-element-closest
* wp-polyfill-fetch
* wp-polyfill-formdata
* wp-polyfill-inert
* wp-polyfill-node-contains
* wp-polyfill-object-fit
* wp-polyfill-url


This expands on the earlier tests introduced for:

* lodash
* moment
* react
* react-dom
* regenerator-runtime

An additional test is added to ensure that the data provider for these tests is maintained as libraries are added via package.json.

`@wordpress/*` scripts are excluded from these tests as wp-scripts generates a version number automatically based on the file's contents.

Additionally, the version of element-closest listed in package.json is updated to use a fixed version rather than a range. This reflects the current practice of WordPress to define the specific version in core. For the avoidance of doubt, this does not affect the version shipped in WordPress.

Follow up to [57185].

Props peterwilsoncc, jorbin.
Fixes #61855.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-20 00:52:20 +00:00
hellofromTonya 4ab4b38ecd External Libraries: Skip instanceof check when null in Text_Diff::_check().
On the first `foreach` loop in Text_Diff::_check()`, `$prevtype` is `null`. As `instanceof` requires the class name term to be an object or string, a fatal error is thrown:

>Fatal error: Uncaught Error: Class name must be a valid object or a string on line 279

This change:
* Adds a simple test for the `Text_Diff::_check()` method, which is how the bug was discovered as the test could never pass with the code as-is.

* Adds a defensive guard to protect against the fatal. It checks if `$prevtype` is not `null` as a pre-condition to for checking the instance. This bugfix also resolves the failing test.

Follow-up to [49194], [7747].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-19 20:22:15 +00:00
hellofromTonya b58cc4d2b0 Code Modernization: handle mysqli_ping() deprecation in wpdb::check_connection().
The `mysqli_ping()` function is deprecated as of PHP 8.4, though, in reality, the function wasn't working according to spec anymore since PHP 8.2 when the `libmysql` driver was dropped in favour of `libmysqlnd`, which was already the default (and recommended) driver since PHP 5.4.

The `mysqli_ping()` method was also not really correctly named as its functionality was to reconnect to the database, not just ping.

The alternative is to "manually" ping the database by sending a `DO 1` query (the cheapest possible SQL query).

Adding a PHP version based toggle was considered, but as mentioned above, the default driver has been `libmysqlnd` since PHP 5.4 and in that case, the function never worked anyway, so in reality `mysqli_ping()` was only really functional for the odd custom PHP compilation where `mysqli` was build against `libmysql` AND `reconnect` was not disabled.

With this in mind, this change replaces the call to `mysqli_ping()` with the `DO 1` query completely. If that query succeeds, it concludes the database connection is still alive. This solution should be the most stable as it will work for both PHP 7.2 <= 8.1, independently of which driver `mysqli` was compiled with, as well as for PHP 8.2+.

Note: It could also be considered to remove the function call to `mysqli_ping()` completely and rely on standard error handling in case the connection would have dropped, as after all, the fact that the connection existed at the moment the "ping" happened, is no guarantee that the connection will still exist when the next query is send.... this approach was not chosen so as WP has custom error handling and does not use the PHP native mysqli exceptions for this, which would make implementing this more awkward.

Includes a test to verify that the connection check works when there is a valid connection (this was previously not covered by tests).

Refs:
* https://wiki.php.net/rfc/deprecations_php_8_4#mysqli_ping_and_mysqliping
* https://github.com/php/php-src/pull/11912#issuecomment-1671762583
* https://stackoverflow.com/questions/2546868/cheapest-way-to-determine-if-a-mysql-connection-is-still-alive/2546922#2546922
* php/php-src#11945
* https://wiki.php.net/rfc/mysqli_support_for_libmysql
* https://www.php.net/mysqli_ping

Follow-up to [56475], [27250], [27075].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-19 18:56:16 +00:00
hellofromTonya 854e55b852 Tests: Remove use of E_STRICT.
The `E_STRICT` constant is deprecated as of PHP 8.4 and will be removed in PHP 9.0.

The error level hasn't been in use since PHP 8.0 anyway, so removing the exclusion from the `error_reporting()` setting in the `install.php` script used in the tests should make no difference in practice.

Ref:
* https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant

Follow-up to [25002].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-19 18:14:14 +00:00
Sergey Biryukov 4b9dc0d225 Coding Standards: Update PHPCS to version 3.10.3.
PHPCS has seen several new releases since the last update, which means more bugs have been fixed, syntax support for PHP 8.3 was added, more sniff documentation is available, performance improvements, a new Help screen, etc.

References:
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.10.3 PHP_CodeSniffer 3.10.3 release notes]
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.10.2 PHP_CodeSniffer 3.10.2 release notes]
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.10.1 PHP_CodeSniffer 3.10.1 release notes]
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.10.0 PHP_CodeSniffer 3.10.0 release notes]
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.9.2 PHP_CodeSniffer 3.9.2 release notes]
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.9.1 PHP_CodeSniffer 3.9.1 release notes]

Follow-up to [56695], [56799], [57378], [57986].

Props jrf.
Fixes #62076.
Built from https://develop.svn.wordpress.org/trunk@59067


git-svn-id: http://core.svn.wordpress.org/trunk@58463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-19 12:40:14 +00:00
Sergey Biryukov 345ff42a6a Coding Standards: Remove unused return value for `WP_Object_Cache::__set()`.
This resolves a WPCS warning:
{{{
Assignments must be the first block of code on a line
}}}

Note: This is enforced by PHPCS 3.10.3.

Follow-up to [28521], [29146].

Props jrf.
See #62076, #61607.
Built from https://develop.svn.wordpress.org/trunk@59066


git-svn-id: http://core.svn.wordpress.org/trunk@58462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-19 12:12:16 +00:00
poena ec7041f1c2 Bundled Themes: Make text strings translatable.
This changeset updates Twenty Twenty-Three and Twenty Twenty-Four and replaces text strings in HTML files with patterns to make the strings translatable.

Follow-up to [58459].

Props sabernhardt, karmatosed, iflairwebtechnologies, poena.
Fixes #61951.
Built from https://develop.svn.wordpress.org/trunk@59065


git-svn-id: http://core.svn.wordpress.org/trunk@58461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-19 10:34:13 +00:00
Peter Wilson 2cc6bb80ef Date/Time, PHP Compat: Prevent type errors using GMT offset option.
Prevents a potential type errors when making use of the `gmt_offset` option by casting the value to a float prior to performing calculations with the value.

This mainly accounts for incorrect storage of values, such as an empty string or city name.

Follow up to [58923].

Props chaion07, hellofromtonya, kirasong, mhshohel, mukesh27, nicolefurlan, nihar007, nurielmeni, oglekler, peterwilsoncc, prionkor, rajinsharwar, rarst, rleeson, sabernhardt, SergeyBiryukov, swissspidy, toastercookie, verygoode.
Fixes #56358, #58986, #60629.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 22:37:15 +00:00
hellofromTonya abe6e87596 Code Modernization: Remove xml_set_object() in MagpieRSS::__construct().
The XML Parser extension still supports a quite dated mechanism for method based callbacks, where the object is first set via `xml_set_object()` and the callbacks are then set by passing only the name of the method to the relevant parameters on any of the `xml_set_*_handler()` functions.

{{{
xml_set_object( $parser, $my_obj );
xml_set_character_data_handler( $parser, 'method_name_on_my_obj' );
}}}

Passing proper callables to the `xml_set_*_handler()` functions has been supported for the longest time and is cross-version compatible. So the above code is 100% equivalent to:

{{{
xml_set_character_data_handler( $parser, [$my_obj, 'method_name_on_my_obj'] );
}}}

The mechanism of setting the callbacks with `xml_set_object()` has now been deprecated as of PHP 8.4, in favour of passing proper callables to the `xml_set_*_handler()` functions. This is also means that calling the `xml_set_object()` function is deprecated as well.

This commit fixes this deprecation for the `MagpieRSS::__construct()` method.

The change has not been not covered by tests. This class has been deprecated since WP 3.0.0 and is not covered by tests at all. Adding those now seems superfluous, all the more as the principle of the fix is no different than for the other files, so we can be sure it works anyway.

Note: Though this is "officially" an external library, this package is no longer externally maintained. The code style of the fix in the source file is in line with the existing code style for the file.

Refs:
* https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names
* https://www.php.net/manual/en/function.xml-set-object.php
* https://www.php.net/manual/en/ref.xml.php

Follow-up to [4399].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 21:40:12 +00:00
hellofromTonya 7b0af151b6 Code Modernization: Remove xml_set_object() in AtomParser::parse().
The XML Parser extension still supports a quite dated mechanism for method based callbacks, where the object is first set via `xml_set_object()` and the callbacks are then set by passing only the name of the method to the relevant parameters on any of the `xml_set_*_handler()` functions.

{{{
xml_set_object( $parser, $my_obj );
xml_set_character_data_handler( $parser, 'method_name_on_my_obj' );
}}}

Passing proper callables to the `xml_set_*_handler()` functions has been supported for the longest time and is cross-version compatible. So the above code is 100% equivalent to:

{{{
xml_set_character_data_handler( $parser, [$my_obj, 'method_name_on_my_obj'] );
}}}

The mechanism of setting the callbacks with `xml_set_object()` has now been deprecated as of PHP 8.4, in favour of passing proper callables to the `xml_set_*_handler()` functions. This is also means that calling the `xml_set_object()` function is deprecated as well.

This commit fixes this deprecation for the `AtomParser::parse()` method.

This change is safeguarded via the new `AtomParser_Parse_Test` class.

Notes:
* Though this is "officially" an external library, this package is no longer externally maintained. The code style of the fix in the source file is in line with the existing code style for the file.
* It appears that this class is not actually used by WP Core itself, so it could be considered to deprecate the class. However, as the class is not currently deprecated, safeguarding the change with a test seemed prudent.
* The fixture used for the test reuses a fixture from the original package: https://code.google.com/archive/p/phpatomlib/source/default/source
* The new test class follows the recommended test format (naming convention of the class, `@covers` tag at class level, only testing one method) as per Trac tickets 62004 / 53010.

Refs:
* https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names
* https://www.php.net/manual/en/function.xml-set-object.php
* https://www.php.net/manual/en/ref.xml.php

Follow-up to [5951].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 21:20:15 +00:00
hellofromTonya ef383d7a78 Tests: Use file paths independent of OS-specifics assertion or helper.
Use `WP_UnitTestCase_Base::assertSamePathIgnoringDirectorySeparators()` and `WP_UnitTestCase_Base::normalizeDirectorySeparatorsInPath()` in existing tests.

Follow-up to [59057], [57753], [57215], [56635], [48937], [25002].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 21:06:15 +00:00
dmsnell e7040022b8 WP_Debug_Data: Extract `wp-media` data into separate method.
This is the sixth 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 sixth of twelve groups, the `wp-media` 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/7356
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 19:12:06 +00:00
Drew Jaynes adf9b988e2 Docs: The `$feedname` parameter in `add_feed()` should not start with an underscore.
Props snehapatil02, hellofromtonya, narenin.
Fixes #59945.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 19:08:11 +00:00
hellofromTonya 25b40364d6 Code Modernization: Explicitly declare all properties in AtomParser.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

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

In this case, the property added are explicitly referenced in this class, so fall in the "known property" category.

Refs:
* https://wiki.php.net/rfc/deprecate_dynamic_properties

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


git-svn-id: http://core.svn.wordpress.org/trunk@58454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 18:46:15 +00:00
hellofromTonya dce18de151 Tests: Introduce assertion for comparing file paths independent of OS-specifics.
Introduces `WP_UnitTestCase_Base::assertSamePathIgnoringDirectorySeparators()` and an associated helper method `WP_UnitTestCase_Base::normalizeDirectorySeparatorsInPath()` to allow for comparing two file path strings independently of OS-specific differences.

The normalization is done in a separate method to also allow this method to be used for path normalization within test methods themselves, like for normalizing a group of paths in an array.

The pretty specific method name for the helper (`normalizeDirectorySeparatorsInPath()`) is an attempt to prevent naming conflicts with methods which may exist in plugin test suites build on top of the WP Core test suite.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 18:22:15 +00:00
hellofromTonya 2fa3d5a56f Code Modernization: Remove xml_set_object() in IXR_Message::parse().
The XML Parser extension still supports a quite dated mechanism for method based callbacks, where the object is first set via `xml_set_object()` and the callbacks are then set by passing only the name of the method to the relevant parameters on any of the `xml_set_*_handler()` functions.

{{{
xml_set_object( $parser, $my_obj );
xml_set_character_data_handler( $parser, 'method_name_on_my_obj' );
}}}

Passing proper callables to the `xml_set_*_handler()` functions has been supported for the longest time and is cross-version compatible. So the above code is 100% equivalent to:

{{{
xml_set_character_data_handler( $parser, [$my_obj, 'method_name_on_my_obj'] );
}}}

The mechanism of setting the callbacks with `xml_set_object()` has now been deprecated as of PHP 8.4, in favour of passing proper callables to the `xml_set_*_handler()` functions. This is also means that calling the `xml_set_object()` function is deprecated as well.

This commit fixes this deprecation for the `IXR_Message::parse()` method.

This change is safeguarded via the new`Tests_XMLRPC_Message::test_parse_sets_handlers()` test method.

Note: Though this is "officially" an external library, this package is no longer externally maintained. The code style of the fix in the source file is in line with the existing code style for the file.

Refs:
* https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names
* https://www.php.net/manual/en/function.xml-set-object.php
* https://www.php.net/manual/en/ref.xml.php

Follow-up to [15612], [1346].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 18:04:14 +00:00
hellofromTonya 9846d9ce8e Tests: Remove use of xml_set_object() in TestXMLParser.
The XML Parser extension still supports a quite dated mechanism for method based callbacks, where the object is first set via `xml_set_object()` and the callbacks are then set by passing only the name of the method to the relevant parameters on any of the `xml_set_*_handler()` functions.

{{{
xml_set_object( $parser, $my_obj );
xml_set_character_data_handler( $parser, 'method_name_on_my_obj' );
}}}

Passing proper callables to the `xml_set_*_handler()` functions has been supported for the longest time and is cross-version compatible. So the above code is 100% equivalent to:

{{{
xml_set_character_data_handler( $parser, [$my_obj, 'method_name_on_my_obj'] );
}}}

The mechanism of setting the callbacks with `xml_set_object()` has now been deprecated as of PHP 8.4, in favour of passing proper callables to the `xml_set_*_handler()` functions. This is also means that calling the `xml_set_object()` function is deprecated as well.

This commit fixes this deprecation for the `TestXMLParser` helper utility. In this case, the callbacks were already using the recommended format and the call to `xml_set_object()` was completely redundant.

As this is a test utility and was already causing pre-existing tests using the utility to fail, there is no need for dedicated tests to cover this change.

Refs:
* https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names
* https://www.php.net/manual/en/function.xml-set-object.php
* https://www.php.net/manual/en/ref.xml.php

Follow-up to [25002].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 17:26:16 +00:00
hellofromTonya 71996c82e7 Tests: Fix Tests_Theme tests to run (and pass) cross-OS.
Uses `DIRECTORY_SEPARATOR` in closures for cross-OS differences.

Follow-up to [56635].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 16:18:15 +00:00
hellofromTonya 37e081e8dc Code Modernization: Fix implicitly nullable parameter in WP_HTML_Processor.
PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameters with a `null` default value, which are not explicitly declared as nullable.

This commit the one instance of this in the `WP_HTML_Processor` class.

Fixed by adding the nullability operator to the type, which is supported since PHP 7.1, so we can use it now the minimum supported PHP version is PHP 7.2.

As this deprecation is thrown at compile time, it can be seen at the top of the test output when running on PHP 8.4 (which will be gone once this change has been committed). It is not possible to write a test to cover this.

Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types

Follow-up to [58867], [58769], [58304], [58192].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 15:04:14 +00:00
hellofromTonya 800e34d2e4 Tests: Fix implicitly nullable parameters in Tests_HtmlApi_WpHtmlProcessorComments.
PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameters with a `null` default value, which are not explicitly declared as nullable.

The `Tests_HtmlApi_WpHtmlProcessorComments` test class contains one problematic parameter in the `test_comment_processing()` method declaration.

While this could be fixed by adding the nullability operator, the type declarations in the test method is removed instead, including other type declarations for this method and the second test method, which were not affected by the deprecation.

The reason for this is quite straight-forward: using type declarations in tests is bad practice and inhibits defense-in-depth type testing.

Using type declarations in tests prevents being able to test the "code under test" with unexpected input types as the values with unexpected (scalar) types will be juggled to the expected type between the data provider and the test method and the _real_ data value would therefore never reach the method under test.

The knock-on effects of this are:
* That the input handling of the "code under test" can not be safeguarded, whether this input handling is done via in-function type checking or via a type declaration in the "code under test".
* That if such "unexpected data type" tests are added to the data provider, they will silently pass (due to the type being juggled before reaching the "code under test"), giving a false sense of security, while in actual fact, these data sets would not be testing anything at all and if, for instance, the type declaration in the "code under test" would be removed, these tests would still pass, while by rights they should start failing.

Also note that this problem would only be exacerbated if the file would be put under `strict_types`.

Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types

Follow-up to [58734].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 14:55:15 +00:00
Sergey Biryukov 11a4dc8aba Script Loader: Restore `user-profile.js` dependencies after an accidental revert.
Follow-up to [59033], [59046], [59047].

Props TobiasBg.
See #61754.
Built from https://develop.svn.wordpress.org/trunk@59051


git-svn-id: http://core.svn.wordpress.org/trunk@58447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 14:24:17 +00:00
Drew Jaynes dbc9df26db Docs: Add missing @since and @param annotations for the `edit_post_{$field}` hook doc.
Props mukesh27
See #50654

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


git-svn-id: http://core.svn.wordpress.org/trunk@58446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 06:04:10 +00:00
desrosj b863c8320c Build/Test Tools: Submit host test results for each PHP version.
The WordPress Hosting Test Results now supports multiple reports for the same commit from the same test bot. This updates the PHPUnit test workflow to submit results for each version of PHP running the tests.

Props swissspidy, jorbin, crixu, kirasong, desrosj.
See #61564.
Built from https://develop.svn.wordpress.org/trunk@59049


git-svn-id: http://core.svn.wordpress.org/trunk@58445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 05:44:12 +00:00
ramonopoly 840f0fc053 Global Styles: allow read access to users with `edit_posts` capabilities
This patch any role that can edit a post, including custom post types, or edit theme options to read global styles from the API. This enables read-only access to global styles in the post editor. Test coverage in included.

Props ramonopoly, peterwilsoncc, mukesh27, aaronrobertshaw, mamaduka, spacedmonkey, talldanwp, timothyblynjacobs.
Fixes #62042.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 05:19:14 +00:00
davidbaumwald 0ec15861c7 Script Loader: Revert removing unused array_merge.
Code is poetry, until it isn’t.

Unprops davidbaumwald.
See #61754.
Built from https://develop.svn.wordpress.org/trunk@59047


git-svn-id: http://core.svn.wordpress.org/trunk@58443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 00:48:14 +00:00
Jeremy Felt 3c85d540d4 Application Passwords: Add copy button when adding new password.
Props circlecube, dhruvang21, ironprogrammer, desrosj.
Fixes #62019.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 00:14:13 +00:00
Drew Jaynes c9c2f41ab4 Docs: Add possible filter names to the hook docs for the following filters in `sanitize_post_field()`:
- `edit_{$field}`
- `{$field_no_prefix}_edit_pre`
- `edit_post_{$field}`
- `pre_{$field}`
- `{$field_no_prefix}_save_pre`
- `pre_post_{$field}`
- `{$field}_pre`
- `{$field}`
- `post_{$field}`

Props johnbillion, DrewAPicture.
Fixes #50654

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


git-svn-id: http://core.svn.wordpress.org/trunk@58441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-18 00:02:13 +00:00
Aaron Jorbin 2597c1b946 Bootstrap/Load: Add documentation warning about updating `$table_prefix`.
Props bjerke-johannessen, swissspidy, SergeyBiryukov, morganestes, stevenlinx, jorbin.
Fixes #34189.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 23:58:13 +00:00
Helen Hou-Sandí d5206419d7 Bootstrap/Load: Give more context and warning about editing compat.php.
As indicated by name, this is a compatibility file which warrants more care to begin with, but it's still worth warning folks about how narrow function availability is in this file.

Props jorbin, dmsnell, helen.
See #61694.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 23:50:12 +00:00
Adam Silverstein d10887c93d Media: improve speed of AVIF image generation.
Set the AVIF encoder to work faster by raising heic:speed to 7 from the default of 5. AVIF generation time is reduced by up to 20% with minimal impact on image size.

Props: adamsilverstein, erikyo, mukesh27, yguyon, felixarntz, jzern.
Fixes #61758.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 23:29:29 +00:00
joedolson 549f626d96 Accessibility: Add border around menus and submenus in high contrast mode.
Add outlines and borders to mark the boundaries between the admin navigation menu and content and around adminbar submenus that are visible when Windows High Contrast Mode is enabled. This clarifies the page structure and makes high contrast mode easier to use.

Props wildworks, hbhalodia, sabernhardt, joedolson, rcreators.
Fixes #61616.
Built from https://develop.svn.wordpress.org/trunk@59041


git-svn-id: http://core.svn.wordpress.org/trunk@58437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 23:28:15 +00:00
K. Adam White 24a4ba8885 REST API: Allow posts to be published with a publication date of midnight 1970-01-01.
Explicitly checks date parsing return values for `false`, so that `0` (the value returned for the UNIX epoch of `1970-01-01 00:00:00`) is correctly treated as a valid timestamp.

It should be valid to create a post dated to any point in history.

Props emmanuel78, sabernhardt, siliconforks, drjosh07, antpb, TimothyBlynJacobs.
Fixes #60184.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 23:24:12 +00:00
Aaron Jorbin 723d01e3e1 Bootstrap/Load: Ensure uses of set_time_limit are documented why.
`set_time_limit` can cause unexpected behavior so it general should be avoided. There are instances though where they should be used so those instances should be properly documented.

Props Rcrayno, ryan, kurtpayne, jorbin.
Fixes #21521. See #19487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 22:41:13 +00:00
TimothyBlynJacobs d598d459ac Build Tools: Allow easier customization of the .env file.
The .env file allows for configuring how the WordPress Local environment should be configured. However, because the file is version controlled, developers must be careful not to commit their modifications.

This commit renames the .env file to be .env.example. During env start, the .env.example file is copied to .env if it does not exist. This allows for contributors to continue using the project without thinking about .env and to make changes when needed. This brings WordPress Core into the dotenv project guidelines.

Props johnbillion, afragen, h71, desrosj.
Fixes #52668.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 22:28:18 +00:00
antpb f92af0238e Coding Standards: Avoid using confusing `!` condition in Media Library selection check.
Checks that value is now equal or less than or equal to 0 which has the same result as the previous confusing `!` usage.

Props kadamwhite, drjosh07.
See #60369.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 22:26:17 +00:00
K. Adam White c418ba0205 REST API: Only check password value in query parameters while checking post permissions.
The `password` property which gets sent as part of a request POST body while setting a post's password should not be checked when calculating post visibility permissions.

That value in the request body is intended to update the post, not to authenticate, and may be malformed or an invalid non-string type which would cause a fatal when checking against the hashed post password value.

Query parameter `?password=` values are the correct interface to check, and are also guaranteed to be strings.

Props mlf20, devansh016, antonvlasenko, TimothyBlynJacobs, kadamwhite.
Fixes #61837.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 22:19:14 +00:00
antpb 2bc0e28dfe Media: Add Ctrl/Command + Enter shortcut to insert selected Media Library items.
Adds a Ctrl/Command + Enter keyboard shortcut to insert the currently selected single media or multiple media items when selecting in the Media Library modal.

Props poena, hirschferkel, antpb, joedolson, skobe, rcreators, plaidharper.
Fixes #60369.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 21:59:24 +00:00
Felix Arntz 1da67e31b5 REST API: Support exact search in the REST API posts endpoint.
This changeset adds support for a new `search_semantics` enum query parameter that can be passed alongside the `search` string parameter. At this point, it only supports "exact" as possible value, but an enum is used for forward compatibility with potential enhancements like "sentence" search support. If `search_semantics=exact` is passed, it will look for an exact match rather than do a full text search, which for some use-cases is more appropriate and more performant.

Props mehulkaklotar, timothyblynjacobs, jimmyh61, ironprogrammer, johnregan3, mukesh27, costdev.
Fixes #56350.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 21:58:14 +00:00
davidbaumwald 90d4f10e74 Script Loader: Remove unused array_merge.
This change removes an unused `array_merge` that was added in [44265].

Props kkmuffme, SergeyBiryukov, akshat2802.
Fixes #61754.
Built from https://develop.svn.wordpress.org/trunk@59033


git-svn-id: http://core.svn.wordpress.org/trunk@58429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 21:54:13 +00:00
TimothyBlynJacobs b4acb10706 REST API: Automatically populate targetHints for the Allow header.
The REST API uses the "Allow" header to communicate what methods a user is authorized to perform on a resource. This works great when operating on a single item route, but can break down when needing to determine authorization over a collection of items.

This commit uses the "targetHints" property of JSON Hyper Schema to provide access to the "allow" header for "self" links. This alleviates needing to make a separate network request for each item in a collection.

Props mamaduka, noisysocks, peterwilsoncc, spacedmonkey, swissspidy, timothyblynjacobs, tyxla, youknowriad.
Fixes #61739.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 21:52:20 +00:00
John Blackbourn 757729e878 Plugins: Correct the item schema for the plugins REST API endpoint.
The `author` property contains the string name of the plugin author.

Props narenin.

Fixes #61920

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


git-svn-id: http://core.svn.wordpress.org/trunk@58427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 21:33:14 +00:00
desrosj 7629bd782d External Libraries: Update PHPass library.
This updates the PHPass library to version `0.5.4` while maintaining the adjustments introduced in [30466].

Props jrf.
Fixes #62058.
Built from https://develop.svn.wordpress.org/trunk@59030


git-svn-id: http://core.svn.wordpress.org/trunk@58426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 21:08:16 +00:00
Pascal Birchler 56eb5c22d8 I18N: Add a new way to determine whether a translation is available.
A new `has_translation()` function can be used to determine whether a translation exists for a given string.

Props louiswol94, swissspidy, drzraf, ckanitz, tomhine, mchirag2002, samuelsilvapt.
Fixes #52696.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 20:58:15 +00:00
Felix Arntz 90673b9066 Taxonomy: Remove redundant `$taxonomies` value from cache keys used for `WP_Term_Query`.
Props niravsherasiya7707, spacedmonkey.
Fixes #59594.
See #35381.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 17:00:14 +00:00
Sergey Biryukov 3cd067ee34 General: Add missing `initial-scale` value in viewport meta tags.
The viewport meta should include `initial-scale=1.0` to ensure that high DPI/mobile display works as expected.

References:
* [https://css-tricks.com/probably-use-initial-scale1/ CSS-Tricks: Probably Use initial-scale=1]
* [https://www.sitepoint.com/community/t/is-it-necessary-to-include-initial-scale-1-0-in-the-meta-viewport-tag/455119 SitePoint Forums: Is it necessary to include initial-scale=1.0 in the meta viewport tag?]

Follow-up to [59026].

Props dhruvang21, sabernhardt, kkmuffme, mukesh27, narenin, swissspidy, SergeyBiryukov.
Fixes #61988.
Built from https://develop.svn.wordpress.org/trunk@59027


git-svn-id: http://core.svn.wordpress.org/trunk@58423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-17 00:03:54 +00:00
Sergey Biryukov 7a04eb9b86 Bundled Themes: Add missing `initial-scale` value in viewport meta tag.
The viewport meta should include `initial-scale=1.0` to ensure that high DPI/mobile display works as expected.

Includes standardizing on `1.0` vs. `1` for consistency.

References:
* [https://css-tricks.com/probably-use-initial-scale1/ CSS-Tricks: Probably Use initial-scale=1]
* [https://www.sitepoint.com/community/t/is-it-necessary-to-include-initial-scale-1-0-in-the-meta-viewport-tag/455119 SitePoint Forums: Is it necessary to include initial-scale=1.0 in the meta viewport tag?]

Props dhruvang21, sabernhardt, kkmuffme, mukesh27, swissspidy, SergeyBiryukov.
See #61988.
Built from https://develop.svn.wordpress.org/trunk@59026


git-svn-id: http://core.svn.wordpress.org/trunk@58422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-16 22:18:35 +00:00
dmsnell 747bda52eb HTML API: Update html5lib test runner to support new features.
This patch updates the html5lib test runner following the merge of changes opening up a full HTML parser and additional fragment contents. It makes no Core code changes, but allows a more tests to complete which previously failed due to incomplete test runner support..

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

Props jonsurrell.
See #61646.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-16 20:17:44 +00:00
dmsnell 3aeb2980f0 HTML API: Prevent infinite loop in foreign content reprocessing step.
An infinite loop was discovered in specific situations within foreign content inside the HTML Processor when a given node inside foreign content must be handled in the rules for the current insertion mode.

This patch resolves the loop by handling those nodes directly instead of reprocessing the node, which previously was redirecting control flow back to where the loop started.

Developed in https://github.com/wordpress/wordpress-develop/7347
Discussed in https://core.trac.wordpress.org/ticket/61656

Follow-up to [58868].

Props jonsurrell.
See #61576.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-16 17:57:13 +00:00
gziolo 6b56a33bfa Meta: Add label argument to register_meta function
With the introduction of Block Bindings, it became more common to see workflows where users need to see the custom fields that are available or connected. They were relying on the meta key, however it feelt too technical sometimes. The solution is adding a new label argument to include a human-readable name that can be used across the UI.

Props santosguillamot, mamaduka, gziolo, timothyblynjacobs, peterwilsoncc.
Fixes #61998.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-16 11:33:38 +00:00
Sergey Biryukov c0350f64a0 Themes: Improve the alignment of feature filters and inputs on Add Themes screen.
Follow-up to [35527], [38640], [40797].

Props Benjamin_Zekavica, sabernhardt, sumitsingh, gauravtiwari, krupajnanda, audrasjb, SergeyBiryukov.
Fixes #53314.
Built from https://develop.svn.wordpress.org/trunk@59022


git-svn-id: http://core.svn.wordpress.org/trunk@58418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-15 13:49:15 +00:00
Sergey Biryukov 21142e7279 Tests: Add tests to ensure that the `WP_Network::$blog_id` property is a string.
Follow-up to [34097], [36340], [37657], [37870], [37871], [59020].

Fixes #62035.
Built from https://develop.svn.wordpress.org/trunk@59021


git-svn-id: http://core.svn.wordpress.org/trunk@58417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-14 21:31:15 +00:00
Sergey Biryukov 997455c982 Networks and Sites: Set `WP_Network` properties via setters upon creation.
This ensures that `WP_Network::$id` is stored internally as `int`, to match the documented type.

Follow-up to [37870].

Props ironprogrammer, scottculverhouse, spacedmonkey, SergeyBiryukov.
See #62035.
Built from https://develop.svn.wordpress.org/trunk@59020


git-svn-id: http://core.svn.wordpress.org/trunk@58416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-13 22:12:15 +00:00
Peter Wilson bd4c40b4c2 Editor: Deprecate "Social links with a shared background color" pattern.
Removes the pattern from the inserter while retaining the related code to ensure the content renders for sites making use of the pattern.

Props annezazu, talldanwp, richtabor, mikachan.
Fixes #61708.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-13 05:37:16 +00:00
Peter Wilson 81de03f277 Upgrade/Install: Indicate HEIC support when checking upgrades.
Adds tracking of HEIC image type support alongside WebP and AVID image types when requesting upgrade from WordPress.org

Props adamsilverstein, swissspidy, dd32, mukesh27.
Fixes #61981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-13 05:23:22 +00:00
Sergey Biryukov 5c52d270ec Tests: Restore the environment before performing assertions in some canonical tests.
This aims to avoid affecting other tests in case of failure.

Follow-up to [28704], [45133].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-12 21:41:15 +00:00
Peter Wilson 5d3a6274b4 Administration: Increase frequency of heartbeat API requests.
Increases the frequency of heartbeat API requests from once every 15 seconds to once every 10 seconds.

The purpose of this change is to reduce the length of time before a post becomes unlocked as a user navigates around the WordPress Dashboard and ceases editing a post.

`wp.heartbeat.interval()` has been modified to allow theme and plugin authors to set the heartbeat interval to any value between one second and one hour rather than limiting them to a fixed set of values.

Props azaozz, annezazu, jorbin, kirasong.
Fixes #61960.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 23:09:16 +00:00
Peter Wilson e296eeb012 Taxonomy: Test inserting a child term flushes queries by term ID.
Adds a test to ensure that interting a child term invalidates the cache of a `get_terms()` query by the parent ID.

Props Dekadinious, peterwilsoncc.
See #62031, #61530.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 22:41:18 +00:00
dmsnell 7d9bb7efd3 HTML API: Make WP_HTML_Processor::get_tag() namespace aware.
The HTML specification indicates that an HTML tag with the name "IMAGE"
should be renamed as "IMG" and handled as if it were an "IMG", but this
only applies to elements in the HTML namespace.

In this patch the HTML Processor is updated to ensure that it doesn't
remap the tag name when processing foreign content, such as SVG and
MathML markup.

Developed in https://github.com/wordpress/wordpress-develop/7330
Discussed in https://core.trac.wordpress.org/ticket/61656

Props dmsnell, jonsurrell.
See #61576.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 16:13:17 +00:00
Felix Arntz 1d71540320 Comments: Reinstate original since annotation on `get_edit_comment_link` filter.
This was accidentally removed in [58875].

See #61727.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 15:44:13 +00:00
Felix Arntz f8a7a22bee Comments: Ensure `$comment_id` parameter on `get_edit_comment_link` filter is always a comment ID.
Follow up to [58875].

Props david.binda, peterwilsoncc, mukesh27, davidbaumwald.
Fixes #61727.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 15:40:17 +00:00
dmsnell ee69ec404e WP_Debug_Data: Extract `wp-mu-plugins` data into separate method.
This is the part five 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 fifth of twelve groups, the `wp-mu-plugins` 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/7305
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, dmsnell.
See #61648.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 14:47:20 +00:00
Sergey Biryukov 3c03500cea Docs: Remove the `@ignore` tag for `_wp_render_title_tag()`.
The function is referenced in the `_block_template_render_title_tag()` DocBlock, and should therefore be included in the documentation.

Follow-up to [30074], [30615], [31170], [35294], [51003].

Props poena.
See #61608.
Built from https://develop.svn.wordpress.org/trunk@59010


git-svn-id: http://core.svn.wordpress.org/trunk@58406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 13:27:12 +00:00
John Blackbourn 87fd392188 Docs: Various docblock improvements and corrections.
See #61608

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


git-svn-id: http://core.svn.wordpress.org/trunk@58405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 12:08:19 +00:00
Joe McGill 2f943897c9 Media: Add auto sizes for lazy-loaded images.
This implements the HTML spec for applying auto sizes to lazy-loaded images by prepending `auto` to the `sizes` attribute generated by WordPress if the image has a `loading` attribute set to `lazy`. For browser that support this HTML spec, the image's size value will be set to the concrete object size of the image. For browsers that don't support the spec, the word "auto" will be ignored when parsing the sizes value.

References:
- https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
- https://github.com/whatwg/html/pull/8008

Props mukesh27, flixos90, joemcgill, westonruter, peterwilsoncc.
Fixes #61847.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-11 00:01:23 +00:00
Sergey Biryukov 7215ea4eb1 Docs: Fix typo in a comment in `get_block_templates()`.
Follow-up to [55687].

Props dj.cowan, mukesh27.
Fixes #62023.
Built from https://develop.svn.wordpress.org/trunk@59003


git-svn-id: http://core.svn.wordpress.org/trunk@58399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-10 09:47:18 +00:00
dmsnell 3293d9ba89 WP_Debug_Data: Extract `wp-server` data into separate method.
This is the part four 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 fourth of twelve groups, the `wp-server` 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/7283
Discussed in https://core.trac.wordpress.org/ticket/61648

Props apermo, costdev, dmsnell, kebbet, mukesh27.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-10 00:04:19 +00:00
dmsnell 011d45abbc HTML API: Add sentinels for unreachable code.
There are places in the HTML API code where some tools get confused and flag invalid types for the return of a function because they are unable to detect that the end of the function is unreachable.

Since PHP doesn't provide a way to encode total matching in the source code, this patch adds a few extra lines in those unreachable locations to satisfy any tooling which isn't able to fully analyze the code.

Additionally this serves as extra guarding in case someone changes these functions in a way which would break them and the existing test suite doesn't catch those breakages.

Developed in https://github.com/WordPress/wordpress-develop/pull/7315
Discussed in https://core.trac.wordpress.org/ticket/62018

Props dlh, dmsnell.
Fixes #62018.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-09 22:12:15 +00:00
Sergey Biryukov 7f0a5f518b Docs: Correct parameter reference for `manage_posts_columns` and related filters.
Follow-up to [27255], [42871].

Props truptikanzariya.
Fixes #62015.
Built from https://develop.svn.wordpress.org/trunk@59000


git-svn-id: http://core.svn.wordpress.org/trunk@58396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-09 14:37:17 +00:00
Sergey Biryukov 911d37b465 Users: Remove obsolete conditional in `wp-admin/user-new.php`.
Since `$username` is set to `$user_details->user_login`, it will never be `null` in this specific line.

Follow-up to [https://mu.trac.wordpress.org/changeset/641 mu:641], [https://mu.trac.wordpress.org/changeset/1529 mu:1529], [12722], [16294].

Props akshat2802, mukesh27, aristath, SergeyBiryukov.
Fixes #62012.
Built from https://develop.svn.wordpress.org/trunk@58999


git-svn-id: http://core.svn.wordpress.org/trunk@58395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-09 10:17:15 +00:00
Sergey Biryukov 11f8d8ec2b Coding Standards: Use strict comparison in `wp-includes/capabilities.php`.
Follow-up to [2703], [3297], [3513], [6697], [14189], [25177], [27390], [38378], [38698], [39588], [48356], [48664].

Props aristath, poena, afercia, SergeyBiryukov.
See #61607.
Built from https://develop.svn.wordpress.org/trunk@58998


git-svn-id: http://core.svn.wordpress.org/trunk@58394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-08 19:18:17 +00:00
Sergey Biryukov 35b7340af9 Administration: Remove old IE9 code from `wp-admin/js/svg-painter.js`.
About half of the file's code was a back-compat polyfill of base64 functions for IE9.

Since WordPress no longer supports IE9 as of version 4.8, and all modern browsers come with these functions, the polyfills can be removed.

Follow-up to [26072], [26131], [26601], [47771].

Props TobiasBg, sabernhardt.
Fixes #61995.
Built from https://develop.svn.wordpress.org/trunk@58997


git-svn-id: http://core.svn.wordpress.org/trunk@58393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-07 22:44:17 +00:00
dmsnell 76c06eb274 Debug Data: Encode section ordering in debug info.
During a refactor to modularize the debug data class, it came up that the ordering of the sections inside of the returned debug info is relevant to existing UIs, as they iterate the array, which happens in insertion order.

This patch presets each section at the start to ensure that the ordering remains consistent even as code within the method is rearranged. As the mini-project progresses, this assignment will be the final place all the sections are referenced.

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

Props apermo, dmsnell, sergeybiryukov.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-06 19:50:19 +00:00
Sergey Biryukov c311a9de36 Docs: Correct the order of `@since` and `@var` annotations.
Follow-up to [4673], [8656], [13041], [13827], [13895], [31134], [34490], [34566].

Props riddhipatel, shailu25.
Fixes #61999.
Built from https://develop.svn.wordpress.org/trunk@58995


git-svn-id: http://core.svn.wordpress.org/trunk@58391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-06 14:36:19 +00:00
Sergey Biryukov 68ed51f937 Coding Standards: Use strict comparison in `wp-admin/includes/upgrade.php`.
Follow-up to [725], [1575], [1975], [2037], [2966], [3670], [4738], [11958], [12776], [14080], [14485], [32378].

Props faisalahammad, mujuonly, aristath, poena, afercia, SergeyBiryukov.
Fixes #58041, #61607.
Built from https://develop.svn.wordpress.org/trunk@58994


git-svn-id: http://core.svn.wordpress.org/trunk@58390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-05 14:59:14 +00:00
Sergey Biryukov 3bf2de3ad2 Docs: Correct the first parameter name for the `pre_site_option_{$option}` filter.
Follow-up to [27365], [41013], [48193].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-04 21:10:14 +00:00
dmsnell 72bc81c048 HTML API: Only examine HTML nodes in `pop_until()` instack of open elements.
The `pop_until( $tag_name )` method in the stack of open elements should only be examining HTML elements, but it has only been checking the tag name. This has led to closing the wrong tags when run from inside foreign content. A very specific situation where this may arise is when a `TEMPLATE` closer is found inside foreign content, inside another template.

{{{
HTML:template   SVG:template                 HTML:/template
<template><svg><template><foreignObject><div></template><div>
╰──< this outer TEMPLATE is closed by this one >───╯
}}}

This patch constains the method to checking for elements matching the tag name which are in the HTML namespace so that the proper detection occurs.

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

Follow-up to [58867].

Props dmsnell, jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-04 19:25:14 +00:00
hellofromTonya 699ea88e6c Editor: Update packages for 6.6.2 RC1.
Updates the versions from the [a74a70ed20 released packages] for the following bugfixes:

* [https://github.com/WordPress/gutenberg/pull/63980 Global Styles: Fix block custom CSS pseudo element selectors]
* [https://github.com/WordPress/gutenberg/pull/64463 Featured Image Block: Reduce CSS specificity]
* [https://github.com/WordPress/gutenberg/pull/64076 Fix bumped specificity for layout styles in non-iframed editor]
* [https://github.com/WordPress/gutenberg/pull/64379 Don't allow duplicating template parts in non-block-based themes]
* [https://github.com/WordPress/gutenberg/pull/64250 Data Views: Don't render action modal when there are no eligible items]
* [https://github.com/WordPress/gutenberg/pull/63724 Fix canvas issues by removing VisualEditor’s height]
* [https://github.com/WordPress/gutenberg/pull/64992 Post Editor: fix click space after post content to append]
* [https://github.com/WordPress/gutenberg/pull/63939 Post Editor: Prevent popover from being hidden by metabox]
* [https://github.com/WordPress/gutenberg/pull/64639 Post editor: apply space below content using a pseudo-element instead of padding-bottom]
* [https://github.com/WordPress/gutenberg/pull/64015 Avoid errors for post types without a 'menu_icon']
* [https://github.com/WordPress/gutenberg/pull/64458 Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in :where selectors]

Props vcanales.
Fixes #61982.
See #61704, #61769, #61829.
Built from https://develop.svn.wordpress.org/trunk@58988


git-svn-id: http://core.svn.wordpress.org/trunk@58384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-04 16:25:19 +00:00
dmsnell d0d8ba24d8 HTML API: Respect document compat mode when handling CSS class names.
The HTML API has been behaving as if CSS class name selectors matched class names in an ASCII case-insensitive manner. This is only true if the document in question is set to quirks mode. Unfortunately most documents processed will be set to no-quirks mode, meaning that some CSS behaviors have been matching incorrectly when provided with case variants of class names.

In this patch, the CSS methods have been audited and updated to adhere to the rules governing ASCII case sensitivity when matching classes. This includes `add_class()`, `remove_class()`, `has_class()`, and `class_list()`. Now, it is assumed that a document is in no-quirks mode unless a full HTML parser infers quirks mode, and these methods will treat class names in a byte-for-byte manner. Otherwise, when a document is in quirks mode, the methods will compare the provided class names against existing class names for the tag in an ASCII case insensitive way, while `class_list()` will return a lower-cased version of the existing class names.

The lower-casing in `class_list()` is performed for consistency, since it's possible that multiple case variants of the same comparable class name exists on a tag in the input HTML.

Developed in https://github.com/WordPress/wordpress-develop/pull/7169
Discussed in https://core.trac.wordpress.org/ticket/61531

Props dmsnell, jonsurrell.
See #61531.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-04 04:34:15 +00:00
Mamaduka 1e6b860630 Editor: Update preloaded paths for the site editor
Add the `OPTIONS /wp/v2/pages` route to the list. The request is made via the `useBlockEditorSettings` hook at the top of the editor React tree. Preloading should improve the editor's loading time.

Avoid hardcoding paths for the 'attachment' post type; use the `rest_get_route_for_post_type_items` helper method instead.

Props mamaduka, noisysocks.
See #61884.
Built from https://develop.svn.wordpress.org/trunk@58984


git-svn-id: http://core.svn.wordpress.org/trunk@58380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-04 04:17:14 +00:00
Sergey Biryukov d65e65cd6c Posts, Post Types: Check if the post type exists in `_admin_notice_post_locked()`.
This adds a guard to verify the result of `get_post_type_object()` before retrieving the `all_items` label, as the function returns `null` if the post type does not exist.

Follow-up to [24527].

Props pcarvalho, akshat280, mukesh27, SergeyBiryukov.
Fixes #60947.
Built from https://develop.svn.wordpress.org/trunk@58983


git-svn-id: http://core.svn.wordpress.org/trunk@58379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 22:43:14 +00:00
joedolson 02d2fa959a Comments: Limit comments shortcut to not execute on links.
Exclude links from activating the comment submission shortcut.

[45790] introduced a shortcut to submit comment forms using `Ctrl/Cmd + Enter`. This keyboard combination is also the combination for opening a link in a new tab, which resulted in submitting the form when using the Log Out or Edit Profile links.

Props greentreefrog, sabernhardt, narenin.
Fixes #61919.
Built from https://develop.svn.wordpress.org/trunk@58981


git-svn-id: http://core.svn.wordpress.org/trunk@58377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 20:36:10 +00:00
hellofromTonya 7b2eb3f79b Docs: Add changing existing items recommendations to 'admin_bar_menu' action.
Improves the `'admin_bar_menu'` docblock by adding recommendations for customizing / changing existing items.

It also improves the `wp_admin_bar_render()` function's docblock by removing the "most optimal point" sentence.

The [58748] changeset moved the user menu to a higher priority level (of `9991`) to achieve:

>so nodes added with higher priorities will still be shown visually before the user and recovery menu items, as they were prior to [58215].

When hooking into `'admin_bar_menu'` with a priority level less than 9991 and attempting to get the `'my-account'` node, `null` is returned. While the preferred approach is to hook into `'wp_before_admin_bar_render'`, the documentation of the `'admin_bar_menu'` action was previously misleading.

Follow-up to [58748], [58759].

Props michaelwp85, narenin, sabernhardt, joedolson, costdev, jorbin, hellofromTonya, mukesh27, pbiron.
Fixes #61738.
Built from https://develop.svn.wordpress.org/trunk@58978


git-svn-id: http://core.svn.wordpress.org/trunk@58374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 19:58:11 +00:00
dmsnell 2ce04ceab9 HTML API: Ensure that NULL and whitespace-only CDATA sections don't forbid FRAMESET.
When CDATA sections (which can only occur inside SVG and MathML content) consist only of NULL bytes or whitespace characters they should not clear the "frameset ok" flag. Previously they have always been clearing this flag, but in this patch the logic is updated to detect these sequences properly.

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

Follow-up to [58867].

Props dmsnell, jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 19:50:14 +00:00
ryelle 8d1fb4e25a Help/About: Fix text wrapping on non-English locales.
In [57715], headings on the About pages were given `text-wrap: balance`. This rule causes unexpected breaks in non-latin langauges, e.g., Japanese, Korean. This fix sets the text-wrap to `pretty` for browsers that support it, and uses `balance` for English-only.

Props akshat2802, wildworks, ryelle, sabernhardt, hellofromTonya.
Fixes #60892.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 18:51:12 +00:00
Felix Arntz 4e167c593d Options, Meta APIs: Explicitly pass `$autoload` parameter to when potentially adding new options.
It is recommended that for every option it is explicitly set whether to autoload it or not. This changeset updates relevant `update_option()` and `add_option()` calls.

Note that the `$autoload` parameter is only needed for `update_option()` if the option is potentially not present yet, i.e. the call will pass through to `add_option()`. Since WordPress core adds the majority of its options to the database during installation, only `update_option()` calls for dynamically added options need to be modified, which is what this changeset does.

As part of revisiting the autoload values for dynamically added WordPress core options, this changeset modifies some options to no longer be autoloaded, since they are only accessed in a few specific places that are not relevant for a regular request. These options are:
* `recently_activated`
* `_wp_suggested_policy_text_has_changed`
* `{upgradeLock}.lock`
* `dashboard_widget_options`
* `ftp_credentials`
* `adminhash`
* `nav_menu_options`
* `wp_force_deactivated_plugins`
* `delete_blog_hash`
* `allowedthemes`
* `{sessionId}_paused_extensions`
* `recovery_keys`
* `https_detection_errors`
* `fresh_site`

An upgrade routine is present as well that sets those options to no longer autoload for existing sites.

Props pbearne, flixos90, mukesh27, swissspidy, SergeyBiryukov, joemcgill, adamsilverstein.
Fixes #61103.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 18:19:14 +00:00
Felix Arntz 77af97466f Media: Consistently pass 'src' attribute to `wp_get_loading_optimization_attributes()`.
A common use-case for the 'wp_get_loading_optimization_attributes' filter is to modify attributes based on the 'src' attribute. However, the `wp_img_tag_add_loading_optimization_attrs()` was not passing that attribute to the function as expected, which would make such usage of the filter unreliable. This changeset ensures the 'src' attribute is also passed in this scenario. All other calls to `wp_get_loading_optimization_attributes()` already included the attribute.

Props deepakrohilla, prestonwordsworth, mukesh27, adamsilverstein, joemcgill, flixos90.
Fixes #61436.
See #58893.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 17:07:16 +00:00
cbravobernal b734476509 Block bindings: Adds a filter to customize the output of a block bindings source.
Introduces a filter to the `block_bindings_source_value` to allow developers to
modify the value returned by any block binding source.

Props snehapatil02, cbravobernal, gziolo, santosguillamot, bacoords, codersantosh.
Fixes #61181.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 16:33:15 +00:00
dmsnell ec9fa01846 HTML API: Improve skipped test reporting with unsupported exception.
The `html5lib-tests` suite skips a number of tests due to unsupported markup. At the moment, these tests all report "Test includes unsupported markup." This patch calls the `get_unsupported_exception()` method in these skipped cases to improve the messages reported to PHPUnit so they're more informative: e.g. "Unsupported markup: Foster parenting is not supported."

Developed in https://github.com/WordPress/wordpress-develop/pull/7285
Discussed in https://core.trac.wordpress.org/ticket/61646

Follow-up to [58714].

Props dmsnell, jonsurrell.
See #61646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-03 16:27:14 +00:00
dmsnell 8d2a10b300 HTML API: Allow subdividing text nodes by meaningful prefixes.
HTML parsing rules at times differentiate character tokens that are all null bytes, all whitespace, or other content. This patch introduces a new function which may be used to classify text node sub-regions and lead to more efficient application of these parsing rules.

Further, when classified in this way, application code may skip some rules and decoding entirely, improving performance. For example, this can be used to ease the implementation of skipping inter-element whitespace, which is usually not rendered.

Developed in https://github.com/WordPress/wordpress-develop/pull/7236
Discussed in https://core.trac.wordpress.org/ticket/61974

Props dmsnell, jonsurrell.
Fixes #61974.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 23:21:18 +00:00
dmsnell 3008472ffb HTML API: Replace null-bytes in class_list class names
As part of an audit of HTML API CSS behaviors, this patch resolves an issue with how the HTML API reports class names containing the NULL byte. NULL bytes should be replaced by the Unicode replacement character, U+FFFD, but previously weren't. This patch performs that replacement.

Developed in https://github.com/WordPress/wordpress-develop/pull/7187
Discussed in https://core.trac.wordpress.org/ticket/61531

Follow-up to [56703].

Props dmsnell, jonsurrell.
See #61531.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 22:28:12 +00:00
Sergey Biryukov b428e1b5be Tests: Add a unit test for `get_metadata()` with a non-existing object ID.
Follow-up to [48658], [50641], [58962].

Props rodrigosprimo, jrf.
See #61530, #61608.
Built from https://develop.svn.wordpress.org/trunk@58968


git-svn-id: http://core.svn.wordpress.org/trunk@58364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 22:18:17 +00:00
dmsnell eac35f6ae6 HTML API: Add missing NOBR end tag handling to HTML Processor.
When the HTML Processor was introduced, an oversight led to a missing case for handling a closing `NOBR` tag. The `NOBR` element is a deprecated tag and should not be used.

This patch adds the missing case so that the deprecated `NOBR` end tag is appropriately handled.

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

Follow-up to [56274].

Props jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 22:03:15 +00:00
dmsnell d7f9d30df8 HTML API: Fix logic bug in HTML Processor when opening A element.
A mistake in the original code handling opening A elements in the HTML Processor led to mistakes in parsing where the Processor would bail in situations when it could have proceeded. While this was errant behavior, it didn't violate the public contract since it would bail in these situations.

This patch fixes the mistake, which was to only break out of the innermost loop instead of breaking from the containing loop, which resolves the issue.

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

Follow-up to [56274].

Props jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 21:54:15 +00:00
dmsnell 3e8d4ddc1d HTML API: Add missing `@global` tag on HTML Decoder.
The `@global` documentation has been missing in the `class-wp-html-decoder.php` file, and this patch adds it.

Discussed in https://core.trac.wordpress.org/ticket/61968

Props dmsnell, jonsurrell, shailu25.
Resolves #61968.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 20:55:14 +00:00
dmsnell d0877b108a WP_Debug_Data: Extract `wp-database` data into separate method.
This is the part three 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 third of twelve groups, the `wp-database` 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/7143
Discussed in https://core.trac.wordpress.org/ticket/61648

Props dmsnell, kebbet, apermo.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 20:44:16 +00:00
Peter Wilson 4fc2975cb5 Options, Meta APIs: Prevent mail options triggering a deprecation warning.
Prevents a deprecation warning saving options when the post by email feature is turned off in code using the `enable_post_by_email_configuration` filter.

Props ironprogrammer, manbo, narenin, sebastienserre, siliconforks.
Fixes #61144.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-02 00:13:16 +00:00
Sergey Biryukov 8532edd526 Docs: Further clarify return results for a non-existing ID in metadata functions.
This adds a note that the functions return either an empty array or an empty string for a valid but non-existing ID, depending on the `$single` parameter.

Follow-up to [48658], [50641].

Props rodrigosprimo, jrf.
See #61608.
Built from https://develop.svn.wordpress.org/trunk@58962


git-svn-id: http://core.svn.wordpress.org/trunk@58358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-01 18:30:16 +00:00
Sergey Biryukov c585121d5e Docs: Correct comment formatting in `wp_autosave_post_revisioned_meta_fields()`.
Follow-up to [56714].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-31 14:46:17 +00:00
Tammie Lister d7a3815245 Twenty Twenty: Correct font-size for Code block and other preformatted elements.
The code block font-size was not the same in the editor and front. This sets it to 1em and corrects the value for preformatted elements along with adding border and padding in the editor for pre elements.

Props viralsampat, mi5t4n, brobken, sabernhardt.
Fixes #61845.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-31 10:54:12 +00:00
Tammie Lister 0d5e01a52e Twenty Nineteen: Reduce bottom margin for Audio block.
The audio block was lacking a bottom margin in some editors. This resolves both non-framed and framed changes.

Props PGeorgiev, desrosj, sabernhardt, hmbashar.
Fixes #53681.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-31 10:39:16 +00:00
Peter Wilson 15aa25f351 Bundled Themes: Add contributors to copyright notices.
One of the benefits of contributing to WordPress is that contributors license their code under the GPL rather than assign copyright to the WordPress Foundation or another entity.

This updates the copyright notices in each of the bundled themes to acknowledge contributors own a portion of the copyright. For themes with a significant contribution from Automattic, the copyright notice is updated from Automattic.com to the legal entity Automattic Inc.

Props peterwilsoncc, desrosj, sabernhardt, jorbin, chanthaboune.
Fixes #61943.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-30 23:09:12 +00:00
joedolson 8d6f540982 Plugins: Delay AJAX search until after 2 characters.
Prevent the AJAX search results from firing until after at least 2 characters have been typed into the search boxes. Toggle `autocomplete` value once AJAX is firing. Add a changeable minimum character threshold.

Props armandsdz, adamsilverstein, afercia, mklusak, finalwebsites, joedolson.
Fixes #38211.
Built from https://develop.svn.wordpress.org/trunk@58957


git-svn-id: http://core.svn.wordpress.org/trunk@58353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-30 22:17:16 +00:00
desrosj 42c2e3578e External Libraries: Update jQuery Color to version `3.0.0`.
This update most notably drops support for jQuery `< 1.12` and `< 2.2`. WordPress has not shipped with a version that matches these ranges since version 4.4 (see [36285]/#35380).

The update also changes the library’s browser support policy to only support the latest Chrome, Firefox, Safari, and Edge. This closely matches Core’s current policy to support the last 2 versions of these browsers. The library’s README notes that other versions nay “also work correctly with this plugin but support is not guaranteed”, which is reasonably similar.

Props vipulgupta003.
Fixes #61835.
Built from https://develop.svn.wordpress.org/trunk@58956


git-svn-id: http://core.svn.wordpress.org/trunk@58352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-30 17:40:14 +00:00
Sergey Biryukov 8385861e3d Docs: Clarify the description for `wp_dropdown_users()`.
Follow-up to [8873].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-30 17:31:18 +00:00
Sergey Biryukov d564af0c7b Tests: Clarify description for `unregister_setting()` test with an unknown setting.
Follow-up to [56817].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-29 23:28:18 +00:00
Pascal Birchler 923afba171 Docs: Remove `@global` annotation after [58952].
Props mukesh27.
See #60970.
Built from https://develop.svn.wordpress.org/trunk@58953


git-svn-id: http://core.svn.wordpress.org/trunk@58349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-29 06:16:09 +00:00
Pascal Birchler 6665a4e30a Script Loader: Remove `importmap` polyfill.
The polyfill was added in [57492], but all browsers supported by WordPress already support import maps.

This not only disables the polyfill, but completely removes it as it was only added recently and there is no usage outside of core.

Props swissspidy, desrosj, luisherranz, gziolo.
Fixes #60970.
Built from https://develop.svn.wordpress.org/trunk@58952


git-svn-id: http://core.svn.wordpress.org/trunk@58348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-29 06:06:13 +00:00
ramonopoly 94b9ccd020 Block Styles: Ensure unique classname generation for variations
This commit simplifies block style variation class name generation to ensure unique class names by replacing the hashing of block attributes in the block style variation class names with a call to `wp_unique_id`.

Doing so avoids potential for non-unique class names and conflicting styles when exact copies of a block are inserted via a repeated pattern.


Props aaronrobertshaw, martinkrcho, mukesh27, peterwilsoncc, ramonopoly.

Fixes #61877.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-29 05:41:10 +00:00
ramonopoly 06e50d2cbb Fluid typography: allow individual preset overrides
In theme.json, individual font sizes may opt out of fluid typography if it is turned on globally.  

This commit ensures that individual font size presets can also opt in to fluid typography if it is not turned on globally. 

Props aaronrobertshaw, mmaattiiaass, ramonopoly, wildworks.

Fixes #61932.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-29 05:22:14 +00:00
Felix Arntz 4d0a623d7a Options, Meta APIs: Soft-deprecate use of 'yes' and 'no' as `$autoload` parameter.
WordPress 6.6 option autoload enhancements included discouraging the use of 'yes' and 'no' to indicate whether to autoload an option when calling `add_option()` or `update_option()`. Instead, a boolean should be used.

This changeset brings the newer autoload related functions `wp_set_option_autoload_values()`, `wp_set_options_autoload()`, and `wp_set_option_autoload()` in line with those changes. Additionally, it soft-deprecates the values more formally, as they should no longer be used. No PHP warnings will be emitted though as this is not a hard deprecation. This change is purely about documentation.

Props flixos90, joemcgill, jrf, mukesh27.
Fixes #61929.
See #61103, #61939.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-28 22:48:18 +00:00
Sergey Biryukov d79898ec1b Docs: Remove obsolete `@todo` entry in REST API post meta tests.
Follow-up to [56714].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-28 21:53:14 +00:00
antpb 81cfe7488c Media: Implement fallback to full-size thumbnails for PDFs in Media Library.
When medium-size thumbnails are disabled, PDF previews in the Media Library grid view now fall back to displaying full-size thumbnails instead of a generic document icon.

Props daleharrison, kushang78, mukesh27, sudipatel007, mai21, antpb.
Fixes #39630.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-28 17:01:13 +00:00
joedolson e57bee933a Media: Fix viewport scrolling and code style in image rotation.
Change `browsePopup` to use `onkeydown`, pass the `event` parameter from the calling control, and adjust variable naming style.

The `browsePopup` method used for the image rotation menu used `onkeyup` to trigger events, which prevented capturing browser scroll actions with arrows occurring on `onkeydown`.

Props afercia, deepakvijayan, nirajgirixd, joedolson, antpb.
Fixes #60548.
Built from https://develop.svn.wordpress.org/trunk@58946


git-svn-id: http://core.svn.wordpress.org/trunk@58342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-28 16:45:11 +00:00
Felix Arntz 05541b406c Options, Meta APIs: Stop using 'yes' and 'no' for autoload parameter in favor of recommended boolean.
This changeset does not modify any behavior, it only updates the code to use the recommended type for the `$autoload` parameter as of WordPress 6.6. The old values 'yes' and 'no' are only maintained in certain tests that are explicitly about these backward compatibility values.

Props flixos90, joemcgill, mukesh27.
Fixes #61939.
See #61103, #61929.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-28 16:41:16 +00:00
Aaron Jorbin 4065eb8bc4 Bootstrap/Load: Add Words of warning about load order.
Since this file is loaded incredibly early, many functions are not available. Those deeply familiar with how load works might have some idea as to what's safe and what isn't, but it's generally confusing and a little opaque so let's warn people there be dragons.

Props helen, DrewAPicture, jorbin.
Fixes #38650.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-28 14:36:17 +00:00
Sergey Biryukov af0ddfb337 Twenty Nineteen: Remove the use of empty rulesets.
Follow-up to [43808].

Props pitamdey, mukesh27, narenin.
Fixes #61933.
Built from https://develop.svn.wordpress.org/trunk@58943


git-svn-id: http://core.svn.wordpress.org/trunk@58339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-27 19:36:14 +00:00
Pascal Birchler 89519c939c Docs: Fix typo in `wp_show_heic_upload_error` docblock.
Follow-up to [58849].
See #53645.
Built from https://develop.svn.wordpress.org/trunk@58942


git-svn-id: http://core.svn.wordpress.org/trunk@58338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-27 15:29:14 +00:00
dmsnell b8dbab9546 Add Adam Zieliński to the mailmap file.
Adds Adam Zieliński's display name to the `.mailmap` file.

Developed in https://github.com/wordpress/wordpress-develop/7204
Discussed in https://core.trac.wordpress.org/ticket/61864

Follow-up to [58899].

Props dmsnell, zieladam.
See #61864.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-27 03:44:10 +00:00
dmsnell 813d784931 HTML API: Fix a bug where the namespace was forced to 'html'
While working on other reviews and audits, a bug was discovered in the HTML API where the wrong namespace was being assigned to a token because the default value of 'html' was used. This patch fixes the bug by calling the `parent::get_namespace()` method instead of assuming 'html'.

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

Follow-up to [58868].

Props jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-27 03:37:12 +00:00
Peter Wilson bd20e0e8d2 Build/test tools: Remove prompt for trac ticket referenced with ticket: prefix.
Prevents the GitHub bot from posting a comment on pull requests requesting a trac ticket link if the ticket description includes a link via the ticket: prefix, eg ticket:61865.

The WordPress/WordPress-Develop repository is configured to automatically convert the text to a trac ticket link.

Props dd32, peterwilsoncc.
Fixes #61865.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-26 23:16:15 +00:00
Sergey Biryukov 3014749ed9 Coding Standards: Use a human-readable constant in the check for max memory limit.
Follow-up to [35286], [38011], [38015], [58937].

See #61607.
Built from https://develop.svn.wordpress.org/trunk@58938


git-svn-id: http://core.svn.wordpress.org/trunk@58334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-26 20:57:13 +00:00
Felix Arntz ddd7f2142e Administration: Avoid using `WP_MAX_MEMORY_LIMIT` default that is smaller than `WP_MEMORY_LIMIT`.
Props eclare, dd32, pbearne.
Fixes #36426.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-26 20:14:14 +00:00
ramonopoly 9e650efbb8 Background images: resolve theme.json dynamic ref values and ensure appropriate style default values
The commit syncs the following changes from Gutenberg:

- Background images: add support for theme.json ref value resolution gutenberg#64128
- Background images: ensure appropriate default values gutenberg#64192
- Background image: ensure consistency with defaults and fix reset/remove functionality gutenberg#64328

These changes brings consistency to the default background image styles WordPress applies to user uploaded images, and adds support for ref resolution to "background" style properties.

Props andrewserong, aaronrobertshaw.  

Fixes #61858



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


git-svn-id: http://core.svn.wordpress.org/trunk@58332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-26 05:40:16 +00:00
Peter Wilson 0735fa8ce0 Script Loader: Refactor Etag generation for concatenated assets.
Move Etag HTTP header generation in `load-scripts.php` and `load-styles.php` to `WP_Dependencies`.

Introduces the method `WP_Dependencies::get_etag()` and associated unit tests.

Follow up to [57943].

Props vrajadas, martinkrcho, mukesh27.
Fixes #61485.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-25 23:48:13 +00:00
Peter Wilson fd94bc45c6 HTTP API: Update `wp_http_supports()` to use Requests.
Update the capabilities check in `wp_http_supports` to use `WpOrg\Requests\Requests::has_capabilities` rather than the deprecated `WP_HTTP::_get_first_available_transport()`.

Props dd32, mukesh27, costdev, desrosj, johnbillion, jorbin, jrf, chaion07.
Fixes #37708.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-25 23:13:17 +00:00
TimothyBlynJacobs a0e8d31590 REST API: Improve error messages when registering an invalid route.
The error messages now include the REST API namespace and route to help identify the offending code.

Props lwangaman, timothyblynjacobs.
Fixes #50493.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-25 22:51:14 +00:00
Sergey Biryukov a45c25d272 Script Loader: Do not normalize absolute paths in inline block styles CSS.
`_wp_normalize_relative_css_links()` used to normalize all non-absolute URLs regardless of whether it's a relative path or an absolute path. The normalization should only happen for relative paths (paths without a leading `/`) and not for absolute paths.

Reference: [https://www.rfc-editor.org/rfc/rfc1808#section-4 RFC 1808, Section 4, Step 4].

Follow-up to [52036], [52695], [52754], [55658], [55669].

Props scholdstrom.
Fixes #61909.
Built from https://develop.svn.wordpress.org/trunk@58932


git-svn-id: http://core.svn.wordpress.org/trunk@58328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-25 22:48:15 +00:00
Peter Wilson ac72a65949 Comments: Announce reply notices to screen reader users.
Improve experience for screen reader users by calling `wp.a11y.speak()` with the results of comment reply submissions within the WordPress dashboard.

Props joedolson, khokansardar.
Fixes #61480.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-25 22:37:19 +00:00
Tammie Lister f51cc56803 Twenty Seventeen: Fixes search block button styling variations.
The search block button was not the same back and front for background, text and font weight. This is an additional patch solving the previous issue of styles being in wrong section and also differences..

Props sabernhardt.
Fixes #61888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-24 12:21:15 +00:00
Sergey Biryukov b754603f04 Toolbar: Use CSS variable for the admin bar height in `wp-admin/css/common.css`.
Follow-up to [16600], [21025], [26072].

Props tdrayson, niravsherasiya7707, mukesh27.
See #61898.
Built from https://develop.svn.wordpress.org/trunk@58929


git-svn-id: http://core.svn.wordpress.org/trunk@58325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-24 00:05:12 +00:00
Sergey Biryukov 9c0e9fb055 Upgrade/Install: Use an empty string for the default “Post via email” password.
This aims to avoid a security warning in Chrome, which could previously be triggered even if the default value is not actually used as a password.

Follow-up to [208], [230], [233], [662], [1599], [1601]

Props adamkheckler, sabernhardt, peterwilsoncc, psykro, petitphp.
Fixes #61332.
Built from https://develop.svn.wordpress.org/trunk@58928


git-svn-id: http://core.svn.wordpress.org/trunk@58324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-23 23:17:13 +00:00
Peter Wilson d1386fb88c Administration: Modernize Site Icon UI in settings, customizer.
Updates the UI for previewing a site icon in general settings and the customizer to account for changes to browser designs over the past years.

Props joedolson, joen, kebbet, nhrrob, swissspidy, mukesh27, afercia, jorbin.
Fixes #60625.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-23 22:47:16 +00:00
dmsnell 01d2199622 HTML API: Add support for missing FRAMESET and "after" insertion modes.
As part of work to add more spec support to the HTML API, this patch adds support for the FRAMESET-related insertion modes, as well as the set of missing after insertion modes. These modes run at the end of parsing a document, closing it and taking care of any lingering tags.

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

Props dmsnell, jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-23 15:42:17 +00:00
dmsnell e3a3c13497 HTML API: Parse DOCTYPE tokens and set HTML parser mode accordingly.
This patch adds until-now missing code to parse the structure of HTML DOCTYPE declarations. The DOCTYPE is mostly unused but can dictate the document compatability mode, which governs whether CSS class names match in a ASCII-case-insensitive way or not, and whether TABLE elements close an open P element.

The DOCTYPE information is made available through a new method on the Tag Processor, `get_doctype_info()`.

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

Props dmsnell, jonsurrell.
See #61576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-23 14:55:15 +00:00
Sergey Biryukov 83c2045588 Docs: Correct inline comment formatting in `redirect_canonical()`.
Follow-up to [57357].

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


git-svn-id: http://core.svn.wordpress.org/trunk@58320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-22 23:47:15 +00:00
Peter Wilson 78a0c7a5b3 Date/Time: Prevent type errors in `current_time()`.
Prevents a potential type error when calling `current_time( 'timestamp' )` by casting `get_option( 'gmt_offset' )` to a float prior to performing calculations with the value.

This mainly accounts for incorrect storage of values, such as an empty string or city name.

Follow up to [45856], [55054], [55598].

Props hellofromtonya, peterwilsoncc, rarst, costdev, Nick_theGeek, SergeyBiryukov, johnbillion, desrosj, reputeinfosystems, audrasjb, oglekler.
Fixes #57035.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-22 23:27:24 +00:00
Pascal Birchler 2531f22a15 I18N: Add hardening for invalid meta lines in MO files.
Props swissspidy, pander.
Fixes #61794.
Built from https://develop.svn.wordpress.org/trunk@58922


git-svn-id: http://core.svn.wordpress.org/trunk@58318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-22 08:08:28 +00:00
Sergey Biryukov cddaa30f95 Site Health: Check if the directories are allowed when testing for a VCS checkout.
As part of determining whether to perform automatic updates, WordPress checks if it is running within a version-controlled environment, recursively looking up the filesystem to the top of the drive, looking for a Subversion, Git, Mercurial, or Bazaar directory, erring on the side of detecting a VCS checkout somewhere.

This commit reuses `WP_Automatic_Updater::is_allowed_dir()` in the Site Health test to avoid a PHP warning if the `open_basedir` directive is in use and any of the directories checked in the process are not allowed:
{{{
is_dir(): open_basedir restriction in effect. File(/.git) is not within the allowed path(s)
}}}

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

Props Keffr3n, narenin.
Fixes #61834.
Built from https://develop.svn.wordpress.org/trunk@58921


git-svn-id: http://core.svn.wordpress.org/trunk@58317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-21 22:23:16 +00:00
hellofromTonya 337bee97b7 Tests: Remove 'errors' assertion when not WP_Error in Tests_Term_WpInsertTerm.
Removes the assertion for 'errors' being empty when the instance is `WP_Term` and not `WP_Error`. This property exists on `WP_Error`.

This assertion always passed because it was checking a dynamic property on `WP_Term` that does not exist and is not added within Core. Thus, this assertion is not needed and fails with dynamic property deprecations.

Follow-up to [51403], [34646], [29830].

See #61890, #61530.
Built from https://develop.svn.wordpress.org/trunk@58920


git-svn-id: http://core.svn.wordpress.org/trunk@58316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-21 21:06:16 +00:00
hellofromTonya 84e11e89c0 Tests: Remove WP_Term::$filter property unset() within term tests.
Removes the `unset()` of the `WP_Term::$filter` property within the term tests.

Why?

Prior to the introduction of WP_Term, the term was added to the cache when its filter property was empty. To test the cache, the tests unset this property to trigger `wp_cache_add()` in `get_term()`. [34997] changed that behavior to trigger `wp_cache_add()` when the term was not found after `wp_cache_get()` (i.e. happened in `WP_Term::get_instance()`).

Unsetting the filter property is and was not needed. Prior to `WP_Term`, the condition was an empty value. With `WP_Term`, the filter property is no longer part of the conditional logic for caching.

Follow-up to [34997], [30954], [34035].

See #61890, #61530.
Built from https://develop.svn.wordpress.org/trunk@58919


git-svn-id: http://core.svn.wordpress.org/trunk@58315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-20 20:07:16 +00:00
Sergey Biryukov 1aa22ca3c6 Taxonomy: Correct the check for error messages in `wp-admin/edit-tag-form.php`.
Instead of checking for a specific message, e.g. “Item not updated”, the `$_REQUEST['error']` variable is now checked. This allows for custom messages added via the `term_updated_messages` filter to be considered an error when appropriate, and displayed with the correct CSS class.

This also brings consistency with a similar check in `wp-admin/edit-tags.php`.

Follow-up to [31823], [44663].

Props xipasduarte.
Fixes #61896.
Built from https://develop.svn.wordpress.org/trunk@58918


git-svn-id: http://core.svn.wordpress.org/trunk@58314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-20 17:50:16 +00:00
hellofromTonya fbf02475bc Media: Fix Media Library "Upload files" tab focus outline.
Adds a z-index to `.media-menu .media-menu-item:focus` to fix the "Upload files" tab's outline on the side next to the other tab.

Follow-up to [57553], [46363].

Props wildworks, antpb, huzaifaalmesbah, krupajnanda, nhrrob, oglekler, rajinsharwar, sabernhardt.
Fixes #60632.
Built from https://develop.svn.wordpress.org/trunk@58917


git-svn-id: http://core.svn.wordpress.org/trunk@58313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-20 16:57:14 +00:00
joedolson a88967db6e Media: Fix admin image cropping calculations.
The admin image editor crop function introduced rounding errors by using a scaled image to calculate values. Fix uses the image at 100% scale for calculations. Also avoid recalculating selection when the selection position is changed, and prevent incorrect values after scaling or restoration.

Previously committed in [58456] and reverted in [58571]. The revert was due to a misattributed test failure.

Props Jossnaz, johnillo, shailu25, rachelbaker, sudipatel007, joedolson, kevin940726 , andrewserong, hmbashar.
Fixes #32282.
Built from https://develop.svn.wordpress.org/trunk@58915


git-svn-id: http://core.svn.wordpress.org/trunk@58311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-19 20:47:17 +00:00
joedolson ce2b9f1fb2 Themes: Fix themes search event not firing on enter.
Attach the submit event to the parent search form in the installed and add new theme screen. Following [58405], the submit event was no longer attached to an object that was able to handle form submissions.

Props nithi22, nithins53, josklever, the-ank, debarghyabanerjee, sabernhardt, jeherve, hellofromtonya.
Fixes #61578.
Built from https://develop.svn.wordpress.org/trunk@58914


git-svn-id: http://core.svn.wordpress.org/trunk@58310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-19 19:19:17 +00:00