← All changes
|
backend/src/Controllers/Notification/AddNotificationController.php
+3
-6
0.2
→
1.5
View file →
| @@ -1,13 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace IvyForms\Controllers\Notification; |
| 4 | 4 | |
| 5 | -// phpcs:disable PSR1.Files.SideEffects | |
| 6 | -if (!defined('ABSPATH')) { | |
| 7 | - exit; // Exit if accessed directly | |
| 8 | -} | |
| 9 | - | |
| 10 | 5 | use IvyForms\Common\Exceptions\ForbiddenException; |
| 11 | 6 | use IvyForms\Common\Exceptions\InvalidArgumentException; |
| 12 | 7 | use IvyForms\Common\Exceptions\QueryExecutionException; |
| 13 | 8 | use IvyForms\Common\Sanitizer\Sanitizer; |
| @@ -47,9 +42,11 @@ | ||
| 47 | 42 | Sanitizer::verifyNonce($data->get_header('X-WP-Nonce')); |
| 48 | 43 | |
| 49 | 44 | // Validate request data |
| 50 | 45 | if (empty($data->get_params())) { |
| 51 | - throw new InvalidArgumentException('Invalid request data.'); | |
| 46 | + throw new InvalidArgumentException( | |
| 47 | + BackendStrings::getExceptionStrings()['invalid_request_data'] | |
| 48 | + ); | |
| 52 | 49 | } |
| 53 | 50 | |
| 54 | 51 | // Sanitize the input data |
| 55 | 52 | $params = Sanitizer::sanitizeNotificationData($data->get_params()); |