PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.3
Elementor Website Builder – more than just a page builder v4.1.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / data / v2 / base / exceptions / data-exception.php

data-exception.php in Elementor Website Builder – more than just a page builder 4.1.3, at data/v2/base/exceptions/data-exception.php

48 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Data\V2\Base\Exceptions;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 class Data_Exception extends \Exception {
9 protected $custom_data = [
10 'code' => '',
11 'data' => [],
12 ];
13
14 public function get_code() {
15 return 'reset-http-error';
16 }
17
18 public function get_message() {
19 return '501 Not Implemented';
20 }
21
22 public function get_data() {
23 return [
24 'status' => $this->get_http_error_code(), // 'status' is used by WP to pass the http error code.
25 ];
26 }
27
28 public function to_wp_error() {
29 return new \WP_Error( $this->custom_data['code'], $this->message, $this->custom_data['data'] );
30 }
31
32 protected function get_http_error_code() {
33 return 501; // 501 Not Implemented
34 }
35
36 protected function apply() {}
37
38 public function __construct( $message = '', $code = '', $data = [] ) {
39 $this->message = empty( $message ) ? $this->get_message() : $message;
40 $this->custom_data['code'] = empty( $code ) ? $this->get_code() : $code;
41 $this->custom_data['data'] = empty( $data ) ? $this->get_data() : $data;
42
43 parent::__construct( $this->message, 0, null );
44
45 $this->apply();
46 }
47 }
48