PluginProbe ʕ •ᴥ•ʔ
Modern Image Formats / 2.6.0
Modern Image Formats v2.6.0
2.7.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 2.0.0 2.0.1 2.0.2 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.5.1 2.6.0 2.6.1
webp-uploads / deprecated.php
webp-uploads Last commit date
deprecated.php 1 year ago helper.php 10 months ago hooks.php 10 months ago image-edit.php 1 year ago load.php 10 months ago picture-element.php 1 year ago readme.txt 6 months ago rest-api.php 1 year ago settings.php 1 year ago uninstall.php 1 year ago
deprecated.php
72 lines
1 <?php
2 /**
3 * Deprecated functions.
4 *
5 * @package webp-uploads
6 *
7 * @since 1.1.1
8 */
9
10 // @codeCoverageIgnoreStart
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly.
13 }
14 // @codeCoverageIgnoreEnd
15
16 /**
17 * Returns the attachment sources array ordered by filesize.
18 *
19 * @since 1.0.0
20 * @deprecated This function is not used anymore as of Performance Lab 1.1.0 when this was still part of the WebP Uploads module. It should have been removed as part of <https://github.com/WordPress/performance/pull/302>.
21 *
22 * @param int $attachment_id The attachment ID.
23 * @param string $size The attachment size.
24 * @return array<string, array{ file: string, filesize: int }> The attachment sources array.
25 */
26 function webp_uploads_get_attachment_sources( int $attachment_id, string $size = 'thumbnail' ): array {
27 _deprecated_function( __FUNCTION__, 'Performance Lab 1.1.0' );
28
29 // Check for the sources attribute in attachment metadata.
30 $metadata = wp_get_attachment_metadata( $attachment_id );
31
32 // Return full image size sources.
33 if (
34 'full' === $size &&
35 isset( $metadata['sources'] ) &&
36 is_array( $metadata['sources'] ) &&
37 count( $metadata['sources'] ) > 0
38 ) {
39 return $metadata['sources'];
40 }
41
42 // Return the resized image sources.
43 if ( isset( $metadata['sizes'][ $size ]['sources'] ) && is_array( $metadata['sizes'][ $size ]['sources'] ) ) {
44 return $metadata['sizes'][ $size ]['sources'];
45 }
46
47 // Return an empty array if no sources found.
48 return array();
49 }
50
51 /**
52 * Adds custom styles to hide specific elements in media settings.
53 *
54 * @since 1.0.0
55 * @deprecated This function is not used as of Modern Image Formats versions 2.0.0.
56 */
57 function webp_uploads_media_setting_style(): void {
58 _deprecated_function( __FUNCTION__, 'Modern Image Formats 2.0.0' );
59
60 if ( is_multisite() ) {
61 return;
62 }
63 ?>
64 <style>
65 .form-table .perflab-generate-webp-and-jpeg th,
66 .form-table .perflab-generate-webp-and-jpeg td:not(.td-full) {
67 display: none;
68 }
69 </style>
70 <?php
71 }
72