PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | inc/functions/attachments.php +17 -1 2.3.0 → trunk View file →
@@ -25,9 +25,25 @@
25 25 if ( 'image' !== $type ) {
26 26 $mimes['pdf'] = 'application/pdf';
27 27 }
28 28
29 - return $mimes;
29 + /**
30 + * Filter the mime types which could be optimized by Imagify.
31 + *
32 + * @since 2.3.1
33 + *
34 + * @param array $mimes The mime types, as extension => mime type pairs.
35 + */
36 + $mimes = wpm_apply_filters_typed( 'array', 'imagify_get_mime_types', $mimes );
37 +
38 + // Keep only well-formed extension => mime type pairs.
39 + return array_filter(
40 + $mimes,
41 + function ( $mime, $ext ) {
42 + return is_string( $ext ) && '' !== $ext && is_string( $mime ) && preg_match( '@^[a-z-]+/[a-z0-9.+-]+$@', $mime );
43 + },
44 + ARRAY_FILTER_USE_BOTH
45 + );
30 46 }
31 47
32 48 /**
33 49 * Tell if an attachment has a supported mime type.