diff --git a/inc/3rd-party/WooCommerce/class-woocommerce.php b/inc/3rd-party/WooCommerce/class-woocommerce.php index 6b994b1e9..05f88bb15 100644 --- a/inc/3rd-party/WooCommerce/class-woocommerce.php +++ b/inc/3rd-party/WooCommerce/class-woocommerce.php @@ -15,17 +15,17 @@ class WooCommerce { * @return void */ public function init() { - add_action( 'woocommerce_single_product_summary', [ $this, 'variable_products_webp_compat' ] ); + add_action( 'woocommerce_single_product_summary', [ $this, 'variable_products_nextgen_compat' ] ); } /** - * Add Variable Products Webp Compatibility. + * Add Variable Products Next-gen images Compatibility. * * @since 1.10.0 * * @return void */ - public function variable_products_webp_compat() { + public function variable_products_nextgen_compat() { global $product; if ( ! isset( $product ) || ! $product->is_type( 'variable' ) ) { diff --git a/inc/3rd-party/amp/amp.php b/inc/3rd-party/amp/amp.php index 4079d653c..a79554e8e 100755 --- a/inc/3rd-party/amp/amp.php +++ b/inc/3rd-party/amp/amp.php @@ -6,12 +6,11 @@ */ if ( function_exists( 'is_amp_endpoint' ) ) : - add_filter( 'imagify_allow_picture_tags_for_webp', 'imagify_amp_disable_picture_on_endpoint' ); + add_filter( 'imagify_allow_picture_tags_for_nextgen', 'imagify_amp_disable_picture_on_endpoint' ); /** * Do not use tags in AMP pages. * - * @since 1.9 - * @author Grégory Viguier + * @since 1.9 * * @param bool $allow True to allow the use of tags (default). False to prevent their use. * @return bool diff --git a/inc/3rd-party/enable-media-replace/classes/Main.php b/inc/3rd-party/enable-media-replace/classes/Main.php index 12896eb4d..5bf96e80e 100755 --- a/inc/3rd-party/enable-media-replace/classes/Main.php +++ b/inc/3rd-party/enable-media-replace/classes/Main.php @@ -5,8 +5,6 @@ use Imagify_Enable_Media_Replace_Deprecated; use Imagify_Filesystem; -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); - /** * Compat class for Enable Media Replace plugin. * @@ -40,12 +38,12 @@ class Main extends Imagify_Enable_Media_Replace_Deprecated { protected $old_backup_path; /** - * List of paths to the old WebP files. + * List of paths to the old next-gen files. * * @var array * @since 1.9.8 */ - protected $old_webp_paths = []; + protected $old_nextgen_paths = []; /** * Launch the hooks before the files and data are replaced. @@ -84,29 +82,26 @@ public function init( $args = [] ) { } /** - * Keep track of existing WebP files. + * Keep track of existing next-gen files. * - * Whether the user chooses to rename the files or not, we will need to delete the current WebP files before creating new ones: + * Whether the user chooses to rename the files or not, we will need to delete the current next-gen files before creating new ones: * - Rename the files: the old ones must be removed, they are useless now. * - Do not rename the files: the thumbnails may still get new names because of the suffix containing the image dimensions, which may differ (for example when thumbnails are scaled, not cropped). - * In this last case, the thumbnails with the old dimensions are removed from the drive and from the WP’s post meta, so there is no need of keeping orphan WebP files that would stay on the drive for ever, even after the attachment is deleted from WP. + * In this last case, the thumbnails with the old dimensions are removed from the drive and from the WP’s post meta, so there is no need of keeping orphan next-gen files that would stay on the drive for ever, even after the attachment is deleted from WP. */ foreach ( $this->process->get_media()->get_media_files() as $media_file ) { - $this->old_webp_paths[] = imagify_path_to_webp( $media_file['path'] ); + foreach ( [ 'avif', 'webp' ] as $format ) { + $this->old_nextgen_paths[] = imagify_path_to_nextgen( $media_file['path'], $format ); + } } - // Delete the old backup file and old WebP files. + // Delete the old backup file and old next-gen files. add_action( 'imagify_before_auto_optimization', [ $this, 'delete_backup' ] ); add_action( 'imagify_not_optimized_attachment_updated', [ $this, 'delete_backup' ] ); } - - /** ----------------------------------------------------------------------------------------- */ - /** HOOKS =================================================================================== */ - /** ----------------------------------------------------------------------------------------- */ - /** - * Delete previous backup file and WebP files. + * Delete previous backup file and next-gen files. * This is done after the images have been already replaced by Enable Media Replace. * * @since 1.8.4 @@ -126,19 +121,14 @@ public function delete_backup( $media_id ) { $this->old_backup_path = false; } - if ( ! empty( $this->old_webp_paths ) ) { - // Delete old WebP files. - $this->old_webp_paths = array_filter( $this->old_webp_paths, [ $filesystem, 'exists' ] ); - array_map( [ $filesystem, 'delete' ], $this->old_webp_paths ); - $this->old_webp_paths = []; + if ( ! empty( $this->old_nextgen_paths ) ) { + // Delete old next-gen files. + $this->old_nextgen_paths = array_filter( $this->old_nextgen_paths, [ $filesystem, 'exists' ] ); + array_map( [ $filesystem, 'delete' ], $this->old_nextgen_paths ); + $this->old_nextgen_paths = []; } } - - /** ----------------------------------------------------------------------------------------- */ - /** TOOLS =================================================================================== */ - /** ----------------------------------------------------------------------------------------- */ - /** * Get the optimization process corresponding to the current media. * diff --git a/inc/3rd-party/regenerate-thumbnails/classes/Main.php b/inc/3rd-party/regenerate-thumbnails/classes/Main.php index 41f2b4878..e8655721c 100644 --- a/inc/3rd-party/regenerate-thumbnails/classes/Main.php +++ b/inc/3rd-party/regenerate-thumbnails/classes/Main.php @@ -158,19 +158,19 @@ public function launch_async_optimization( $metadata, $media_id ) { /** * Optimize the sizes that have been regenerated. */ - // If the media has WebP versions, recreate them for the sizes that have been regenerated. + // If the media has next-gen versions, recreate them for the sizes that have been regenerated. $data = $process->get_data(); $optimization_data = $data->get_optimization_data(); if ( ! empty( $optimization_data['sizes'] ) ) { foreach ( $optimization_data['sizes'] as $size_name => $size_data ) { - $non_webp_size_name = $process->is_size_next_gen( $size_name ); + $non_nextgen_size_name = $process->is_size_next_gen( $size_name ); - if ( ! $non_webp_size_name || ! isset( $sizes[ $non_webp_size_name ] ) ) { + if ( ! $non_nextgen_size_name || ! isset( $sizes[ $non_nextgen_size_name ] ) ) { continue; } - // Add the WebP size. + // Add the next-gen size. $sizes[ $size_name ] = []; } }