diff --git a/classes/Bulk/Bulk.php b/classes/Bulk/Bulk.php index ee474667d..f4ccec665 100644 --- a/classes/Bulk/Bulk.php +++ b/classes/Bulk/Bulk.php @@ -20,8 +20,8 @@ public function init() { add_action( 'imagify_convert_next_gen', [ $this, 'generate_next_gen_versions' ], 10, 2 ); add_action( 'imagify_convert_webp_finished', [ $this, 'clear_webp_transients' ], 10, 2 ); add_action( 'wp_ajax_imagify_bulk_optimize', [ $this, 'bulk_optimize_callback' ] ); + add_action( 'wp_ajax_imagify_missing_nextgen_generation', [ $this, 'missing_nextgen_callback' ] ); add_action( 'imagify_bulk_optimize', [ $this, 'bulk_optimize' ], 10, 2 ); - add_action( 'wp_ajax_imagify_missing_webp_generation', [ $this, 'missing_webp_callback' ] ); add_action( 'wp_ajax_imagify_get_folder_type_data', [ $this, 'get_folder_type_data_callback' ] ); add_action( 'wp_ajax_imagify_bulk_info_seen', [ $this, 'bulk_info_seen_callback' ] ); add_action( 'wp_ajax_imagify_bulk_get_stats', [ $this, 'bulk_get_stats_callback' ] ); @@ -218,10 +218,11 @@ public function run_optimize( string $context, int $optimization_level ) { * Runs the WebP generation * * @param array $contexts An array of contexts (WP/Custom folders). + * @param array $formats An array of format to generate. * * @return array */ - public function run_generate_webp( array $contexts ) { + public function run_generate_nextgen( array $contexts, array $formats ) { if ( ! $this->can_optimize() ) { return [ 'success' => false, @@ -514,7 +515,7 @@ public function bulk_optimize_callback() { * * @return void */ - public function missing_webp_callback() { + public function missing_nextgen_callback() { imagify_check_nonce( 'imagify-bulk-optimize' ); $contexts = explode( '_', sanitize_key( wp_unslash( $_GET['context'] ) ) ); @@ -525,7 +526,9 @@ public function missing_webp_callback() { } } - $data = $this->run_generate_webp( $contexts ); + $formats = imagify_nextgen_images_formats(); + + $data = $this->run_generate_nextgen( $contexts, $formats ); if ( false === $data['success'] ) { wp_send_json_error( [ 'message' => $data['message'] ] ); diff --git a/classes/CLI/GenerateMissingWebpCommand.php b/classes/CLI/GenerateMissingNextgenCommand.php similarity index 89% rename from classes/CLI/GenerateMissingWebpCommand.php rename to classes/CLI/GenerateMissingNextgenCommand.php index 33cebc0e4..c8b5f2dae 100644 --- a/classes/CLI/GenerateMissingWebpCommand.php +++ b/classes/CLI/GenerateMissingNextgenCommand.php @@ -6,9 +6,9 @@ use Imagify\Bulk\Bulk; /** - * Command class for the missing WebP generation + * Command class for the missing Nextgen generation */ -class GenerateMissingWebpCommand extends AbstractCommand { +class GenerateMissingNextgenCommand extends AbstractCommand { /** * Executes the command. * diff --git a/classes/Plugin.php b/classes/Plugin.php index eaa0f1b55..c3cf0ad3b 100644 --- a/classes/Plugin.php +++ b/classes/Plugin.php @@ -5,7 +5,7 @@ use Imagify\Bulk\Bulk; use Imagify\CLI\BulkOptimizeCommand; -use Imagify\CLI\GenerateMissingWebpCommand; +use Imagify\CLI\GenerateMissingNextgenCommand; use Imagify\Notices\Notices; use Imagify\Admin\AdminBar; @@ -80,7 +80,7 @@ class_alias( '\\Imagify\\Traits\\InstanceGetterTrait', '\\Imagify\\Traits\\FakeS imagify_load_translations(); imagify_add_command( new BulkOptimizeCommand() ); - imagify_add_command( new GenerateMissingWebpCommand() ); + imagify_add_command( new GenerateMissingNextgenCommand() ); /** * Fires when Imagify is fully loaded. diff --git a/inc/functions/i18n.php b/inc/functions/i18n.php index 425c99a42..b59d885e8 100755 --- a/inc/functions/i18n.php +++ b/inc/functions/i18n.php @@ -93,7 +93,7 @@ function get_imagify_localize_script_translations( $context ) { 'requirements' => $imagifybeat_actions->get_imagifybeat_id( 'requirements' ), ], 'ajaxActions' => [ - 'MissingWebp' => 'imagify_missing_webp_generation', + 'MissingNextGen' => 'imagify_missing_nextgen_generation', ], 'ajaxNonce' => wp_create_nonce( 'imagify-bulk-optimize' ), 'contexts' => $contexts,