PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / trunk
Image Optimizer – Compress Images and Convert to WebP or AVIF vtrunk
1.7.7 1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 33 releases
← All changes | modules/optimization/module.php +26 -15 1.0.0 → trunk View file →
@@ -1,15 +1,18 @@
1 1 <?php
2 -namespace ImageOptimizer\Modules\Optimization;
2 +namespace ImageOptimization\Modules\Optimization;
3 3
4 -use ImageOptimizer\Classes\Module_Base;
5 -use ImageOptimizer\Modules\Backups\Rest\Restore_Single;
6 -use ImageOptimizer\Modules\Optimization\Rest\Optimize_Single_Image;
4 +use ImageOptimization\Classes\Module_Base;
5 +use ImageOptimization\Modules\Backups\Rest\Restore_Single;
6 +use ImageOptimization\Modules\Optimization\Rest\Optimize_Single_Image;
7 +use ImageOptimization\Modules\Settings\Module as Settings_Module;
7 8 use Throwable;
8 9
10 +// @codeCoverageIgnoreStart
9 11 if ( ! defined( 'ABSPATH' ) ) {
10 12 exit; // Exit if accessed directly.
11 13 }
14 +// @codeCoverageIgnoreEnd
12 15
13 16 class Module extends Module_Base {
14 17 public function get_name(): string {
15 18 return 'optimization';
@@ -14,20 +17,21 @@
14 17 public function get_name(): string {
15 18 return 'optimization';
16 19 }
17 20
18 - public static function routes_list() : array {
21 + public static function routes_list(): array {
19 22 return [
20 23 'Optimize_Single_Image',
21 24 'Optimize_Bulk',
22 - 'Get_Bulk_Optimization_Operations',
25 + 'Get_Bulk_Optimization_Images',
23 26 'Optimization_Status',
24 27 'Cancel_Bulk_Optimization',
25 28 ];
26 29 }
27 30
28 - public static function component_list() : array {
31 + public static function component_list(): array {
29 32 return [
33 + 'Avif_Compatibility',
30 34 'Media_Control',
31 35 'Single_Optimization',
32 36 'Upload_Optimization',
33 37 'Bulk_Optimization',
@@ -33,8 +37,11 @@
33 37 'Bulk_Optimization',
34 38 'List_View_Pointer',
35 39 'Admin_Bulk_Actions',
36 40 'Admin_Filter',
41 + 'Retry',
42 + 'Bulk_Operation_Recovery',
43 + 'Actions_Cleanup',
37 44 ];
38 45 }
39 46
40 47 /**
@@ -40,37 +47,40 @@
40 47 /**
41 48 * Enqueue styles and scripts
42 49 */
43 50 public function enqueue_scripts() {
44 - $asset_file = include IMAGE_OPTIMIZER_ASSETS_PATH . 'build/control.asset.php';
51 + $asset_file = include IMAGE_OPTIMIZATION_ASSETS_PATH . 'build/control.asset.php';
45 52
46 53 foreach ( $asset_file['dependencies'] as $style ) {
47 54 wp_enqueue_style( $style );
48 55 }
49 56
57 + add_thickbox();
58 +
50 59 wp_enqueue_style(
51 - 'image-optimizer-control',
60 + 'image-optimization-control',
52 61 $this->get_css_assets_url( 'control' ),
53 62 [],
54 - IMAGE_OPTIMIZER_VERSION,
63 + IMAGE_OPTIMIZATION_VERSION,
55 64 );
56 65
57 66 wp_enqueue_script(
58 - 'image-optimizer-control',
67 + 'image-optimization-control',
59 68 $this->get_js_assets_url( 'control' ),
60 69 $asset_file['dependencies'],
61 - IMAGE_OPTIMIZER_VERSION,
70 + IMAGE_OPTIMIZATION_VERSION,
62 71 true
63 72 );
64 73
65 - wp_set_script_translations( 'image-optimizer-control', 'image-optimizer' );
74 + wp_set_script_translations( 'image-optimization-control', 'image-optimization' );
66 75
67 76 wp_localize_script(
68 - 'image-optimizer-control',
77 + 'image-optimization-control',
69 78 'imageOptimizerControlSettings',
70 79 [
71 80 'optimizeSingleImageNonce' => wp_create_nonce( Optimize_Single_Image::NONCE_NAME ),
72 81 'restoreSingleImageNonce' => wp_create_nonce( Restore_Single::NONCE_NAME ),
82 + 'connectLink' => admin_url( 'admin.php?page=' . Settings_Module::SETTING_BASE_SLUG . '&action=connect' ),
73 83 ]
74 84 );
75 85 }
76 86
@@ -76,9 +86,9 @@
76 86
77 87 public static function load_template( $path, $name, $args = [] ): bool {
78 88 $templates_path = sprintf(
79 89 '%s/templates/%s/%s.php',
80 - dirname( __FILE__ ),
90 + __DIR__,
81 91 $path,
82 92 $name
83 93 );
84 94
@@ -98,6 +108,7 @@
98 108 $this->register_components();
99 109 $this->register_routes();
100 110
101 111 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
112 + add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
102 113 }
103 114 }