WordPress/wp-includes/widgets
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
..
class-wp-nav-menu-widget.php
class-wp-widget-archives.php 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. 2023-09-25 21:05:21 +00:00
class-wp-widget-block.php Code Modernization: Replace usage of strpos() with str_starts_with(). 2023-05-02 15:45:22 +00:00
class-wp-widget-calendar.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:28:26 +00:00
class-wp-widget-categories.php 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. 2023-09-25 21:05:21 +00:00
class-wp-widget-custom-html.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-10 23:21:22 +00:00
class-wp-widget-links.php
class-wp-widget-media-audio.php Administration: Increase wp_admin_notice() usage in /wp-includes/. 2023-09-16 21:49:27 +00:00
class-wp-widget-media-gallery.php Widgets: Improve performance of has_content method in WP_Widget_Media_Gallery class. 2023-09-04 16:33:17 +00:00
class-wp-widget-media-image.php Administration: Increase wp_admin_notice() usage in /wp-includes/. 2023-09-16 21:49:27 +00:00
class-wp-widget-media-video.php Administration: Increase wp_admin_notice() usage in /wp-includes/. 2023-09-16 21:49:27 +00:00
class-wp-widget-media.php Coding Standards: Use pre-increment/decrement for stand-alone statements. 2023-09-09 09:28:26 +00:00
class-wp-widget-meta.php
class-wp-widget-pages.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:32:23 +00:00
class-wp-widget-recent-comments.php
class-wp-widget-recent-posts.php
class-wp-widget-rss.php Widgets: Match variable types in rss feed link filter. 2023-02-22 22:02:23 +00:00
class-wp-widget-search.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:32:23 +00:00
class-wp-widget-tag-cloud.php
class-wp-widget-text.php Administration: Increase wp_admin_notice() usage in /wp-includes/. 2023-09-16 21:49:27 +00:00