Changeset 56682
- Timestamp:
- 09/25/2023 05:04:41 PM (16 months ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/admin-filters.php
r56500 r56682 61 61 add_action( 'admin_print_scripts', 'print_head_scripts', 20 ); 62 62 add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' ); 63 add_action( 'admin_print_styles', 'print_emoji_styles' ); 63 add_action( 'admin_enqueue_scripts', 'wp_enqueue_emoji_styles' ); 64 add_action( 'admin_print_styles', 'print_emoji_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_emoji_styles(). 64 65 add_action( 'admin_print_styles', 'print_admin_styles', 20 ); 65 66 -
trunk/src/wp-includes/admin-bar.php
r56548 r56682 1226 1226 1227 1227 /** 1228 * Prints style and scripts for the admin bar. 1229 * 1230 * @since 3.1.0 1231 */ 1232 function wp_admin_bar_header() { 1233 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 1234 ?> 1235 <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style> 1236 <?php 1237 } 1238 1239 /** 1240 * Prints default admin bar callback. 1241 * 1242 * @since 3.1.0 1243 */ 1244 function _admin_bar_bump_cb() { 1245 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 1246 ?> 1247 <style<?php echo $type_attr; ?> media="screen"> 1248 html { margin-top: 32px !important; } 1249 @media screen and ( max-width: 782px ) { 1250 html { margin-top: 46px !important; } 1251 } 1252 </style> 1253 <?php 1228 * Enqueues inline style to hide the admin bar when printing. 1229 * 1230 * @since 6.4.0 1231 */ 1232 function wp_enqueue_admin_bar_header_styles() { 1233 // Back-compat for plugins that disable functionality by unhooking this action. 1234 $action = is_admin() ? 'admin_head' : 'wp_head'; 1235 if ( ! has_action( $action, 'wp_admin_bar_header' ) ) { 1236 return; 1237 } 1238 remove_action( $action, 'wp_admin_bar_header' ); 1239 1240 wp_add_inline_style( 'admin-bar', '@media print { #wpadminbar { display:none; } }' ); 1241 } 1242 1243 /** 1244 * Enqueues inline bump styles to make room for the admin bar. 1245 * 1246 * @since 6.4.0 1247 */ 1248 function wp_enqueue_admin_bar_bump_styles() { 1249 if ( current_theme_supports( 'admin-bar' ) ) { 1250 $admin_bar_args = get_theme_support( 'admin-bar' ); 1251 $header_callback = $admin_bar_args[0]['callback']; 1252 } 1253 1254 if ( empty( $header_callback ) ) { 1255 $header_callback = '_admin_bar_bump_cb'; 1256 } 1257 1258 if ( '_admin_bar_bump_cb' !== $header_callback ) { 1259 return; 1260 } 1261 1262 // Back-compat for plugins that disable functionality by unhooking this action. 1263 if ( ! has_action( 'wp_head', $header_callback ) ) { 1264 return; 1265 } 1266 remove_action( 'wp_head', $header_callback ); 1267 1268 $css = ' 1269 @media screen { html { margin-top: 32px !important; } } 1270 @media screen and ( max-width: 782px ) { html { margin-top: 46px !important; } } 1271 '; 1272 wp_add_inline_style( 'admin-bar', $css ); 1254 1273 } 1255 1274 -
trunk/src/wp-includes/default-filters.php
r56664 r56682 358 358 add_action( 'after_switch_theme', '_wp_menus_changed' ); 359 359 add_action( 'after_switch_theme', '_wp_sidebars_changed' ); 360 add_action( 'wp_print_styles', 'print_emoji_styles' ); 360 add_action( 'wp_enqueue_scripts', 'wp_enqueue_emoji_styles' ); 361 add_action( 'wp_print_styles', 'print_emoji_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_emoji_styles(). 361 362 362 363 if ( isset( $_GET['replytocom'] ) ) { … … 648 649 add_action( 'template_redirect', '_wp_admin_bar_init', 0 ); 649 650 add_action( 'admin_init', '_wp_admin_bar_init' ); 651 add_action( 'wp_enqueue_scripts', 'wp_enqueue_admin_bar_bump_styles' ); 652 add_action( 'wp_enqueue_scripts', 'wp_enqueue_admin_bar_header_styles' ); 653 add_action( 'admin_enqueue_scripts', 'wp_enqueue_admin_bar_header_styles' ); 650 654 add_action( 'before_signup_header', '_wp_admin_bar_init' ); 651 655 add_action( 'activate_header', '_wp_admin_bar_init' ); … … 669 673 add_action( 'embed_head', 'enqueue_embed_scripts', 1 ); 670 674 add_action( 'embed_head', 'print_emoji_detection_script' ); 671 add_action( 'embed_head', 'print_embed_styles' ); 675 add_action( 'embed_head', 'wp_enqueue_embed_styles', 9 ); 676 add_action( 'embed_head', 'print_embed_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_embed_styles(). 672 677 add_action( 'embed_head', 'wp_print_head_scripts', 20 ); 673 678 add_action( 'embed_head', 'wp_print_styles', 20 ); -
trunk/src/wp-includes/deprecated.php
r56664 r56682 5873 5873 5874 5874 /** 5875 * Prints the CSS in the embed iframe header. 5876 * 5877 * @since 4.4.0 5878 * @deprecated 6.4.0 Use wp_enqueue_embed_styles() instead. 5879 */ 5880 function print_embed_styles() { 5881 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' ); 5882 5883 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 5884 $suffix = SCRIPT_DEBUG ? '' : '.min'; 5885 ?> 5886 <style<?php echo $type_attr; ?>> 5887 <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?> 5888 </style> 5889 <?php 5890 } 5891 5892 /** 5893 * Prints the important emoji-related styles. 5894 * 5895 * @since 4.2.0 5896 * @deprecated 6.4.0 Use wp_enqueue_emoji_styles() instead. 5897 */ 5898 function print_emoji_styles() { 5899 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_emoji_styles' ); 5900 static $printed = false; 5901 5902 if ( $printed ) { 5903 return; 5904 } 5905 5906 $printed = true; 5907 5908 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 5909 ?> 5910 <style<?php echo $type_attr; ?>> 5911 img.wp-smiley, 5912 img.emoji { 5913 display: inline !important; 5914 border: none !important; 5915 box-shadow: none !important; 5916 height: 1em !important; 5917 width: 1em !important; 5918 margin: 0 0.07em !important; 5919 vertical-align: -0.1em !important; 5920 background: none !important; 5921 padding: 0 !important; 5922 } 5923 </style> 5924 <?php 5925 } 5926 5927 /** 5928 * Prints style and scripts for the admin bar. 5929 * 5930 * @since 3.1.0 5931 * @deprecated 6.4.0 Use wp_enqueue_admin_bar_header_styles() instead. 5932 */ 5933 function wp_admin_bar_header() { 5934 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_header_styles' ); 5935 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 5936 ?> 5937 <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style> 5938 <?php 5939 } 5940 5941 /** 5942 * Prints default admin bar callback. 5943 * 5944 * @since 3.1.0 5945 * @deprecated 6.4.0 Use wp_enqueue_admin_bar_bump_styles() instead. 5946 */ 5947 function _admin_bar_bump_cb() { 5948 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_bump_styles' ); 5949 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 5950 ?> 5951 <style<?php echo $type_attr; ?> media="screen"> 5952 html { margin-top: 32px !important; } 5953 @media screen and ( max-width: 782px ) { 5954 html { margin-top: 46px !important; } 5955 } 5956 </style> 5957 <?php 5958 } 5959 5960 /** 5875 5961 * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. 5876 5962 * -
trunk/src/wp-includes/embed.php
r56180 r56682 1060 1060 1061 1061 /** 1062 * Prints the CSS in the embed iframe header. 1063 * 1064 * @since 4.4.0 1065 */ 1066 function print_embed_styles() { 1067 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 1068 $suffix = SCRIPT_DEBUG ? '' : '.min'; 1069 ?> 1070 <style<?php echo $type_attr; ?>> 1071 <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?> 1072 </style> 1073 <?php 1062 * Enqueues the CSS in the embed iframe header. 1063 * 1064 * @since 6.4.0 1065 */ 1066 function wp_enqueue_embed_styles() { 1067 // Back-compat for plugins that disable functionality by unhooking this action. 1068 if ( ! has_action( 'embed_head', 'print_embed_styles' ) ) { 1069 return; 1070 } 1071 remove_action( 'embed_head', 'print_embed_styles' ); 1072 1073 $suffix = wp_scripts_get_suffix(); 1074 $handle = 'wp-embed-template'; 1075 wp_register_style( $handle, false ); 1076 wp_add_inline_style( $handle, file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ) ); 1077 wp_enqueue_style( $handle ); 1074 1078 } 1075 1079 -
trunk/src/wp-includes/formatting.php
r56596 r56682 5859 5859 5860 5860 /** 5861 * Prints the important emoji-related styles.5862 * 5863 * @since 4.2.05864 */ 5865 function print_emoji_styles() {5866 static $printed = false;5867 5868 if ( $printed) {5861 * Enqueues the important emoji-related styles. 5862 * 5863 * @since 6.4.0 5864 */ 5865 function wp_enqueue_emoji_styles() { 5866 // Back-compat for plugins that disable functionality by unhooking this action. 5867 $action = is_admin() ? 'admin_print_styles' : 'wp_print_styles'; 5868 if ( ! has_action( $action, 'print_emoji_styles' ) ) { 5869 5869 return; 5870 5870 } 5871 5872 $printed = true; 5873 5874 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 5875 ?> 5876 <style<?php echo $type_attr; ?>> 5877 img.wp-smiley, 5878 img.emoji { 5879 display: inline !important; 5880 border: none !important; 5881 box-shadow: none !important; 5882 height: 1em !important; 5883 width: 1em !important; 5884 margin: 0 0.07em !important; 5885 vertical-align: -0.1em !important; 5886 background: none !important; 5887 padding: 0 !important; 5888 } 5889 </style> 5890 <?php 5871 remove_action( $action, 'print_emoji_styles' ); 5872 5873 $emoji_styles = ' 5874 img.wp-smiley, img.emoji { 5875 display: inline !important; 5876 border: none !important; 5877 box-shadow: none !important; 5878 height: 1em !important; 5879 width: 1em !important; 5880 margin: 0 0.07em !important; 5881 vertical-align: -0.1em !important; 5882 background: none !important; 5883 padding: 0 !important; 5884 }'; 5885 $handle = 'wp-emoji-styles'; 5886 wp_register_style( $handle, false ); 5887 wp_add_inline_style( $handle, $emoji_styles ); 5888 wp_enqueue_style( $handle ); 5891 5889 } 5892 5890 -
trunk/src/wp-includes/theme-templates.php
r56549 r56682 119 119 return; 120 120 } 121 ?> 122 123 <?php 124 /** 125 * Print the skip-link styles. 126 */ 127 ?> 128 <style id="skip-link-styles"> 121 122 $skip_link_styles = ' 129 123 .skip-link.screen-reader-text { 130 124 border: 0; … … 155 149 width: auto; 156 150 z-index: 100000; 157 } 158 </style> 159 <?php 151 }'; 152 153 $handle = 'wp-block-template-skip-link'; 154 155 /** 156 * Print the skip-link styles. 157 */ 158 wp_register_style( $handle, false ); 159 wp_add_inline_style( $handle, $skip_link_styles ); 160 wp_enqueue_style( $handle ); 161 160 162 /** 161 163 * Print the skip-link script. -
trunk/tests/phpunit/tests/blocks/editor.php
r56680 r56682 18 18 19 19 parent::set_up(); 20 21 remove_action( 'wp_print_styles', 'print_emoji_styles' ); 20 22 21 23 $args = array( -
trunk/tests/phpunit/tests/oembed/template.php
r56383 r56682 11 11 global $wp_scripts; 12 12 $wp_scripts = null; 13 14 remove_action( 'wp_print_styles', 'print_emoji_styles' ); 13 15 } 14 16 -
trunk/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php
r56254 r56682 19 19 private $test_blocks = array(); 20 20 21 public function set_up() { 22 parent::set_up(); 23 remove_action( 'wp_print_styles', 'print_emoji_styles' ); 24 } 25 21 26 public function tear_down() { 22 27 // Unregister test blocks.
Note: See TracChangeset
for help on using the changeset viewer.