PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.7.7
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.7.7
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/backups/rest/remove-backups.php +12 -4 1.0.11.7.7 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2
3 -namespace ImageOptimizer\Modules\Backups\Rest;
3 +namespace ImageOptimization\Modules\Backups\Rest;
4 4
5 -use ImageOptimizer\Modules\Backups\Classes\{
5 +use ImageOptimization\Modules\Backups\Classes\{
6 6 Route_Base,
7 7 Remove_All_Backups,
8 8 };
9 9 use Throwable;
@@ -8,10 +8,14 @@
8 8 };
9 9 use Throwable;
10 10 use WP_REST_Request;
11 11
12 +if ( ! defined( 'ABSPATH' ) ) {
13 + exit; // Exit if accessed directly.
14 +}
15 +
12 16 class Remove_Backups extends Route_Base {
13 - const NONCE_NAME = 'image-optimizer-remove-backups';
17 + const NONCE_NAME = 'image-optimization-remove-backups';
14 18
15 19 protected string $path = '';
16 20
17 21 public function get_name(): string {
@@ -22,12 +26,16 @@
22 26 return [ 'DELETE' ];
23 27 }
24 28
25 29 public function DELETE( WP_REST_Request $request ) {
26 - $this->verify_nonce_and_capability(
30 + $error = $this->verify_nonce_and_capability(
27 31 $request->get_param( self::NONCE_NAME ),
28 32 self::NONCE_NAME
29 33 );
34 +
35 + if ( $error ) {
36 + return $error;
37 + }
30 38
31 39 try {
32 40 Remove_All_Backups::find_and_schedule_removing();
33 41