1909 $src = wp_get_attachment_url( $post->ID ); |
1909 $src = wp_get_attachment_url( $post->ID ); |
1910 $src_file = & $file; |
1910 $src_file = & $file; |
1911 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { |
1911 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { |
1912 // No thumb, no image. We'll look for a mime-related icon instead. |
1912 // No thumb, no image. We'll look for a mime-related icon instead. |
1913 |
1913 |
|
1914 /** This filter is documented in wp-includes/post.php */ |
1914 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); |
1915 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); |
1915 $src_file = $icon_dir . '/' . wp_basename($src); |
1916 $src_file = $icon_dir . '/' . wp_basename($src); |
1916 } |
1917 } |
1917 |
1918 |
1918 if ( !isset($src) || !$src ) |
1919 if ( !isset($src) || !$src ) |
1945 list($src, $src_file) = $src; |
1946 list($src, $src_file) = $src; |
1946 |
1947 |
1947 // Do we need to constrain the image? |
1948 // Do we need to constrain the image? |
1948 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { |
1949 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { |
1949 |
1950 |
1950 $imagesize = @getimagesize($src_file); |
1951 $imagesize = wp_getimagesize($src_file); |
1951 |
1952 |
1952 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { |
1953 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { |
1953 $actual_aspect = $imagesize[0] / $imagesize[1]; |
1954 $actual_aspect = $imagesize[0] / $imagesize[1]; |
1954 $desired_aspect = $max_dims[0] / $max_dims[1]; |
1955 $desired_aspect = $max_dims[0] / $max_dims[1]; |
1955 |
1956 |
3194 * @since 2.1.0 |
3195 * @since 2.1.0 |
3195 * @deprecated 3.5.0 Use wp_get_image_editor() |
3196 * @deprecated 3.5.0 Use wp_get_image_editor() |
3196 * @see wp_get_image_editor() |
3197 * @see wp_get_image_editor() |
3197 * |
3198 * |
3198 * @param string $file Filename of the image to load. |
3199 * @param string $file Filename of the image to load. |
3199 * @return resource The resulting image resource on success, Error string on failure. |
3200 * @return resource|GdImage|string The resulting image resource or GdImage instance on success, |
|
3201 * error string on failure. |
3200 */ |
3202 */ |
3201 function wp_load_image( $file ) { |
3203 function wp_load_image( $file ) { |
3202 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
3204 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
3203 |
3205 |
3204 if ( is_numeric( $file ) ) |
3206 if ( is_numeric( $file ) ) |
3336 return (imagetypes() & IMG_JPG) != 0; |
3338 return (imagetypes() & IMG_JPG) != 0; |
3337 case 'image/png': |
3339 case 'image/png': |
3338 return (imagetypes() & IMG_PNG) != 0; |
3340 return (imagetypes() & IMG_PNG) != 0; |
3339 case 'image/gif': |
3341 case 'image/gif': |
3340 return (imagetypes() & IMG_GIF) != 0; |
3342 return (imagetypes() & IMG_GIF) != 0; |
|
3343 case 'image/webp': |
|
3344 return (imagetypes() & IMG_WEBP) != 0; // phpcs:ignore PHPCompatibility.Constants.NewConstants.img_webpFound |
3341 } |
3345 } |
3342 } else { |
3346 } else { |
3343 switch( $mime_type ) { |
3347 switch( $mime_type ) { |
3344 case 'image/jpeg': |
3348 case 'image/jpeg': |
3345 return function_exists('imagecreatefromjpeg'); |
3349 return function_exists('imagecreatefromjpeg'); |
3346 case 'image/png': |
3350 case 'image/png': |
3347 return function_exists('imagecreatefrompng'); |
3351 return function_exists('imagecreatefrompng'); |
3348 case 'image/gif': |
3352 case 'image/gif': |
3349 return function_exists('imagecreatefromgif'); |
3353 return function_exists('imagecreatefromgif'); |
|
3354 case 'image/webp': |
|
3355 return function_exists('imagecreatefromwebp'); |
3350 } |
3356 } |
3351 } |
3357 } |
3352 return false; |
3358 return false; |
3353 } |
3359 } |
3354 |
3360 |
4098 function remove_option_whitelist( $del_options, $options = '' ) { |
4104 function remove_option_whitelist( $del_options, $options = '' ) { |
4099 _deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' ); |
4105 _deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' ); |
4100 |
4106 |
4101 return remove_allowed_options( $del_options, $options ); |
4107 return remove_allowed_options( $del_options, $options ); |
4102 } |
4108 } |
|
4109 |
|
4110 /** |
|
4111 * Adds slashes to only string values in an array of values. |
|
4112 * |
|
4113 * This should be used when preparing data for core APIs that expect slashed data. |
|
4114 * This should not be used to escape data going directly into an SQL query. |
|
4115 * |
|
4116 * @since 5.3.0 |
|
4117 * @deprecated 5.6.0 Use wp_slash() |
|
4118 * |
|
4119 * @see wp_slash() |
|
4120 * |
|
4121 * @param mixed $value Scalar or array of scalars. |
|
4122 * @return mixed Slashes $value |
|
4123 */ |
|
4124 function wp_slash_strings_only( $value ) { |
|
4125 return map_deep( $value, 'addslashes_strings_only' ); |
|
4126 } |
|
4127 |
|
4128 /** |
|
4129 * Adds slashes only if the provided value is a string. |
|
4130 * |
|
4131 * @since 5.3.0 |
|
4132 * @deprecated 5.6.0 |
|
4133 * |
|
4134 * @see wp_slash() |
|
4135 * |
|
4136 * @param mixed $value |
|
4137 * @return mixed |
|
4138 */ |
|
4139 function addslashes_strings_only( $value ) { |
|
4140 return is_string( $value ) ? addslashes( $value ) : $value; |
|
4141 } |
|
4142 |
|
4143 /** |
|
4144 * Displays a noindex meta tag if required by the blog configuration. |
|
4145 * |
|
4146 * If a blog is marked as not being public then the noindex meta tag will be |
|
4147 * output to tell web robots not to index the page content. Add this to the |
|
4148 * {@see 'wp_head'} action. |
|
4149 * |
|
4150 * Typical usage is as a {@see 'wp_head'} callback: |
|
4151 * |
|
4152 * add_action( 'wp_head', 'noindex' ); |
|
4153 * |
|
4154 * @see wp_no_robots() |
|
4155 * |
|
4156 * @since 2.1.0 |
|
4157 * @deprecated 5.7.0 Use wp_robots_noindex() instead on 'wp_robots' filter. |
|
4158 */ |
|
4159 function noindex() { |
|
4160 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' ); |
|
4161 |
|
4162 // If the blog is not public, tell robots to go away. |
|
4163 if ( '0' == get_option( 'blog_public' ) ) { |
|
4164 wp_no_robots(); |
|
4165 } |
|
4166 } |
|
4167 |
|
4168 /** |
|
4169 * Display a noindex meta tag. |
|
4170 * |
|
4171 * Outputs a noindex meta tag that tells web robots not to index the page content. |
|
4172 * Typical usage is as a {@see 'wp_head'} callback. add_action( 'wp_head', 'wp_no_robots' ); |
|
4173 * |
|
4174 * @since 3.3.0 |
|
4175 * @since 5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged. |
|
4176 * @deprecated 5.7.0 Use wp_robots_no_robots() instead on 'wp_robots' filter. |
|
4177 */ |
|
4178 function wp_no_robots() { |
|
4179 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' ); |
|
4180 |
|
4181 if ( get_option( 'blog_public' ) ) { |
|
4182 echo "<meta name='robots' content='noindex,follow' />\n"; |
|
4183 return; |
|
4184 } |
|
4185 |
|
4186 echo "<meta name='robots' content='noindex,nofollow' />\n"; |
|
4187 } |
|
4188 |
|
4189 /** |
|
4190 * Display a noindex,noarchive meta tag and referrer origin-when-cross-origin meta tag. |
|
4191 * |
|
4192 * Outputs a noindex,noarchive meta tag that tells web robots not to index or cache the page content. |
|
4193 * Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full |
|
4194 * url as a referrer to other sites when cross-origin assets are loaded. |
|
4195 * |
|
4196 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_sensitive_page_meta' ); |
|
4197 * |
|
4198 * @since 5.0.1 |
|
4199 * @deprecated 5.7.0 Use wp_robots_sensitive_page() instead on 'wp_robots' filter |
|
4200 * and wp_strict_cross_origin_referrer() on 'wp_head' action. |
|
4201 */ |
|
4202 function wp_sensitive_page_meta() { |
|
4203 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' ); |
|
4204 |
|
4205 ?> |
|
4206 <meta name='robots' content='noindex,noarchive' /> |
|
4207 <?php |
|
4208 wp_strict_cross_origin_referrer(); |
|
4209 } |
|
4210 |
|
4211 /** |
|
4212 * Render inner blocks from the `core/columns` block for generating an excerpt. |
|
4213 * |
|
4214 * @since 5.2.0 |
|
4215 * @deprecated 5.8.0 |
|
4216 * |
|
4217 * @access private |
|
4218 * |
|
4219 * @param array $columns The parsed columns block. |
|
4220 * @param array $allowed_blocks The list of allowed inner blocks. |
|
4221 * @return string The rendered inner blocks. |
|
4222 */ |
|
4223 function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) { |
|
4224 _deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' ); |
|
4225 return _excerpt_render_inner_blocks( $columns, $allowed_blocks ); |
|
4226 } |