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/rest/cancel-bulk-optimization.php +7 -4 1.5.0 → trunk View file →
@@ -2,12 +2,11 @@
2 2
3 3 namespace ImageOptimization\Modules\Optimization\Rest;
4 4
5 5 use ImageOptimization\Modules\Optimization\Classes\{
6 - Bulk_Optimization_Controller,
6 + Bulk_Optimization\Bulk_Optimization_Controller,
7 7 Route_Base,
8 8 };
9 -use ImageOptimization\Modules\Oauth\Components\Connect;
10 9 use Throwable;
11 10 use WP_REST_Request;
12 11 use ImageOptimization\Plugin;
13 12
@@ -28,13 +27,17 @@
28 27 return [ 'POST' ];
29 28 }
30 29
31 30 public function POST( WP_REST_Request $request ) {
32 - $this->verify_nonce_and_capability(
31 + $error = $this->verify_nonce_and_capability(
33 32 $request->get_param( self::NONCE_NAME ),
34 33 self::NONCE_NAME
35 34 );
36 35
36 + if ( $error ) {
37 + return $error;
38 + }
39 +
37 40 if ( ! Plugin::instance()->modules_manager->get_modules( 'connect-manager' )->connect_instance->is_activated() ) {
38 41 return $this->respond_error_json([
39 42 'message' => esc_html__( 'Invalid activation', 'image-optimization' ),
40 43 'code' => 'unauthorized',
@@ -50,9 +53,9 @@
50 53 'code' => 'forbidden',
51 54 ]);
52 55 }
53 56
54 - Bulk_Optimization_Controller::cancel_bulk_optimization();
57 + Bulk_Optimization_Controller::delete_bulk_optimization();
55 58
56 59 return $this->respond_success_json();
57 60 } catch ( Throwable $t ) {
58 61 return $this->respond_error_json([