diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/deprecated.php --- a/wp/wp-includes/deprecated.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/deprecated.php Tue Sep 27 16:37:53 2022 +0200 @@ -76,17 +76,17 @@ * @deprecated 0.71 Use get_the_category() * @see get_the_category() * - * @param bool $echo Optional. Whether to echo the output. Default true. + * @param bool $display Optional. Whether to display the output. Default true. * @return int Category ID. */ -function the_category_ID($echo = true) { +function the_category_ID($display = true) { _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); // Grab the first cat in the list. $categories = get_the_category(); $cat = $categories[0]->term_id; - if ( $echo ) + if ( $display ) echo $cat; return $cat; @@ -795,17 +795,17 @@ * @deprecated 2.1.0 Use get_author_posts_url() * @see get_author_posts_url() * - * @param bool $echo + * @param bool $display * @param int $author_id * @param string $author_nicename Optional. * @return string|null */ -function get_author_link($echo, $author_id, $author_nicename = '') { +function get_author_link($display, $author_id, $author_nicename = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); $link = get_author_posts_url($author_id, $author_nicename); - if ( $echo ) + if ( $display ) echo $link; return $link; } @@ -939,11 +939,11 @@ * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. * Default -1. * @param int $show_updated Optional. Whether to show last updated timestamp. Default 1. - * @param bool $echo Whether to echo the results, or return them instead. + * @param bool $display Whether to display the results, or return them instead. * @return null|string */ function get_links($category = -1, $before = '', $after = '
', $between = ' ', $show_images = true, $orderby = 'name', - $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { + $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $display = true) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $order = 'ASC'; @@ -1018,7 +1018,7 @@ $output .= "$after\n"; } // End while. - if ( !$echo ) + if ( !$display ) return $output; echo $output; } @@ -1149,16 +1149,16 @@ * @deprecated 2.5.0 Use get_category_feed_link() * @see get_category_feed_link() * - * @param bool $echo + * @param bool $display * @param int $cat_ID * @return string */ -function get_category_rss_link($echo = false, $cat_ID = 1) { +function get_category_rss_link($display = false, $cat_ID = 1) { _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); $link = get_category_feed_link($cat_ID, 'rss2'); - if ( $echo ) + if ( $display ) echo $link; return $link; } @@ -1170,15 +1170,15 @@ * @deprecated 2.5.0 Use get_author_feed_link() * @see get_author_feed_link() * - * @param bool $echo + * @param bool $display * @param int $author_id * @return string */ -function get_author_rss_link($echo = false, $author_id = 1) { +function get_author_rss_link($display = false, $author_id = 1) { _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); $link = get_author_feed_link($author_id); - if ( $echo ) + if ( $display ) echo $link; return $link; } @@ -2024,22 +2024,6 @@ } /** - * Performs esc_url() for database or redirect usage. - * - * @since 2.3.1 - * @deprecated 2.8.0 Use esc_url_raw() - * @see esc_url_raw() - * - * @param string $url The URL to be cleaned. - * @param array $protocols An array of acceptable protocols. - * @return string The cleaned URL. - */ -function sanitize_url( $url, $protocols = null ) { - _deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' ); - return esc_url_raw( $url, $protocols ); -} - -/** * Checks and cleans a URL. * * A number of characters are removed from the URL. If the URL is for displaying @@ -2086,18 +2070,18 @@ * @deprecated 2.8.0 Use esc_html() * @see esc_html() * - * @param string $string String to escape. + * @param string $text Text to escape. * @param string $quote_style Unused. * @param false|string $charset Unused. * @param false $double_encode Whether to double encode. Unused. - * @return string Escaped `$string`. + * @return string Escaped `$text`. */ -function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { +function wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. - return _wp_specialchars( $string, $quote_style, $charset, $double_encode ); + return _wp_specialchars( $text, $quote_style, $charset, $double_encode ); } else { - return esc_html( $string ); + return esc_html( $text ); } } @@ -2874,13 +2858,13 @@ * * @link https://www.php.net/manual/en/function.error-log.php * - * @param mixed $fp Unused. - * @param string $string Message to log. + * @param mixed $fp Unused. + * @param string $message Message to log. */ -function debug_fwrite( $fp, $string ) { +function debug_fwrite( $fp, $message ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); if ( ! empty( $GLOBALS['debug'] ) ) - error_log( $string ); + error_log( $message ); } /** @@ -3208,7 +3192,7 @@ if ( ! is_file( $file ) ) { /* translators: %s: File name. */ - return sprintf( __( 'File “%s” doesn’t exist?' ), $file ); + return sprintf( __( 'File “%s” does not exist?' ), $file ); } if ( ! function_exists('imagecreatefromstring') ) @@ -3341,7 +3325,7 @@ case 'image/gif': return (imagetypes() & IMG_GIF) != 0; case 'image/webp': - return (imagetypes() & IMG_WEBP) != 0; // phpcs:ignore PHPCompatibility.Constants.NewConstants.img_webpFound + return (imagetypes() & IMG_WEBP) != 0; } } else { switch( $mime_type ) { @@ -3836,13 +3820,13 @@ * @since 1.0.0 * @deprecated 4.7.0 Officially dropped security support for Netscape 4. * - * @param string $string + * @param string $content * @return string */ -function wp_kses_js_entities( $string ) { +function wp_kses_js_entities( $content ) { _deprecated_function( __FUNCTION__, '4.7.0' ); - return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string ); + return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $content ); } /** @@ -4141,11 +4125,10 @@ } /** - * Displays a noindex meta tag if required by the blog configuration. - * - * If a blog is marked as not being public then the noindex meta tag will be - * output to tell web robots not to index the page content. Add this to the - * {@see 'wp_head'} action. + * Displays a `noindex` meta tag if required by the blog configuration. + * + * If a blog is marked as not being public then the `noindex` meta tag will be + * output to tell web robots not to index the page content. * * Typical usage is as a {@see 'wp_head'} callback: * @@ -4166,13 +4149,16 @@ } /** - * Display a noindex meta tag. - * - * Outputs a noindex meta tag that tells web robots not to index the page content. - * Typical usage is as a {@see 'wp_head'} callback. add_action( 'wp_head', 'wp_no_robots' ); + * Display a `noindex` meta tag. + * + * Outputs a `noindex` meta tag that tells web robots not to index the page content. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'wp_no_robots' ); * * @since 3.3.0 - * @since 5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged. + * @since 5.3.0 Echo `noindex,nofollow` if search engine visibility is discouraged. * @deprecated 5.7.0 Use wp_robots_no_robots() instead on 'wp_robots' filter. */ function wp_no_robots() { @@ -4187,17 +4173,21 @@ } /** - * Display a noindex,noarchive meta tag and referrer origin-when-cross-origin meta tag. - * - * Outputs a noindex,noarchive meta tag that tells web robots not to index or cache the page content. - * Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full - * url as a referrer to other sites when cross-origin assets are loaded. - * - * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_sensitive_page_meta' ); + * Display a `noindex,noarchive` meta tag and referrer `strict-origin-when-cross-origin` meta tag. + * + * Outputs a `noindex,noarchive` meta tag that tells web robots not to index or cache the page content. + * Outputs a referrer `strict-origin-when-cross-origin` meta tag that tells the browser not to send + * the full URL as a referrer to other sites when cross-origin assets are loaded. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'wp_sensitive_page_meta' ); * * @since 5.0.1 * @deprecated 5.7.0 Use wp_robots_sensitive_page() instead on 'wp_robots' filter * and wp_strict_cross_origin_referrer() on 'wp_head' action. + * + * @see wp_robots_sensitive_page() */ function wp_sensitive_page_meta() { _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' ); @@ -4212,9 +4202,10 @@ * Render inner blocks from the `core/columns` block for generating an excerpt. * * @since 5.2.0 - * @deprecated 5.8.0 - * * @access private + * @deprecated 5.8.0 Use _excerpt_render_inner_blocks() introduced in 5.8.0. + * + * @see _excerpt_render_inner_blocks() * * @param array $columns The parsed columns block. * @param array $allowed_blocks The list of allowed inner blocks. @@ -4222,5 +4213,101 @@ */ function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) { _deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' ); + return _excerpt_render_inner_blocks( $columns, $allowed_blocks ); } + +/** + * Renders the duotone filter SVG and returns the CSS filter property to + * reference the rendered SVG. + * + * @since 5.9.0 + * @deprecated 5.9.1 Use wp_get_duotone_filter_property() introduced in 5.9.1. + * + * @see wp_get_duotone_filter_property() + * + * @param array $preset Duotone preset value as seen in theme.json. + * @return string Duotone CSS filter property. + */ +function wp_render_duotone_filter_preset( $preset ) { + _deprecated_function( __FUNCTION__, '5.9.1', 'wp_get_duotone_filter_property()' ); + + return wp_get_duotone_filter_property( $preset ); +} + +/** + * Checks whether serialization of the current block's border properties should occur. + * + * @since 5.8.0 + * @access private + * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0. + * + * @see wp_should_skip_block_supports_serialization() + * + * @param WP_Block_Type $block_type Block type. + * @return bool Whether serialization of the current block's border properties + * should occur. + */ +function wp_skip_border_serialization( $block_type ) { + _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); + + $border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false ); + + return is_array( $border_support ) && + array_key_exists( '__experimentalSkipSerialization', $border_support ) && + $border_support['__experimentalSkipSerialization']; +} + +/** + * Checks whether serialization of the current block's dimensions properties should occur. + * + * @since 5.9.0 + * @access private + * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0. + * + * @see wp_should_skip_block_supports_serialization() + * + * @param WP_Block_type $block_type Block type. + * @return bool Whether to serialize spacing support styles & classes. + */ +function wp_skip_dimensions_serialization( $block_type ) { + _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); + + $dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false ); + + return is_array( $dimensions_support ) && + array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) && + $dimensions_support['__experimentalSkipSerialization']; +} + +/** + * Checks whether serialization of the current block's spacing properties should occur. + * + * @since 5.9.0 + * @access private + * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0. + * + * @see wp_should_skip_block_supports_serialization() + * + * @param WP_Block_Type $block_type Block type. + * @return bool Whether to serialize spacing support styles & classes. + */ +function wp_skip_spacing_serialization( $block_type ) { + _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); + + $spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false ); + + return is_array( $spacing_support ) && + array_key_exists( '__experimentalSkipSerialization', $spacing_support ) && + $spacing_support['__experimentalSkipSerialization']; +} + +/** + * Inject the block editor assets that need to be loaded into the editor's iframe as an inline script. + * + * @since 5.8.0 + * @deprecated 6.0.0 + */ +function wp_add_iframed_editor_assets_html() { + _deprecated_function( __FUNCTION__, '6.0.0' ); +}