PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Core/Messages/EmailTemplateHandler.php +30 -1 2.10.03.3.1 View file →
@@ -16,8 +16,31 @@
16 16 static::$_emailTemplateModel = new EmailTemplateModel();
17 17 $this->_user_details = $user_details;
18 18 }
19 19
20 + /**
21 + * Decode a stored template `config` column into the object shape the admin editor expects.
22 + *
23 + * Older versions could persist an empty config as `[]`; decoded, that reaches the React editor
24 + * as a JS array and setting a key on it throws inside the immutable-draft library. Anything that
25 + * is not a non-empty object collapses to `{}`.
26 + *
27 + * @param mixed $config raw column value (JSON string, already-decoded value, or null)
28 + *
29 + * @return object
30 + */
31 + public static function normalizeConfig($config)
32 + {
33 + if (is_string($config)) {
34 + $config = json_decode($config);
35 + }
36 + if (is_array($config)) {
37 + $config = (object) $config;
38 + }
39 +
40 + return is_object($config) ? $config : (object) [];
41 + }
42 +
20 43 public function getAllTemplate($templateID = null, $userID = null)
21 44 {
22 45 $condition = [
23 46 'form_id' => static::$_formID,
@@ -32,9 +55,11 @@
32 55 [
33 56 'id',
34 57 'title',
35 58 'sub',
36 - 'body'
59 + 'body',
60 + 'status',
61 + 'config'
37 62 ],
38 63 $condition
39 64 );
40 65 }
@@ -50,8 +75,10 @@
50 75 [
51 76 'title' => $templateDetail->title,
52 77 'sub' => $templateDetail->sub,
53 78 'body' => $templateDetail->body,
79 + 'status' => isset($templateDetail->status) ? (int) $templateDetail->status : 1,
80 + 'config' => isset($templateDetail->config) ? wp_json_encode($templateDetail->config) : null,
54 81 'form_id' => static::$_formID,
55 82 'user_id' => $this->_user_details['id'],
56 83 'user_ip' => $this->_user_details['ip'],
57 84 'created_at'=> $this->_user_details['time'],
@@ -66,8 +93,10 @@
66 93 [
67 94 'title' => $templateDetail->title,
68 95 'sub' => $templateDetail->sub,
69 96 'body' => $templateDetail->body,
97 + 'status' => isset($templateDetail->status) ? (int) $templateDetail->status : 1,
98 + 'config' => isset($templateDetail->config) ? wp_json_encode($templateDetail->config) : null,
70 99 'form_id' => static::$_formID,
71 100 'user_id' => $this->_user_details['id'],
72 101 'user_ip' => $this->_user_details['ip'],
73 102 'updated_at'=> $this->_user_details['time']