Skip to content

Commit

Permalink
Move newly deprecated functions to deprecated.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlende committed Jun 27, 2023
1 parent 3b976b6 commit b7ffac2
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 73 deletions.
73 changes: 73 additions & 0 deletions src/wp-includes/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -5229,3 +5229,76 @@ function wp_render_duotone_support( $block_content, $block ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::render_duotone_support' );
return WP_Duotone::render_duotone_support( $block_content, $block );
}

/**
* Returns a string containing the SVGs to be referenced as filters (duotone).
*
* @since 5.9.1
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
*
* @return string
*/
function wp_get_global_styles_svg_filters() {
_deprecated_function( __FUNCTION__, '6.3.0' );

/*
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
* developer's workflow.
*/
$can_use_cached = wp_get_development_mode() !== 'theme';
$cache_group = 'theme_json';
$cache_key = 'wp_get_global_styles_svg_filters';
if ( $can_use_cached ) {
$cached = wp_cache_get( $cache_key, $cache_group );
if ( $cached ) {
return $cached;
}
}

$supports_theme_json = wp_theme_has_theme_json();

$origins = array( 'default', 'theme', 'custom' );
if ( ! $supports_theme_json ) {
$origins = array( 'default' );
}

$tree = WP_Theme_JSON_Resolver::get_merged_data();
$svgs = $tree->get_svg_filters( $origins );

if ( $can_use_cached ) {
wp_cache_set( $cache_key, $svgs, $cache_group );
}

return $svgs;
}

/**
* Renders the SVG filters supplied by theme.json.
*
* Note that this doesn't render the per-block user-defined
* filters which are handled by wp_render_duotone_support,
* but it should be rendered before the filtered content
* in the body to satisfy Safari's rendering quirks.
*
* @since 5.9.1
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
*/
function wp_global_styles_render_svg_filters() {
_deprecated_function( __FUNCTION__, '6.3.0' );

/*
* When calling via the in_admin_header action, we only want to render the
* SVGs on block editor pages.
*/
if (
is_admin() &&
! get_current_screen()->is_block_editor()
) {
return;
}

$filters = wp_get_global_styles_svg_filters();
if ( ! empty( $filters ) ) {
echo $filters;
}
}
42 changes: 0 additions & 42 deletions src/wp-includes/global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,48 +288,6 @@ function wp_get_global_styles_custom_css() {
return $stylesheet;
}

/**
* Returns a string containing the SVGs to be referenced as filters (duotone).
*
* @since 5.9.1
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
*
* @return string
*/
function wp_get_global_styles_svg_filters() {
_deprecated_function( __FUNCTION__, '6.3.0' );

/*
* Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
* developer's workflow.
*/
$can_use_cached = wp_get_development_mode() !== 'theme';
$cache_group = 'theme_json';
$cache_key = 'wp_get_global_styles_svg_filters';
if ( $can_use_cached ) {
$cached = wp_cache_get( $cache_key, $cache_group );
if ( $cached ) {
return $cached;
}
}

$supports_theme_json = wp_theme_has_theme_json();

$origins = array( 'default', 'theme', 'custom' );
if ( ! $supports_theme_json ) {
$origins = array( 'default' );
}

$tree = WP_Theme_JSON_Resolver::get_merged_data();
$svgs = $tree->get_svg_filters( $origins );

if ( $can_use_cached ) {
wp_cache_set( $cache_key, $svgs, $cache_group );
}

return $svgs;
}

/**
* Adds global style rules to the inline style for each block.
*
Expand Down
31 changes: 0 additions & 31 deletions src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2491,37 +2491,6 @@ function wp_enqueue_global_styles_custom_css() {
}
}

/**
* Renders the SVG filters supplied by theme.json.
*
* Note that this doesn't render the per-block user-defined
* filters which are handled by wp_render_duotone_support,
* but it should be rendered before the filtered content
* in the body to satisfy Safari's rendering quirks.
*
* @since 5.9.1
* @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports.
*/
function wp_global_styles_render_svg_filters() {
_deprecated_function( __FUNCTION__, '6.3.0' );

/*
* When calling via the in_admin_header action, we only want to render the
* SVGs on block editor pages.
*/
if (
is_admin() &&
! get_current_screen()->is_block_editor()
) {
return;
}

$filters = wp_get_global_styles_svg_filters();
if ( ! empty( $filters ) ) {
echo $filters;
}
}

/**
* Checks if the editor scripts and styles for all registered block types
* should be enqueued on the current screen.
Expand Down

0 comments on commit b7ffac2

Please sign in to comment.