Commit Graph

2453 Commits

Author SHA1 Message Date
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
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
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
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
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
Sergey Biryukov c6324a7388 Script Loader: Remove redundant check in `wp_register_tinymce_scripts()`.
Since removing the build steps for a gzipped version of TinyMCE, the check whether gzip is supported on the server is superfluous. It may also result in the uncompressed files being used when the compressed files are available and could be used.

Follow-up to [44114], [44651].

Props MattyRob, hbhalodia.
Fixes #61862.
Built from https://develop.svn.wordpress.org/trunk@58902


git-svn-id: http://core.svn.wordpress.org/trunk@58298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-15 14:58:16 +00:00
Peter Wilson d09e94165e External Libraries: Update the Underscore.js library to version 1.13.7.
This updates the Underscore library from version 1.13.6 to 1.13.7. This is a minor bug fix release.

The full list of changes can be found in the Underscore.js change log: https://underscorejs.org/#changelog.

Props hbhalodia, aristath, desrosj, mcrisp1972.
Fixes #61836.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-10 23:57:16 +00:00
desrosj 32bf860db4 External Libraries: Update the Backbone.js library to version `1.6.0`.
This updates the `backbone` library from version `1.5.0` to `1.6.0`. This is a minor bug fix release.

The full list of changes can be found in the Backbone.js change log: https://backbonejs.org/#changelog.

Props manooweb mardroid.
Fixes #60512.
Built from https://develop.svn.wordpress.org/trunk@58872


git-svn-id: http://core.svn.wordpress.org/trunk@58268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-08 19:37:19 +00:00
desrosj cb0f56f131 External Libraries: Update the `whatwg-fetch` polyfill library.
This updates the `whatwg-fetch` library from version `3.6.17` to `3.6.20`, the latest current version.

This library is included and registered within WordPress as the `wp-polyfill-fetch` script but is no longer used by WordPress itself. Updates are provided as a courtesy, and all projects using this polyfill should reevaluate usage.

Props manooweb.
Fixes #60514.
Built from https://develop.svn.wordpress.org/trunk@58860


git-svn-id: http://core.svn.wordpress.org/trunk@58256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-07 15:52:22 +00:00
Peter Wilson dd21bf5f22 General: Introduce `wp_get_wp_version()` to get unmodified version.
Introduces `wp_get_wp_version()` to get an unmodified value of `$wp_version` from `wp-includes/version.php`. Some plugins modify the global in an attempt to improve security through obscurity. This practice can cause errors in WordPress so the ability to get an unmodified version is needed.

Replaces instances within the code base in which `version.php` was required in order to get an unmodified value. `script-loader.php` is intentionally excluded from the replacements as the function is not always available to the file.

Props debarghyabanerjee, afragen, costdev.
See #61627.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-27 00:27:16 +00:00
desrosj 86754f2bc2 External Libraries: Update the `regenerator-runtime` library.
This updates the `regenerator-runtime` library to version `0.14.1`.

This library has not been used by Core itself in quite a while and only maintained as a courtesy. Any projects relying on `regenerator-runtime` should reevaluate their usage.

Props manooweb.
Fixes #60515.
Built from https://develop.svn.wordpress.org/trunk@58800


git-svn-id: http://core.svn.wordpress.org/trunk@58196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-24 14:07:17 +00:00
isabel_brison ccc46f8ada Editor: enqueue block custom CSS only when block renders on the page.
Updates the global styles custom CSS handling logic to be consistent with other global styles and take advantage of conditional enqueuing of block styles.

Props isabel_brison, aaronrobertshaw, andrewserong.
Fixes #61395.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-10 06:19:17 +00:00
desrosj 2889f4d90e Coding Standards: Apply changes after running `composer format`.
This applies several formatting related changes made while running `composer format`.

Follow up to [55720], [58171], [58271], [58282], [58283], [58292], [58299], [58303], [58332].
See #51857, #60719, #60895, #61021, #61118, #61228, #61276, #61324.
Built from https://develop.svn.wordpress.org/trunk@58408


git-svn-id: http://core.svn.wordpress.org/trunk@57857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-13 15:06:07 +00:00
gziolo 6635e1b9f3 Editor: Remove unnecessary code for ensuring interactivity API dependency in block core functions
Removing old code for registering the private version of the Interactivity API pre-6.5.

Props czapla, gziolo, shailu25, cbravobernal.
Fixes #60913.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-04 07:39:10 +00:00
audrasjb e9b86ce6d0 Script Loader: Add missing escaping function to `Moment.js` string localization.
This changeset avoids breaking the inline script added for `Moment.js` localization if for some reason `get_user_locale()` doesn't return a simply string.

Props swissspidy.
Fixes #61341.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-02 22:35:10 +00:00
ellatrix 13df6623cf Add missing vendors file after r58271.
See #61324.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-31 18:56:14 +00:00
audrasjb 407584f9ef External Libraries: Revert some unwanted changes after [58218].
This reverts some unwanted changes related to `react` and react-dom` versions in `$vendor_scripts_versions`.

Follow-up to [58218].

Unprops audrasjb.
Fixes #61090.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 21:22:10 +00:00
audrasjb 12541213c1 External Libraries: Update the jQuery UI library to version 1.13.3.
For more information on the changes included, see https://blog.jqueryui.com/2024/04/jquery-ui-1-13-3-released/.

Props audrasjb, desrosj, khokansardar, swissspidy.
Fixes #61090.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 21:14:15 +00:00
ellatrix 1fbf5fa51d Editor: Update npm packages.
Updates the editor npm packages to latest versions.

See https://github.com/WordPress/wordpress-develop/pull/6612.

Props ellatrix, mukesh27, youknowriad, mamaduka.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 19:39:28 +00:00
Pascal Birchler a6b9c3d542 Script Loader: stop enqueueing some now obsolete polyfills.
Stop enqueueing polyfills such as `wp-polyfill-inert` (for the `inert` attribute) and `regenerator-runtime` (for generator functions), as they are no longer needed, considering the WordPress project's [https://make.wordpress.org/core/handbook/best-practices/browser-support/ browser support policy].

In addition to that, `wp-polyfill` (essentially `core-js`) is no longer enqueued as a dependency of `react`. This was added in [43903] to ensure compatibility with IE 11, which is no longer supported by WordPress. Developers requiring `wp-polyfill` need to manually add it as a dependency for their scripts.

Props swissspidy, flixos90, adamsilverstein, youknowriad, gziolo.
Fixes #60962.
Built from https://develop.svn.wordpress.org/trunk@57981


git-svn-id: http://core.svn.wordpress.org/trunk@57467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-10 14:42:17 +00:00
Aaron Jorbin 7173bb9a94 Site icon: Polish up Site Icon on the general settings screen.
This fixes a number of issues, chief among them:
- Updates to the site title are reflected in the preview.
- Improve alt text for preview
- Make string describing site icon more succinct.
- Add inline documentation to JavaScript

Props kebbet, jorbin, swissspidy, afercia, mukesh27, alexstine, jameskoster, andraganescu.
Fixes #54370.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-26 20:18:09 +00:00
K. Adam White 9a3210759f Script Loader: Inject wp_remove_surrounding_empty_script_tags function name in returned error string using sprintf.
The name of this function should not be editable by the translator in the internationalized return error string.

Props naoki0h, swissspidy, kirasong.
Fixes #60590.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-23 05:45:12 +00:00
Pascal Birchler 26673814df Script Loader: Fix small typo in `wp_remove_surrounding_empty_script_tags` docblock.
Props shailu25.
Fixes #60591.
Built from https://develop.svn.wordpress.org/trunk@57682


git-svn-id: http://core.svn.wordpress.org/trunk@57183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-21 18:39:09 +00:00
Peter Wilson b70ebbddf9 Script Loader: Switch to JavaScript translations.
Update JavaScript files for tag suggestions and the TinyMCE link plugin to use client side translations. This allows for `_n()` to be used for strings requiring singular and plural versions in which the correct form is only known client side.

Props audrasjb, chaion07, costdev, hellofromtonya, johnbillion, marybaum, nicolefurlan, oglekler, rebasaurus, rsiddharth, sergeybiryukov, shaampk1, shahariaazam, swissspidy, tobifjellner.
Fixes #48244.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-18 22:16:14 +00:00
Aaron Jorbin d080076580 General: Add an option to configure the site icon in general settings.
This restores the site icon setting to its original home on the settings page where it lives with the title and tagline.

The base for this code was originally added in [32994] and then removed in [33329]. The majority of the modification to that version are to remove the no-js pieces and make the workflow completely inline rather than putting the cropping on a separate page.

Additionally, since image crops rely on the ability to upload an image, this setting is gated by the `upload_files` capability.

Follow-up to: [32994], [33329].

Props jorbin, audrasjb, mukesh27, joedolson, afercia, kebbet, swissspidy, obenland, jameskoster, kjellr, andraganescu, stacimc, mikeschroder, h71, krupajnanda, huzaifaalmesbah.
Fixes #54370.
See #16434.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-12 21:57:09 +00:00
youknowriad 812c9ad3da Script Loader: Improve translators comments for wp.date.setSettings in compat file.
Fixing a few translators comments that have incorrect placeholders reference or unnecessary ones.

Props get_dave, mukesh27, afercia.
Fixes #60412.
Built from https://develop.svn.wordpress.org/trunk@57557


git-svn-id: http://core.svn.wordpress.org/trunk@57058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-08 07:11:08 +00:00
youknowriad cd2716ff72 Script Loader: Add a timezone offset display value to wp.date.setSettings.
Fixes a bug in the editor where the offset values are displayed as decimals rather than minutes.

Props afercia, get_dave.
Fixes #60105.
Built from https://develop.svn.wordpress.org/trunk@57556


git-svn-id: http://core.svn.wordpress.org/trunk@57057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-08 07:08:13 +00:00
gziolo 2de003154d Script Modules API: Add import map polyfill for older browsers
Syncs the changes from https://github.com/WordPress/gutenberg/pull/58263. Adds a polyfill to make import maps compatible with unsported browsers (https://caniuse.com/import-maps).

Fixes #60348.
Props cbravobernal, jorbin, luisherranz, jonsurrell.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-31 08:31:29 +00:00
youknowriad 1de40f71be Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress. 
This includes features like:

 - DataViews.
 - Customization tools like box shadow, background size and repeat.
 - UI improvements in the site editor. 
 - Preferences sharing between the post and site editors.
 - Unified panels and editors between post and site editors.
 - Improved template mode in the post editor.
 - Iterations to multiple interactive blocks.
 - Preparing the blocks and UI for pattern overrides.
 - and a lot more.

Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377


git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 21:07:12 +00:00
Weston Ruter 3f2e254478 Script Loader: Clarify in docs that `wp_get_inline_script_tag()` and `wp_print_inline_script_tag()` can take non-JS data.
Props vladimiraus.
Fixes #60331.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-27 01:04:14 +00:00
Weston Ruter a3abf9c89f Script Loader: Only emit CDATA wrapper comments in `wp_get_inline_script_tag()` for JavaScript.
This avoids erroneously adding CDATA wrapper comments for non-JavaScript scripts, including those for JSON such as the `importmap` for script modules in #56313.

Props westonruter, flixos90, mukesh27, dmsnell.
See #56313.
Fixes #60320.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 17:56:12 +00:00
Felix Arntz e19c18cba9 Bootstrap/Load: Introduce functions to check whether WordPress is serving a REST API request.
This changeset introduces two functions:
* `wp_is_serving_rest_request()` returns a boolean for whether WordPress is serving an actual REST API request.
* `wp_is_rest_endpoint()` returns a boolean for whether a WordPress REST API endpoint is currently being used. While this is always the case if `wp_is_serving_rest_request()` returns `true`, the function additionally covers the scenario of internal REST API requests, i.e. where WordPress calls a REST API endpoint within the same request.

Both functions should only be used after the `parse_request` action.

All relevant manual checks have been adjusted to use one of the new functions, depending on the use-case. They were all using the same constant check so far, while in fact some of them were intending to check for an actual REST API request while others were intending to check for REST endpoint usage.

A new filter `wp_is_rest_endpoint` can be used to alter the return value of the `wp_is_rest_endpoint()` function.

Props lots.0.logs, TimothyBlynJacobs, flixos90, joehoyle, peterwilsoncc, swissspidy, SergeyBiryukov, pento, mikejolley, iandunn, hellofromTonya, Cybr, petitphp.
Fixes #42061.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 17:40:09 +00:00
Sergey Biryukov a559c54aef Docs: Document the `$shortcode_tags` global in `wp_just_in_time_script_localization()`.
Follow-up to [41395], [41844].

Props upadalavipul.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57204


git-svn-id: http://core.svn.wordpress.org/trunk@56712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-19 13:12:27 +00:00
Aaron Jorbin d5b96bf00d External Libraries: For Lodash, sync the declared version number with the one that is loaded.
In [50941] the version of lodash was updated, however the version inside `wp_default_packages_vendor` was not updated at the same time. This updates the version to correctly reflect the version that is loaded.

Also adds some basic tests for the scripts in `wp_default_packages_vendor` that match the name of the package from package.json to help prevent errors like this in the future.

Props jadpm, jorbin, swissspidy.
Fixes #60048. See #52991.



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


git-svn-id: http://core.svn.wordpress.org/trunk@56696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-13 17:50:31 +00:00
Sergey Biryukov 747b2c9f11 Docs: Replace incorrect `@private` tags.
The `@private` tag does not exist and is not supported. To indicate that something is private when in the global namespace, `@access private` should be used instead.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#phpdoc-tags PHP Documentation Standards: PHPDoc tags].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 09:27:23 +00:00
Felix Arntz 5496e4b70b Script Loader: Fix missing documentation for the `$path` argument of `wp_enqueue_block_style()`.
See #59466.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 18:48:24 +00:00
Weston Ruter a20cb28d14 Script Loader: Harden removal of script tag wrappers.
* Add `wp_remove_surrounding_empty_script_tags()` to more precisely remove script tag wrappers and warn when doing it wrong.
* Add clarifying comments for XML escaping logic in `wp_get_inline_script_tag()`.
* Leverage `WP_HTML_Tag_Processor` in `test_remove_frameless_preview_messenger_channel`.
* Reuse `assertEqualMarkup` in `test_blocking_dependent_with_delayed_dependency`.
* Normalize whitespace in `parse_markup_fragment` for `assertEqualMarkup`.

Follow-up to [56687].
Props dmsnell, westonruter, flixos90.
See #58664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 19:47:21 +00:00
gziolo 1050b47e06 General: Set the correct script version for `regenerator-runtime`
Follow-up for [56710]. Brings back the version specified in the `package.json` file.

Props ockham.
See #59411.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 08:35:23 +00:00
Tammie Lister 04f631f232 Update editor related npm packages
The npm packages needed updating for 6.4 to the latest.

Props mikachan, mukesdpanchal27, luisherranz, youknowriad, tellthemachines, gziolo, ockham, michalczaplinski

Fixes #59411


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


git-svn-id: http://core.svn.wordpress.org/trunk@56222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 14:23:26 +00:00
Weston Ruter e7747ce23e Script Loader: Use `wp_get_script_tag()` and `wp_get_inline_script_tag()`/`wp_print_inline_script_tag()` helper functions to output scripts on the frontend and login screen.
Using script tag helper functions allows plugins to employ the `wp_script_attributes` and `wp_inline_script_attributes` filters to inject the `nonce` attribute to apply Content Security Policy (e.g. Strict CSP). Use of helper functions also simplifies logic in `WP_Scripts`.

* Update `wp_get_inline_script_tag()` to wrap inline script in CDATA blocks for XHTML-compatibility when not using HTML5.
* Ensure the `type` attribute is printed first in `wp_get_inline_script_tag()` for back-compat.
* Wrap existing `<script>` tags in output buffering to retain IDE supports.
* In `wp_get_inline_script_tag()`, append the newline to `$javascript` before it is passed into the `wp_inline_script_attributes` filter so that the CSP hash can be computed properly.
* In `the_block_template_skip_link()`, opt to enqueue the inline script rather than print it.
* Add `ext-php` to `composer.json` under `suggest` as previously it was an undeclared dependency for running PHPUnit tests.
* Update tests to rely on `DOMDocument` to compare script markup, normalizing unsemantic differences.

Props westonruter, spacedmonkey, flixos90, 10upsimon, dmsnell, mukesh27, joemcgill, swissspidy, azaozz.
Fixes #58664.
See #39941.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 21:05:21 +00:00
desrosj 1df2b50c43 External Libraries: Update the `polyfill-library` package.
This updates the `wp-polyfill-node-contains` and `'wp-polyfill-dom-rect` scripts to the latest version, `4.8.0`.

These scripts are no longer used by WordPress Core, but are kept up to date as a courtesy.

Props rajinsharwar, hrshahin, oglekler.
Fixes #59077.
Built from https://develop.svn.wordpress.org/trunk@56646


git-svn-id: http://core.svn.wordpress.org/trunk@56158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 12:28:33 +00:00
desrosj 081e87f702 External Libraries: Update the `regenerator-runtime` version.
Adds the required change to the `script-loader.php` file for [56626] that was missed.

See #59078.
Built from https://develop.svn.wordpress.org/trunk@56627


git-svn-id: http://core.svn.wordpress.org/trunk@56139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 19:32:12 +00:00
isabel_brison 21ecbc3b0d Editor: disable default style engine optimisation.
Stops style engine from combining CSS selectors by default so that rule order is preserved.

Props ramonopoly, rajinsharwar, timdix, costdev, audrasjb, SergeyBiryukov, JeffPaul, mukesh27.
Fixes #58811.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 04:56:21 +00:00
Felix Arntz ca8a033079 General: Update `wp_register_script()` calls in core to use new function signature.
Since most core scripts are registered using `WP_Scripts::add()`, which is not affected by the signature change, only calls to `wp_register_script()` using the old signature need to be updated. There is only a single instance left, which is updated in this changeset.

Props incursadesigns.
Fixes #58634.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-13 20:52:22 +00:00
Sergey Biryukov e5490118af Coding Standards: Include one space after `function` keyword for closures.
Note: This is enforced by WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/pull/2328 WPCS: PR #2328 Core: properly check formatting of function declaration statements].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56559


git-svn-id: http://core.svn.wordpress.org/trunk@56071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-12 15:23:18 +00:00
hellofromTonya 8c4c35311b Introduce font-face styles generator and printer.
Introducing Font Face, a server-side `@font-face` styles generator and printer. 

tl;dr:
* Introduces Font Face.
* Deprecates `_wp_theme_json_webfonts_handler()`.

**Introduce Font Face**

From an array of fonts (i.e. each font-family and its font variations to be processed), it:

1. Validates each `font-face` declaration, i.e. the CSS property and value pairing. If validation fails, processing stops with no font-face styles printed.
3. Generates the `@font-face` CSS for each font-family.
4. Prints the CSS within a `<style id="wp-fonts-local">` element.

The entry point into Font Face is through a new global function called `wp_print_font_faces()`, which is automatically called:

* when the `'wp_head'` hook runs (for the front-end).
* when the `'admin_print_styles'` hook runs (for the back-end).
* when `_wp_get_iframed_editor_assets()` runs to inject the `@font-face` styles into the iframed editor.

Once called, it gets the fonts from Theme_JSON merged data layer, which includes theme defined fonts and user activated fonts (once the Font Library #59166 is introduced into Core).

For classic sites, themes and plugins can directly call `wp_print_font_faces()` and pass their fonts array to it for processing.

**Deprecates `_wp_theme_json_webfonts_handler()`.**

As Font Face is a direct replacement, the stopgap code in `_wp_theme_json_webfonts_handler()` (introduced in 6.0.0 via [53282]) is deprecated and unused in Core.

**Props note:**
There's a long multiple year history baked into Font Face, which dates back to the early versions of a web font API (see #46370 and [https://github.com/WordPress/gutenberg/issues/41479 roadmap]. The props list includes those who contributed from those early versions up to this commit.

**References:**
* #46370 original (Web)Fonts API proposal for registering and enqueuing web fonts.
* [https://github.com/WordPress/gutenberg/issues/41479 Gutenberg tracking issue] which includes the evolution from Webfonts API to Fonts API to Font Face.
* [53282] / #55567 Added the stopgap code `_wp_theme_json_webfonts_handler()` in 6.0.
* [https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face @font-face on mdn web docs]
* #59166 Font Library: Font manager for WordPress

Follow-up to [53282].

Props aristath, jonoaldersonwp, hellofromTonya, andraganescu, annezazu, antonvlasenko, arena, askdesign, azaozz, bph, bradley2083, colorful-tones, costdev, davidbaumwald, desrosj, dingo_d, djcowan, domainsupport, dryanpress, elmastudio, flixos90, francina, garrett-eclipse, gigitux, grantmkin, grapplerulrich, gziolo, ironprogrammer, jb510, jeffpaul, jeremyyip, jffng, joostdevalk, jorgefilipecosta, juanmaguitar, mamaduka, matveb, mburridge, mitogh, ndiego, ntsekouras, oandregal, ocean90, oglekler, paaljoachim, pagelab, peterwilsoncc, poena, priethor, scruffian, SergeyBiryukov, shiloey, simison, skorasaurus, soean, westonruter, wildworks, zaguiini.
Fixes #59165.
Built from https://develop.svn.wordpress.org/trunk@56500


git-svn-id: http://core.svn.wordpress.org/trunk@56012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-31 21:49:20 +00:00
audrasjb 6687c0ec8f Editor: Add relative time strings for the `wp-date` inline script output.
This changeset updates `wp_default_packages_inline_scripts()` to add relative time strings to the `wp-date` inline script, so the JS version of `human_time_diff` 
can output translated strings.

Props ramonopoly, oandregal, swissspidy, manzoorwanijk, adrianduffell, Presskopp.
Fixes #59219, #47373.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 22:11:12 +00:00
Aaron Jorbin 2213e52fd8 External Libraries: Update jQuery to version 3.7.1.
This release fixes a regression from jQuery 3.6.0 that resulted in rounded dimensions for `<tr />` elements in Chrome and Safari. Also, a (mostly) internal Sizzle method, `jQuery.find.tokenize` that was on the jQuery object was accidentally removed when they removed Sizzle in jQuery 3.7.0. That method has been restored.

References:
- https://blog.jquery.com/2023/08/28/jquery-3-7-1-released-reliable-table-row-dimensions/
- https://github.com/jquery/jquery/compare/3.7.0...3.7.1

Follow-up to [49101], [50445], [50520], [54202], [55012], [55491], [55860].

Props TobiasBg, jorbin.
Fixes #59227.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-28 17:14:23 +00:00