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/optimize-single-image.php +5 -3 1.6.2 → trunk View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2
3 3 namespace ImageOptimization\Modules\Optimization\Rest;
4 4
5 -use ImageOptimization\Classes\Image\Image;
6 -use ImageOptimization\Modules\Oauth\Components\Connect;
7 5 use ImageOptimization\Modules\Optimization\Classes\{
8 6 Route_Base,
9 7 Single_Optimization,
10 8 Validate_Image,
@@ -31,12 +29,16 @@
31 29 return [ 'POST' ];
32 30 }
33 31
34 32 public function POST( WP_REST_Request $request ) {
35 - $this->verify_nonce_and_capability(
33 + $error = $this->verify_nonce_and_capability(
36 34 $request->get_param( self::NONCE_NAME ),
37 35 self::NONCE_NAME
38 36 );
37 +
38 + if ( $error ) {
39 + return $error;
40 + }
39 41
40 42 if ( ! Plugin::instance()->modules_manager->get_modules( 'connect-manager' )->connect_instance->is_activated() ) {
41 43 return $this->respond_error_json([
42 44 'message' => esc_html__( 'Invalid activation', 'image-optimization' ),