PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.16.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.16.2
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 2.10.2 All 137 releases
← All changes | includes/Core/Database/ApiModel.php +41 -15 2.02.16.2 View file →
@@ -7,15 +7,20 @@
7 7 /**
8 8 * Undocumented class
9 9 */
10 10
11 -class ApiModel extends Model {
12 - public function __construct() {
11 +class ApiModel extends Model
12 +{
13 + public $_wpdb;
14 +
15 + public function __construct()
16 + {
13 17 global $wpdb;
14 18 $this->_wpdb = $wpdb;
15 19 }
16 20
17 - public function getForm() {
21 + public function getForm()
22 + {
18 23 $result = $this->_wpdb->get_results(
19 24 "
20 25 SELECT form_name,id FROM `{$this->_wpdb->prefix}bitforms_form` WHERE `status`=1 order By created_at DESC
21 26 "
@@ -22,9 +27,10 @@
22 27 );
23 28 return $result;
24 29 }
25 30
26 - public function getField($id) {
31 + public function getField($id)
32 + {
27 33 $result = $this->_wpdb->get_results(
28 34 "
29 35 SELECT form_content,id FROM `{$this->_wpdb->prefix}bitforms_form` WHERE `status`=1 AND `id`='$id'
30 36 "
@@ -31,9 +37,10 @@
31 37 );
32 38 return $result;
33 39 }
34 40
35 - public function editEntry($entryID) {
41 + public function editEntry($entryID)
42 + {
36 43 $result = $this->_wpdb->get_results(
37 44 "
38 45 SELECT bitforms_form_entry_id,meta_key,meta_value FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` WHERE `bitforms_form_entry_id`='$entryID'
39 46 "
@@ -40,15 +47,17 @@
40 47 );
41 48 return $result;
42 49 }
43 50
44 - public function entryDelete($entryID) {
51 + public function entryDelete($entryID)
52 + {
45 53 $sql = "DELETE FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` WHERE `bitforms_form_entry_id` = $entryID";
46 54 $result = $this->_wpdb->query($sql);
47 55 return $result;
48 56 }
49 57
50 - public function findRecord($table_name, $column, $value) {
58 + public function findRecord($table_name, $column, $value)
59 + {
51 60 $result = $this->_wpdb->get_results(
52 61 "
53 62 SELECT $column FROM `{$this->_wpdb->prefix}$table_name` WHERE `$column`='$value'
54 63 "
@@ -55,9 +64,10 @@
55 64 );
56 65 return $result;
57 66 }
58 67
59 - public function noteCreate($formID, $entryID, $note_details) {
68 + public function noteCreate($formID, $entryID, $note_details)
69 + {
60 70 $ipTool = new IpTool();
61 71 $user_details = $ipTool->getUserDetail();
62 72 $result = $this->_wpdb->insert(
63 73 "{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo",
@@ -73,9 +83,10 @@
73 83 );
74 84 return $result;
75 85 }
76 86
77 - public function noteList() {
87 + public function noteList()
88 + {
78 89 $result = $this->_wpdb->get_results(
79 90 "
80 91 SELECT * FROM `{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo` WHERE `status`=1
81 92 "
@@ -82,9 +93,10 @@
82 93 );
83 94 return $result;
84 95 }
85 96
86 - public function getWorkFlow($formID) {
97 + public function getWorkFlow($formID)
98 + {
87 99 $result = $this->_wpdb->get_results(
88 100 "
89 101 SELECT workflow_name,id FROM `{$this->_wpdb->prefix}bitforms_workflows` WHERE `form_id`= $formID
90 102 "
@@ -91,9 +103,10 @@
91 103 );
92 104 return $result;
93 105 }
94 106
95 - public function noteUpdate($noteID, $note_details) {
107 + public function noteUpdate($noteID, $note_details)
108 + {
96 109 $data = ['info_details' => $note_details];
97 110 $result = $this->_wpdb->update(
98 111 "{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo",
99 112 $data,
@@ -103,21 +116,24 @@
103 116 );
104 117 return $result;
105 118 }
106 119
107 - public function noteDelete($noteID) {
120 + public function noteDelete($noteID)
121 + {
108 122 $sql = "DELETE FROM `{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo` WHERE `id` = $noteID";
109 123 $result = $this->_wpdb->query($sql);
110 124 return $result;
111 125 }
112 126
113 - public function get_form_value($entryID) {
127 + public function get_form_value($entryID)
128 + {
114 129 $sql = "SELECT `meta_key`,`meta_value` FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` where bitforms_form_entry_id=$entryID";
115 130 $result = $this->_wpdb->get_results($sql);
116 131 return $result;
117 132 }
118 133
119 - public function logUpdate($updateValue, $logID) {
134 + public function logUpdate($updateValue, $logID)
135 + {
120 136 if (empty($logID)) {
121 137 return false;
122 138 }
123 139 $sql = "UPDATE `{$this->_wpdb->prefix}bitforms_form_entry_log` SET content='$updateValue' WHERE id=$logID";
@@ -124,10 +140,20 @@
124 140 $result = $this->_wpdb->get_results($sql);
125 141 return $result;
126 142 }
127 143
128 - public function getFormId($formID) {
144 + public function getFormId($formID)
145 + {
129 146 $sql = "SELECT form_id FROM `{$this->_wpdb->prefix}bitforms_form_entries` WHERE id=$formID";
147 + $result = $this->_wpdb->get_results($sql);
148 + return $result;
149 + }
150 +
151 + public function getOnSubmitWorkflow($formID)
152 + {
153 + $sql = "SELECT `id`, `workflow_name`, `workflow_type`, `workflow_run`, `workflow_behaviour`
154 + FROM `{$this->_wpdb->prefix}bitforms_workflows`
155 + WHERE `form_id`=$formID AND `workflow_type`='onsubmit' order by id desc";
130 156 $result = $this->_wpdb->get_results($sql);
131 157 return $result;
132 158 }
133 159 }