Skip to content

Commit e2cf339

Browse files
committed
Move newly deprecated functions to deprecated.php
1 parent d1a32d1 commit e2cf339

3 files changed

Lines changed: 73 additions & 73 deletions

File tree

src/wp-includes/deprecated.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5229,3 +5229,76 @@ function wp_render_duotone_support( $block_content, $block ) {
52295229
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::render_duotone_support' );
52305230
return WP_Duotone::render_duotone_support( $block_content, $block );
52315231
}
5232+
5233+
/**
5234+
* Returns a string containing the SVGs to be referenced as filters (duotone).
5235+
*
5236+
* @since 5.9.1
5237+
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
5238+
*
5239+
* @return string
5240+
*/
5241+
function wp_get_global_styles_svg_filters() {
5242+
_deprecated_function( __FUNCTION__, '6.3.0' );
5243+
5244+
/*
5245+
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
5246+
* developer's workflow.
5247+
*/
5248+
$can_use_cached = wp_get_development_mode() !== 'theme';
5249+
$cache_group = 'theme_json';
5250+
$cache_key = 'wp_get_global_styles_svg_filters';
5251+
if ( $can_use_cached ) {
5252+
$cached = wp_cache_get( $cache_key, $cache_group );
5253+
if ( $cached ) {
5254+
return $cached;
5255+
}
5256+
}
5257+
5258+
$supports_theme_json = wp_theme_has_theme_json();
5259+
5260+
$origins = array( 'default', 'theme', 'custom' );
5261+
if ( ! $supports_theme_json ) {
5262+
$origins = array( 'default' );
5263+
}
5264+
5265+
$tree = WP_Theme_JSON_Resolver::get_merged_data();
5266+
$svgs = $tree->get_svg_filters( $origins );
5267+
5268+
if ( $can_use_cached ) {
5269+
wp_cache_set( $cache_key, $svgs, $cache_group );
5270+
}
5271+
5272+
return $svgs;
5273+
}
5274+
5275+
/**
5276+
* Renders the SVG filters supplied by theme.json.
5277+
*
5278+
* Note that this doesn't render the per-block user-defined
5279+
* filters which are handled by wp_render_duotone_support,
5280+
* but it should be rendered before the filtered content
5281+
* in the body to satisfy Safari's rendering quirks.
5282+
*
5283+
* @since 5.9.1
5284+
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
5285+
*/
5286+
function wp_global_styles_render_svg_filters() {
5287+
_deprecated_function( __FUNCTION__, '6.3.0' );
5288+
5289+
/*
5290+
* When calling via the in_admin_header action, we only want to render the
5291+
* SVGs on block editor pages.
5292+
*/
5293+
if (
5294+
is_admin() &&
5295+
! get_current_screen()->is_block_editor()
5296+
) {
5297+
return;
5298+
}
5299+
5300+
$filters = wp_get_global_styles_svg_filters();
5301+
if ( ! empty( $filters ) ) {
5302+
echo $filters;
5303+
}
5304+
}

src/wp-includes/global-styles-and-settings.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -288,48 +288,6 @@ function wp_get_global_styles_custom_css() {
288288
return $stylesheet;
289289
}
290290

291-
/**
292-
* Returns a string containing the SVGs to be referenced as filters (duotone).
293-
*
294-
* @since 5.9.1
295-
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
296-
*
297-
* @return string
298-
*/
299-
function wp_get_global_styles_svg_filters() {
300-
_deprecated_function( __FUNCTION__, '6.3.0' );
301-
302-
/*
303-
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
304-
* developer's workflow.
305-
*/
306-
$can_use_cached = wp_get_development_mode() !== 'theme';
307-
$cache_group = 'theme_json';
308-
$cache_key = 'wp_get_global_styles_svg_filters';
309-
if ( $can_use_cached ) {
310-
$cached = wp_cache_get( $cache_key, $cache_group );
311-
if ( $cached ) {
312-
return $cached;
313-
}
314-
}
315-
316-
$supports_theme_json = wp_theme_has_theme_json();
317-
318-
$origins = array( 'default', 'theme', 'custom' );
319-
if ( ! $supports_theme_json ) {
320-
$origins = array( 'default' );
321-
}
322-
323-
$tree = WP_Theme_JSON_Resolver::get_merged_data();
324-
$svgs = $tree->get_svg_filters( $origins );
325-
326-
if ( $can_use_cached ) {
327-
wp_cache_set( $cache_key, $svgs, $cache_group );
328-
}
329-
330-
return $svgs;
331-
}
332-
333291
/**
334292
* Adds global style rules to the inline style for each block.
335293
*

src/wp-includes/script-loader.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,37 +2479,6 @@ function wp_enqueue_global_styles_custom_css() {
24792479
}
24802480
}
24812481

2482-
/**
2483-
* Renders the SVG filters supplied by theme.json.
2484-
*
2485-
* Note that this doesn't render the per-block user-defined
2486-
* filters which are handled by wp_render_duotone_support,
2487-
* but it should be rendered before the filtered content
2488-
* in the body to satisfy Safari's rendering quirks.
2489-
*
2490-
* @since 5.9.1
2491-
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
2492-
*/
2493-
function wp_global_styles_render_svg_filters() {
2494-
_deprecated_function( __FUNCTION__, '6.3.0' );
2495-
2496-
/*
2497-
* When calling via the in_admin_header action, we only want to render the
2498-
* SVGs on block editor pages.
2499-
*/
2500-
if (
2501-
is_admin() &&
2502-
! get_current_screen()->is_block_editor()
2503-
) {
2504-
return;
2505-
}
2506-
2507-
$filters = wp_get_global_styles_svg_filters();
2508-
if ( ! empty( $filters ) ) {
2509-
echo $filters;
2510-
}
2511-
}
2512-
25132482
/**
25142483
* Checks if the editor scripts and styles for all registered block types
25152484
* should be enqueued on the current screen.

0 commit comments

Comments
 (0)