<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56682] trunk: Script Loader: Replace hardcoded output of style tags with calls to `wp_add_inline_style`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56682">56682</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56682","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>spacedmonkey</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-09-25 17:04:41 +0000 (Mon, 25 Sep 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Script Loader: Replace hardcoded output of style tags with calls to `wp_add_inline_style`.
In this commit, enhancements have been made by replacing manually constructed style tags with calls to `wp_add_inline_style`. Previously, numerous style tags were generated and output directly in the header, resulting in redundant code and bypassing the core's style enqueueing system. This approach made it challenging for third-party developers to manage and control the output of these style tags.
To ensure backward compatibility, the following functions have been deprecated and replaced:
- print_embed_styles
- print_emoji_styles
- wp_admin_bar_header
- _admin_bar_bump_cb
Backward compatibility shims have also been added, ensuring that if these functions were previously unhooked from there actions, they will continue to not output a style tag.
However, for the following functions, conversion to use inline styles was not feasible due to the potential disruption it might cause by changing the style tag IDs, potentially breaking JavaScript functionality for a number of plugins in the repository:
- custom-background
- wp-custom
These changes improve code maintainability and enhance the flexibility and control available to developers when managing style outputs within WordPress core.
Props spacedmonkey, hlunter, westonruter, flixos90.
Fixes <a href="https://core.trac.wordpress.org/ticket/58775">#58775</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesadminfiltersphp">trunk/src/wp-admin/includes/admin-filters.php</a></li>
<li><a href="#trunksrcwpincludesadminbarphp">trunk/src/wp-includes/admin-bar.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunksrcwpincludesdeprecatedphp">trunk/src/wp-includes/deprecated.php</a></li>
<li><a href="#trunksrcwpincludesembedphp">trunk/src/wp-includes/embed.php</a></li>
<li><a href="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
<li><a href="#trunksrcwpincludesthemetemplatesphp">trunk/src/wp-includes/theme-templates.php</a></li>
<li><a href="#trunktestsphpunittestsblockseditorphp">trunk/tests/phpunit/tests/blocks/editor.php</a></li>
<li><a href="#trunktestsphpunittestsoembedtemplatephp">trunk/tests/phpunit/tests/oembed/template.php</a></li>
<li><a href="#trunktestsphpunitteststhemewpAddGlobalStylesForBlocksphp">trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesadminfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/admin-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/admin-filters.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-admin/includes/admin-filters.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,7 +60,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'admin_print_styles', 'print_emoji_styles' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'admin_enqueue_scripts', 'wp_enqueue_emoji_styles' );
+add_action( 'admin_print_styles', 'print_emoji_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_emoji_styles().
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_print_styles', 'print_admin_styles', 20 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_print_scripts-index.php', 'wp_localize_community_events' );
</span></span></pre></div>
<a id="trunksrcwpincludesadminbarphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/admin-bar.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/admin-bar.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-includes/admin-bar.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1225,32 +1225,51 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prints style and scripts for the admin bar.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Enqueues inline style to hide the admin bar when printing.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 3.1.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.4.0
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_admin_bar_header() {
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
- ?>
-<style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
- <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_enqueue_admin_bar_header_styles() {
+ // Back-compat for plugins that disable functionality by unhooking this action.
+ $action = is_admin() ? 'admin_head' : 'wp_head';
+ if ( ! has_action( $action, 'wp_admin_bar_header' ) ) {
+ return;
+ }
+ remove_action( $action, 'wp_admin_bar_header' );
+
+ wp_add_inline_style( 'admin-bar', '@media print { #wpadminbar { display:none; } }' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prints default admin bar callback.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Enqueues inline bump styles to make room for the admin bar.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 3.1.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.4.0
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _admin_bar_bump_cb() {
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
- ?>
-<style<?php echo $type_attr; ?> media="screen">
- html { margin-top: 32px !important; }
- @media screen and ( max-width: 782px ) {
- html { margin-top: 46px !important; }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_enqueue_admin_bar_bump_styles() {
+ if ( current_theme_supports( 'admin-bar' ) ) {
+ $admin_bar_args = get_theme_support( 'admin-bar' );
+ $header_callback = $admin_bar_args[0]['callback'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-</style>
- <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( empty( $header_callback ) ) {
+ $header_callback = '_admin_bar_bump_cb';
+ }
+
+ if ( '_admin_bar_bump_cb' !== $header_callback ) {
+ return;
+ }
+
+ // Back-compat for plugins that disable functionality by unhooking this action.
+ if ( ! has_action( 'wp_head', $header_callback ) ) {
+ return;
+ }
+ remove_action( 'wp_head', $header_callback );
+
+ $css = '
+ @media screen { html { margin-top: 32px !important; } }
+ @media screen and ( max-width: 782px ) { html { margin-top: 46px !important; } }
+ ';
+ wp_add_inline_style( 'admin-bar', $css );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-includes/default-filters.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -357,7 +357,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'start_previewing_theme', 'wp_clean_theme_json_cache' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'after_switch_theme', '_wp_menus_changed' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'after_switch_theme', '_wp_sidebars_changed' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'wp_print_styles', 'print_emoji_styles' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'wp_enqueue_scripts', 'wp_enqueue_emoji_styles' );
+add_action( 'wp_print_styles', 'print_emoji_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_emoji_styles().
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_GET['replytocom'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_robots', 'wp_robots_no_robots' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -647,6 +648,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't remove. Wrong way to disable.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_init', '_wp_admin_bar_init' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'wp_enqueue_scripts', 'wp_enqueue_admin_bar_bump_styles' );
+add_action( 'wp_enqueue_scripts', 'wp_enqueue_admin_bar_header_styles' );
+add_action( 'admin_enqueue_scripts', 'wp_enqueue_admin_bar_header_styles' );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'before_signup_header', '_wp_admin_bar_init' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'activate_header', '_wp_admin_bar_init' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_body_open', 'wp_admin_bar_render', 0 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -668,7 +672,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'embed_head', 'enqueue_embed_scripts', 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'embed_head', 'print_emoji_detection_script' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'embed_head', 'print_embed_styles' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'embed_head', 'wp_enqueue_embed_styles', 9 );
+add_action( 'embed_head', 'print_embed_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_embed_styles().
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'embed_head', 'wp_print_head_scripts', 20 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'embed_head', 'wp_print_styles', 20 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'embed_head', 'wp_robots' );
</span></span></pre></div>
<a id="trunksrcwpincludesdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/deprecated.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-includes/deprecated.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5872,6 +5872,92 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Prints the CSS in the embed iframe header.
+ *
+ * @since 4.4.0
+ * @deprecated 6.4.0 Use wp_enqueue_embed_styles() instead.
+ */
+function print_embed_styles() {
+ _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' );
+
+ $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
+ ?>
+ <style<?php echo $type_attr; ?>>
+ <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
+ </style>
+ <?php
+}
+
+/**
+ * Prints the important emoji-related styles.
+ *
+ * @since 4.2.0
+ * @deprecated 6.4.0 Use wp_enqueue_emoji_styles() instead.
+ */
+function print_emoji_styles() {
+ _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_emoji_styles' );
+ static $printed = false;
+
+ if ( $printed ) {
+ return;
+ }
+
+ $printed = true;
+
+ $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
+ ?>
+ <style<?php echo $type_attr; ?>>
+ img.wp-smiley,
+ img.emoji {
+ display: inline !important;
+ border: none !important;
+ box-shadow: none !important;
+ height: 1em !important;
+ width: 1em !important;
+ margin: 0 0.07em !important;
+ vertical-align: -0.1em !important;
+ background: none !important;
+ padding: 0 !important;
+ }
+ </style>
+ <?php
+}
+
+/**
+ * Prints style and scripts for the admin bar.
+ *
+ * @since 3.1.0
+ * @deprecated 6.4.0 Use wp_enqueue_admin_bar_header_styles() instead.
+ */
+function wp_admin_bar_header() {
+ _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_header_styles' );
+ $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
+ ?>
+ <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
+ <?php
+}
+
+/**
+ * Prints default admin bar callback.
+ *
+ * @since 3.1.0
+ * @deprecated 6.4.0 Use wp_enqueue_admin_bar_bump_styles() instead.
+ */
+function _admin_bar_bump_cb() {
+ _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_bump_styles' );
+ $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
+ ?>
+ <style<?php echo $type_attr; ?> media="screen">
+ html { margin-top: 32px !important; }
+ @media screen and ( max-width: 782px ) {
+ html { margin-top: 46px !important; }
+ }
+ </style>
+ <?php
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5907,4 +5993,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $support_errors = wp_get_https_detection_errors();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'https_detection_errors', $support_errors );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre></div>
<a id="trunksrcwpincludesembedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/embed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/embed.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-includes/embed.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1059,18 +1059,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prints the CSS in the embed iframe header.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Enqueues the CSS in the embed iframe header.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 4.4.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.4.0
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function print_embed_styles() {
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
- $suffix = SCRIPT_DEBUG ? '' : '.min';
- ?>
- <style<?php echo $type_attr; ?>>
- <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
- </style>
- <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_enqueue_embed_styles() {
+ // Back-compat for plugins that disable functionality by unhooking this action.
+ if ( ! has_action( 'embed_head', 'print_embed_styles' ) ) {
+ return;
+ }
+ remove_action( 'embed_head', 'print_embed_styles' );
+
+ $suffix = wp_scripts_get_suffix();
+ $handle = 'wp-embed-template';
+ wp_register_style( $handle, false );
+ wp_add_inline_style( $handle, file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ) );
+ wp_enqueue_style( $handle );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesformattingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/formatting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/formatting.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-includes/formatting.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5858,37 +5858,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prints the important emoji-related styles.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Enqueues the important emoji-related styles.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 4.2.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.4.0
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function print_emoji_styles() {
- static $printed = false;
-
- if ( $printed ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_enqueue_emoji_styles() {
+ // Back-compat for plugins that disable functionality by unhooking this action.
+ $action = is_admin() ? 'admin_print_styles' : 'wp_print_styles';
+ if ( ! has_action( $action, 'print_emoji_styles' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ remove_action( $action, 'print_emoji_styles' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $printed = true;
-
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
- ?>
-<style<?php echo $type_attr; ?>>
-img.wp-smiley,
-img.emoji {
- display: inline !important;
- border: none !important;
- box-shadow: none !important;
- height: 1em !important;
- width: 1em !important;
- margin: 0 0.07em !important;
- vertical-align: -0.1em !important;
- background: none !important;
- padding: 0 !important;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $emoji_styles = '
+ img.wp-smiley, img.emoji {
+ display: inline !important;
+ border: none !important;
+ box-shadow: none !important;
+ height: 1em !important;
+ width: 1em !important;
+ margin: 0 0.07em !important;
+ vertical-align: -0.1em !important;
+ background: none !important;
+ padding: 0 !important;
+ }';
+ $handle = 'wp-emoji-styles';
+ wp_register_style( $handle, false );
+ wp_add_inline_style( $handle, $emoji_styles );
+ wp_enqueue_style( $handle );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-</style>
- <?php
-}
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Prints the inline Emoji detection script if it is not already printed.
</span></span></pre></div>
<a id="trunksrcwpincludesthemetemplatesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/theme-templates.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme-templates.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/src/wp-includes/theme-templates.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -118,14 +118,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $_wp_current_template_content ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?>
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php
- /**
- * Print the skip-link styles.
- */
- ?>
- <style id="skip-link-styles">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $skip_link_styles = '
</ins><span class="cx" style="display: block; padding: 0 10px"> .skip-link.screen-reader-text {
</span><span class="cx" style="display: block; padding: 0 10px"> border: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> clip: rect(1px,1px,1px,1px);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -154,10 +148,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> top: 5px;
</span><span class="cx" style="display: block; padding: 0 10px"> width: auto;
</span><span class="cx" style="display: block; padding: 0 10px"> z-index: 100000;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- </style>
- <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }';
+
+ $handle = 'wp-block-template-skip-link';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Print the skip-link styles.
+ */
+ wp_register_style( $handle, false );
+ wp_add_inline_style( $handle, $skip_link_styles );
+ wp_enqueue_style( $handle );
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Print the skip-link script.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span></span></pre></div>
<a id="trunktestsphpunittestsblockseditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/blocks/editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/editor.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/tests/phpunit/tests/blocks/editor.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $args = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_title' => 'Example',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="trunktestsphpunittestsoembedtemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/oembed/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/oembed/template.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/tests/phpunit/tests/oembed/template.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,6 +10,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_scripts;
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_scripts = null;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function tear_down() {
</span></span></pre></div>
<a id="trunktestsphpunitteststhemewpAddGlobalStylesForBlocksphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php 2023-09-25 16:23:52 UTC (rev 56681)
+++ trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php 2023-09-25 17:04:41 UTC (rev 56682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private $test_blocks = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function set_up() {
+ parent::set_up();
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function tear_down() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Unregister test blocks.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $this->test_blocks ) ) {
</span></span></pre>
</div>
</div>
</body>
</html>