PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.0.5
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.0.5
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
← All changes | class/class-mainwp-exception.php +9 -83 5.14.0.5 View file →
@@ -1,90 +1,16 @@
1 1 <?php
2 -/**
3 - * Extends MainWP Exception
4 - *
5 - * Grabs $extra and stores it in $messageExtra.
6 - *
7 - * @package MainWP/Dashboard
8 - */
9 2
10 -namespace MainWP\Dashboard;
3 +class MainWP_Exception extends Exception {
11 4
12 -/**
13 - * Class MainWP_Exception
14 - *
15 - * @package MainWP\Dashboard
16 - */
17 -class MainWP_Exception extends \Exception { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
5 + protected $messageExtra;
18 6
19 - /**
20 - * Protected variable to hold the extra messages.
21 - *
22 - * @var string Error messages.
23 - */
24 - protected $messageExtra;
7 + public function __construct( $message, $extra = null ) {
8 + parent::__construct( $message );
9 + $this->messageExtra = esc_html($extra); // more secure
10 + }
25 11
26 - /**
27 - * Protected variable to hold the Error Code.
28 - *
29 - * @var string Error Code.
30 - */
31 - protected $errorCode;
12 + public function getMessageExtra() {
13 + return $this->messageExtra;
14 + }
32 15
33 - /**
34 - * Protected variable to hold the extra data.
35 - *
36 - * @var array data.
37 - */
38 - protected $data;
39 -
40 - /**
41 - * MainWP_Exception constructor.
42 - *
43 - * Grab Exception Message upon creation of the object.
44 - *
45 - * @param mixed $message Exception message.
46 - * @param null $extra Any extra Errors.
47 - * @param string $errCode Errors code.
48 - */
49 - public function __construct( $message, $extra = null, $errCode = '' ) {
50 - parent::__construct( $message );
51 - $this->messageExtra = esc_html( $extra ); // add more secure.
52 - $this->errorCode = esc_html( $errCode );
53 - }
54 -
55 - /**
56 - * Method get_message_extra()
57 - *
58 - * @return $messageExtra Extra messages.
59 - */
60 - public function get_message_extra() {
61 - return $this->messageExtra;
62 - }
63 -
64 - /**
65 - * Method get_message_error_code()
66 - *
67 - * @return string $errorCode Errors code.
68 - */
69 - public function get_message_error_code() {
70 - return $this->errorCode;
71 - }
72 -
73 - /**
74 - * Method set_data()
75 - *
76 - * @param mixed $data Addition data.
77 - */
78 - public function set_data( $data ) {
79 - $this->data = $data;
80 - }
81 -
82 - /**
83 - * Method get_data()
84 - *
85 - * @return $data Addition data.
86 - */
87 - public function get_data() {
88 - return $this->data;
89 - }
90 16 }