PluginProbe
The Innovative Form Builder – IvyForms / 1.5.1
The Innovative Form Builder – IvyForms v1.5.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Common/Exceptions/ForbiddenException.php +7 -5 1.1 → 1.5.1 View file →
@@ -11,8 +11,10 @@
11 11
12 12 /**
13 13 * Class ForbiddenException
14 14 *
15 + * Handled by Controller to return a JSON 403 REST response.
16 + *
15 17 * @package IvyForms\Common\Exceptions
16 18 */
17 19 class ForbiddenException extends Exception
18 20 {
@@ -22,13 +24,13 @@
22 24 * @param string $message
23 25 * @param int $code
24 26 * @param Exception|null $previous
25 27 */
26 - public function __construct($message = 'forbidden', $code = 0, Exception $previous = null)
28 + public function __construct($message = '', $code = 403, ?Exception $previous = null)
27 29 {
30 + if ($message === '' || $message === 'forbidden') {
31 + $message = esc_html__('You do not have permission to access this page.', 'ivyforms');
32 + }
33 +
28 34 parent::__construct($message, $code, $previous);
29 - wp_die(
30 - esc_html__('You do not have permission to access this page.', 'ivyforms'),
31 - 403
32 - );
33 35 }
34 36 }