diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/deprecated.php --- a/wp/wp-includes/deprecated.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/deprecated.php Wed Sep 21 18:19:35 2022 +0200 @@ -1303,7 +1303,7 @@ * * @link https://developer.wordpress.org/reference/functions/get_all_category_ids/ * - * @return object List of all of the category IDs. + * @return int[] List of all of the category IDs. */ function get_all_category_ids() { _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); @@ -1911,6 +1911,7 @@ } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { // No thumb, no image. We'll look for a mime-related icon instead. + /** This filter is documented in wp-includes/post.php */ $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); $src_file = $icon_dir . '/' . wp_basename($src); } @@ -1947,7 +1948,7 @@ // Do we need to constrain the image? if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { - $imagesize = @getimagesize($src_file); + $imagesize = wp_getimagesize($src_file); if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { $actual_aspect = $imagesize[0] / $imagesize[1]; @@ -3196,7 +3197,8 @@ * @see wp_get_image_editor() * * @param string $file Filename of the image to load. - * @return resource The resulting image resource on success, Error string on failure. + * @return resource|GdImage|string The resulting image resource or GdImage instance on success, + * error string on failure. */ function wp_load_image( $file ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); @@ -3217,7 +3219,7 @@ $image = imagecreatefromstring( file_get_contents( $file ) ); - if ( ! is_resource( $image ) ) { + if ( ! is_gd_image( $image ) ) { /* translators: %s: File name. */ return sprintf( __( 'File “%s” is not an image.' ), $file ); } @@ -3338,6 +3340,8 @@ return (imagetypes() & IMG_PNG) != 0; case 'image/gif': return (imagetypes() & IMG_GIF) != 0; + case 'image/webp': + return (imagetypes() & IMG_WEBP) != 0; // phpcs:ignore PHPCompatibility.Constants.NewConstants.img_webpFound } } else { switch( $mime_type ) { @@ -3347,6 +3351,8 @@ return function_exists('imagecreatefrompng'); case 'image/gif': return function_exists('imagecreatefromgif'); + case 'image/webp': + return function_exists('imagecreatefromwebp'); } } return false; @@ -3564,7 +3570,7 @@ /** * Formats text for the rich text editor. * - * The {@see 'richedit_pre'} filter is applied here. If $text is empty the filter will + * The {@see 'richedit_pre'} filter is applied here. If `$text` is empty the filter will * be applied to an empty string. * * @since 2.0.0 @@ -4100,3 +4106,121 @@ return remove_allowed_options( $del_options, $options ); } + +/** + * Adds slashes to only string values in an array of values. + * + * This should be used when preparing data for core APIs that expect slashed data. + * This should not be used to escape data going directly into an SQL query. + * + * @since 5.3.0 + * @deprecated 5.6.0 Use wp_slash() + * + * @see wp_slash() + * + * @param mixed $value Scalar or array of scalars. + * @return mixed Slashes $value + */ +function wp_slash_strings_only( $value ) { + return map_deep( $value, 'addslashes_strings_only' ); +} + +/** + * Adds slashes only if the provided value is a string. + * + * @since 5.3.0 + * @deprecated 5.6.0 + * + * @see wp_slash() + * + * @param mixed $value + * @return mixed + */ +function addslashes_strings_only( $value ) { + return is_string( $value ) ? addslashes( $value ) : $value; +} + +/** + * 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. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'noindex' ); + * + * @see wp_no_robots() + * + * @since 2.1.0 + * @deprecated 5.7.0 Use wp_robots_noindex() instead on 'wp_robots' filter. + */ +function noindex() { + _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' ); + + // If the blog is not public, tell robots to go away. + if ( '0' == get_option( 'blog_public' ) ) { + 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. + * @deprecated 5.7.0 Use wp_robots_no_robots() instead on 'wp_robots' filter. + */ +function wp_no_robots() { + _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' ); + + if ( get_option( 'blog_public' ) ) { + echo "\n"; + return; + } + + echo "\n"; +} + +/** + * 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' ); + * + * @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. + */ +function wp_sensitive_page_meta() { + _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' ); + + ?> + +