Changeset 61418
- Timestamp:
- 12/30/2025 01:01:11 PM (4 weeks ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 4 edited
-
class-wp-styles.php (modified) (2 diffs)
-
fonts/class-wp-font-face.php (modified) (2 diffs)
-
script-loader.php (modified) (2 diffs)
-
theme.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-styles.php
r61411 r61418 159 159 160 160 if ( $inline_style ) { 161 $ inline_style_tag = sprintf(162 "<style id='%s-inline-css'>\n%s\n</style>\n",163 esc_attr( $handle ),164 $inline_style165 );161 $processor = new WP_HTML_Tag_Processor( '<style></style>' ); 162 $processor->next_tag(); 163 $processor->set_attribute( 'id', "{$handle}-inline-css" ); 164 $processor->set_modifiable_text( "\n{$inline_style}\n" ); 165 $inline_style_tag = "{$processor->get_updated_html()}\n"; 166 166 } else { 167 167 $inline_style_tag = ''; … … 337 337 } 338 338 339 printf(340 "<style id='%s-inline-css'>\n%s\n</style>\n",341 esc_attr( $handle ),342 $output343 );339 $processor = new WP_HTML_Tag_Processor( '<style></style>' ); 340 $processor->next_tag(); 341 $processor->set_attribute( 'id', "{$handle}-inline-css" ); 342 $processor->set_modifiable_text( "\n{$output}\n" ); 343 echo "{$processor->get_updated_html()}\n"; 344 344 345 345 return true; -
trunk/src/wp-includes/fonts/class-wp-font-face.php
r61411 r61418 93 93 } 94 94 95 printf( $this->get_style_element(), $css ); 95 $processor = new WP_HTML_Tag_Processor( '<style class="wp-fonts-local"></style>' ); 96 $processor->next_tag(); 97 $processor->set_modifiable_text( "\n{$css}\n" ); 98 echo "{$processor->get_updated_html()}\n"; 96 99 } 97 100 … … 195 198 196 199 /** 197 * Gets the style element for wrapping the `@font-face` CSS.198 *199 * @since 6.4.0200 *201 * @return string The style element.202 */203 private function get_style_element() {204 return "<style class='wp-fonts-local'>\n%s\n</style>\n";205 }206 207 /**208 200 * Gets the `@font-face` CSS styles for locally-hosted font files. 209 201 * -
trunk/src/wp-includes/script-loader.php
r61416 r61418 2414 2414 2415 2415 if ( ! empty( $wp_styles->print_code ) ) { 2416 echo "<style>\n"; 2417 echo $wp_styles->print_code; 2418 echo sprintf( "\n/*# sourceURL=%s */", rawurlencode( $concat_source_url ) ); 2419 echo "\n</style>\n"; 2416 $processor = new WP_HTML_Tag_Processor( '<style></style>' ); 2417 $processor->next_tag(); 2418 $style_tag_contents = "\n{$wp_styles->print_code}\n" 2419 . sprintf( "/*# sourceURL=%s */\n", rawurlencode( $concat_source_url ) ); 2420 $processor->set_modifiable_text( $style_tag_contents ); 2421 echo "{$processor->get_updated_html()}\n"; 2420 2422 } 2421 2423 } … … 3172 3174 $action_hook_name, 3173 3175 static function () use ( $style ) { 3174 echo "<style>$style</style>\n"; 3176 $processor = new WP_HTML_Tag_Processor( '<style></style>' ); 3177 $processor->next_tag(); 3178 $processor->set_modifiable_text( $style ); 3179 echo "{$processor->get_updated_html()}\n"; 3175 3180 }, 3176 3181 $priority -
trunk/src/wp-includes/theme.php
r61411 r61418 1951 1951 $style .= $image . $position . $size . $repeat . $attachment; 1952 1952 } 1953 ?> 1954 <style<?php echo $type_attr; ?> id="custom-background-css"> 1955 body.custom-background { <?php echo trim( $style ); ?> } 1956 </style> 1957 <?php 1953 1954 $processor = new WP_HTML_Tag_Processor( "<style{$type_attr} id=\"custom-background-css\"></style>" ); 1955 $processor->next_tag(); 1956 1957 $style_tag_content = 'body.custom-background { ' . trim( $style ) . ' }'; 1958 $processor->set_modifiable_text( "\n{$style_tag_content}\n" ); 1959 echo "{$processor->get_updated_html()}\n"; 1958 1960 } 1959 1961 … … 1965 1967 function wp_custom_css_cb() { 1966 1968 $styles = wp_get_custom_css(); 1967 if ( $styles || is_customize_preview() ) : 1968 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 1969 ?> 1970 <style<?php echo $type_attr; ?> id="wp-custom-css"> 1971 <?php 1972 // Note that esc_html() cannot be used because `div > span` is not interpreted properly. 1973 echo strip_tags( $styles ); 1974 ?> 1975 </style> 1976 <?php 1977 endif; 1969 if ( ! $styles && ! is_customize_preview() ) { 1970 return; 1971 } 1972 1973 $processor = new WP_HTML_Tag_Processor( '<style></style>' ); 1974 $processor->next_tag(); 1975 if ( ! current_theme_supports( 'html5', 'style' ) ) { 1976 $processor->set_attribute( 'type', 'text/css' ); 1977 } 1978 $processor->set_attribute( 'id', 'wp-custom-css' ); 1979 $processor->set_modifiable_text( "\n{$styles}\n" ); 1980 echo "{$processor->get_updated_html()}\n"; 1978 1981 } 1979 1982
Note: See TracChangeset
for help on using the changeset viewer.