Form Maker by WD – user-friendly drag & drop Form Builder plugin - Version 1.11.5

Version Description

  • Fixed: Bug on CSV/XML export.
  • Fixed: Google maps api conflict with other plugins.
  • Changed: Improved Matrix type field view in submissions.
  • Fixed: File upload field styles with "Inherit from website theme".
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Form Maker by WD – user-friendly drag & drop Form Builder plugin
Version 1.11.5
Comparing to
See all releases

Code changes from version 1.11.4 to 1.11.5

admin/models/FMModelGenerete_csv.php CHANGED
@@ -1,300 +1,300 @@
1
- <?php
2
-
3
- class FMModelGenerete_csv {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_data() {
22
- global $wpdb;
23
- $is_paypal_info = FALSE;
24
- $params = array();
25
- $group_id_s = array();
26
- $form_id = (int)$_REQUEST['form_id'];
27
- $limitstart = (int)$_REQUEST['limitstart'];
28
- $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : '';
29
- $verified_emails = isset($_REQUEST['verified_emails']) ? json_decode(stripslashes($_REQUEST['verified_emails']), true) : array();
30
-
31
- $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
32
- $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
33
-
34
-
35
- if($search_labels){
36
- $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(".$search_labels.")", $form_id);
37
- $group_id_s = $wpdb->get_col($query);
38
- }
39
-
40
-
41
- $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
42
- $labels = $wpdb->get_col($query);
43
-
44
- $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
45
- $rows_lable = $wpdb->get_results($query_lable);
46
- $ptn = "/[^a-zA-Z0-9_]/";
47
- $rpltxt = "";
48
- $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
49
-
50
- $sorted_labels_id = array();
51
- $sorted_labels = array();
52
- $sorted_types = array();
53
- $label_titles = array();
54
- $label_id = array();
55
- $label_order = array();
56
- $label_order_original = array();
57
- $label_type = array();
58
- if ($labels) {
59
- $label_all = explode('#****#', $rows_lable[0]->label_order);
60
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
61
- foreach ($label_all as $key => $label_each) {
62
- $label_id_each = explode('#**id**#', $label_each);
63
- array_push($label_id, $label_id_each[0]);
64
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
65
- array_push($label_order_original, $label_oder_each[0]);
66
- $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
67
- array_push($label_order, $label_temp);
68
- array_push($label_type, $label_oder_each[1]);
69
- }
70
- foreach ($label_id as $key => $label) {
71
- if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
72
- array_push($sorted_labels, $label_order[$key]);
73
- array_push($sorted_labels_id, $label);
74
- array_push($label_titles, stripslashes($label_order_original[$key]));
75
- array_push($sorted_types, $label_type[$key]);
76
- }
77
- }
78
- }
79
-
80
- $m = count($sorted_labels);
81
- $wpdb->query("SET SESSION group_concat_max_len = 1000000");
82
-
83
- $rows = array();
84
-
85
- if($search_labels){
86
- $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d and group_id IN (".$search_labels.") GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
87
- $rows = $wpdb->get_results($query, OBJECT_K);
88
- }
89
-
90
-
91
- $data = array();
92
- $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
93
-
94
- sort($group_id_s,SORT_NUMERIC);
95
- for ($www = $limitstart; $www < $group_id_s_count; $www++) {
96
- $i = $group_id_s[$www];
97
- $field_key = array_search($i, $label_id);
98
- if($label_type[$field_key] != 'type_arithmetic_captcha') {
99
- $data_temp = array();
100
- $tt = $rows[$i];
101
-
102
- $date = $tt->date;
103
- $ip = $tt->ip;
104
- $user_id = get_userdata($tt->user_id_wd);
105
- $username = $user_id ? $user_id->display_name : "";
106
- $useremail = $user_id ? $user_id->user_email : "";
107
- $data_temp['Submission ID'] = $i;
108
- $data_temp['Submit date'] = $date;
109
- $data_temp['Ip']=$ip;
110
- $data_temp['Submitter\'s Username']=$username;
111
- $data_temp['Submitter\'s Email Address']=$useremail;
112
-
113
- $element_labels = explode(',', $tt->element_label);
114
- $element_values = explode('*:*el_value*:*', $tt->element_value);
115
-
116
-
117
- for ($h = 0; $h < $m; $h++) {
118
- if(isset($data_temp[$label_titles[$h]]))
119
- $label_titles[$h] .= '(1)';
120
-
121
- if(in_array($sorted_labels_id[$h], $element_labels)) {
122
- $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
123
-
124
- if (strpos($element_value, "*@@url@@*")) {
125
- $file_names = '';
126
- $new_files = explode("*@@url@@*", $element_value);
127
- foreach ($new_files as $new_file) {
128
- if ($new_file) {
129
- $file_names .= $new_file . ", ";
130
- }
131
- }
132
- $data_temp[stripslashes($label_titles[$h])] = $file_names;
133
- }
134
- elseif (strpos($element_value, "***br***")) {
135
- $element_value = str_replace("***br***", ', ', $element_value);
136
- if (strpos($element_value, "***quantity***")) {
137
- $element_value = str_replace("***quantity***", '', $element_value);
138
- }
139
- if (strpos($element_value, "***property***")) {
140
- $element_value = str_replace("***property***", '', $element_value);
141
- }
142
- if(substr($element_value, -2) == ', ') {
143
- $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
144
- }
145
- else {
146
- $data_temp[stripslashes($label_titles[$h])]= $element_value;
147
- }
148
- }
149
- elseif (strpos($element_value, "***map***")) {
150
- $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
151
- }
152
- elseif (strpos($element_value, "***star_rating***")) {
153
- $element = str_replace("***star_rating***", '', $element_value);
154
- $element = explode("***", $element);
155
- $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
156
- }
157
- elseif (strpos($element_value, "@@@") || $element_value == "@@@" || $element_value == "@@@@@@@@@") {
158
- $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
159
- }
160
- elseif (strpos($element_value, "***grading***")) {
161
- $element = str_replace("***grading***", '', $element_value);
162
- $grading = explode(":", $element);
163
- $items_count = sizeof($grading) - 1;
164
- $items = "";
165
- $total = "";
166
- for ($k = 0; $k < $items_count / 2; $k++) {
167
- $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
168
- $total += $grading[$k];
169
- }
170
- $items .= "Total: " . $total;
171
- $data_temp[stripslashes($label_titles[$h])] = $items;
172
- }
173
- elseif (strpos($element_value, "***matrix***")) {
174
- $element = str_replace("***matrix***", '', $element_value);
175
- $matrix_value = explode('***', $element);
176
- $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
177
- $mat_rows = $matrix_value[0];
178
- $mat_columns = $matrix_value[$mat_rows + 1];
179
- $matrix = "";
180
- $aaa = array();
181
- $var_checkbox = 1;
182
- $selected_value = "";
183
- $selected_value_yes = "";
184
- $selected_value_no = "";
185
- for ($k = 1; $k <= $mat_rows; $k++) {
186
- if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
187
- if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
188
- $checked = "0";
189
- $aaa[1] = "";
190
- }
191
- else {
192
- $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
193
- }
194
- for ($l = 1; $l <= $mat_columns; $l++) {
195
- $checked = $aaa[1] == $l ? '1' : '0';
196
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
197
- }
198
- }
199
- else {
200
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
201
- for ($l = 1; $l <= $mat_columns; $l++) {
202
- $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
203
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
204
- $var_checkbox++;
205
- }
206
- }
207
- else {
208
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
209
- for ($l = 1; $l <= $mat_columns; $l++) {
210
- $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
211
- $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
212
- $var_checkbox++;
213
- }
214
- }
215
- else {
216
- for ($l = 1; $l <= $mat_columns; $l++) {
217
- $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
218
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
219
- $var_checkbox++;
220
- }
221
- }
222
- }
223
- }
224
- }
225
- $data_temp[stripslashes($label_titles[$h])] = $matrix;
226
- }
227
- else {
228
- $val = strip_tags(htmlspecialchars_decode($element_value));
229
- $val = stripslashes(str_replace('&#039;', "'", $val));
230
- $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
231
- }
232
- }
233
- else {
234
- $data_temp[stripslashes($label_titles[$h])] = '';
235
- }
236
-
237
- if(isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail") {
238
- if($data_temp[stripslashes($label_titles[$h])] == '') {
239
- $data_temp[stripslashes($label_titles[$h]).'(verified)'] = '';
240
- } else {
241
- if(in_array($i, $verified_emails[$sorted_labels_id[$h]])){
242
- $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'yes';
243
- } else{
244
- $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'no';
245
- }
246
- }
247
- }
248
- }
249
-
250
- $query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits where element_label=%s AND form_id = %d AND group_id=%d",'item_total', $form_id, $i);
251
- $is_paypal = $wpdb->get_results($query);
252
-
253
- if($is_paypal) {
254
- $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'item_total'));
255
- $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'total'));
256
- $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, '0'));
257
- $data_temp['Item Total'] = $item_total;
258
- $data_temp['Total'] = $total;
259
- $data_temp['Payment Status'] = $payment_status;
260
- }
261
- $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id=%d",$i);
262
- $paypal_info = $wpdb->get_results($query);
263
- if ($paypal_info) {
264
- $is_paypal_info = TRUE;
265
- }
266
- if ($is_paypal) {
267
- foreach ($paypal_info_fields as $key=>$paypal_info_field) {
268
- if ($paypal_info) {
269
- $data_temp['PAYPAL_'.$paypal_info_labels[$key]]=$paypal_info[0]->$paypal_info_field;
270
- }
271
- else {
272
- $data_temp['PAYPAL_'.$paypal_info_labels[$key]]='';
273
- }
274
- }
275
- }
276
-
277
- $data[$i] = $data_temp;
278
- }
279
-
280
- }
281
-
282
-
283
- array_push($params, $data);
284
- array_push($params, $title);
285
- array_push($params, $is_paypal_info);
286
- return $params;
287
-
288
- }
289
-
290
-
291
- ////////////////////////////////////////////////////////////////////////////////////////
292
- // Getters & Setters //
293
- ////////////////////////////////////////////////////////////////////////////////////////
294
- ////////////////////////////////////////////////////////////////////////////////////////
295
- // Private Methods //
296
- ////////////////////////////////////////////////////////////////////////////////////////
297
- ////////////////////////////////////////////////////////////////////////////////////////
298
- // Listeners //
299
- ////////////////////////////////////////////////////////////////////////////////////////
300
  }
1
+ <?php
2
+
3
+ class FMModelGenerete_csv {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ ////////////////////////////////////////////////////////////////////////////////////////
14
+ // Constructor & Destructor //
15
+ ////////////////////////////////////////////////////////////////////////////////////////
16
+ public function __construct() {
17
+ }
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ // Public Methods //
20
+ ////////////////////////////////////////////////////////////////////////////////////////
21
+ public function get_data() {
22
+ global $wpdb;
23
+ $is_paypal_info = FALSE;
24
+ $params = array();
25
+ $group_id_s = array();
26
+ $form_id = (int)$_REQUEST['form_id'];
27
+ $limitstart = (int)$_REQUEST['limitstart'];
28
+ $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : '';
29
+ $verified_emails = isset($_REQUEST['verified_emails']) ? json_decode(stripslashes($_REQUEST['verified_emails']), true) : array();
30
+
31
+ $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
32
+ $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
33
+
34
+
35
+ if($search_labels){
36
+ $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(".$search_labels.")", $form_id);
37
+ $group_id_s = $wpdb->get_col($query);
38
+ }
39
+
40
+
41
+ $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
42
+ $labels = $wpdb->get_col($query);
43
+
44
+ $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
45
+ $rows_lable = $wpdb->get_results($query_lable);
46
+ $ptn = "/[^a-zA-Z0-9_]/";
47
+ $rpltxt = "";
48
+ $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
49
+
50
+ $sorted_labels_id = array();
51
+ $sorted_labels = array();
52
+ $sorted_types = array();
53
+ $label_titles = array();
54
+ $label_id = array();
55
+ $label_order = array();
56
+ $label_order_original = array();
57
+ $label_type = array();
58
+ if ($labels) {
59
+ $label_all = explode('#****#', $rows_lable[0]->label_order);
60
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
61
+ foreach ($label_all as $key => $label_each) {
62
+ $label_id_each = explode('#**id**#', $label_each);
63
+ array_push($label_id, $label_id_each[0]);
64
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
65
+ array_push($label_order_original, $label_oder_each[0]);
66
+ $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
67
+ array_push($label_order, $label_temp);
68
+ array_push($label_type, $label_oder_each[1]);
69
+ }
70
+ foreach ($label_id as $key => $label) {
71
+ if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
72
+ array_push($sorted_labels, $label_order[$key]);
73
+ array_push($sorted_labels_id, $label);
74
+ array_push($label_titles, stripslashes($label_order_original[$key]));
75
+ array_push($sorted_types, $label_type[$key]);
76
+ }
77
+ }
78
+ }
79
+
80
+ $m = count($sorted_labels);
81
+ $wpdb->query("SET SESSION group_concat_max_len = 1000000");
82
+
83
+ $rows = array();
84
+
85
+ if($search_labels){
86
+ $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d and group_id IN (".$search_labels.") GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
87
+ $rows = $wpdb->get_results($query, OBJECT_K);
88
+ }
89
+
90
+
91
+ $data = array();
92
+ $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
93
+
94
+ sort($group_id_s,SORT_NUMERIC);
95
+ for ($www = $limitstart; $www < $group_id_s_count; $www++) {
96
+ $i = $group_id_s[$www];
97
+ $field_key = array_search($i, $label_id);
98
+ if($label_type[$field_key] != 'type_arithmetic_captcha') {
99
+ $data_temp = array();
100
+ $tt = $rows[$i];
101
+
102
+ $date = $tt->date;
103
+ $ip = $tt->ip;
104
+ $user_id = get_userdata($tt->user_id_wd);
105
+ $username = $user_id ? $user_id->display_name : "";
106
+ $useremail = $user_id ? $user_id->user_email : "";
107
+ $data_temp['Submission ID'] = $i;
108
+ $data_temp['Submit date'] = $date;
109
+ $data_temp['Ip']=$ip;
110
+ $data_temp['Submitter\'s Username']=$username;
111
+ $data_temp['Submitter\'s Email Address']=$useremail;
112
+
113
+ $element_labels = explode(',', $tt->element_label);
114
+ $element_values = explode('*:*el_value*:*', $tt->element_value);
115
+
116
+
117
+ for ($h = 0; $h < $m; $h++) {
118
+ if(isset($data_temp[$label_titles[$h]]))
119
+ $label_titles[$h] .= '(1)';
120
+
121
+ if(in_array($sorted_labels_id[$h], $element_labels)) {
122
+ $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
123
+
124
+ if (strpos($element_value, "*@@url@@*")) {
125
+ $file_names = '';
126
+ $new_files = explode("*@@url@@*", $element_value);
127
+ foreach ($new_files as $new_file) {
128
+ if ($new_file) {
129
+ $file_names .= $new_file . ", ";
130
+ }
131
+ }
132
+ $data_temp[stripslashes($label_titles[$h])] = $file_names;
133
+ }
134
+ elseif (strpos($element_value, "***br***")) {
135
+ $element_value = str_replace("***br***", ', ', $element_value);
136
+ if (strpos($element_value, "***quantity***")) {
137
+ $element_value = str_replace("***quantity***", '', $element_value);
138
+ }
139
+ if (strpos($element_value, "***property***")) {
140
+ $element_value = str_replace("***property***", '', $element_value);
141
+ }
142
+ if(substr($element_value, -2) == ', ') {
143
+ $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
144
+ }
145
+ else {
146
+ $data_temp[stripslashes($label_titles[$h])]= $element_value;
147
+ }
148
+ }
149
+ elseif (strpos($element_value, "***map***")) {
150
+ $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
151
+ }
152
+ elseif (strpos($element_value, "***star_rating***")) {
153
+ $element = str_replace("***star_rating***", '', $element_value);
154
+ $element = explode("***", $element);
155
+ $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
156
+ }
157
+ elseif (strpos($element_value, "@@@") !== FALSE) {
158
+ $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
159
+ }
160
+ elseif (strpos($element_value, "***grading***")) {
161
+ $element = str_replace("***grading***", '', $element_value);
162
+ $grading = explode(":", $element);
163
+ $items_count = sizeof($grading) - 1;
164
+ $items = "";
165
+ $total = "";
166
+ for ($k = 0; $k < $items_count / 2; $k++) {
167
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
168
+ $total += $grading[$k];
169
+ }
170
+ $items .= "Total: " . $total;
171
+ $data_temp[stripslashes($label_titles[$h])] = $items;
172
+ }
173
+ elseif (strpos($element_value, "***matrix***")) {
174
+ $element = str_replace("***matrix***", '', $element_value);
175
+ $matrix_value = explode('***', $element);
176
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
177
+ $mat_rows = $matrix_value[0];
178
+ $mat_columns = $matrix_value[$mat_rows + 1];
179
+ $matrix = "";
180
+ $aaa = array();
181
+ $var_checkbox = 1;
182
+ $selected_value = "";
183
+ $selected_value_yes = "";
184
+ $selected_value_no = "";
185
+ for ($k = 1; $k <= $mat_rows; $k++) {
186
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
187
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
188
+ $checked = "0";
189
+ $aaa[1] = "";
190
+ }
191
+ else {
192
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
193
+ }
194
+ for ($l = 1; $l <= $mat_columns; $l++) {
195
+ $checked = $aaa[1] == $l ? '1' : '0';
196
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
197
+ }
198
+ }
199
+ else {
200
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
201
+ for ($l = 1; $l <= $mat_columns; $l++) {
202
+ $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
203
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
204
+ $var_checkbox++;
205
+ }
206
+ }
207
+ else {
208
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
209
+ for ($l = 1; $l <= $mat_columns; $l++) {
210
+ $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
211
+ $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
212
+ $var_checkbox++;
213
+ }
214
+ }
215
+ else {
216
+ for ($l = 1; $l <= $mat_columns; $l++) {
217
+ $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
218
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
219
+ $var_checkbox++;
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+ $data_temp[stripslashes($label_titles[$h])] = $matrix;
226
+ }
227
+ else {
228
+ $val = strip_tags(htmlspecialchars_decode($element_value));
229
+ $val = stripslashes(str_replace('&#039;', "'", $val));
230
+ $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
231
+ }
232
+ }
233
+ else {
234
+ $data_temp[stripslashes($label_titles[$h])] = '';
235
+ }
236
+
237
+ if(isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail") {
238
+ if($data_temp[stripslashes($label_titles[$h])] == '') {
239
+ $data_temp[stripslashes($label_titles[$h]).'(verified)'] = '';
240
+ } else {
241
+ if(in_array($i, $verified_emails[$sorted_labels_id[$h]])){
242
+ $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'yes';
243
+ } else{
244
+ $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'no';
245
+ }
246
+ }
247
+ }
248
+ }
249
+
250
+ $query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits where element_label=%s AND form_id = %d AND group_id=%d",'item_total', $form_id, $i);
251
+ $is_paypal = $wpdb->get_results($query);
252
+
253
+ if($is_paypal) {
254
+ $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'item_total'));
255
+ $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, 'total'));
256
+ $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s", $i, '0'));
257
+ $data_temp['Item Total'] = $item_total;
258
+ $data_temp['Total'] = $total;
259
+ $data_temp['Payment Status'] = $payment_status;
260
+ }
261
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id=%d",$i);
262
+ $paypal_info = $wpdb->get_results($query);
263
+ if ($paypal_info) {
264
+ $is_paypal_info = TRUE;
265
+ }
266
+ if ($is_paypal) {
267
+ foreach ($paypal_info_fields as $key=>$paypal_info_field) {
268
+ if ($paypal_info) {
269
+ $data_temp['PAYPAL_'.$paypal_info_labels[$key]]=$paypal_info[0]->$paypal_info_field;
270
+ }
271
+ else {
272
+ $data_temp['PAYPAL_'.$paypal_info_labels[$key]]='';
273
+ }
274
+ }
275
+ }
276
+
277
+ $data[$i] = $data_temp;
278
+ }
279
+
280
+ }
281
+
282
+
283
+ array_push($params, $data);
284
+ array_push($params, $title);
285
+ array_push($params, $is_paypal_info);
286
+ return $params;
287
+
288
+ }
289
+
290
+
291
+ ////////////////////////////////////////////////////////////////////////////////////////
292
+ // Getters & Setters //
293
+ ////////////////////////////////////////////////////////////////////////////////////////
294
+ ////////////////////////////////////////////////////////////////////////////////////////
295
+ // Private Methods //
296
+ ////////////////////////////////////////////////////////////////////////////////////////
297
+ ////////////////////////////////////////////////////////////////////////////////////////
298
+ // Listeners //
299
+ ////////////////////////////////////////////////////////////////////////////////////////
300
  }
admin/models/FMModelGenerete_xml.php CHANGED
@@ -1,301 +1,301 @@
1
- <?php
2
-
3
- class FMModelGenerete_xml {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
-
22
- public function get_data() {
23
- global $wpdb;
24
- $is_paypal_info = FALSE;
25
- $params = array();
26
- $group_id_s = array();
27
- $form_id = (int)$_REQUEST['form_id'];
28
- $limitstart = (int)$_REQUEST['limitstart'];
29
- $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : '';
30
- $verified_emails = isset($_REQUEST['verified_emails']) ? json_decode(stripslashes($_REQUEST['verified_emails']), true) : array();
31
-
32
- $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
33
- $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
34
-
35
- if($search_labels){
36
- $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(".$search_labels.")", $form_id);
37
- $group_id_s = $wpdb->get_col($query);
38
- }
39
-
40
- $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
41
- $labels = $wpdb->get_col($query);
42
-
43
- $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
44
- $rows_lable = $wpdb->get_results($query_lable);
45
- $ptn = "/[^a-zA-Z0-9_]/";
46
- $rpltxt = "";
47
- $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
48
-
49
- $sorted_labels_id = array();
50
- $sorted_labels = array();
51
- $label_titles = array();
52
- $sorted_types = array();
53
- $label_id = array();
54
- $label_order = array();
55
- $label_order_original = array();
56
- $label_type = array();
57
- if ($labels) {
58
- $label_all = explode('#****#', $rows_lable[0]->label_order);
59
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
60
- foreach ($label_all as $key => $label_each) {
61
- $label_id_each = explode('#**id**#', $label_each);
62
- array_push($label_id, $label_id_each[0]);
63
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
64
- array_push($label_order_original, $label_oder_each[0]);
65
- $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
66
- array_push($label_order, $label_temp);
67
- array_push($label_type, $label_oder_each[1]);
68
- }
69
- foreach ($label_id as $key => $label) {
70
- if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
71
- array_push($sorted_labels, $label_order[$key]);
72
- array_push($sorted_labels_id, $label);
73
- array_push($label_titles, stripslashes($label_order_original[$key]));
74
- array_push($sorted_types, $label_type[$key]);
75
- }
76
- }
77
- }
78
-
79
- $m = count($sorted_labels);
80
-
81
- $rows = array();
82
-
83
- if($search_labels){
84
- $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d and group_id IN(".$search_labels.") GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
85
- $rows = $wpdb->get_results($query, OBJECT_K);
86
- }
87
-
88
- $data = array();
89
- $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
90
-
91
- sort($group_id_s,SORT_NUMERIC);
92
- for ($www = $limitstart; $www < $group_id_s_count; $www++) {
93
-
94
- $i = $group_id_s[$www];
95
-
96
- $field_key = array_search($i, $label_id);
97
- if($label_type[$field_key] != 'type_arithmetic_captcha') {
98
- $data_temp = array();
99
- $tt = $rows[$i];
100
-
101
- $date = $tt->date;
102
- $ip = $tt->ip;
103
- $user_id = get_userdata($tt->user_id_wd);
104
- $username = $user_id ? $user_id->display_name : "";
105
- $useremail = $user_id ? $user_id->user_email : "";
106
- $data_temp['Submit date'] = $date;
107
- $data_temp['Ip']=$ip;
108
- $data_temp['Submitter\'s Username']=$username;
109
- $data_temp['Submitter\'s Email Address']=$useremail;
110
-
111
- $element_labels = explode(',', $tt->element_label);
112
- $element_values = explode('*:*el_value*:*', $tt->element_value);
113
- for ($h = 0; $h < $m; $h++) {
114
- if(isset($data_temp[$label_titles[$h]]))
115
- $label_titles[$h] .= '(1)';
116
-
117
- if(in_array($sorted_labels_id[$h], $element_labels)) {
118
- $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
119
-
120
- if (strpos($element_value, "*@@url@@*")) {
121
- $file_names = '';
122
- $new_files = explode("*@@url@@*", $element_value);
123
- foreach ($new_files as $new_file) {
124
- if ($new_file) {
125
- $file_names .= $new_file . ", ";
126
- }
127
- }
128
- $data_temp[stripslashes($label_titles[$h])] = $file_names;
129
- }
130
- elseif (strpos($element_value, "***br***")) {
131
- $element_value = str_replace("***br***", ', ', $element_value);
132
- if (strpos($element_value, "***quantity***")) {
133
- $element_value = str_replace("***quantity***", '', $element_value);
134
- }
135
- if (strpos($element_value, "***property***")) {
136
- $element_value = str_replace("***property***", '', $element_value);
137
- }
138
- if(substr($element_value, -2) == ', ') {
139
- $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
140
- }
141
- else {
142
- $data_temp[stripslashes($label_titles[$h])]= $element_value;
143
- }
144
- }
145
- elseif (strpos($element_value, "***map***")) {
146
- $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
147
- }
148
- elseif (strpos($element_value, "***star_rating***")) {
149
- $element = str_replace("***star_rating***", '', $element_value);
150
- $element = explode("***", $element);
151
- $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
152
- }
153
- elseif (strpos($element_value, "@@@") || $element_value == "@@@" || $element_value == "@@@@@@@@@") {
154
- $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
155
- }
156
- elseif (strpos($element_value, "***grading***")) {
157
- $element = str_replace("***grading***", '', $element_value);
158
- $grading = explode(":", $element);
159
- $items_count = sizeof($grading) - 1;
160
- $items = "";
161
- $total = "";
162
- for ($k = 0; $k < $items_count / 2; $k++) {
163
- $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
164
- $total += $grading[$k];
165
- }
166
- $items .= "Total: " . $total;
167
- $data_temp[stripslashes($label_titles[$h])] = $items;
168
- }
169
- elseif (strpos($element_value, "***matrix***")) {
170
- $element = str_replace("***matrix***", '', $element_value);
171
- $matrix_value = explode('***', $element);
172
- $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
173
- $mat_rows = $matrix_value[0];
174
- $mat_columns = $matrix_value[$mat_rows + 1];
175
- $matrix = "";
176
- $aaa = array();
177
- $var_checkbox = 1;
178
- $selected_value = "";
179
- $selected_value_yes = "";
180
- $selected_value_no = "";
181
- for ($k = 1; $k <= $mat_rows; $k++) {
182
- if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
183
- if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
184
- $checked = "0";
185
- $aaa[1] = "";
186
- }
187
- else {
188
- $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
189
- }
190
- for ($l = 1; $l <= $mat_columns; $l++) {
191
- $checked = $aaa[1] == $l ? '1' : '0';
192
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
193
- }
194
- }
195
- else {
196
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
197
- for ($l = 1; $l <= $mat_columns; $l++) {
198
- $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
199
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
200
- $var_checkbox++;
201
- }
202
- }
203
- else {
204
- if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
205
- for ($l = 1; $l <= $mat_columns; $l++) {
206
- $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
207
- $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
208
- $var_checkbox++;
209
- }
210
- }
211
- else {
212
- for ($l = 1; $l <= $mat_columns; $l++) {
213
- $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
214
- $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
215
- $var_checkbox++;
216
- }
217
- }
218
- }
219
- }
220
- }
221
- $data_temp[stripslashes($label_titles[$h])] = $matrix;
222
- }
223
- else {
224
- $val = strip_tags(htmlspecialchars_decode($element_value));
225
- $val = stripslashes(str_replace('&#039;', "'", $val));
226
- $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
227
- }
228
- }
229
- else
230
- $data_temp[stripslashes($label_titles[$h])] = '';
231
-
232
- if(isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail") {
233
- if($data_temp[stripslashes($label_titles[$h])] == '') {
234
- $data_temp[stripslashes($label_titles[$h]).'(verified)'] = '';
235
- } else {
236
- if(in_array($i, $verified_emails[$sorted_labels_id[$h]])){
237
- $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'yes';
238
- } else{
239
- $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'no';
240
- }
241
- }
242
- }
243
- }
244
-
245
- $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'item_total'));
246
-
247
- $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'total'));
248
-
249
- $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'0'));
250
-
251
-
252
- if($item_total)
253
- $data_temp['Item Total'] = $item_total;
254
-
255
- if($total)
256
- $data_temp['Total'] = $total;
257
-
258
- if($payment_status)
259
- $data_temp['Payment Status'] = $payment_status;
260
-
261
- $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id= %d", $i);
262
-
263
-
264
-
265
- $paypal_info = $wpdb->get_results($query);
266
- if ($paypal_info) {
267
- $is_paypal_info = TRUE;
268
- }
269
- if ($is_paypal_info) {
270
- foreach ($paypal_info_fields as $key=>$paypal_info_field) {
271
- if ($paypal_info) {
272
- $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = $paypal_info[0]->$paypal_info_field;
273
- }
274
- else {
275
- $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = '';
276
- }
277
- }
278
- }
279
-
280
- $data[$i] = $data_temp;
281
- }
282
- }
283
-
284
- array_push($params, $data);
285
- array_push($params, $title);
286
- array_push($params, $is_paypal_info);
287
-
288
- return $params;
289
-
290
- }
291
-
292
- ////////////////////////////////////////////////////////////////////////////////////////
293
- // Getters & Setters //
294
- ////////////////////////////////////////////////////////////////////////////////////////
295
- ////////////////////////////////////////////////////////////////////////////////////////
296
- // Private Methods //
297
- ////////////////////////////////////////////////////////////////////////////////////////
298
- ////////////////////////////////////////////////////////////////////////////////////////
299
- // Listeners //
300
- ////////////////////////////////////////////////////////////////////////////////////////
301
  }
1
+ <?php
2
+
3
+ class FMModelGenerete_xml {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ ////////////////////////////////////////////////////////////////////////////////////////
14
+ // Constructor & Destructor //
15
+ ////////////////////////////////////////////////////////////////////////////////////////
16
+ public function __construct() {
17
+ }
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ // Public Methods //
20
+ ////////////////////////////////////////////////////////////////////////////////////////
21
+
22
+ public function get_data() {
23
+ global $wpdb;
24
+ $is_paypal_info = FALSE;
25
+ $params = array();
26
+ $group_id_s = array();
27
+ $form_id = (int)$_REQUEST['form_id'];
28
+ $limitstart = (int)$_REQUEST['limitstart'];
29
+ $search_labels = isset($_REQUEST['search_labels']) ? $_REQUEST['search_labels'] : '';
30
+ $verified_emails = isset($_REQUEST['verified_emails']) ? json_decode(stripslashes($_REQUEST['verified_emails']), true) : array();
31
+
32
+ $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
33
+ $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
34
+
35
+ if($search_labels){
36
+ $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d and group_id IN(".$search_labels.")", $form_id);
37
+ $group_id_s = $wpdb->get_col($query);
38
+ }
39
+
40
+ $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
41
+ $labels = $wpdb->get_col($query);
42
+
43
+ $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=%d", $form_id);
44
+ $rows_lable = $wpdb->get_results($query_lable);
45
+ $ptn = "/[^a-zA-Z0-9_]/";
46
+ $rpltxt = "";
47
+ $title = isset($rows_lable[0]) ? preg_replace($ptn, $rpltxt, $rows_lable[0]->title) : '';
48
+
49
+ $sorted_labels_id = array();
50
+ $sorted_labels = array();
51
+ $label_titles = array();
52
+ $sorted_types = array();
53
+ $label_id = array();
54
+ $label_order = array();
55
+ $label_order_original = array();
56
+ $label_type = array();
57
+ if ($labels) {
58
+ $label_all = explode('#****#', $rows_lable[0]->label_order);
59
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
60
+ foreach ($label_all as $key => $label_each) {
61
+ $label_id_each = explode('#**id**#', $label_each);
62
+ array_push($label_id, $label_id_each[0]);
63
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
64
+ array_push($label_order_original, $label_oder_each[0]);
65
+ $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
66
+ array_push($label_order, $label_temp);
67
+ array_push($label_type, $label_oder_each[1]);
68
+ }
69
+ foreach ($label_id as $key => $label) {
70
+ if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
71
+ array_push($sorted_labels, $label_order[$key]);
72
+ array_push($sorted_labels_id, $label);
73
+ array_push($label_titles, stripslashes($label_order_original[$key]));
74
+ array_push($sorted_types, $label_type[$key]);
75
+ }
76
+ }
77
+ }
78
+
79
+ $m = count($sorted_labels);
80
+
81
+ $rows = array();
82
+
83
+ if($search_labels){
84
+ $query = $wpdb->prepare("SELECT group_id, ip, date, user_id_wd, GROUP_CONCAT( element_label SEPARATOR ',') as element_label, GROUP_CONCAT( element_value SEPARATOR '*:*el_value*:*') as element_value FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d and group_id IN(".$search_labels.") GROUP BY group_id ORDER BY date ASC limit %d, %d", $form_id, $limitstart, 1000);
85
+ $rows = $wpdb->get_results($query, OBJECT_K);
86
+ }
87
+
88
+ $data = array();
89
+ $group_id_s_count = $limitstart + 1000 < count($group_id_s) ? $limitstart + 1000 : count($group_id_s);
90
+
91
+ sort($group_id_s,SORT_NUMERIC);
92
+ for ($www = $limitstart; $www < $group_id_s_count; $www++) {
93
+
94
+ $i = $group_id_s[$www];
95
+
96
+ $field_key = array_search($i, $label_id);
97
+ if($label_type[$field_key] != 'type_arithmetic_captcha') {
98
+ $data_temp = array();
99
+ $tt = $rows[$i];
100
+
101
+ $date = $tt->date;
102
+ $ip = $tt->ip;
103
+ $user_id = get_userdata($tt->user_id_wd);
104
+ $username = $user_id ? $user_id->display_name : "";
105
+ $useremail = $user_id ? $user_id->user_email : "";
106
+ $data_temp['Submit date'] = $date;
107
+ $data_temp['Ip']=$ip;
108
+ $data_temp['Submitter\'s Username']=$username;
109
+ $data_temp['Submitter\'s Email Address']=$useremail;
110
+
111
+ $element_labels = explode(',', $tt->element_label);
112
+ $element_values = explode('*:*el_value*:*', $tt->element_value);
113
+ for ($h = 0; $h < $m; $h++) {
114
+ if(isset($data_temp[$label_titles[$h]]))
115
+ $label_titles[$h] .= '(1)';
116
+
117
+ if(in_array($sorted_labels_id[$h], $element_labels)) {
118
+ $element_value = $element_values[array_search($sorted_labels_id[$h], $element_labels)];
119
+
120
+ if (strpos($element_value, "*@@url@@*")) {
121
+ $file_names = '';
122
+ $new_files = explode("*@@url@@*", $element_value);
123
+ foreach ($new_files as $new_file) {
124
+ if ($new_file) {
125
+ $file_names .= $new_file . ", ";
126
+ }
127
+ }
128
+ $data_temp[stripslashes($label_titles[$h])] = $file_names;
129
+ }
130
+ elseif (strpos($element_value, "***br***")) {
131
+ $element_value = str_replace("***br***", ', ', $element_value);
132
+ if (strpos($element_value, "***quantity***")) {
133
+ $element_value = str_replace("***quantity***", '', $element_value);
134
+ }
135
+ if (strpos($element_value, "***property***")) {
136
+ $element_value = str_replace("***property***", '', $element_value);
137
+ }
138
+ if(substr($element_value, -2) == ', ') {
139
+ $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
140
+ }
141
+ else {
142
+ $data_temp[stripslashes($label_titles[$h])]= $element_value;
143
+ }
144
+ }
145
+ elseif (strpos($element_value, "***map***")) {
146
+ $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $element_value);
147
+ }
148
+ elseif (strpos($element_value, "***star_rating***")) {
149
+ $element = str_replace("***star_rating***", '', $element_value);
150
+ $element = explode("***", $element);
151
+ $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
152
+ }
153
+ elseif (strpos($element_value, "@@@") !== FALSE) {
154
+ $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $element_value);
155
+ }
156
+ elseif (strpos($element_value, "***grading***")) {
157
+ $element = str_replace("***grading***", '', $element_value);
158
+ $grading = explode(":", $element);
159
+ $items_count = sizeof($grading) - 1;
160
+ $items = "";
161
+ $total = "";
162
+ for ($k = 0; $k < $items_count / 2; $k++) {
163
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
164
+ $total += $grading[$k];
165
+ }
166
+ $items .= "Total: " . $total;
167
+ $data_temp[stripslashes($label_titles[$h])] = $items;
168
+ }
169
+ elseif (strpos($element_value, "***matrix***")) {
170
+ $element = str_replace("***matrix***", '', $element_value);
171
+ $matrix_value = explode('***', $element);
172
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
173
+ $mat_rows = $matrix_value[0];
174
+ $mat_columns = $matrix_value[$mat_rows + 1];
175
+ $matrix = "";
176
+ $aaa = array();
177
+ $var_checkbox = 1;
178
+ $selected_value = "";
179
+ $selected_value_yes = "";
180
+ $selected_value_no = "";
181
+ for ($k = 1; $k <= $mat_rows; $k++) {
182
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
183
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
184
+ $checked = "0";
185
+ $aaa[1] = "";
186
+ }
187
+ else {
188
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
189
+ }
190
+ for ($l = 1; $l <= $mat_columns; $l++) {
191
+ $checked = $aaa[1] == $l ? '1' : '0';
192
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
193
+ }
194
+ }
195
+ else {
196
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
197
+ for ($l = 1; $l <= $mat_columns; $l++) {
198
+ $checked = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1 ? '1' : '0';
199
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
200
+ $var_checkbox++;
201
+ }
202
+ }
203
+ else {
204
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
205
+ for ($l = 1; $l <= $mat_columns; $l++) {
206
+ $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
207
+ $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
208
+ $var_checkbox++;
209
+ }
210
+ }
211
+ else {
212
+ for ($l = 1; $l <= $mat_columns; $l++) {
213
+ $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
214
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
215
+ $var_checkbox++;
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ $data_temp[stripslashes($label_titles[$h])] = $matrix;
222
+ }
223
+ else {
224
+ $val = strip_tags(htmlspecialchars_decode($element_value));
225
+ $val = stripslashes(str_replace('&#039;', "'", $val));
226
+ $data_temp[stripslashes($label_titles[$h])] = ($element_value ? $val : '');
227
+ }
228
+ }
229
+ else
230
+ $data_temp[stripslashes($label_titles[$h])] = '';
231
+
232
+ if(isset($verified_emails[$sorted_labels_id[$h]]) && $sorted_types[$h] == "type_submitter_mail") {
233
+ if($data_temp[stripslashes($label_titles[$h])] == '') {
234
+ $data_temp[stripslashes($label_titles[$h]).'(verified)'] = '';
235
+ } else {
236
+ if(in_array($i, $verified_emails[$sorted_labels_id[$h]])){
237
+ $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'yes';
238
+ } else{
239
+ $data_temp[stripslashes($label_titles[$h]).'(verified)']= 'no';
240
+ }
241
+ }
242
+ }
243
+ }
244
+
245
+ $item_total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'item_total'));
246
+
247
+ $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'total'));
248
+
249
+ $payment_status = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'0'));
250
+
251
+
252
+ if($item_total)
253
+ $data_temp['Item Total'] = $item_total;
254
+
255
+ if($total)
256
+ $data_temp['Total'] = $total;
257
+
258
+ if($payment_status)
259
+ $data_temp['Payment Status'] = $payment_status;
260
+
261
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id= %d", $i);
262
+
263
+
264
+
265
+ $paypal_info = $wpdb->get_results($query);
266
+ if ($paypal_info) {
267
+ $is_paypal_info = TRUE;
268
+ }
269
+ if ($is_paypal_info) {
270
+ foreach ($paypal_info_fields as $key=>$paypal_info_field) {
271
+ if ($paypal_info) {
272
+ $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = $paypal_info[0]->$paypal_info_field;
273
+ }
274
+ else {
275
+ $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = '';
276
+ }
277
+ }
278
+ }
279
+
280
+ $data[$i] = $data_temp;
281
+ }
282
+ }
283
+
284
+ array_push($params, $data);
285
+ array_push($params, $title);
286
+ array_push($params, $is_paypal_info);
287
+
288
+ return $params;
289
+
290
+ }
291
+
292
+ ////////////////////////////////////////////////////////////////////////////////////////
293
+ // Getters & Setters //
294
+ ////////////////////////////////////////////////////////////////////////////////////////
295
+ ////////////////////////////////////////////////////////////////////////////////////////
296
+ // Private Methods //
297
+ ////////////////////////////////////////////////////////////////////////////////////////
298
+ ////////////////////////////////////////////////////////////////////////////////////////
299
+ // Listeners //
300
+ ////////////////////////////////////////////////////////////////////////////////////////
301
  }
admin/views/FMViewFormMakerSubmits.php CHANGED
@@ -1,119 +1,217 @@
1
- <?php
2
-
3
- class FMViewFormMakerSubmits {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- public function display() {
26
- if (isset($_GET['form_id']) && isset($_GET['group_id'])) {
27
- $form_id = esc_html(stripslashes($_GET['form_id']));
28
- $label_order = $this->model->get_from_label_order($form_id);
29
- $group_id = esc_html(stripslashes($_GET['group_id']));
30
- $rows = $this->model->get_submissions($group_id);
31
- $labels_id = array();
32
- $labels_name = array();
33
- $labels_type = array();
34
- $label_all = explode('#****#', $label_order);
35
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
36
- foreach ($label_all as $key => $label_each) {
37
- $label_id_each = explode('#**id**#', $label_each);
38
- array_push($labels_id, $label_id_each[0]);
39
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
40
- array_push($labels_name, $label_oder_each[0]);
41
- array_push($labels_type, $label_oder_each[1]);
42
- }
43
- ?>
44
- <style>
45
- table.submit_table {
46
- font-family: verdana,arial,sans-serif;
47
- border-width: 1px;
48
- border-color: #999999;
49
- border-collapse: collapse;
50
- }
51
- table.submit_table td {
52
- padding: 6px;
53
- border: 1px solid #fff;
54
- font-size: 13px;
55
- }
56
- .field_label {
57
- background: #E4E4E4;
58
- font-weight: bold;
59
- }
60
- .field_value {
61
- background: #f0f0ee;
62
- }
63
- </style>
64
- <table class="submit_table">
65
- <tr>
66
- <td class="field_label">ID: </td>
67
- <td class="field_value"><?php echo $rows[0]->group_id; ?></td>
68
- </tr>
69
- <tr>
70
- <td class="field_label"><?php echo __("Date","form_maker"); ?>: </td>
71
- <td class="field_value"><?php echo $rows[0]->date; ?></td>
72
- </tr>
73
- <tr>
74
- <td class="field_label">IP: </td>
75
- <td class="field_value"><?php echo $rows[0]->ip; ?></td>
76
- </tr>
77
- <?php
78
- foreach ($labels_id as $key => $label_id) {
79
- if ($labels_type[$key] != '' and $labels_type[$key] != 'type_editor' and $labels_type[$key] != 'type_submit_reset' and $labels_type[$key] != 'type_map' and $labels_type[$key] != 'type_captcha') {
80
- $element_value = '';
81
- foreach ($rows as $row) {
82
- if ($row->element_label == $label_id) {
83
- $element_value = $row->element_value;
84
- break;
85
- }
86
- else {
87
- $element_value = 'element_valueelement_valueelement_value';
88
- }
89
- }
90
- if($labels_type[$key] == "type_name")
91
- $element_value = str_replace("@@@", " ", $element_value);
92
- if ($element_value == "element_valueelement_valueelement_value") {
93
- continue;
94
- }
95
- ?>
96
- <tr>
97
- <td class="field_label"><?php echo $labels_name[$key]; ?></td>
98
- <td class="field_value"><?php echo str_replace("***br***", '<br>', wpautop(esc_html($element_value))); ?></td>
99
- </tr>
100
- <?php
101
- }
102
- }
103
- ?>
104
- </table>
105
- <?php
106
- }
107
- die();
108
- }
109
-
110
- ////////////////////////////////////////////////////////////////////////////////////////
111
- // Getters & Setters //
112
- ////////////////////////////////////////////////////////////////////////////////////////
113
- ////////////////////////////////////////////////////////////////////////////////////////
114
- // Private Methods //
115
- ////////////////////////////////////////////////////////////////////////////////////////
116
- ////////////////////////////////////////////////////////////////////////////////////////
117
- // Listeners //
118
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
1
+ <?php
2
+
3
+ class FMViewFormMakerSubmits {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ private $model;
14
+
15
+
16
+ ////////////////////////////////////////////////////////////////////////////////////////
17
+ // Constructor & Destructor //
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ public function __construct($model) {
20
+ $this->model = $model;
21
+ }
22
+ ////////////////////////////////////////////////////////////////////////////////////////
23
+ // Public Methods //
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+ public function display() {
26
+ if (isset($_GET['form_id']) && isset($_GET['group_id'])) {
27
+ $form_id = esc_html(stripslashes($_GET['form_id']));
28
+ $label_order = $this->model->get_from_label_order($form_id);
29
+ $group_id = esc_html(stripslashes($_GET['group_id']));
30
+ $rows = $this->model->get_submissions($group_id);
31
+ $labels_id = array();
32
+ $labels_name = array();
33
+ $labels_type = array();
34
+ $label_all = explode('#****#', $label_order);
35
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
36
+ foreach ($label_all as $key => $label_each) {
37
+ $label_id_each = explode('#**id**#', $label_each);
38
+ array_push($labels_id, $label_id_each[0]);
39
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
40
+ array_push($labels_name, $label_oder_each[0]);
41
+ array_push($labels_type, $label_oder_each[1]);
42
+ }
43
+ ?>
44
+ <style>
45
+ table.submit_table {
46
+ font-family: verdana,arial,sans-serif;
47
+ border-width: 1px;
48
+ border-color: #999999;
49
+ border-collapse: collapse;
50
+ }
51
+ table.submit_table td {
52
+ padding: 6px;
53
+ border: 1px solid #fff;
54
+ font-size: 13px;
55
+ }
56
+ .field_label {
57
+ background: #E4E4E4;
58
+ font-weight: bold;
59
+ }
60
+ .field_value {
61
+ background: #f0f0ee;
62
+ }
63
+ </style>
64
+ <table class="submit_table">
65
+ <tr>
66
+ <td class="field_label">ID: </td>
67
+ <td class="field_value"><?php echo $rows[0]->group_id; ?></td>
68
+ </tr>
69
+ <tr>
70
+ <td class="field_label"><?php echo __("Date","form_maker"); ?>: </td>
71
+ <td class="field_value"><?php echo $rows[0]->date; ?></td>
72
+ </tr>
73
+ <tr>
74
+ <td class="field_label">IP: </td>
75
+ <td class="field_value"><?php echo $rows[0]->ip; ?></td>
76
+ </tr>
77
+ <?php
78
+ foreach ($labels_id as $key => $label_id) {
79
+ if ($labels_type[$key] != '' and $labels_type[$key] != 'type_editor' and $labels_type[$key] != 'type_submit_reset' and $labels_type[$key] != 'type_map' and $labels_type[$key] != 'type_captcha') {
80
+ $element_value = '';
81
+ foreach ($rows as $row) {
82
+ if ($row->element_label == $label_id) {
83
+ $element_value = $row->element_value;
84
+ break;
85
+ }
86
+ else {
87
+ $element_value = 'element_valueelement_valueelement_value';
88
+ }
89
+ }
90
+ if($labels_type[$key] == "type_name")
91
+ $element_value = str_replace("@@@", " ", $element_value);
92
+ if($labels_type[$key] == "type_file_upload")
93
+ $element_value = str_replace("*@@url@@*", " ", $element_value);
94
+
95
+
96
+
97
+ if ($element_value == "element_valueelement_valueelement_value") {
98
+ continue;
99
+ }
100
+ ?>
101
+ <tr>
102
+ <td class="field_label"><?php echo $labels_name[$key]; ?></td>
103
+ <?php if($labels_type[$key] != 'type_matrix'){ ?>
104
+ <td class="field_value"><?php echo wpautop(str_replace("***br***", '<br>', wpautop(esc_html($element_value)))); ?></td>
105
+ <?php }
106
+ else { ?>
107
+ <td class="field_value"><?php $new_filename = str_replace("***matrix***", '', $element_value);
108
+ $new_filename = explode('***', $element_value);
109
+ $mat_params = array_slice($new_filename, 0, count($new_filename) - 1);
110
+ $mat_rows = $mat_params[0];
111
+ $mat_columns = $mat_params[$mat_rows + 1];
112
+ ?>
113
+ <table style="margin: 0 auto;">
114
+ <tr>
115
+ <td></td>
116
+ <?php
117
+ for ($k = 1; $k <= $mat_columns; $k++) {
118
+ ?>
119
+ <td style="background-color: #BBBBBB; padding: 5px;"><?php echo $mat_params[$mat_rows + 1 + $k]; ?></td>
120
+ <?php
121
+ }
122
+ ?>
123
+ </tr>
124
+ <?php
125
+ $aaa = Array();
126
+ $var_checkbox = 1;
127
+ for ($k = 1; $k <= $mat_rows; $k++) {
128
+ ?>
129
+ <tr>
130
+ <td style="background-color: #BBBBBB; padding: 5px; "><?php echo $mat_params[$k]; ?></td>
131
+ <?php
132
+ if ($mat_params[$mat_rows + $mat_columns + 2] == "radio") {
133
+ if ($mat_params[$mat_rows + $mat_columns + 2 + $k] == 0) {
134
+ $checked = 0;
135
+ $aaa[1] = "";
136
+ }
137
+ else {
138
+ $aaa = explode("_", $mat_params[$mat_rows + $mat_columns + 2 + $k]);
139
+ }
140
+ for ($l = 1; $l <= $mat_columns; $l++) {
141
+ if ($aaa[1] == $l) {
142
+ $checked = "checked";
143
+ }
144
+ else {
145
+ $checked = "";
146
+ }
147
+ ?>
148
+ <td style="text-align: center;"><input type="radio" <?php echo $checked; ?> disabled /></td>
149
+ <?php
150
+ }
151
+ }
152
+ else {
153
+ if ($mat_params[$mat_rows + $mat_columns + 2] == "checkbox") {
154
+ for ($l = 1; $l <= $mat_columns; $l++) {
155
+ if ($mat_params[$mat_rows+$mat_columns + 2 + $var_checkbox] == "1") {
156
+ $checked = "checked";
157
+ }
158
+ else {
159
+ $checked = "";
160
+ }
161
+ ?>
162
+ <td style="text-align:center"><input type="checkbox" <?php echo $checked; ?> disabled /></td>
163
+ <?php
164
+ $var_checkbox++;
165
+ }
166
+ }
167
+ else {
168
+ if ($mat_params[$mat_rows + $mat_columns + 2] == "text") {
169
+ for ($l = 1; $l <= $mat_columns; $l++) {
170
+ $checked = $mat_params[$mat_rows + $mat_columns + 2 + $var_checkbox];
171
+ ?>
172
+ <td style="text-align:center"><input type="text" value="<?php echo $checked; ?>" disabled /></td>
173
+ <?php
174
+ $var_checkbox++;
175
+ }
176
+ }
177
+ else {
178
+ for ($l = 1; $l <= $mat_columns; $l++) {
179
+ $checked = $mat_params[$mat_rows + $mat_columns + 2 + $var_checkbox];
180
+ ?>
181
+ <td style="text-align: center;"><?php echo $checked; ?></td>
182
+ <?php
183
+ $var_checkbox++;
184
+ }
185
+ }
186
+ }
187
+ }
188
+ ?>
189
+ </tr>
190
+ <?php
191
+ }
192
+ ?>
193
+ </table>
194
+ </td>
195
+ <?php } ?>
196
+ </tr>
197
+
198
+ <?php
199
+ }
200
+ }
201
+ ?>
202
+ </table>
203
+ <?php
204
+ }
205
+ die();
206
+ }
207
+
208
+ ////////////////////////////////////////////////////////////////////////////////////////
209
+ // Getters & Setters //
210
+ ////////////////////////////////////////////////////////////////////////////////////////
211
+ ////////////////////////////////////////////////////////////////////////////////////////
212
+ // Private Methods //
213
+ ////////////////////////////////////////////////////////////////////////////////////////
214
+ ////////////////////////////////////////////////////////////////////////////////////////
215
+ // Listeners //
216
+ ////////////////////////////////////////////////////////////////////////////////////////
217
  }
admin/views/FMViewUninstall_fm.php CHANGED
@@ -1,155 +1,158 @@
1
- <?php
2
-
3
- class FMViewUninstall_fm {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- public function display() {
26
- global $wpdb;
27
- $prefix = $wpdb->prefix;
28
- $addons = array('WD_FM_MAILCHIMP' => 'mailchimp', 'WD_FM_REG' => 'reg', 'WD_FM_POST_GEN' => 'post_gen_options', 'WD_FM_EMAIL_COND' => 'email_conditions', 'WD_FM_DBOX_INT' => 'dbox_int', 'WD_FM_GDRIVE_INT' => 'formmaker_gdrive_int','WD_FM_PDF' => array('pdf_options', 'pdf'), 'WD_FM_PUSHOVER' => 'pushover', 'WD_FM_SAVE_PROG' => array('save_options', 'saved_entries', 'saved_attributes'), 'WD_FM_STRIPE'=>'stripe', 'WD_FM_CALCULATOR'=>'calculator');
29
- ?>
30
- <form method="post" action="admin.php?page=uninstall_fm" style="width:95%;">
31
- <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
32
- <div class="wrap">
33
- <div class="uninstall-banner">
34
- <div class="uninstall_icon">
35
- </div>
36
- <div class="fm-logo-title">Uninstall Form Maker</div>
37
- </div>
38
- <br />
39
- <div class="goodbye-text">
40
- Before uninstalling the plugin, please Contact our <a href="https://web-dorado.com/support/contact-us.html" target= '_blank'>support team</a>. We'll do our best to help you out with your issue. We value each and every user and value what’s right for our users in everything we do.<br>
41
- However, if anyway you have made a decision to uninstall the plugin, please take a minute to <a href="https://web-dorado.com/support/contact-us.html" target= '_blank'>Contact us</a> and tell what you didn't like for our plugins further improvement and development. Thank you !!!
42
- </div>
43
- <p>
44
- Deactivating Form Maker plugin does not remove any data that may have been created, such as the Forms and the Submissions. To completely remove this plugin, you can uninstall it here.
45
- </p>
46
- <p style="color: red;">
47
- <strong>WARNING:</strong>
48
- Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first.
49
- </p>
50
- <p style="color: red">
51
- <strong>The following WordPress Options/Tables will be DELETED:</strong>
52
- </p>
53
- <table class="widefat">
54
- <thead>
55
- <tr>
56
- <th>Database Tables</th>
57
- </tr>
58
- </thead>
59
- <tr>
60
- <td valign="top">
61
- <ol>
62
- <li><?php echo $prefix; ?>formmaker</li>
63
- <li><?php echo $prefix; ?>formmaker_backup</li>
64
- <li><?php echo $prefix; ?>formmaker_blocked</li>
65
- <li><?php echo $prefix; ?>formmaker_submits</li>
66
- <li><?php echo $prefix; ?>formmaker_views</li>
67
- <li><?php echo $prefix; ?>formmaker_themes</li>
68
- <li><?php echo $prefix; ?>formmaker_sessions</li>
69
- <li><?php echo $prefix; ?>formmaker_query</li>
70
- <li><?php echo $prefix; ?>formmaker_display_options</li>
71
- <?php
72
- foreach($addons as $addon => $addon_name) {
73
- if (defined($addon) && is_plugin_active(constant($addon))) {
74
- if(is_array($addon_name)){
75
- foreach($addon_name as $ad_name){
76
- echo '<li>'.$prefix.'formmaker_'.$ad_name.'</li>';
77
- }
78
- } else{
79
- echo '<li>'.$prefix.'formmaker_'.$addon_name.'</li>';
80
- }
81
- }
82
- }
83
- ?>
84
- </ol>
85
- </td>
86
- </tr>
87
- </table>
88
- <p style="text-align: center;">
89
- Do you really want to uninstall Form Maker?
90
- </p>
91
- <p style="text-align: center;">
92
- <input type="checkbox" name="Form Maker" id="check_yes" value="yes" />&nbsp;<label for="check_yes">Yes</label>
93
- </p>
94
- <p style="text-align: center;">
95
- <input type="submit" value="UNINSTALL" class="button-primary" onclick="if (check_yes.checked) { if (confirm('You are About to Uninstall Form Maker from WordPress.\nThis Action Is Not Reversible.')) { fm_set_input_value('task', 'uninstall'); } else { return false; } } else { return false; }" />
96
- </p>
97
- </div>
98
- <input id="task" name="task" type="hidden" value="" />
99
- </form>
100
- <?php
101
- }
102
-
103
- public function uninstall() {
104
- $this->model->delete_db_tables();
105
- global $wpdb;
106
- $prefix = $wpdb->prefix;
107
- $addons = array('WD_FM_MAILCHIMP' => 'mailchimp', 'WD_FM_REG' => 'reg', 'WD_FM_POST_GEN' => 'post_gen_options', 'WD_FM_EMAIL_COND' => 'email_conditions', 'WD_FM_DBOX_INT' => 'dbox_int', 'WD_FM_GDRIVE_INT' => 'formmaker_gdrive_int', 'WD_FM_PDF' => array('pdf_options', 'pdf'), 'WD_FM_PUSHOVER' => 'pushover', 'WD_FM_SAVE_PROG' => array('save_options', 'saved_entries', 'saved_attributes'), 'WD_FM_STRIPE' => 'stripe', 'WD_FM_CALCULATOR' => 'calculator');
108
- $deactivate_url = add_query_arg(array('action' => 'deactivate', 'plugin' => WD_MAIN_FILE), admin_url('plugins.php'));
109
- $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_' . WD_MAIN_FILE);
110
- ?>
111
- <div id="message" class="updated fade">
112
- <p>The following Database Tables succesfully deleted:</p>
113
- <p><?php echo $prefix; ?>formmaker,</p>
114
- <p><?php echo $prefix; ?>formmaker_backup</p>
115
- <p><?php echo $prefix; ?>formmaker_blocked</p>
116
- <p><?php echo $prefix; ?>formmaker_sessions</p>
117
- <p><?php echo $prefix; ?>formmaker_submits</p>
118
- <p><?php echo $prefix; ?>formmaker_themes</p>
119
- <p><?php echo $prefix; ?>formmaker_views</p>
120
- <p><?php echo $prefix; ?>formmaker_query</p>
121
- <p><?php echo $prefix; ?>formmaker_display_options,</p>
122
- <?php
123
- foreach ($addons as $addon => $addon_name) {
124
- if (defined($addon) && is_plugin_active(constant($addon))) {
125
- if (is_array($addon_name)) {
126
- foreach ($addon_name as $ad_name) {
127
- echo '<p>' . $prefix . 'formmaker_' . $ad_name . '</p>';
128
- }
129
- }
130
- else {
131
- echo '<p>' . $prefix . 'formmaker_' . $addon_name . '</p>';
132
- }
133
- }
134
- }
135
- ?>
136
- </div>
137
- <div class="wrap">
138
- <h2>Uninstall Form Maker</h2>
139
- <p><strong><a href="<?php echo $deactivate_url; ?>" class="fm_deactivate_link" data-uninstall="1">Click Here</a> To Finish the Uninstallation and Form Maker
140
- will be Deactivated Automatically.</strong></p>
141
- <input id="task" name="task" type="hidden" value=""/>
142
- </div>
143
- <?php
144
- }
145
-
146
- ////////////////////////////////////////////////////////////////////////////////////////
147
- // Getters & Setters //
148
- ////////////////////////////////////////////////////////////////////////////////////////
149
- ////////////////////////////////////////////////////////////////////////////////////////
150
- // Private Methods //
151
- ////////////////////////////////////////////////////////////////////////////////////////
152
- ////////////////////////////////////////////////////////////////////////////////////////
153
- // Listeners //
154
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
155
  }
1
+ <?php
2
+
3
+ class FMViewUninstall_fm {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ private $model;
14
+
15
+
16
+ ////////////////////////////////////////////////////////////////////////////////////////
17
+ // Constructor & Destructor //
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ public function __construct($model) {
20
+ $this->model = $model;
21
+ }
22
+ ////////////////////////////////////////////////////////////////////////////////////////
23
+ // Public Methods //
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+ public function display() {
26
+ global $wpdb;
27
+ $prefix = $wpdb->prefix;
28
+ $addons = array('WD_FM_MAILCHIMP' => 'mailchimp', 'WD_FM_REG' => 'reg', 'WD_FM_POST_GEN' => 'post_gen_options', 'WD_FM_EMAIL_COND' => 'email_conditions', 'WD_FM_DBOX_INT' => 'dbox_int', 'WD_FM_GDRIVE_INT' => 'formmaker_gdrive_int','WD_FM_PDF' => array('pdf_options', 'pdf'), 'WD_FM_PUSHOVER' => 'pushover', 'WD_FM_SAVE_PROG' => array('save_options', 'saved_entries', 'saved_attributes'), 'WD_FM_STRIPE'=>'stripe', 'WD_FM_CALCULATOR'=>'calculator');
29
+ ?>
30
+ <form method="post" action="admin.php?page=uninstall_fm" style="width:95%;">
31
+ <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
32
+ <div class="wrap">
33
+ <div class="uninstall-banner">
34
+ <div class="uninstall_icon">
35
+ </div>
36
+ <div class="fm-logo-title">Uninstall Form Maker</div>
37
+ </div>
38
+ <br />
39
+ <div class="goodbye-text">
40
+ Before uninstalling the plugin, please Contact our <a href="https://web-dorado.com/support/contact-us.html" target= '_blank'>support team</a>. We'll do our best to help you out with your issue. We value each and every user and value what’s right for our users in everything we do.<br>
41
+ However, if anyway you have made a decision to uninstall the plugin, please take a minute to <a href="https://web-dorado.com/support/contact-us.html" target= '_blank'>Contact us</a> and tell what you didn't like for our plugins further improvement and development. Thank you !!!
42
+ </div>
43
+ <div class="goodbye-text" style="color: red;">
44
+ Note, that uninstalling Form Maker will remove all forms, submissions and other data on the plugin.<br />Please make sure you don't have any important information before you proceed.
45
+ </div>
46
+ <p>
47
+ Deactivating Form Maker plugin does not remove any data that may have been created, such as the Forms and the Submissions. To completely remove this plugin, you can uninstall it here.
48
+ </p>
49
+ <p style="color: red;">
50
+ <strong>WARNING:</strong>
51
+ Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first.
52
+ </p>
53
+ <p style="color: red">
54
+ <strong>The following WordPress Options/Tables will be DELETED:</strong>
55
+ </p>
56
+ <table class="widefat">
57
+ <thead>
58
+ <tr>
59
+ <th>Database Tables</th>
60
+ </tr>
61
+ </thead>
62
+ <tr>
63
+ <td valign="top">
64
+ <ol>
65
+ <li><?php echo $prefix; ?>formmaker</li>
66
+ <li><?php echo $prefix; ?>formmaker_backup</li>
67
+ <li><?php echo $prefix; ?>formmaker_blocked</li>
68
+ <li><?php echo $prefix; ?>formmaker_submits</li>
69
+ <li><?php echo $prefix; ?>formmaker_views</li>
70
+ <li><?php echo $prefix; ?>formmaker_themes</li>
71
+ <li><?php echo $prefix; ?>formmaker_sessions</li>
72
+ <li><?php echo $prefix; ?>formmaker_query</li>
73
+ <li><?php echo $prefix; ?>formmaker_display_options</li>
74
+ <?php
75
+ foreach($addons as $addon => $addon_name) {
76
+ if (defined($addon) && is_plugin_active(constant($addon))) {
77
+ if(is_array($addon_name)){
78
+ foreach($addon_name as $ad_name){
79
+ echo '<li>'.$prefix.'formmaker_'.$ad_name.'</li>';
80
+ }
81
+ } else{
82
+ echo '<li>'.$prefix.'formmaker_'.$addon_name.'</li>';
83
+ }
84
+ }
85
+ }
86
+ ?>
87
+ </ol>
88
+ </td>
89
+ </tr>
90
+ </table>
91
+ <p style="text-align: center;">
92
+ Do you really want to uninstall Form Maker?
93
+ </p>
94
+ <p style="text-align: center;">
95
+ <input type="checkbox" name="Form Maker" id="check_yes" value="yes" />&nbsp;<label for="check_yes">Yes</label>
96
+ </p>
97
+ <p style="text-align: center;">
98
+ <input type="submit" value="UNINSTALL" class="button-primary" onclick="if (check_yes.checked) { if (confirm('You are About to Uninstall Form Maker from WordPress.\nThis Action Is Not Reversible.')) { fm_set_input_value('task', 'uninstall'); } else { return false; } } else { return false; }" />
99
+ </p>
100
+ </div>
101
+ <input id="task" name="task" type="hidden" value="" />
102
+ </form>
103
+ <?php
104
+ }
105
+
106
+ public function uninstall() {
107
+ $this->model->delete_db_tables();
108
+ global $wpdb;
109
+ $prefix = $wpdb->prefix;
110
+ $addons = array('WD_FM_MAILCHIMP' => 'mailchimp', 'WD_FM_REG' => 'reg', 'WD_FM_POST_GEN' => 'post_gen_options', 'WD_FM_EMAIL_COND' => 'email_conditions', 'WD_FM_DBOX_INT' => 'dbox_int', 'WD_FM_GDRIVE_INT' => 'formmaker_gdrive_int', 'WD_FM_PDF' => array('pdf_options', 'pdf'), 'WD_FM_PUSHOVER' => 'pushover', 'WD_FM_SAVE_PROG' => array('save_options', 'saved_entries', 'saved_attributes'), 'WD_FM_STRIPE' => 'stripe', 'WD_FM_CALCULATOR' => 'calculator');
111
+ $deactivate_url = add_query_arg(array('action' => 'deactivate', 'plugin' => WD_MAIN_FILE), admin_url('plugins.php'));
112
+ $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_' . WD_MAIN_FILE);
113
+ ?>
114
+ <div id="message" class="updated fade">
115
+ <p>The following Database Tables succesfully deleted:</p>
116
+ <p><?php echo $prefix; ?>formmaker,</p>
117
+ <p><?php echo $prefix; ?>formmaker_backup</p>
118
+ <p><?php echo $prefix; ?>formmaker_blocked</p>
119
+ <p><?php echo $prefix; ?>formmaker_sessions</p>
120
+ <p><?php echo $prefix; ?>formmaker_submits</p>
121
+ <p><?php echo $prefix; ?>formmaker_themes</p>
122
+ <p><?php echo $prefix; ?>formmaker_views</p>
123
+ <p><?php echo $prefix; ?>formmaker_query</p>
124
+ <p><?php echo $prefix; ?>formmaker_display_options,</p>
125
+ <?php
126
+ foreach ($addons as $addon => $addon_name) {
127
+ if (defined($addon) && is_plugin_active(constant($addon))) {
128
+ if (is_array($addon_name)) {
129
+ foreach ($addon_name as $ad_name) {
130
+ echo '<p>' . $prefix . 'formmaker_' . $ad_name . '</p>';
131
+ }
132
+ }
133
+ else {
134
+ echo '<p>' . $prefix . 'formmaker_' . $addon_name . '</p>';
135
+ }
136
+ }
137
+ }
138
+ ?>
139
+ </div>
140
+ <div class="wrap">
141
+ <h2>Uninstall Form Maker</h2>
142
+ <p><strong><a href="<?php echo $deactivate_url; ?>" class="fm_deactivate_link" data-uninstall="1">Click Here</a> To Finish the Uninstallation and Form Maker
143
+ will be Deactivated Automatically.</strong></p>
144
+ <input id="task" name="task" type="hidden" value=""/>
145
+ </div>
146
+ <?php
147
+ }
148
+
149
+ ////////////////////////////////////////////////////////////////////////////////////////
150
+ // Getters & Setters //
151
+ ////////////////////////////////////////////////////////////////////////////////////////
152
+ ////////////////////////////////////////////////////////////////////////////////////////
153
+ // Private Methods //
154
+ ////////////////////////////////////////////////////////////////////////////////////////
155
+ ////////////////////////////////////////////////////////////////////////////////////////
156
+ // Listeners //
157
+ ////////////////////////////////////////////////////////////////////////////////////////
158
  }
form-maker.php CHANGED
@@ -1,784 +1,784 @@
1
- <?php
2
- /**
3
- * Plugin Name: Form Maker
4
- * Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
5
- * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
- * Version: 1.11.4
7
- * Author: WebDorado Form Builder Team
8
- * Author URI: https://web-dorado.com/
9
- * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
- */
11
- define('WD_FM_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
12
- define('WD_FM_URL', plugins_url(plugin_basename(dirname(__FILE__))));
13
- define('WD_MAIN_FILE', plugin_basename(__FILE__));
14
- define('WD_FM_VERSION', '1.11.4');
15
- // Plugin menu.
16
- function form_maker_options_panel() {
17
- $parent_slug = null;
18
- if( get_option( "fm_subscribe_done" ) == 1 ) {
19
- add_menu_page('Form Maker', 'Form Maker', 'manage_options', 'manage_fm', 'form_maker', WD_FM_URL . '/images/FormMakerLogo-16.png', 105.105);
20
- $parent_slug = "manage_fm";
21
- }
22
-
23
- add_menu_page('Form Maker Add-ons', 'Form Maker &nbsp;&nbsp;&nbsp;&nbsp; Add-ons', 'manage_options', 'extensions_fm', 'fm_extensions', WD_FM_URL . '/assets/add-ons-icon.png');
24
-
25
- $manage_page = add_submenu_page($parent_slug, 'Manager', 'Manager', 'manage_options', 'manage_fm', 'form_maker');
26
- add_action('admin_print_styles-' . $manage_page, 'form_maker_manage_styles');
27
- add_action('admin_print_scripts-' . $manage_page, 'form_maker_manage_scripts');
28
-
29
- $submissions_page = add_submenu_page($parent_slug, 'Submissions', 'Submissions', 'manage_options', 'submissions_fm', 'form_maker');
30
- add_action('admin_print_styles-' . $submissions_page, 'form_maker_submissions_styles');
31
- add_action('admin_print_scripts-' . $submissions_page, 'form_maker_submissions_scripts');
32
-
33
- if (defined('WD_FM_SAVE_PROG') && is_plugin_active(constant('WD_FM_SAVE_PROG'))) {
34
- $saved_entries_page = add_submenu_page($parent_slug, 'Saved Entries', 'Saved Entries', 'manage_options', 'saved_entries', 'fm_saved_entries');
35
- add_action('admin_print_styles-' . $saved_entries_page, 'form_maker_submissions_styles');
36
- add_action('admin_print_scripts-' . $saved_entries_page, 'form_maker_submissions_scripts');
37
- }
38
-
39
- $blocked_ips_page = add_submenu_page($parent_slug, 'Blocked IPs', 'Blocked IPs', 'manage_options', 'blocked_ips_fm', 'form_maker');
40
- add_action('admin_print_styles-' . $blocked_ips_page, 'form_maker_manage_styles');
41
- add_action('admin_print_scripts-' . $blocked_ips_page, 'form_maker_manage_scripts');
42
-
43
- $themes_page = add_submenu_page($parent_slug, 'Themes', 'Themes', 'manage_options', 'themes_fm', 'form_maker');
44
- add_action('admin_print_styles-' . $themes_page, 'form_maker_manage_styles');
45
- add_action('admin_print_scripts-' . $themes_page, 'form_maker_manage_scripts');
46
-
47
- $global_options_page = add_submenu_page($parent_slug, 'Global Options', 'Global Options', 'manage_options', 'goptions_fm', 'form_maker');
48
- add_action('admin_print_styles-' . $global_options_page, 'form_maker_manage_styles');
49
- add_action('admin_print_scripts-' . $global_options_page, 'form_maker_manage_scripts');
50
-
51
- $licensing_plugins_page = add_submenu_page($parent_slug, 'Pro Version', 'Pro Version', 'manage_options', 'licensing_fm', 'form_maker');
52
-
53
- $uninstall_page = add_submenu_page($parent_slug, 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_fm', 'form_maker');
54
- add_action('admin_print_styles-' . $uninstall_page, 'form_maker_styles');
55
- add_action('admin_print_scripts-' . $uninstall_page, 'form_maker_scripts');
56
- }
57
- add_action('admin_menu', 'form_maker_options_panel');
58
-
59
- function form_maker() {
60
- if (function_exists('current_user_can')) {
61
- if (!current_user_can('manage_options')) {
62
- die('Access Denied');
63
- }
64
- }
65
- else {
66
- die('Access Denied');
67
- }
68
- require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
69
- $page = WDW_FM_Library::get('page');
70
- if (($page != '') && (($page == 'manage_fm') || ($page == 'goptions_fm') || ($page == 'submissions_fm') || ($page == 'blocked_ips_fm') || ($page == 'themes_fm') || ($page == 'uninstall_fm') || ($page == 'formmakerwindow') || ($page == 'extensions_fm') || ($page == 'licensing_fm'))) {
71
- require_once (WD_FM_DIR . '/admin/controllers/FMController' . ucfirst(strtolower($page)) . '.php');
72
- $controller_class = 'FMController' . ucfirst(strtolower($page));
73
- $controller = new $controller_class();
74
- $controller->execute();
75
- }
76
- }
77
-
78
-
79
- function fm_extensions() {
80
- if (function_exists('current_user_can')) {
81
- if (!current_user_can('manage_options')) {
82
- die('Access Denied');
83
- }
84
- }
85
- else {
86
- die('Access Denied');
87
- }
88
- require_once(WD_FM_DIR . '/featured/featured.php');
89
- wp_register_style('fm_featured', WD_FM_URL . '/featured/style.css', array(), WD_FM_VERSION);
90
- wp_print_styles('fm_featured');
91
- fm_extensions_page('form-maker');
92
- }
93
-
94
- add_action('wp_ajax_get_stats', 'form_maker'); //Show statistics
95
- add_action('wp_ajax_generete_csv', 'form_maker_ajax'); // Export csv.
96
- add_action('wp_ajax_generete_xml', 'form_maker_ajax'); // Export xml.
97
- add_action('wp_ajax_FormMakerPreview', 'form_maker_ajax');
98
- add_action('wp_ajax_formmakerwdcaptcha', 'form_maker_ajax'); // Generete captcha image and save it code in session.
99
- add_action('wp_ajax_nopriv_formmakerwdcaptcha', 'form_maker_ajax'); // Generete captcha image and save it code in session for all users.
100
- add_action('wp_ajax_formmakerwdmathcaptcha', 'form_maker_ajax'); // Generete math captcha image and save it code in session.
101
- add_action('wp_ajax_nopriv_formmakerwdmathcaptcha', 'form_maker_ajax'); // Generete math captcha image and save it code in session for all users.
102
- add_action('wp_ajax_fromeditcountryinpopup', 'form_maker_ajax'); // Open country list.
103
- add_action('wp_ajax_product_option', 'form_maker_ajax'); // Open product options on add paypal field.
104
- add_action('wp_ajax_frommapeditinpopup', 'form_maker_ajax'); // Open map in submissions.
105
- add_action('wp_ajax_fromipinfoinpopup', 'form_maker_ajax'); // Open ip in submissions.
106
- add_action('wp_ajax_show_matrix', 'form_maker_ajax'); // Edit matrix in submissions.
107
- add_action('wp_ajax_FormMakerSubmits', 'form_maker_ajax'); // Open submissions in submissions.
108
- add_action('wp_ajax_FormMakerSQLMapping', 'form_maker_ajax'); // Add/Edit SQLMaping from form options.
109
-
110
- add_action('wp_ajax_select_data_from_db', 'form_maker_ajax'); // select data from db.
111
- add_action('wp_ajax_manage_fm', 'form_maker_ajax'); //Show statistics
112
-
113
- if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
114
- require_once( 'fm_admin_class.php' );
115
- add_action( 'plugins_loaded', array( 'FM_Admin', 'get_instance' ) );
116
- }
117
-
118
- function form_maker_ajax() {
119
- require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
120
- $page = WDW_FM_Library::get('action');
121
- if ($page != 'formmakerwdcaptcha' && $page != 'formmakerwdmathcaptcha') {
122
- if (function_exists('current_user_can')) {
123
- if (!current_user_can('manage_options')) {
124
- die('Access Denied');
125
- }
126
- }
127
- else {
128
- die('Access Denied');
129
- }
130
- }
131
- if ($page != '') {
132
- require_once (WD_FM_DIR . '/admin/controllers/FMController' . ucfirst($page) . '.php');
133
- $controller_class = 'FMController' . ucfirst($page);
134
- $controller = new $controller_class();
135
- $controller->execute();
136
- }
137
- }
138
-
139
- // Add the Form Maker button.
140
- function form_maker_add_button($buttons) {
141
- array_push($buttons, "Form_Maker_mce");
142
- return $buttons;
143
- }
144
-
145
- // Register Form Maker button.
146
- function form_maker_register($plugin_array) {
147
- $url = WD_FM_URL . '/js/form_maker_editor_button.js';
148
- $plugin_array["Form_Maker_mce"] = $url;
149
- return $plugin_array;
150
- }
151
-
152
- function form_maker_admin_ajax() {
153
- ?>
154
- <script>
155
- var form_maker_admin_ajax = '<?php echo add_query_arg(array('action' => 'formmakerwindow'), admin_url('admin-ajax.php')); ?>';
156
- var plugin_url = '<?php echo WD_FM_URL; ?>';
157
- var content_url = '<?php echo content_url() ?>';
158
- var admin_url = '<?php echo admin_url('admin.php'); ?>';
159
- var nonce_fm = '<?php echo wp_create_nonce('nonce_fm') ?>';
160
- </script>
161
- <?php
162
- }
163
- add_action('admin_head', 'form_maker_admin_ajax');
164
-
165
- function fm_output_buffer() {
166
- ob_start();
167
- }
168
- add_action('init', 'fm_output_buffer');
169
-
170
- add_shortcode('Form', 'fm_shortcode');
171
-
172
- function fm_shortcode($attrs) {
173
- $fm_settings = get_option('fm_settings');
174
- $fm_shortcode = isset($fm_settings['fm_shortcode']) ? $fm_settings['fm_shortcode'] : '';
175
- if ($fm_shortcode) {
176
- $new_shortcode = '[Form';
177
- foreach ($attrs as $key => $value) {
178
- $new_shortcode .= ' ' . $key . '="' . $value . '"';
179
- }
180
- $new_shortcode .= ']';
181
- return $new_shortcode;
182
- }
183
- else {
184
- ob_start();
185
- FM_front_end_main($attrs, 'embedded');
186
- return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
187
- }
188
- }
189
- if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
190
- add_action('wp_footer', 'FM_front_end_main');
191
- add_action('wp_enqueue_scripts', 'form_maker_front_end_scripts');
192
- }
193
- function FM_front_end_main($params = array(), $type = '') {
194
- if(!isset($params['type'])){
195
- $form_id = isset($params['id']) ? (int)$params['id'] : 0;
196
- wd_form_maker($form_id, $type);
197
- }
198
-
199
- return;
200
- }
201
-
202
- add_shortcode('email_verification', 'fm_email_verification_shortcode');
203
- function fm_email_verification_shortcode() {
204
- require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
205
- require_once(WD_FM_DIR . '/frontend/controllers/FMControllerVerify_email.php');
206
- $controller_class = 'FMControllerVerify_email';
207
- $controller = new $controller_class();
208
- $controller->execute();
209
- }
210
-
211
- function wd_form_maker($id, $type = 'embedded') {
212
- require_once (WD_FM_DIR . '/frontend/controllers/FMControllerForm_maker.php');
213
- $controller = new FMControllerForm_maker();
214
- $form = $controller->execute($id, $type);
215
- echo $form;
216
- }
217
-
218
- function Form_maker_fornt_end_main($content) {
219
- global $form_maker_generate_action;
220
- if ($form_maker_generate_action) {
221
- $pattern = '[\[Form id="([0-9]*)"\]]';
222
- $count_forms_in_post = preg_match_all($pattern, $content, $matches_form);
223
- if ($count_forms_in_post) {
224
- require_once (WD_FM_DIR . '/frontend/controllers/FMControllerForm_maker.php');
225
- $controller = new FMControllerForm_maker();
226
- for ($jj = 0; $jj < $count_forms_in_post; $jj++) {
227
- $padron = $matches_form[0][$jj];
228
- $replacment = $controller->execute($matches_form[1][$jj]);
229
- $content = str_replace($padron, $replacment, $content);
230
- }
231
- }
232
- }
233
- return $content;
234
- }
235
-
236
- $fm_settings = get_option('fm_settings');
237
- if(isset($fm_settings['fm_shortcode']) && $fm_settings['fm_shortcode']!= '')
238
- add_filter('the_content', 'Form_maker_fornt_end_main', 5000);
239
-
240
- // Add the Form Maker button to editor.
241
- add_action('wp_ajax_formmakerwindow', 'form_maker_ajax');
242
- add_filter('mce_external_plugins', 'form_maker_register');
243
- add_filter('mce_buttons', 'form_maker_add_button', 0);
244
-
245
- // Form Maker Widget.
246
- if (class_exists('WP_Widget')) {
247
- require_once(WD_FM_DIR . '/admin/controllers/FMControllerWidget.php');
248
- add_action('widgets_init', create_function('', 'return register_widget("FMControllerWidget");'));
249
- }
250
-
251
- // Register fmemailverification post type
252
- add_action('init', 'register_fmemailverification_cpt');
253
- function register_fmemailverification_cpt(){
254
- $args = array(
255
- 'public' => true,
256
- 'label' => 'FM Email Verification'
257
- );
258
-
259
- register_post_type( 'fmemailverification', $args );
260
- if(!get_option('fm_emailverification')) {
261
- flush_rewrite_rules();
262
- add_option('fm_emailverification', true);
263
- }
264
- }
265
-
266
- // Activate plugin.
267
- function form_maker_activate() {
268
- $version = get_option("wd_form_maker_version");
269
- $new_version = substr_replace(WD_FM_VERSION, '1.', 0, 2);
270
-
271
- global $wpdb;
272
- if (!$version) {
273
- add_option("wd_form_maker_version", $new_version, '', 'no');
274
- if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "formmaker'") == $wpdb->prefix . "formmaker") {
275
- require_once WD_FM_DIR . "/form_maker_update.php";
276
- $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
277
- $public_key = isset($recaptcha_keys['public_key']) ? $recaptcha_keys['public_key'] : '';
278
- $private_key = isset($recaptcha_keys['private_key']) ? $recaptcha_keys['private_key'] : '';
279
- if (FALSE === $fm_settings = get_option('fm_settings')) {
280
- add_option('fm_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => ',', 'map_key' => ''));
281
- }
282
- form_maker_update_until_mvc();
283
- form_maker_update_contact();
284
- form_maker_update('');
285
- }
286
- else {
287
- require_once WD_FM_DIR . "/form_maker_insert.php";
288
- from_maker_insert();
289
- $email_verification_post = array(
290
- 'post_title' => 'Email Verification',
291
- 'post_content' => '[email_verification]',
292
- 'post_status' => 'publish',
293
- 'post_author' => 1,
294
- 'post_type' => 'fmemailverification',
295
- );
296
- $mail_verification_post_id = wp_insert_post($email_verification_post);
297
-
298
- add_option('fm_settings', array('public_key' => '', 'private_key' => '', 'csv_delimiter' => ',', 'map_key' => ''));
299
- $wpdb->update($wpdb->prefix . "formmaker", array(
300
- 'mail_verification_post_id' => $mail_verification_post_id,
301
- ), array('id' => 1), array(
302
- '%d',
303
- ), array('%d'));
304
- }
305
- }
306
- elseif (version_compare($version, $new_version, '<')) {
307
- $version = substr_replace($version, '1.', 0, 2);
308
- require_once WD_FM_DIR . "/form_maker_update.php";
309
- $mail_verification_post_ids = $wpdb->get_results($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!="%d"',0));
310
- if($mail_verification_post_ids)
311
- foreach($mail_verification_post_ids as $mail_verification_post_id) {
312
- $update_email_ver_post_type = array(
313
- 'ID' => (int)$mail_verification_post_id->mail_verification_post_id,
314
- 'post_type' => 'fmemailverification',
315
- );
316
-
317
- wp_update_post( $update_email_ver_post_type );
318
- }
319
- form_maker_update($version);
320
- update_option("wd_form_maker_version", $new_version);
321
-
322
- $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
323
- $public_key = isset($recaptcha_keys['public_key']) ? $recaptcha_keys['public_key'] : '';
324
- $private_key = isset($recaptcha_keys['private_key']) ? $recaptcha_keys['private_key'] : '';
325
- if (FALSE === $fm_settings = get_option('fm_settings')) {
326
- add_option('fm_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => ',', 'map_key' => ''));
327
- }
328
- }
329
- }
330
- register_activation_hook(__FILE__, 'form_maker_activate');
331
-
332
- if ((!isset($_GET['action']) || $_GET['action'] != 'deactivate') && (!isset($_GET['page']) || $_GET['page'] != 'uninstall_fm')) {
333
- add_action('admin_init', 'form_maker_activate');
334
- }
335
-
336
- // Form Maker manage page styles.
337
- function form_maker_manage_styles() {
338
- wp_admin_css('thickbox');
339
- wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), WD_FM_VERSION);
340
- wp_enqueue_style('form_maker_first', WD_FM_URL . '/css/form_maker_first.css', array(), WD_FM_VERSION);
341
- wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css', array(), WD_FM_VERSION);
342
- wp_enqueue_style('phone_field_css', WD_FM_URL . '/css/intlTelInput.css', array(), WD_FM_VERSION);
343
- wp_enqueue_style('jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css', array(), WD_FM_VERSION);
344
- wp_enqueue_style('jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css', array(), WD_FM_VERSION);
345
- wp_enqueue_style('form_maker_style', WD_FM_URL . '/css/style.css', array(), WD_FM_VERSION);
346
- wp_enqueue_style('form_maker_codemirror', WD_FM_URL . '/css/codemirror.css', array(), WD_FM_VERSION);
347
- wp_enqueue_style('form_maker_layout', WD_FM_URL . '/css/form_maker_layout.css', array(), WD_FM_VERSION);
348
- wp_enqueue_style('fm-bootstrap', WD_FM_URL . '/css/fm-bootstrap.css', array(), WD_FM_VERSION);
349
- wp_enqueue_style('fm-colorpicker', WD_FM_URL . '/css/spectrum.css', array(), WD_FM_VERSION);
350
- wp_enqueue_style('fm-font-awesome', WD_FM_URL . '/css/frontend/font-awesome/font-awesome.css', array(), WD_FM_VERSION);
351
- }
352
-
353
- // Form Maker manage page scripts.
354
- function form_maker_manage_scripts() {
355
- wp_enqueue_script('thickbox');
356
- $fm_settings = get_option('fm_settings');
357
- $map_key = isset($fm_settings['map_key']) ? $fm_settings['map_key'] : '';
358
-
359
- wp_enqueue_script('jquery');
360
- wp_enqueue_script('jquery-ui-sortable');
361
- wp_enqueue_script('jquery-ui-widget');
362
- wp_enqueue_script('jquery-ui-slider');
363
- wp_enqueue_script('jquery-ui-spinner');
364
- wp_enqueue_script('jquery-ui-datepicker');
365
- wp_enqueue_media();
366
-
367
- // wp_enqueue_script('mootools', WD_FM_URL . '/js/mootools.js', array(), '1.12');
368
- if($_GET['page'] == 'manage_fm'){
369
- wp_enqueue_script('gmap_form_api', 'https://maps.google.com/maps/api/js?v=3.exp&key='.$map_key);
370
- }
371
- wp_enqueue_script('gmap_form', WD_FM_URL . '/js/if_gmap_back_end.js', array(), WD_FM_VERSION);
372
- wp_enqueue_script('phone_field', WD_FM_URL . '/js/intlTelInput.js', array(), '11.0.0');
373
-
374
- wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
375
- wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), WD_FM_VERSION);
376
-
377
- wp_enqueue_script('form_maker_codemirror', WD_FM_URL . '/js/layout/codemirror.js', array(), '2.3');
378
- wp_enqueue_script('form_maker_clike', WD_FM_URL . '/js/layout/clike.js', array(), '1.0.0');
379
- wp_enqueue_script('form_maker_formatting', WD_FM_URL . '/js/layout/formatting.js', array(), '1.0.0');
380
- wp_enqueue_script('form_maker_css', WD_FM_URL . '/js/layout/css.js', array(), '1.0.0');
381
- wp_enqueue_script('form_maker_javascript', WD_FM_URL . '/js/layout/javascript.js', array(), '1.0.0');
382
- wp_enqueue_script('form_maker_xml', WD_FM_URL . '/js/layout/xml.js', array(), '1.0.0');
383
- wp_enqueue_script('form_maker_php', WD_FM_URL . '/js/layout/php.js', array(), '1.0.0');
384
- wp_enqueue_script('form_maker_htmlmixed', WD_FM_URL . '/js/layout/htmlmixed.js', array(), '1.0.0');
385
-
386
- wp_enqueue_script('Calendar', WD_FM_URL . '/js/calendar/calendar.js', array(), '1.0');
387
- wp_enqueue_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js', array(), WD_FM_VERSION);
388
-
389
- // wp_enqueue_script('form_maker_calendar_setup', WD_FM_URL . '/js/calendar/calendar-setup.js');
390
- wp_enqueue_script('fm-colorpicker', WD_FM_URL . '/js/spectrum.js', array(), WD_FM_VERSION);
391
- }
392
-
393
- // Form Maker submissions page styles.
394
- function form_maker_submissions_styles() {
395
- wp_admin_css('thickbox');
396
- wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), WD_FM_VERSION);
397
- wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css', array(), WD_FM_VERSION);
398
-
399
- wp_enqueue_style('jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css', array(), '1.10.3');
400
- wp_enqueue_style('jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css', array(), '1.10.3');
401
- wp_enqueue_style('form_maker_style', WD_FM_URL . '/css/style.css', array(), WD_FM_VERSION);
402
- }
403
- // Form Maker submissions page scripts.
404
- function form_maker_submissions_scripts() {
405
- wp_enqueue_script('thickbox');
406
- wp_enqueue_script('jquery');
407
- wp_enqueue_script( 'jquery-ui-progressbar' );
408
- wp_enqueue_script('jquery-ui-sortable');
409
- wp_enqueue_script('jquery-ui-widget');
410
- wp_enqueue_script('jquery-ui-slider');
411
- wp_enqueue_script('jquery-ui-spinner');
412
- wp_enqueue_script('jquery-ui-mouse');
413
- wp_enqueue_script('jquery-ui-core');
414
- wp_enqueue_script('jquery-ui-datepicker');
415
-
416
- // wp_enqueue_script('mootools', WD_FM_URL . '/js/mootools.js', array(), '1.12');
417
-
418
- wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
419
- wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), WD_FM_VERSION);
420
- wp_enqueue_script('form_maker_submissions', WD_FM_URL . '/js/form_maker_submissions.js', array(), WD_FM_VERSION);
421
-
422
- wp_enqueue_script('main_div_front_end', WD_FM_URL . '/js/main_div_front_end.js', array(), WD_FM_VERSION);
423
-
424
- wp_enqueue_script('Calendar', WD_FM_URL . '/js/calendar/calendar.js', array(), '1.0');
425
- wp_enqueue_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js', array(), WD_FM_VERSION);
426
-
427
- // wp_enqueue_script('form_maker_calendar_setup', WD_FM_URL . '/js/calendar/calendar-setup.js');
428
-
429
- wp_localize_script('main_div_front_end', 'fm_objectL10n', array(
430
- 'plugin_url' => WD_FM_URL
431
- ));
432
- }
433
-
434
- function form_maker_styles() {
435
- wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), WD_FM_VERSION);
436
- wp_enqueue_style('fm_deactivate-css', WD_FM_URL . '/wd/assets/css/deactivate_popup.css', array(), WD_FM_VERSION);
437
- }
438
- function form_maker_scripts() {
439
- wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
440
- wp_enqueue_script('fm-deactivate-popup', WD_FM_URL . '/wd/assets/js/deactivate_popup.js', array(), WD_FM_VERSION, true );
441
- $admin_data = wp_get_current_user();
442
- wp_localize_script( 'fm-deactivate-popup', 'fmWDDeactivateVars', array(
443
- "prefix" => "fm" ,
444
- "deactivate_class" => 'fm_deactivate_link',
445
- "email" => $admin_data->data->user_email,
446
- "plugin_wd_url" => "https://web-dorado.com/products/wordpress-form.html",
447
- ));
448
- }
449
-
450
- $form_maker_generate_action = 0;
451
- function form_maker_generate_action() {
452
- global $form_maker_generate_action;
453
- $form_maker_generate_action = 1;
454
- }
455
- add_filter('wp_head', 'form_maker_generate_action', 10000);
456
-
457
- function form_maker_front_end_scripts() {
458
- wp_enqueue_script('jquery');
459
- wp_enqueue_script('jquery-ui-widget');
460
- wp_enqueue_script('jquery-ui-slider');
461
- wp_enqueue_script('jquery-ui-spinner');
462
- wp_enqueue_script('jquery-effects-shake');
463
- wp_enqueue_script('jquery-ui-datepicker');
464
-
465
- wp_register_style('fm-jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css', array(), WD_FM_VERSION);
466
- wp_enqueue_style('fm-jquery-ui');
467
- wp_register_style('fm-jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css', array(), WD_FM_VERSION);
468
- wp_enqueue_style('fm-jquery-ui-spinner');
469
-
470
- wp_register_script('gmap_form', WD_FM_URL . '/js/if_gmap_front_end.js', array(), WD_FM_VERSION);
471
- wp_enqueue_script('gmap_form');
472
- wp_register_script('phone_field', WD_FM_URL . '/js/intlTelInput.js', array(), WD_FM_VERSION);
473
- wp_enqueue_script('phone_field');
474
-
475
- wp_register_script('fm-Calendar', WD_FM_URL . '/js/calendar/calendar.js', array(), WD_FM_VERSION);
476
- wp_enqueue_script('fm-Calendar');
477
- wp_register_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js', array(), WD_FM_VERSION);
478
- wp_enqueue_script('calendar_function');
479
-
480
- wp_register_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css', array(), WD_FM_VERSION);
481
- wp_enqueue_style('form_maker_calendar-jos');
482
- wp_register_style('phone_field_css', WD_FM_URL . '/css/intlTelInput.css', array(), WD_FM_VERSION);
483
- wp_enqueue_style('phone_field_css');
484
- wp_register_style('form_maker_frontend', WD_FM_URL . '/css/form_maker_frontend.css', array(), WD_FM_VERSION);
485
- wp_enqueue_style('form_maker_frontend');
486
-
487
- wp_register_script('main_div_front_end', WD_FM_URL . '/js/main_div_front_end.js', array(), WD_FM_VERSION);
488
- wp_enqueue_script('main_div_front_end');
489
- wp_localize_script('main_div_front_end', 'fm_objectL10n', array(
490
- 'plugin_url' => WD_FM_URL,
491
- 'fm_file_type_error' => addslashes(__('Can not upload this type of file', 'form_maker')),
492
- 'fm_field_is_required' => addslashes(__('Field is required', 'form_maker')),
493
- 'fm_min_max_check_1' => addslashes((__('The ', 'form_maker'))),
494
- 'fm_min_max_check_2' => addslashes((__(' value must be between ', 'form_maker'))),
495
- 'fm_spinner_check' => addslashes((__('Value must be between ', 'form_maker'))),
496
- ));
497
-
498
- require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
499
- $google_fonts = WDW_FM_Library::get_google_fonts();
500
- $fonts = implode("|", str_replace(' ', '+', $google_fonts));
501
- wp_register_style('fm_googlefonts', 'https://fonts.googleapis.com/css?family=' . $fonts . '&subset=greek,latin,greek-ext,vietnamese,cyrillic-ext,latin-ext,cyrillic', null, null);
502
- wp_enqueue_style('fm_googlefonts');
503
-
504
- wp_register_style('fm-animate', WD_FM_URL . '/css/frontend/fm-animate.css', array(), WD_FM_VERSION);
505
- wp_enqueue_style('fm-animate');
506
- wp_register_style('fm-font-awesome', WD_FM_URL . '/css/frontend/font-awesome/font-awesome.css', array(), WD_FM_VERSION);
507
- wp_enqueue_style('fm-font-awesome');
508
- }
509
- // add_action('wp_enqueue_scripts', 'form_maker_front_end_scripts');
510
-
511
- // Languages localization.
512
- function form_maker_language_load() {
513
- load_plugin_textdomain('form_maker', FALSE, basename(dirname(__FILE__)) . '/languages');
514
- }
515
- add_action('init', 'form_maker_language_load');
516
-
517
- function fm_topic() {
518
- $page = isset($_GET['page']) ? $_GET['page'] : '';
519
- $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
520
- $user_guide_link = 'https://web-dorado.com/wordpress-form-maker/';
521
- $support_forum_link = 'https://wordpress.org/support/plugin/form-maker';
522
- $pro_icon = WD_FM_URL . '/images/wd_logo.png';
523
- $pro_link = 'https://web-dorado.com/files/fromFormMaker.php';
524
- $support_icon = WD_FM_URL . '/images/support.png';
525
- $prefix = 'form_maker';
526
- $is_free = TRUE;
527
- switch ($page) {
528
- case 'blocked_ips_fm': {
529
- $help_text = 'block IPs';
530
- $user_guide_link .= 'blocking-ips.html';
531
- break;
532
- }
533
- case 'goptions_fm': {
534
- $help_text = 'edit form settings';
535
- $user_guide_link .= 'configuring-form-options.html';
536
- break;
537
- }
538
- case 'licensing_fm': {
539
- $help_text = '';
540
- $user_guide_link .= '';
541
- break;
542
- }
543
- case 'manage_fm': {
544
- switch ($task) {
545
- case 'edit':
546
- case 'edit_old': {
547
- $help_text = 'add fields to your form';
548
- $user_guide_link .= 'description-of-form-fields.html';
549
- break;
550
- }
551
- case 'form_options':
552
- case 'form_options_old': {
553
- $help_text = 'edit form options';
554
- $user_guide_link .= 'configuring-form-options.html';
555
- break;
556
- }
557
- default: {
558
- $help_text = 'create, edit forms';
559
- $user_guide_link .= 'creating-form.html';
560
- }
561
- }
562
- break;
563
- }
564
- case 'submissions_fm': {
565
- $help_text = 'view and manage form submissions';
566
- $user_guide_link .= 'managing-submissions.html';
567
- break;
568
- }
569
- case 'themes_fm': {
570
- $help_text = 'create, edit form themes';
571
- $user_guide_link .= 'creating-form.html';
572
- break;
573
- }
574
- default: {
575
- return '';
576
- }
577
- }
578
- ob_start();
579
- ?>
580
- <style>
581
- .wd_topic {
582
- background-color: #ffffff;
583
- border: none;
584
- box-sizing: border-box;
585
- clear: both;
586
- color: #6e7990;
587
- font-size: 14px;
588
- font-weight: bold;
589
- line-height: 44px;
590
- padding: 0 0 0 15px;
591
- vertical-align: middle;
592
- width: 98%;
593
- }
594
- .wd_topic .wd_help_topic {
595
- float: left;
596
- }
597
- .wd_topic .wd_help_topic a {
598
- color: #0073aa;
599
- }
600
- .wd_topic .wd_help_topic a:hover {
601
- color: #00A0D2;
602
- }
603
- .wd_topic .wd_support {
604
- float: right;
605
- margin: 0 10px;
606
- }
607
- .wd_topic .wd_support img {
608
- vertical-align: middle;
609
- }
610
- .wd_topic .wd_support a {
611
- text-decoration: none;
612
- color: #6E7990;
613
- }
614
- .wd_topic .wd_pro {
615
- float: right;
616
- padding: 0;
617
- }
618
- .wd_topic .wd_pro a {
619
- border: none;
620
- box-shadow: none !important;
621
- text-decoration: none;
622
- }
623
- .wd_topic .wd_pro img {
624
- border: none;
625
- display: inline-block;
626
- vertical-align: middle;
627
- }
628
- .wd_topic .wd_pro a,
629
- .wd_topic .wd_pro a:active,
630
- .wd_topic .wd_pro a:visited,
631
- .wd_topic .wd_pro a:hover {
632
- background-color: #D8D8D8;
633
- color: #175c8b;
634
- display: inline-block;
635
- font-size: 11px;
636
- font-weight: bold;
637
- padding: 0 10px;
638
- vertical-align: middle;
639
- }
640
- </style>
641
- <div class="update-nag wd_topic">
642
- <?php
643
- if ($help_text) {
644
- ?>
645
- <span class="wd_help_topic">
646
- <?php echo sprintf(__('This section allows you to %s.', $prefix), $help_text); ?>
647
- <a target="_blank" href="<?php echo $user_guide_link; ?>">
648
- <?php _e('Read More in User Manual', $prefix); ?>
649
- </a>
650
- </span>
651
- <?php
652
- }
653
- if ($is_free) {
654
- $text = strtoupper(__('Upgrade to paid version', $prefix));
655
- ?>
656
- <div class="wd_pro">
657
- <a target="_blank" href="<?php echo $pro_link; ?>">
658
- <img alt="web-dorado.com" title="<?php echo $text; ?>" src="<?php echo $pro_icon; ?>" />
659
- <span><?php echo $text; ?></span>
660
- </a>
661
- </div>
662
- <?php
663
- }
664
- if (FALSE) {
665
- ?>
666
- <span class="wd_support">
667
- <a target="_blank" href="<?php echo $support_forum_link; ?>">
668
- <img src="<?php echo $support_icon; ?>" />
669
- <?php _e('Support Forum', $prefix); ?>
670
- </a>
671
- </span>
672
- <?php
673
- }
674
- ?>
675
- </div>
676
- <?php
677
- echo ob_get_clean();
678
- }
679
-
680
- add_action('admin_notices', 'fm_topic', 11);
681
-
682
- function fm_overview() {
683
- if (is_admin() && !isset($_REQUEST['ajax'])) {
684
- if (!class_exists("DoradoWeb")) {
685
- require_once(WD_FM_DIR . '/wd/start.php');
686
- }
687
- global $fm_options;
688
- $fm_options = array(
689
- "prefix" => "fm",
690
- "wd_plugin_id" => 31,
691
- "plugin_title" => "Form Maker",
692
- "plugin_wordpress_slug" => "form-maker",
693
- "plugin_dir" => WD_FM_DIR,
694
- "plugin_main_file" => __FILE__,
695
- "description" => __('Form Maker plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.', 'form_maker'),
696
- // from web-dorado.com
697
- "plugin_features" => array(
698
- 0 => array(
699
- "title" => __("Easy to Use", "form_maker"),
700
- "description" => __("This responsive form maker plugin is one of the most easy-to-use form builder solutions available on the market. Simple, yet powerful plugin allows you to quickly and easily build any complex forms.", "form_maker"),
701
- ),
702
- 1 => array(
703
- "title" => __("Customizable Fields", "form_maker"),
704
- "description" => __("All the fields of Form Maker plugin are highly customizable, which allows you to change almost every detail in the form and make it look exactly like you want it to be.", "form_maker"),
705
- ),
706
- 2 => array(
707
- "title" => __("Submissions", "form_maker"),
708
- "description" => __("You can view the submissions for each form you have. The plugin allows to view submissions statistics, filter submission data and export in csv or xml formats.", "form_maker"),
709
- ),
710
- 3 => array(
711
- "title" => __("Multi-Page Forms", "form_maker"),
712
- "description" => __("With the form builder plugin you can create muilti-page forms. Simply use the page break field to separate the pages in your forms.", "form_maker"),
713
- ),
714
- 4 => array(
715
- "title" => __("Themes", "form_maker"),
716
- "description" => __("The WordPress Form Maker plugin comes with a wide range of customizable themes. You can choose from a list of existing themes or simply create the one that better fits your brand and website.", "form_maker"),
717
- )
718
- ),
719
- // user guide from web-dorado.com
720
- "user_guide" => array(
721
- 0 => array(
722
- "main_title" => __("Installing", "form_maker"),
723
- "url" => "https://web-dorado.com/wordpress-form-maker/installing.html",
724
- "titles" => array()
725
- ),
726
- 1 => array(
727
- "main_title" => __("Creating a new Form", "form_maker"),
728
- "url" => "https://web-dorado.com/wordpress-form-maker/creating-form.html",
729
- "titles" => array()
730
- ),
731
- 2 => array(
732
- "main_title" => __("Configuring Form Options", "form_maker"),
733
- "url" => "https://web-dorado.com/wordpress-form-maker/configuring-form-options.html",
734
- "titles" => array()
735
- ),
736
- 3 => array(
737
- "main_title" => __("Description of The Form Fields", "form_maker"),
738
- "url" => "https://web-dorado.com/wordpress-form-maker/description-of-form-fields.html",
739
- "titles" => array(
740
- array(
741
- "title" => __("Selecting Options from Database", "form_maker"),
742
- "url" => "https://web-dorado.com/wordpress-form-maker/description-of-form-fields/selecting-options-from-database.html",
743
- ),
744
- )
745
- ),
746
- 4 => array(
747
- "main_title" => __("Publishing the Created Form", "form_maker"),
748
- "url" => "https://web-dorado.com/wordpress-form-maker/publishing-form.html",
749
- "titles" => array()
750
- ),
751
- 5 => array(
752
- "main_title" => __("Blocking IPs", "form_maker"),
753
- "url" => "https://web-dorado.com/wordpress-form-maker/blocking-ips.html",
754
- "titles" => array()
755
- ),
756
- 6 => array(
757
- "main_title" => __("Managing Submissions", "form_maker"),
758
- "url" => "https://web-dorado.com/wordpress-form-maker/managing-submissions.html",
759
- "titles" => array()
760
- ),
761
- 7 => array(
762
- "main_title" => __("Publishing Submissions", "form_maker"),
763
- "url" => "https://web-dorado.com/wordpress-form-maker/publishing-submissions.html",
764
- "titles" => array()
765
- ),
766
- ),
767
- "video_youtube_id" => "tN3_c6MhqFk", // e.g. https://www.youtube.com/watch?v=acaexefeP7o youtube id is the acaexefeP7o
768
- "plugin_wd_url" => "https://web-dorado.com/products/wordpress-form.html",
769
- "plugin_wd_demo_link" => "http://wpdemo.web-dorado.com",
770
- "plugin_wd_addons_link" => "https://web-dorado.com/products/wordpress-form/add-ons.html",
771
- "after_subscribe" => admin_url('admin.php?page=overview_fm'), // this can be plagin overview page or set up page
772
- "plugin_wizard_link" => '',
773
- "plugin_menu_title" => "Form Maker",
774
- "plugin_menu_icon" => WD_FM_URL . '/images/FormMakerLogo-16.png',
775
- "deactivate" => true,
776
- "subscribe" => true,
777
- "custom_post" => 'manage_fm',
778
- "menu_position" => null,
779
- );
780
-
781
- dorado_web_init($fm_options);
782
- }
783
- }
784
- add_action('init', 'fm_overview');
1
+ <?php
2
+ /**
3
+ * Plugin Name: Form Maker
4
+ * Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
5
+ * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
+ * Version: 1.11.5
7
+ * Author: WebDorado Form Builder Team
8
+ * Author URI: https://web-dorado.com/
9
+ * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
+ */
11
+ define('WD_FM_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
12
+ define('WD_FM_URL', plugins_url(plugin_basename(dirname(__FILE__))));
13
+ define('WD_MAIN_FILE', plugin_basename(__FILE__));
14
+ define('WD_FM_VERSION', '1.11.5');
15
+ // Plugin menu.
16
+ function form_maker_options_panel() {
17
+ $parent_slug = null;
18
+ if( get_option( "fm_subscribe_done" ) == 1 ) {
19
+ add_menu_page('Form Maker', 'Form Maker', 'manage_options', 'manage_fm', 'form_maker', WD_FM_URL . '/images/FormMakerLogo-16.png', 105.105);
20
+ $parent_slug = "manage_fm";
21
+ }
22
+
23
+ add_menu_page('Form Maker Add-ons', 'Form Maker &nbsp;&nbsp;&nbsp;&nbsp; Add-ons', 'manage_options', 'extensions_fm', 'fm_extensions', WD_FM_URL . '/assets/add-ons-icon.png');
24
+
25
+ $manage_page = add_submenu_page($parent_slug, 'Manager', 'Manager', 'manage_options', 'manage_fm', 'form_maker');
26
+ add_action('admin_print_styles-' . $manage_page, 'form_maker_manage_styles');
27
+ add_action('admin_print_scripts-' . $manage_page, 'form_maker_manage_scripts');
28
+
29
+ $submissions_page = add_submenu_page($parent_slug, 'Submissions', 'Submissions', 'manage_options', 'submissions_fm', 'form_maker');
30
+ add_action('admin_print_styles-' . $submissions_page, 'form_maker_submissions_styles');
31
+ add_action('admin_print_scripts-' . $submissions_page, 'form_maker_submissions_scripts');
32
+
33
+ if (defined('WD_FM_SAVE_PROG') && is_plugin_active(constant('WD_FM_SAVE_PROG'))) {
34
+ $saved_entries_page = add_submenu_page($parent_slug, 'Saved Entries', 'Saved Entries', 'manage_options', 'saved_entries', 'fm_saved_entries');
35
+ add_action('admin_print_styles-' . $saved_entries_page, 'form_maker_submissions_styles');
36
+ add_action('admin_print_scripts-' . $saved_entries_page, 'form_maker_submissions_scripts');
37
+ }
38
+
39
+ $blocked_ips_page = add_submenu_page($parent_slug, 'Blocked IPs', 'Blocked IPs', 'manage_options', 'blocked_ips_fm', 'form_maker');
40
+ add_action('admin_print_styles-' . $blocked_ips_page, 'form_maker_manage_styles');
41
+ add_action('admin_print_scripts-' . $blocked_ips_page, 'form_maker_manage_scripts');
42
+
43
+ $themes_page = add_submenu_page($parent_slug, 'Themes', 'Themes', 'manage_options', 'themes_fm', 'form_maker');
44
+ add_action('admin_print_styles-' . $themes_page, 'form_maker_manage_styles');
45
+ add_action('admin_print_scripts-' . $themes_page, 'form_maker_manage_scripts');
46
+
47
+ $global_options_page = add_submenu_page($parent_slug, 'Global Options', 'Global Options', 'manage_options', 'goptions_fm', 'form_maker');
48
+ add_action('admin_print_styles-' . $global_options_page, 'form_maker_manage_styles');
49
+ add_action('admin_print_scripts-' . $global_options_page, 'form_maker_manage_scripts');
50
+
51
+ $licensing_plugins_page = add_submenu_page($parent_slug, 'Pro Version', 'Pro Version', 'manage_options', 'licensing_fm', 'form_maker');
52
+
53
+ $uninstall_page = add_submenu_page($parent_slug, 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_fm', 'form_maker');
54
+ add_action('admin_print_styles-' . $uninstall_page, 'form_maker_styles');
55
+ add_action('admin_print_scripts-' . $uninstall_page, 'form_maker_scripts');
56
+ }
57
+ add_action('admin_menu', 'form_maker_options_panel');
58
+
59
+ function form_maker() {
60
+ if (function_exists('current_user_can')) {
61
+ if (!current_user_can('manage_options')) {
62
+ die('Access Denied');
63
+ }
64
+ }
65
+ else {
66
+ die('Access Denied');
67
+ }
68
+ require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
69
+ $page = WDW_FM_Library::get('page');
70
+ if (($page != '') && (($page == 'manage_fm') || ($page == 'goptions_fm') || ($page == 'submissions_fm') || ($page == 'blocked_ips_fm') || ($page == 'themes_fm') || ($page == 'uninstall_fm') || ($page == 'formmakerwindow') || ($page == 'extensions_fm') || ($page == 'licensing_fm'))) {
71
+ require_once (WD_FM_DIR . '/admin/controllers/FMController' . ucfirst(strtolower($page)) . '.php');
72
+ $controller_class = 'FMController' . ucfirst(strtolower($page));
73
+ $controller = new $controller_class();
74
+ $controller->execute();
75
+ }
76
+ }
77
+
78
+
79
+ function fm_extensions() {
80
+ if (function_exists('current_user_can')) {
81
+ if (!current_user_can('manage_options')) {
82
+ die('Access Denied');
83
+ }
84
+ }
85
+ else {
86
+ die('Access Denied');
87
+ }
88
+ require_once(WD_FM_DIR . '/featured/featured.php');
89
+ wp_register_style('fm_featured', WD_FM_URL . '/featured/style.css', array(), WD_FM_VERSION);
90
+ wp_print_styles('fm_featured');
91
+ fm_extensions_page('form-maker');
92
+ }
93
+
94
+ add_action('wp_ajax_get_stats', 'form_maker'); //Show statistics
95
+ add_action('wp_ajax_generete_csv', 'form_maker_ajax'); // Export csv.
96
+ add_action('wp_ajax_generete_xml', 'form_maker_ajax'); // Export xml.
97
+ add_action('wp_ajax_FormMakerPreview', 'form_maker_ajax');
98
+ add_action('wp_ajax_formmakerwdcaptcha', 'form_maker_ajax'); // Generete captcha image and save it code in session.
99
+ add_action('wp_ajax_nopriv_formmakerwdcaptcha', 'form_maker_ajax'); // Generete captcha image and save it code in session for all users.
100
+ add_action('wp_ajax_formmakerwdmathcaptcha', 'form_maker_ajax'); // Generete math captcha image and save it code in session.
101
+ add_action('wp_ajax_nopriv_formmakerwdmathcaptcha', 'form_maker_ajax'); // Generete math captcha image and save it code in session for all users.
102
+ add_action('wp_ajax_fromeditcountryinpopup', 'form_maker_ajax'); // Open country list.
103
+ add_action('wp_ajax_product_option', 'form_maker_ajax'); // Open product options on add paypal field.
104
+ add_action('wp_ajax_frommapeditinpopup', 'form_maker_ajax'); // Open map in submissions.
105
+ add_action('wp_ajax_fromipinfoinpopup', 'form_maker_ajax'); // Open ip in submissions.
106
+ add_action('wp_ajax_show_matrix', 'form_maker_ajax'); // Edit matrix in submissions.
107
+ add_action('wp_ajax_FormMakerSubmits', 'form_maker_ajax'); // Open submissions in submissions.
108
+ add_action('wp_ajax_FormMakerSQLMapping', 'form_maker_ajax'); // Add/Edit SQLMaping from form options.
109
+
110
+ add_action('wp_ajax_select_data_from_db', 'form_maker_ajax'); // select data from db.
111
+ add_action('wp_ajax_manage_fm', 'form_maker_ajax'); //Show statistics
112
+
113
+ if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
114
+ require_once( 'fm_admin_class.php' );
115
+ add_action( 'plugins_loaded', array( 'FM_Admin', 'get_instance' ) );
116
+ }
117
+
118
+ function form_maker_ajax() {
119
+ require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
120
+ $page = WDW_FM_Library::get('action');
121
+ if ($page != 'formmakerwdcaptcha' && $page != 'formmakerwdmathcaptcha') {
122
+ if (function_exists('current_user_can')) {
123
+ if (!current_user_can('manage_options')) {
124
+ die('Access Denied');
125
+ }
126
+ }
127
+ else {
128
+ die('Access Denied');
129
+ }
130
+ }
131
+ if ($page != '') {
132
+ require_once (WD_FM_DIR . '/admin/controllers/FMController' . ucfirst($page) . '.php');
133
+ $controller_class = 'FMController' . ucfirst($page);
134
+ $controller = new $controller_class();
135
+ $controller->execute();
136
+ }
137
+ }
138
+
139
+ // Add the Form Maker button.
140
+ function form_maker_add_button($buttons) {
141
+ array_push($buttons, "Form_Maker_mce");
142
+ return $buttons;
143
+ }
144
+
145
+ // Register Form Maker button.
146
+ function form_maker_register($plugin_array) {
147
+ $url = WD_FM_URL . '/js/form_maker_editor_button.js';
148
+ $plugin_array["Form_Maker_mce"] = $url;
149
+ return $plugin_array;
150
+ }
151
+
152
+ function form_maker_admin_ajax() {
153
+ ?>
154
+ <script>
155
+ var form_maker_admin_ajax = '<?php echo add_query_arg(array('action' => 'formmakerwindow'), admin_url('admin-ajax.php')); ?>';
156
+ var plugin_url = '<?php echo WD_FM_URL; ?>';
157
+ var content_url = '<?php echo content_url() ?>';
158
+ var admin_url = '<?php echo admin_url('admin.php'); ?>';
159
+ var nonce_fm = '<?php echo wp_create_nonce('nonce_fm') ?>';
160
+ </script>
161
+ <?php
162
+ }
163
+ add_action('admin_head', 'form_maker_admin_ajax');
164
+
165
+ function fm_output_buffer() {
166
+ ob_start();
167
+ }
168
+ add_action('init', 'fm_output_buffer');
169
+
170
+ add_shortcode('Form', 'fm_shortcode');
171
+
172
+ function fm_shortcode($attrs) {
173
+ $fm_settings = get_option('fm_settings');
174
+ $fm_shortcode = isset($fm_settings['fm_shortcode']) ? $fm_settings['fm_shortcode'] : '';
175
+ if ($fm_shortcode) {
176
+ $new_shortcode = '[Form';
177
+ foreach ($attrs as $key => $value) {
178
+ $new_shortcode .= ' ' . $key . '="' . $value . '"';
179
+ }
180
+ $new_shortcode .= ']';
181
+ return $new_shortcode;
182
+ }
183
+ else {
184
+ ob_start();
185
+ FM_front_end_main($attrs, 'embedded');
186
+ return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
187
+ }
188
+ }
189
+ if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
190
+ add_action('wp_footer', 'FM_front_end_main');
191
+ add_action('wp_enqueue_scripts', 'form_maker_front_end_scripts');
192
+ }
193
+ function FM_front_end_main($params = array(), $type = '') {
194
+ if(!isset($params['type'])){
195
+ $form_id = isset($params['id']) ? (int)$params['id'] : 0;
196
+ wd_form_maker($form_id, $type);
197
+ }
198
+
199
+ return;
200
+ }
201
+
202
+ add_shortcode('email_verification', 'fm_email_verification_shortcode');
203
+ function fm_email_verification_shortcode() {
204
+ require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
205
+ require_once(WD_FM_DIR . '/frontend/controllers/FMControllerVerify_email.php');
206
+ $controller_class = 'FMControllerVerify_email';
207
+ $controller = new $controller_class();
208
+ $controller->execute();
209
+ }
210
+
211
+ function wd_form_maker($id, $type = 'embedded') {
212
+ require_once (WD_FM_DIR . '/frontend/controllers/FMControllerForm_maker.php');
213
+ $controller = new FMControllerForm_maker();
214
+ $form = $controller->execute($id, $type);
215
+ echo $form;
216
+ }
217
+
218
+ function Form_maker_fornt_end_main($content) {
219
+ global $form_maker_generate_action;
220
+ if ($form_maker_generate_action) {
221
+ $pattern = '[\[Form id="([0-9]*)"\]]';
222
+ $count_forms_in_post = preg_match_all($pattern, $content, $matches_form);
223
+ if ($count_forms_in_post) {
224
+ require_once (WD_FM_DIR . '/frontend/controllers/FMControllerForm_maker.php');
225
+ $controller = new FMControllerForm_maker();
226
+ for ($jj = 0; $jj < $count_forms_in_post; $jj++) {
227
+ $padron = $matches_form[0][$jj];
228
+ $replacment = $controller->execute($matches_form[1][$jj]);
229
+ $content = str_replace($padron, $replacment, $content);
230
+ }
231
+ }
232
+ }
233
+ return $content;
234
+ }
235
+
236
+ $fm_settings = get_option('fm_settings');
237
+ if(isset($fm_settings['fm_shortcode']) && $fm_settings['fm_shortcode']!= '')
238
+ add_filter('the_content', 'Form_maker_fornt_end_main', 5000);
239
+
240
+ // Add the Form Maker button to editor.
241
+ add_action('wp_ajax_formmakerwindow', 'form_maker_ajax');
242
+ add_filter('mce_external_plugins', 'form_maker_register');
243
+ add_filter('mce_buttons', 'form_maker_add_button', 0);
244
+
245
+ // Form Maker Widget.
246
+ if (class_exists('WP_Widget')) {
247
+ require_once(WD_FM_DIR . '/admin/controllers/FMControllerWidget.php');
248
+ add_action('widgets_init', create_function('', 'return register_widget("FMControllerWidget");'));
249
+ }
250
+
251
+ // Register fmemailverification post type
252
+ add_action('init', 'register_fmemailverification_cpt');
253
+ function register_fmemailverification_cpt(){
254
+ $args = array(
255
+ 'public' => true,
256
+ 'label' => 'FM Email Verification'
257
+ );
258
+
259
+ register_post_type( 'fmemailverification', $args );
260
+ if(!get_option('fm_emailverification')) {
261
+ flush_rewrite_rules();
262
+ add_option('fm_emailverification', true);
263
+ }
264
+ }
265
+
266
+ // Activate plugin.
267
+ function form_maker_activate() {
268
+ $version = get_option("wd_form_maker_version");
269
+ $new_version = substr_replace(WD_FM_VERSION, '1.', 0, 2);
270
+
271
+ global $wpdb;
272
+ if (!$version) {
273
+ add_option("wd_form_maker_version", $new_version, '', 'no');
274
+ if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "formmaker'") == $wpdb->prefix . "formmaker") {
275
+ require_once WD_FM_DIR . "/form_maker_update.php";
276
+ $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
277
+ $public_key = isset($recaptcha_keys['public_key']) ? $recaptcha_keys['public_key'] : '';
278
+ $private_key = isset($recaptcha_keys['private_key']) ? $recaptcha_keys['private_key'] : '';
279
+ if (FALSE === $fm_settings = get_option('fm_settings')) {
280
+ add_option('fm_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => ',', 'map_key' => ''));
281
+ }
282
+ form_maker_update_until_mvc();
283
+ form_maker_update_contact();
284
+ form_maker_update('');
285
+ }
286
+ else {
287
+ require_once WD_FM_DIR . "/form_maker_insert.php";
288
+ from_maker_insert();
289
+ $email_verification_post = array(
290
+ 'post_title' => 'Email Verification',
291
+ 'post_content' => '[email_verification]',
292
+ 'post_status' => 'publish',
293
+ 'post_author' => 1,
294
+ 'post_type' => 'fmemailverification',
295
+ );
296
+ $mail_verification_post_id = wp_insert_post($email_verification_post);
297
+
298
+ add_option('fm_settings', array('public_key' => '', 'private_key' => '', 'csv_delimiter' => ',', 'map_key' => ''));
299
+ $wpdb->update($wpdb->prefix . "formmaker", array(
300
+ 'mail_verification_post_id' => $mail_verification_post_id,
301
+ ), array('id' => 1), array(
302
+ '%d',
303
+ ), array('%d'));
304
+ }
305
+ }
306
+ elseif (version_compare($version, $new_version, '<')) {
307
+ $version = substr_replace($version, '1.', 0, 2);
308
+ require_once WD_FM_DIR . "/form_maker_update.php";
309
+ $mail_verification_post_ids = $wpdb->get_results($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!="%d"',0));
310
+ if($mail_verification_post_ids)
311
+ foreach($mail_verification_post_ids as $mail_verification_post_id) {
312
+ $update_email_ver_post_type = array(
313
+ 'ID' => (int)$mail_verification_post_id->mail_verification_post_id,
314
+ 'post_type' => 'fmemailverification',
315
+ );
316
+
317
+ wp_update_post( $update_email_ver_post_type );
318
+ }
319
+ form_maker_update($version);
320
+ update_option("wd_form_maker_version", $new_version);
321
+
322
+ $recaptcha_keys = $wpdb->get_row('SELECT `public_key`, `private_key` FROM ' . $wpdb->prefix . 'formmaker WHERE public_key!="" and private_key!=""', ARRAY_A);
323
+ $public_key = isset($recaptcha_keys['public_key']) ? $recaptcha_keys['public_key'] : '';
324
+ $private_key = isset($recaptcha_keys['private_key']) ? $recaptcha_keys['private_key'] : '';
325
+ if (FALSE === $fm_settings = get_option('fm_settings')) {
326
+ add_option('fm_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => ',', 'map_key' => ''));
327
+ }
328
+ }
329
+ }
330
+ register_activation_hook(__FILE__, 'form_maker_activate');
331
+
332
+ if ((!isset($_GET['action']) || $_GET['action'] != 'deactivate') && (!isset($_GET['page']) || $_GET['page'] != 'uninstall_fm')) {
333
+ add_action('admin_init', 'form_maker_activate');
334
+ }
335
+
336
+ // Form Maker manage page styles.
337
+ function form_maker_manage_styles() {
338
+ wp_admin_css('thickbox');
339
+ wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), WD_FM_VERSION);
340
+ wp_enqueue_style('form_maker_first', WD_FM_URL . '/css/form_maker_first.css', array(), WD_FM_VERSION);
341
+ wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css', array(), WD_FM_VERSION);
342
+ wp_enqueue_style('phone_field_css', WD_FM_URL . '/css/intlTelInput.css', array(), WD_FM_VERSION);
343
+ wp_enqueue_style('jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css', array(), WD_FM_VERSION);
344
+ wp_enqueue_style('jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css', array(), WD_FM_VERSION);
345
+ wp_enqueue_style('form_maker_style', WD_FM_URL . '/css/style.css', array(), WD_FM_VERSION);
346
+ wp_enqueue_style('form_maker_codemirror', WD_FM_URL . '/css/codemirror.css', array(), WD_FM_VERSION);
347
+ wp_enqueue_style('form_maker_layout', WD_FM_URL . '/css/form_maker_layout.css', array(), WD_FM_VERSION);
348
+ wp_enqueue_style('fm-bootstrap', WD_FM_URL . '/css/fm-bootstrap.css', array(), WD_FM_VERSION);
349
+ wp_enqueue_style('fm-colorpicker', WD_FM_URL . '/css/spectrum.css', array(), WD_FM_VERSION);
350
+ wp_enqueue_style('fm-font-awesome', WD_FM_URL . '/css/frontend/font-awesome/font-awesome.css', array(), WD_FM_VERSION);
351
+ }
352
+
353
+ // Form Maker manage page scripts.
354
+ function form_maker_manage_scripts() {
355
+ wp_enqueue_script('thickbox');
356
+ $fm_settings = get_option('fm_settings');
357
+ $map_key = isset($fm_settings['map_key']) ? $fm_settings['map_key'] : '';
358
+
359
+ wp_enqueue_script('jquery');
360
+ wp_enqueue_script('jquery-ui-sortable');
361
+ wp_enqueue_script('jquery-ui-widget');
362
+ wp_enqueue_script('jquery-ui-slider');
363
+ wp_enqueue_script('jquery-ui-spinner');
364
+ wp_enqueue_script('jquery-ui-datepicker');
365
+ wp_enqueue_media();
366
+
367
+ // wp_enqueue_script('mootools', WD_FM_URL . '/js/mootools.js', array(), '1.12');
368
+ if($_GET['page'] == 'manage_fm'){
369
+ wp_enqueue_script('google-maps', 'https://maps.google.com/maps/api/js?v=3.exp&key='.$map_key);
370
+ }
371
+ wp_enqueue_script('gmap_form', WD_FM_URL . '/js/if_gmap_back_end.js', array(), WD_FM_VERSION);
372
+ wp_enqueue_script('phone_field', WD_FM_URL . '/js/intlTelInput.js', array(), '11.0.0');
373
+
374
+ wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
375
+ wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), WD_FM_VERSION);
376
+
377
+ wp_enqueue_script('form_maker_codemirror', WD_FM_URL . '/js/layout/codemirror.js', array(), '2.3');
378
+ wp_enqueue_script('form_maker_clike', WD_FM_URL . '/js/layout/clike.js', array(), '1.0.0');
379
+ wp_enqueue_script('form_maker_formatting', WD_FM_URL . '/js/layout/formatting.js', array(), '1.0.0');
380
+ wp_enqueue_script('form_maker_css', WD_FM_URL . '/js/layout/css.js', array(), '1.0.0');
381
+ wp_enqueue_script('form_maker_javascript', WD_FM_URL . '/js/layout/javascript.js', array(), '1.0.0');
382
+ wp_enqueue_script('form_maker_xml', WD_FM_URL . '/js/layout/xml.js', array(), '1.0.0');
383
+ wp_enqueue_script('form_maker_php', WD_FM_URL . '/js/layout/php.js', array(), '1.0.0');
384
+ wp_enqueue_script('form_maker_htmlmixed', WD_FM_URL . '/js/layout/htmlmixed.js', array(), '1.0.0');
385
+
386
+ wp_enqueue_script('Calendar', WD_FM_URL . '/js/calendar/calendar.js', array(), '1.0');
387
+ wp_enqueue_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js', array(), WD_FM_VERSION);
388
+
389
+ // wp_enqueue_script('form_maker_calendar_setup', WD_FM_URL . '/js/calendar/calendar-setup.js');
390
+ wp_enqueue_script('fm-colorpicker', WD_FM_URL . '/js/spectrum.js', array(), WD_FM_VERSION);
391
+ }
392
+
393
+ // Form Maker submissions page styles.
394
+ function form_maker_submissions_styles() {
395
+ wp_admin_css('thickbox');
396
+ wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), WD_FM_VERSION);
397
+ wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css', array(), WD_FM_VERSION);
398
+
399
+ wp_enqueue_style('jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css', array(), '1.10.3');
400
+ wp_enqueue_style('jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css', array(), '1.10.3');
401
+ wp_enqueue_style('form_maker_style', WD_FM_URL . '/css/style.css', array(), WD_FM_VERSION);
402
+ }
403
+ // Form Maker submissions page scripts.
404
+ function form_maker_submissions_scripts() {
405
+ wp_enqueue_script('thickbox');
406
+ wp_enqueue_script('jquery');
407
+ wp_enqueue_script( 'jquery-ui-progressbar' );
408
+ wp_enqueue_script('jquery-ui-sortable');
409
+ wp_enqueue_script('jquery-ui-widget');
410
+ wp_enqueue_script('jquery-ui-slider');
411
+ wp_enqueue_script('jquery-ui-spinner');
412
+ wp_enqueue_script('jquery-ui-mouse');
413
+ wp_enqueue_script('jquery-ui-core');
414
+ wp_enqueue_script('jquery-ui-datepicker');
415
+
416
+ // wp_enqueue_script('mootools', WD_FM_URL . '/js/mootools.js', array(), '1.12');
417
+
418
+ wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
419
+ wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), WD_FM_VERSION);
420
+ wp_enqueue_script('form_maker_submissions', WD_FM_URL . '/js/form_maker_submissions.js', array(), WD_FM_VERSION);
421
+
422
+ wp_enqueue_script('main_div_front_end', WD_FM_URL . '/js/main_div_front_end.js', array(), WD_FM_VERSION);
423
+
424
+ wp_enqueue_script('Calendar', WD_FM_URL . '/js/calendar/calendar.js', array(), '1.0');
425
+ wp_enqueue_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js', array(), WD_FM_VERSION);
426
+
427
+ // wp_enqueue_script('form_maker_calendar_setup', WD_FM_URL . '/js/calendar/calendar-setup.js');
428
+
429
+ wp_localize_script('main_div_front_end', 'fm_objectL10n', array(
430
+ 'plugin_url' => WD_FM_URL
431
+ ));
432
+ }
433
+
434
+ function form_maker_styles() {
435
+ wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), WD_FM_VERSION);
436
+ wp_enqueue_style('fm_deactivate-css', WD_FM_URL . '/wd/assets/css/deactivate_popup.css', array(), WD_FM_VERSION);
437
+ }
438
+ function form_maker_scripts() {
439
+ wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
440
+ wp_enqueue_script('fm-deactivate-popup', WD_FM_URL . '/wd/assets/js/deactivate_popup.js', array(), WD_FM_VERSION, true );
441
+ $admin_data = wp_get_current_user();
442
+ wp_localize_script( 'fm-deactivate-popup', 'fmWDDeactivateVars', array(
443
+ "prefix" => "fm" ,
444
+ "deactivate_class" => 'fm_deactivate_link',
445
+ "email" => $admin_data->data->user_email,
446
+ "plugin_wd_url" => "https://web-dorado.com/products/wordpress-form.html",
447
+ ));
448
+ }
449
+
450
+ $form_maker_generate_action = 0;
451
+ function form_maker_generate_action() {
452
+ global $form_maker_generate_action;
453
+ $form_maker_generate_action = 1;
454
+ }
455
+ add_filter('wp_head', 'form_maker_generate_action', 10000);
456
+
457
+ function form_maker_front_end_scripts() {
458
+ wp_enqueue_script('jquery');
459
+ wp_enqueue_script('jquery-ui-widget');
460
+ wp_enqueue_script('jquery-ui-slider');
461
+ wp_enqueue_script('jquery-ui-spinner');
462
+ wp_enqueue_script('jquery-effects-shake');
463
+ wp_enqueue_script('jquery-ui-datepicker');
464
+
465
+ wp_register_style('fm-jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css', array(), WD_FM_VERSION);
466
+ wp_enqueue_style('fm-jquery-ui');
467
+ wp_register_style('fm-jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css', array(), WD_FM_VERSION);
468
+ wp_enqueue_style('fm-jquery-ui-spinner');
469
+
470
+ wp_register_script('gmap_form', WD_FM_URL . '/js/if_gmap_front_end.js', array(), WD_FM_VERSION);
471
+ wp_enqueue_script('gmap_form');
472
+ wp_register_script('phone_field', WD_FM_URL . '/js/intlTelInput.js', array(), WD_FM_VERSION);
473
+ wp_enqueue_script('phone_field');
474
+
475
+ wp_register_script('fm-Calendar', WD_FM_URL . '/js/calendar/calendar.js', array(), WD_FM_VERSION);
476
+ wp_enqueue_script('fm-Calendar');
477
+ wp_register_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js', array(), WD_FM_VERSION);
478
+ wp_enqueue_script('calendar_function');
479
+
480
+ wp_register_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css', array(), WD_FM_VERSION);
481
+ wp_enqueue_style('form_maker_calendar-jos');
482
+ wp_register_style('phone_field_css', WD_FM_URL . '/css/intlTelInput.css', array(), WD_FM_VERSION);
483
+ wp_enqueue_style('phone_field_css');
484
+ wp_register_style('form_maker_frontend', WD_FM_URL . '/css/form_maker_frontend.css', array(), WD_FM_VERSION);
485
+ wp_enqueue_style('form_maker_frontend');
486
+
487
+ wp_register_script('main_div_front_end', WD_FM_URL . '/js/main_div_front_end.js', array(), WD_FM_VERSION);
488
+ wp_enqueue_script('main_div_front_end');
489
+ wp_localize_script('main_div_front_end', 'fm_objectL10n', array(
490
+ 'plugin_url' => WD_FM_URL,
491
+ 'fm_file_type_error' => addslashes(__('Can not upload this type of file', 'form_maker')),
492
+ 'fm_field_is_required' => addslashes(__('Field is required', 'form_maker')),
493
+ 'fm_min_max_check_1' => addslashes((__('The ', 'form_maker'))),
494
+ 'fm_min_max_check_2' => addslashes((__(' value must be between ', 'form_maker'))),
495
+ 'fm_spinner_check' => addslashes((__('Value must be between ', 'form_maker'))),
496
+ ));
497
+
498
+ require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
499
+ $google_fonts = WDW_FM_Library::get_google_fonts();
500
+ $fonts = implode("|", str_replace(' ', '+', $google_fonts));
501
+ wp_register_style('fm_googlefonts', 'https://fonts.googleapis.com/css?family=' . $fonts . '&subset=greek,latin,greek-ext,vietnamese,cyrillic-ext,latin-ext,cyrillic', null, null);
502
+ wp_enqueue_style('fm_googlefonts');
503
+
504
+ wp_register_style('fm-animate', WD_FM_URL . '/css/frontend/fm-animate.css', array(), WD_FM_VERSION);
505
+ wp_enqueue_style('fm-animate');
506
+ wp_register_style('fm-font-awesome', WD_FM_URL . '/css/frontend/font-awesome/font-awesome.css', array(), WD_FM_VERSION);
507
+ wp_enqueue_style('fm-font-awesome');
508
+ }
509
+ // add_action('wp_enqueue_scripts', 'form_maker_front_end_scripts');
510
+
511
+ // Languages localization.
512
+ function form_maker_language_load() {
513
+ load_plugin_textdomain('form_maker', FALSE, basename(dirname(__FILE__)) . '/languages');
514
+ }
515
+ add_action('plugins_loaded', 'form_maker_language_load');
516
+
517
+ function fm_topic() {
518
+ $page = isset($_GET['page']) ? $_GET['page'] : '';
519
+ $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
520
+ $user_guide_link = 'https://web-dorado.com/wordpress-form-maker/';
521
+ $support_forum_link = 'https://wordpress.org/support/plugin/form-maker';
522
+ $pro_icon = WD_FM_URL . '/images/wd_logo.png';
523
+ $pro_link = 'https://web-dorado.com/files/fromFormMaker.php';
524
+ $support_icon = WD_FM_URL . '/images/support.png';
525
+ $prefix = 'form_maker';
526
+ $is_free = TRUE;
527
+ switch ($page) {
528
+ case 'blocked_ips_fm': {
529
+ $help_text = 'block IPs';
530
+ $user_guide_link .= 'blocking-ips.html';
531
+ break;
532
+ }
533
+ case 'goptions_fm': {
534
+ $help_text = 'edit form settings';
535
+ $user_guide_link .= 'configuring-form-options.html';
536
+ break;
537
+ }
538
+ case 'licensing_fm': {
539
+ $help_text = '';
540
+ $user_guide_link .= '';
541
+ break;
542
+ }
543
+ case 'manage_fm': {
544
+ switch ($task) {
545
+ case 'edit':
546
+ case 'edit_old': {
547
+ $help_text = 'add fields to your form';
548
+ $user_guide_link .= 'description-of-form-fields.html';
549
+ break;
550
+ }
551
+ case 'form_options':
552
+ case 'form_options_old': {
553
+ $help_text = 'edit form options';
554
+ $user_guide_link .= 'configuring-form-options.html';
555
+ break;
556
+ }
557
+ default: {
558
+ $help_text = 'create, edit forms';
559
+ $user_guide_link .= 'creating-form.html';
560
+ }
561
+ }
562
+ break;
563
+ }
564
+ case 'submissions_fm': {
565
+ $help_text = 'view and manage form submissions';
566
+ $user_guide_link .= 'managing-submissions.html';
567
+ break;
568
+ }
569
+ case 'themes_fm': {
570
+ $help_text = 'create, edit form themes';
571
+ $user_guide_link .= 'creating-form.html';
572
+ break;
573
+ }
574
+ default: {
575
+ return '';
576
+ }
577
+ }
578
+ ob_start();
579
+ ?>
580
+ <style>
581
+ .wd_topic {
582
+ background-color: #ffffff;
583
+ border: none;
584
+ box-sizing: border-box;
585
+ clear: both;
586
+ color: #6e7990;
587
+ font-size: 14px;
588
+ font-weight: bold;
589
+ line-height: 44px;
590
+ padding: 0 0 0 15px;
591
+ vertical-align: middle;
592
+ width: 98%;
593
+ }
594
+ .wd_topic .wd_help_topic {
595
+ float: left;
596
+ }
597
+ .wd_topic .wd_help_topic a {
598
+ color: #0073aa;
599
+ }
600
+ .wd_topic .wd_help_topic a:hover {
601
+ color: #00A0D2;
602
+ }
603
+ .wd_topic .wd_support {
604
+ float: right;
605
+ margin: 0 10px;
606
+ }
607
+ .wd_topic .wd_support img {
608
+ vertical-align: middle;
609
+ }
610
+ .wd_topic .wd_support a {
611
+ text-decoration: none;
612
+ color: #6E7990;
613
+ }
614
+ .wd_topic .wd_pro {
615
+ float: right;
616
+ padding: 0;
617
+ }
618
+ .wd_topic .wd_pro a {
619
+ border: none;
620
+ box-shadow: none !important;
621
+ text-decoration: none;
622
+ }
623
+ .wd_topic .wd_pro img {
624
+ border: none;
625
+ display: inline-block;
626
+ vertical-align: middle;
627
+ }
628
+ .wd_topic .wd_pro a,
629
+ .wd_topic .wd_pro a:active,
630
+ .wd_topic .wd_pro a:visited,
631
+ .wd_topic .wd_pro a:hover {
632
+ background-color: #D8D8D8;
633
+ color: #175c8b;
634
+ display: inline-block;
635
+ font-size: 11px;
636
+ font-weight: bold;
637
+ padding: 0 10px;
638
+ vertical-align: middle;
639
+ }
640
+ </style>
641
+ <div class="update-nag wd_topic">
642
+ <?php
643
+ if ($help_text) {
644
+ ?>
645
+ <span class="wd_help_topic">
646
+ <?php echo sprintf(__('This section allows you to %s.', $prefix), $help_text); ?>
647
+ <a target="_blank" href="<?php echo $user_guide_link; ?>">
648
+ <?php _e('Read More in User Manual', $prefix); ?>
649
+ </a>
650
+ </span>
651
+ <?php
652
+ }
653
+ if ($is_free) {
654
+ $text = strtoupper(__('Upgrade to paid version', $prefix));
655
+ ?>
656
+ <div class="wd_pro">
657
+ <a target="_blank" href="<?php echo $pro_link; ?>">
658
+ <img alt="web-dorado.com" title="<?php echo $text; ?>" src="<?php echo $pro_icon; ?>" />
659
+ <span><?php echo $text; ?></span>
660
+ </a>
661
+ </div>
662
+ <?php
663
+ }
664
+ if (FALSE) {
665
+ ?>
666
+ <span class="wd_support">
667
+ <a target="_blank" href="<?php echo $support_forum_link; ?>">
668
+ <img src="<?php echo $support_icon; ?>" />
669
+ <?php _e('Support Forum', $prefix); ?>
670
+ </a>
671
+ </span>
672
+ <?php
673
+ }
674
+ ?>
675
+ </div>
676
+ <?php
677
+ echo ob_get_clean();
678
+ }
679
+
680
+ add_action('admin_notices', 'fm_topic', 11);
681
+
682
+ function fm_overview() {
683
+ if (is_admin() && !isset($_REQUEST['ajax'])) {
684
+ if (!class_exists("DoradoWeb")) {
685
+ require_once(WD_FM_DIR . '/wd/start.php');
686
+ }
687
+ global $fm_options;
688
+ $fm_options = array(
689
+ "prefix" => "fm",
690
+ "wd_plugin_id" => 31,
691
+ "plugin_title" => "Form Maker",
692
+ "plugin_wordpress_slug" => "form-maker",
693
+ "plugin_dir" => WD_FM_DIR,
694
+ "plugin_main_file" => __FILE__,
695
+ "description" => __('Form Maker plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.', 'form_maker'),
696
+ // from web-dorado.com
697
+ "plugin_features" => array(
698
+ 0 => array(
699
+ "title" => __("Easy to Use", "form_maker"),
700
+ "description" => __("This responsive form maker plugin is one of the most easy-to-use form builder solutions available on the market. Simple, yet powerful plugin allows you to quickly and easily build any complex forms.", "form_maker"),
701
+ ),
702
+ 1 => array(
703
+ "title" => __("Customizable Fields", "form_maker"),
704
+ "description" => __("All the fields of Form Maker plugin are highly customizable, which allows you to change almost every detail in the form and make it look exactly like you want it to be.", "form_maker"),
705
+ ),
706
+ 2 => array(
707
+ "title" => __("Submissions", "form_maker"),
708
+ "description" => __("You can view the submissions for each form you have. The plugin allows to view submissions statistics, filter submission data and export in csv or xml formats.", "form_maker"),
709
+ ),
710
+ 3 => array(
711
+ "title" => __("Multi-Page Forms", "form_maker"),
712
+ "description" => __("With the form builder plugin you can create muilti-page forms. Simply use the page break field to separate the pages in your forms.", "form_maker"),
713
+ ),
714
+ 4 => array(
715
+ "title" => __("Themes", "form_maker"),
716
+ "description" => __("The WordPress Form Maker plugin comes with a wide range of customizable themes. You can choose from a list of existing themes or simply create the one that better fits your brand and website.", "form_maker"),
717
+ )
718
+ ),
719
+ // user guide from web-dorado.com
720
+ "user_guide" => array(
721
+ 0 => array(
722
+ "main_title" => __("Installing", "form_maker"),
723
+ "url" => "https://web-dorado.com/wordpress-form-maker/installing.html",
724
+ "titles" => array()
725
+ ),
726
+ 1 => array(
727
+ "main_title" => __("Creating a new Form", "form_maker"),
728
+ "url" => "https://web-dorado.com/wordpress-form-maker/creating-form.html",
729
+ "titles" => array()
730
+ ),
731
+ 2 => array(
732
+ "main_title" => __("Configuring Form Options", "form_maker"),
733
+ "url" => "https://web-dorado.com/wordpress-form-maker/configuring-form-options.html",
734
+ "titles" => array()
735
+ ),
736
+ 3 => array(
737
+ "main_title" => __("Description of The Form Fields", "form_maker"),
738
+ "url" => "https://web-dorado.com/wordpress-form-maker/description-of-form-fields.html",
739
+ "titles" => array(
740
+ array(
741
+ "title" => __("Selecting Options from Database", "form_maker"),
742
+ "url" => "https://web-dorado.com/wordpress-form-maker/description-of-form-fields/selecting-options-from-database.html",
743
+ ),
744
+ )
745
+ ),
746
+ 4 => array(
747
+ "main_title" => __("Publishing the Created Form", "form_maker"),
748
+ "url" => "https://web-dorado.com/wordpress-form-maker/publishing-form.html",
749
+ "titles" => array()
750
+ ),
751
+ 5 => array(
752
+ "main_title" => __("Blocking IPs", "form_maker"),
753
+ "url" => "https://web-dorado.com/wordpress-form-maker/blocking-ips.html",
754
+ "titles" => array()
755
+ ),
756
+ 6 => array(
757
+ "main_title" => __("Managing Submissions", "form_maker"),
758
+ "url" => "https://web-dorado.com/wordpress-form-maker/managing-submissions.html",
759
+ "titles" => array()
760
+ ),
761
+ 7 => array(
762
+ "main_title" => __("Publishing Submissions", "form_maker"),
763
+ "url" => "https://web-dorado.com/wordpress-form-maker/publishing-submissions.html",
764
+ "titles" => array()
765
+ ),
766
+ ),
767
+ "video_youtube_id" => "tN3_c6MhqFk", // e.g. https://www.youtube.com/watch?v=acaexefeP7o youtube id is the acaexefeP7o
768
+ "plugin_wd_url" => "https://web-dorado.com/products/wordpress-form.html",
769
+ "plugin_wd_demo_link" => "http://wpdemo.web-dorado.com",
770
+ "plugin_wd_addons_link" => "https://web-dorado.com/products/wordpress-form/add-ons.html",
771
+ "after_subscribe" => admin_url('admin.php?page=overview_fm'), // this can be plagin overview page or set up page
772
+ "plugin_wizard_link" => '',
773
+ "plugin_menu_title" => "Form Maker",
774
+ "plugin_menu_icon" => WD_FM_URL . '/images/FormMakerLogo-16.png',
775
+ "deactivate" => true,
776
+ "subscribe" => true,
777
+ "custom_post" => 'manage_fm',
778
+ "menu_position" => null,
779
+ );
780
+
781
+ dorado_web_init($fm_options);
782
+ }
783
+ }
784
+ add_action('init', 'fm_overview');
frontend/models/FMModelForm_maker.php CHANGED
@@ -1,3889 +1,3897 @@
1
- <?php
2
-
3
- class FMModelForm_maker {
4
-
5
- public function showform($id, $type = 'embedded') {
6
- global $wpdb;
7
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d" AND id NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')', $id));
8
- $form_preview = isset($_GET['form_preview']) ? $_GET['form_preview'] : '';
9
- if (!$row || !$row->published || (!$form_preview && $row->type != $type)) {
10
- return FALSE;
11
- }
12
- if (isset($_GET['test_theme']) && (esc_html(stripslashes($_GET['test_theme'])) != '')) {
13
- /* From preview.*/
14
- $theme_id = esc_html(stripslashes($_GET['test_theme']));
15
- }
16
- else {
17
- $theme_id = $row->theme;
18
- }
19
- $form_theme = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
20
- if (!$form_theme) {
21
- $form_theme = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes');
22
- if (!$form_theme) {
23
- return FALSE;
24
- }
25
- }
26
-
27
- $params_decoded = json_decode(html_entity_decode($form_theme->css), true);
28
- if ($params_decoded != null) {
29
- $old = $form_theme->version == 1;
30
- $form_theme = $params_decoded;
31
- }
32
- else {
33
- $old = true;
34
- $form_theme = array("CUPCSS" => $form_theme->css);
35
- }
36
-
37
- $cssver = isset($form_theme['nonce_fm']) ? $form_theme['nonce_fm'] : rand();
38
- $create_css_data = $this->create_css($theme_id, $form_theme, $old);
39
- wp_register_style('fm-style-' . $theme_id, WD_FM_URL . '/css/frontend/fm-style-' . $theme_id . '.css', array(), $cssver);
40
-
41
- $fm_settings = get_option('fm_settings');
42
- $fm_shortcode = isset($fm_settings['fm_shortcode']) ? $fm_settings['fm_shortcode'] : '';
43
- if ($form_preview || $fm_shortcode) {
44
- wp_print_styles('fm-style-' . $theme_id);
45
- }
46
- else {
47
- wp_enqueue_style('fm-style-' . $theme_id);
48
- }
49
- $label_id = array();
50
- $label_type = array();
51
- $label_all = explode('#****#', $row->label_order);
52
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
53
- foreach ($label_all as $key => $label_each) {
54
- $label_id_each = explode('#**id**#', $label_each);
55
- array_push($label_id, $label_id_each[0]);
56
- $label_order_each = explode('#**label**#', $label_id_each[1]);
57
- array_push($label_type, $label_order_each[1]);
58
- }
59
- return array(
60
- $row,
61
- 1,
62
- $label_id,
63
- $label_type,
64
- $form_theme
65
- );
66
- }
67
-
68
- public static function set_empty_values_transparent(&$value, $key) {
69
- if(strpos($key, 'Color') > -1) {
70
- /*
71
- * New themes colorpicker conflict with others.
72
- * Remove comments if no '#' is beeing saved with colors.
73
- * */
74
- if ($value == '') {
75
- $value = 'transparent';
76
- }
77
- /*elseif (strpos($value, '#') === false) {
78
- $value = '#' . $value;
79
- }*/
80
- }
81
- }
82
-
83
- public function create_css($theme_id, $form_theme, $old = true, $force_rewrite = false) {
84
- $frontend_css = WD_FM_DIR . '/css/frontend/fm-style-' . $theme_id . '.css';
85
- if ($theme_id && !$force_rewrite && file_exists($frontend_css)) {
86
- return;
87
- }
88
- $prefixes = array('HP', 'AGP', 'GP', 'IP', 'SBP', 'SCP', 'MCP', 'SP', 'SHP', 'BP', 'BHP', 'NBP', 'NBHP', 'PBP', 'PBHP', 'PSAP', 'PSDP', 'CBP', 'CBHP', 'MBP', 'MBHP');
89
- $border_types = array('top', 'left','right', 'bottom');
90
- $borders = array();
91
- foreach ($prefixes as $prefix) {
92
- $borders[$prefix] = array();
93
- foreach ($border_types as $border_type) {
94
- if (isset($form_theme[$prefix.'Border'.ucfirst($border_type)])) {
95
- array_push($borders[$prefix], $form_theme[$prefix.'Border'.ucfirst($border_type)]);
96
- }
97
- }
98
- }
99
- clearstatcache();
100
- $cssfile = fopen($frontend_css, "w");
101
-
102
- array_walk($form_theme, 'self::set_empty_values_transparent');
103
-
104
- $css_content = '';
105
- if (!$old) {
106
- $css_content =
107
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form {
108
- padding:".$form_theme['AGPPadding']." !important;
109
- border-radius:".$form_theme['AGPBorderRadius']."px;
110
- box-shadow:".$form_theme['AGPBoxShadow'].";
111
- background: transparent;
112
- border:none !important;
113
- display:table;
114
- width:".$form_theme['AGPWidth']."%;
115
- margin:".$form_theme['AGPMargin'].";
116
- }\r\n";
117
-
118
-
119
- if($borders['AGP']) {
120
- foreach($borders['AGP'] as $border){
121
- if($form_theme['AGPBorderType'] == 'inherit' || $form_theme['AGPBorderType'] == 'initial') {
122
- $css_content .="
123
- .fm-form-container.fm-theme" . $theme_id . " .fm-form {
124
- border-".$border.": ".$form_theme['AGPBorderType']." !important;
125
- }";
126
- break;
127
- } else{
128
- $css_content .="
129
- .fm-form-container.fm-theme" . $theme_id . " .fm-form {
130
- border-".$border.": ".$form_theme['AGPBorderWidth']."px ".$form_theme['AGPBorderType']." ".$form_theme['AGPBorderColor']." !important;
131
- }";
132
- }
133
- }
134
- }
135
-
136
- $css_content .=
137
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header-bg{
138
- background-color:".$form_theme['HPBGColor'].";
139
- display: " . ($form_theme['HPAlign'] == 'left' || $form_theme['HPAlign'] == 'right' ? "table-cell" : "block") . ";
140
- vertical-align: top;
141
- width: ".$form_theme['HPWidth']."%;
142
- }\r\n";
143
-
144
-
145
- $css_content .=
146
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
147
- width:".$form_theme['HPWidth']."%;
148
- margin:".$form_theme['HPMargin'].";
149
- border-radius:".$form_theme['HPBorderRadius']."px;
150
- text-align: ".$form_theme['HPTextAlign'].";
151
- padding:".$form_theme['HPPadding']." !important;
152
- border:none !important;
153
- }\r\n";
154
-
155
- $css_content .=
156
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .image_left_right.fm-header {
157
- padding: 0 !important;
158
- }\r\n";
159
-
160
- $css_content .=
161
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .image_left_right > div {
162
- padding:".$form_theme['HPPadding']." !important;
163
- }\r\n";
164
-
165
-
166
- if($borders['HP']) {
167
- foreach($borders['HP'] as $border){
168
- if($form_theme['HPBorderType'] == 'inherit' || $form_theme['HPBorderType'] == 'initial') {
169
- $css_content .="
170
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
171
- border-".$border.": ".$form_theme['HPBorderType']." !important;
172
- }";
173
- break;
174
- } else{
175
- $css_content .="
176
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
177
- border-".$border.": ".$form_theme['HPBorderWidth']."px ".$form_theme['HPBorderType']." ".$form_theme['HPBorderColor']." !important;
178
- }";
179
- }
180
- }
181
- }
182
-
183
- $css_content .=
184
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form.header_left_right .wdform-page-and-images{
185
- display: table-cell;
186
- width:".$form_theme['GPWidth']."%;
187
- }\r\n";
188
-
189
-
190
- $css_content .=
191
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form.header_left_right .fm-header{
192
- display: table-cell !important;
193
- width:".$form_theme['HPWidth']."%;
194
- vertical-align:middle;
195
- }\r\n";
196
-
197
- $css_content .=
198
- ".fm-topbar .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
199
- width:".$form_theme['HTPWidth']."% !important;
200
- }\r\n";
201
-
202
- $css_content .=
203
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header-title{
204
- font-size:".$form_theme['HTPFontSize']."px;
205
- color:".$form_theme['HTPColor'].";
206
- }\r\n";
207
-
208
- $css_content .=
209
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header-description{
210
- font-size:".$form_theme['HDPFontSize']."px;
211
- color:".$form_theme['HDPColor'].";
212
- }\r\n";
213
-
214
- $css_content .=
215
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form-message {
216
- font-family:".$form_theme['GPFontFamily'].";
217
- font-size:".$form_theme['GPFontSize']."px;
218
- font-weight:".$form_theme['GPFontWeight'].";
219
- width:100%;
220
- padding:".$form_theme['GPPadding']." !important;
221
- margin:".$form_theme['GPMargin'].";
222
- border-radius:".$form_theme['GPBorderRadius']."px;
223
- border:none !important;
224
- background-color:".$form_theme['GPBGColor'].";
225
- text-align: center;
226
- }\r\n";
227
-
228
- $css_content .=
229
- ".fm-form-container.fm-theme" . $theme_id . " .fm-success.fm-form-message {
230
- color:".$form_theme['GPColor'].";
231
- }\r\n";
232
-
233
- $css_content .=
234
- ".fm-form-container.fm-theme" . $theme_id . " .fm-scrollbox {
235
- width:".$form_theme['AGPSPWidth']."%;
236
- }\r\n";
237
-
238
- $css_content .=
239
- ".fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
240
- background-color: #fff;
241
- font-size:".$form_theme['MBPFontSize']."px;
242
- font-weight:".$form_theme['MBPFontWeight'].";
243
- color: #444;
244
- padding:".$form_theme['MBPPadding']." !important;
245
- margin:".$form_theme['MBPMargin'].";
246
- border-radius:".$form_theme['MBPBorderRadius']."px;
247
- text-align: ".$form_theme['MBPTextAlign'].";
248
- border:none !important;
249
- cursor: pointer;
250
- }\r\n";
251
-
252
- if($borders['MBP']) {
253
- foreach($borders['MBP'] as $border){
254
- if($form_theme['MBPBorderType'] == 'inherit' || $form_theme['MBPBorderType'] == 'initial') {
255
- $css_content .="
256
- .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
257
- border-".$border.": ".$form_theme['MBPBorderType']." !important;
258
- }";
259
- break;
260
- } else{
261
- $css_content .="
262
- .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
263
- border-".$border.": ".$form_theme['MBPBorderWidth']."px ".$form_theme['MBPBorderType']." ".$form_theme['MBPBorderColor']." !important;
264
- }";
265
- }
266
- }
267
- }
268
-
269
- $css_content .=
270
- ".fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div:hover {
271
- background-color:".$form_theme['MBHPBGColor'].";
272
- color:".$form_theme['MBHPColor'].";
273
- outline: none;
274
- border: none !important;
275
- cursor: pointer;
276
- }\r\n";
277
-
278
- if($borders['MBHP']) {
279
- foreach($borders['MBHP'] as $border){
280
- if($form_theme['MBHPBorderType'] == 'inherit' || $form_theme['MBHPBorderType'] == 'initial') {
281
- $css_content .="
282
- .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div:hover {
283
- border-".$border.": ".$form_theme['MBHPBorderType']." !important;
284
- }";
285
- break;
286
- } else{
287
- $css_content .="
288
- .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div:hover {
289
- border-".$border.": ".$form_theme['MBHPBorderWidth']."px ".$form_theme['MBHPBorderType']." ".$form_theme['MBHPBorderColor']." !important;
290
- }";
291
- }
292
- }
293
- }
294
-
295
- $css_content .=
296
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images{
297
- font-size:".$form_theme['GPFontSize']."px;
298
- font-weight:".$form_theme['GPFontWeight'].";
299
- width:".$form_theme['GPWidth']."%;
300
- color:".$form_theme['GPColor'].";
301
- padding:".$form_theme['GPPadding'].";
302
- margin:".$form_theme['GPMargin'].";
303
- border-radius:".$form_theme['GPBorderRadius']."px;
304
- border:none !important;
305
- }\r\n";
306
-
307
- $css_content .=
308
- ".fm-topbar .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images{
309
- width:".$form_theme['GTPWidth']."% !important;
310
- }\r\n";
311
-
312
- if($borders['GP']) {
313
- foreach($borders['GP'] as $border){
314
- if($form_theme['GPBorderType'] == 'inherit' || $form_theme['GPBorderType'] == 'initial') {
315
- $css_content .="
316
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images,
317
- .fm-form-container.fm-theme" . $theme_id . " .fm-form-message,
318
- .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text {
319
- border-".$border.": ".$form_theme['GPBorderType']." !important;
320
- }";
321
- break;
322
- } else{
323
- $css_content .="
324
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images,
325
- .fm-form-container.fm-theme" . $theme_id . " .fm-form-message,
326
- .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text {
327
- border-".$border.": ".$form_theme['GPBorderWidth']."px ".$form_theme['GPBorderType']." ".$form_theme['GPBorderColor']." !important;
328
- }";
329
- }
330
- }
331
- }
332
-
333
- $css_content .="
334
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .mini_label {
335
- font-size:".$form_theme['GPMLFontSize']."px !important;
336
- font-weight:".$form_theme['GPMLFontWeight'].";
337
- color:".$form_theme['GPMLColor'].";
338
- padding:".$form_theme['GPMLPadding']." !important;
339
- margin:".$form_theme['GPMLMargin'].";
340
- }";
341
-
342
- $css_content .="
343
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label,
344
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label{
345
- font-size:".$form_theme['GPMLFontSize']."px !important;
346
- }\r\n";
347
-
348
-
349
- $css_content .="
350
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images label{
351
- font-size:".$form_theme['GPFontSize']."px;
352
- }\r\n";
353
-
354
-
355
- if($form_theme['GPAlign'] == 'center'){
356
- $css_content .="
357
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section{
358
- margin:0 auto;
359
- }\r\n";
360
-
361
- /* $css_content .=
362
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_column{
363
- float:none;
364
- }\r\n"; */
365
- } else{
366
- $css_content .="
367
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section{
368
- float:".$form_theme['GPAlign'].";
369
- }\r\n";
370
-
371
- }
372
-
373
- $css_content .="
374
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section {
375
- padding:".$form_theme['SEPPadding'].";
376
- margin:".$form_theme['SEPMargin'].";
377
- background: transparent;
378
- }";
379
-
380
- $css_content .="
381
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_column {
382
- padding:".$form_theme['COPPadding'].";
383
- margin:".$form_theme['COPMargin'].";
384
- }";
385
-
386
-
387
- $css_content .="
388
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider {
389
- background: ".$form_theme['IPBGColor']." !important;
390
- }";
391
-
392
- $css_content .="
393
- .fm-form-container.fm-theme" . $theme_id . " .fm-scrollbox .fm-scrollbox-form {
394
- margin:".$form_theme['AGPMargin'].";
395
- position: relative;
396
- }";
397
-
398
- $css_content .="
399
- .fm-form-container.fm-theme" . $theme_id . " .fm-popover .fm-popover-content {
400
- margin:".$form_theme['AGPMargin'].";
401
- position: relative;
402
- }";
403
-
404
-
405
- $css_content .="
406
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages.wdform_page_navigation {
407
- width:".$form_theme['AGPWidth']."%;
408
- margin:".$form_theme['AGPMargin'].";
409
- }";
410
-
411
- $css_content .="
412
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_footer {
413
- font-size: ".$form_theme['GPFontSize']."px;
414
- font-weight: ".$form_theme['GPFontWeight'].";
415
- color: ".$form_theme['GPColor'].";
416
- width: ".$form_theme['FPWidth']."%;
417
- margin: ".$form_theme['FPMargin'].";
418
- padding: ".$form_theme['FPPadding'].";
419
- /* clear: both; */
420
- }";
421
-
422
- $css_content .="
423
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_active {
424
- background-color: ".$form_theme['PSAPBGColor'].";
425
- font-size: ".$form_theme['PSAPFontSize']."px;
426
- font-weight: ".$form_theme['PSAPFontWeight'].";
427
- color: ".$form_theme['PSAPColor'].";
428
- width: ".$form_theme['PSAPWidth']."px;
429
- height: ".$form_theme['PSAPHeight']."px;
430
- line-height: ".$form_theme['PSAPLineHeight']."px;
431
- margin: ".$form_theme['PSAPMargin'].";
432
- padding: ".$form_theme['PSAPPadding'].";
433
- border-radius: ".$form_theme['PSAPBorderRadius']."px;
434
- cursor: pointer;
435
- }";
436
-
437
- if($borders['PSAP']) {
438
- foreach($borders['PSAP'] as $border){
439
- if($form_theme['PSAPBorderType'] == 'inherit' || $form_theme['PSAPBorderType'] == 'initial') {
440
- $css_content .="
441
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_active {
442
- border: ".$form_theme['PSAPBorderType']." !important;
443
- }";
444
- break;
445
- } else {
446
- $css_content .="
447
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_active {
448
- border-".$border.": ".$form_theme['PSAPBorderWidth']."px ".$form_theme['PSAPBorderType']." ".$form_theme['PSAPBorderColor']." !important;
449
- }";
450
- }
451
- }
452
- }
453
-
454
- $css_content .="
455
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_deactive {
456
- background-color: ".$form_theme['PSDPBGColor'].";
457
- font-size: ".$form_theme['PSDPFontSize']."px;
458
- font-weight: ".$form_theme['PSDPFontWeight'].";
459
- color: ".$form_theme['PSDPColor'].";
460
- width: ".$form_theme['PSAPWidth']."px;
461
- height: ".$form_theme['PSDPHeight']."px;
462
- line-height: ".$form_theme['PSDPLineHeight']."px;
463
- margin: ".$form_theme['PSDPMargin'].";
464
- padding: ".$form_theme['PSDPPadding'].";
465
- border-radius: ".$form_theme['PSAPBorderRadius']."px;
466
- cursor: pointer;
467
- }";
468
-
469
- if($borders['PSDP']) {
470
- foreach($borders['PSDP'] as $border){
471
- if($form_theme['PSDPBorderType'] == 'inherit' || $form_theme['PSDPBorderType'] == 'initial') {
472
- $css_content .="
473
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_deactive {
474
- border: ".$form_theme['PSDPBorderType']." !important;
475
- }";
476
- break;
477
- } else {
478
- $css_content .="
479
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_deactive {
480
- border-".$border.": ".$form_theme['PSDPBorderWidth']."px ".$form_theme['PSDPBorderType']." ".$form_theme['PSDPBorderColor']." !important;
481
- }";
482
- }
483
- }
484
- }
485
-
486
- $css_content .="
487
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_active {
488
- background-color: ".$form_theme['PSAPBGColor'].";
489
- font-size: ".$form_theme['PSAPFontSize']."px;
490
- font-weight: ".$form_theme['PSAPFontWeight'].";
491
- color: ".$form_theme['PSAPColor'].";
492
- width: ".$form_theme['PSAPWidth'].";
493
- height: ".$form_theme['PSAPHeight']."px;
494
- line-height: ".$form_theme['PSAPLineHeight']."px;
495
- margin: ".$form_theme['PSAPMargin'].";
496
- padding: ".$form_theme['PSAPPadding'].";
497
- border-radius: ".$form_theme['PSAPBorderRadius']."px;
498
- min-width: 7%;
499
- }";
500
-
501
- if($borders['PSAP']) {
502
- foreach($borders['PSAP'] as $border){
503
- if($form_theme['PSAPBorderType'] == 'inherit' || $form_theme['PSAPBorderType'] == 'initial') {
504
- $css_content .="
505
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_active {
506
- border: ".$form_theme['PSAPBorderType']." !important;
507
- }";
508
- break;
509
- } else {
510
- $css_content .="
511
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_active {
512
- border-".$border.": ".$form_theme['PSAPBorderWidth']."px ".$form_theme['PSAPBorderType']." ".$form_theme['PSAPBorderColor']." !important;
513
- }";
514
- }
515
- }
516
- }
517
-
518
- $css_content .="
519
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_deactive {
520
- background-color: ".$form_theme['PSDPBGColor'].";
521
- font-size: ".$form_theme['PSDPFontSize']."px;
522
- font-weight: ".$form_theme['PSDPFontWeight'].";
523
- color: ".$form_theme['PSDPColor'].";
524
- width: ".$form_theme['PPAPWidth'].";
525
- height: ".$form_theme['PSDPHeight']."px;
526
- line-height: ".$form_theme['PSDPLineHeight']."px;
527
- margin: ".$form_theme['PSDPMargin'].";
528
- padding: ".$form_theme['PSDPPadding'].";
529
- border-radius: ".$form_theme['PSDPBorderRadius']."px;
530
- }";
531
-
532
- if($borders['PSDP']) {
533
- foreach($borders['PSDP'] as $border){
534
- if($form_theme['PSDPBorderType'] == 'inherit' || $form_theme['PSDPBorderType'] == 'initial') {
535
- $css_content .="
536
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_deactive {
537
- border: ".$form_theme['PSDPBorderType']." !important;
538
- }";
539
- break;
540
- } else {
541
- $css_content .="
542
- .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_deactive {
543
- border-".$border.": ".$form_theme['PSDPBorderWidth']."px ".$form_theme['PSDPBorderType']." ".$form_theme['PSDPBorderColor']." !important;
544
- }";
545
- }
546
- }
547
- }
548
-
549
- $css_content .="
550
- .fm-form-container.fm-theme" . $theme_id . " .fm-action-buttons {
551
- font-size:".$form_theme['CBPFontSize']."px;
552
- font-weight:".$form_theme['CBPFontWeight'].";
553
- color:".$form_theme['CBPColor'].";
554
- text-align: center;
555
- cursor: pointer;
556
- font-family: monospace;
557
- }";
558
-
559
- $css_content .="
560
- .fm-form-container.fm-theme" . $theme_id . " .closing-form,
561
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
562
- position: ".$form_theme['CBPPosition'].";
563
- background:".$form_theme['CBPBGColor'].";
564
- padding:".$form_theme['CBPPadding'].";
565
- margin:".$form_theme['CBPMargin'].";
566
- border-radius:".$form_theme['CBPBorderRadius']."px;
567
- border:none;
568
- }";
569
-
570
- $css_content .="
571
- .fm-form-container.fm-theme" . $theme_id . " .closing-form {
572
- top: ".$form_theme['CBPTop'].";
573
- right: ".$form_theme['CBPRight'].";
574
- bottom: ".$form_theme['CBPBottom'].";
575
- left: ".$form_theme['CBPLeft'].";
576
- }";
577
-
578
-
579
- $for_mini = $form_theme['CBPLeft'] ? 'left' : 'right';
580
- $css_content .="
581
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
582
- top: ".$form_theme['CBPTop'].";
583
- ".$for_mini.": ".(2 * $form_theme['CBP'.ucfirst($for_mini)] + $form_theme['CBPFontSize'] + 3)."px;
584
- bottom: ".$form_theme['CBPBottom'].";
585
- }";
586
-
587
- if($borders['CBP']) {
588
- foreach($borders['CBP'] as $border){
589
- if($form_theme['CBPBorderType'] == 'inherit' || $form_theme['CBPBorderType'] == 'initial') {
590
- $css_content .="
591
- .fm-form-container.fm-theme" . $theme_id . " .closing-form,
592
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
593
- border-".$border.": ".$form_theme['CBPBorderType']." !important;
594
- }";
595
- break;
596
- } else{
597
- $css_content .="
598
- .fm-form-container.fm-theme" . $theme_id . " .closing-form,
599
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
600
- border-".$border.": ".$form_theme['CBPBorderWidth']."px ".$form_theme['CBPBorderType']." ".$form_theme['CBPBorderColor']." !important;
601
- }";
602
- }
603
- }
604
- }
605
-
606
- $css_content .="
607
- .fm-form-container.fm-theme" . $theme_id . " .closing-form:hover,
608
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form:hover {
609
- background:".$form_theme['CBHPBGColor'].";
610
- color:".$form_theme['CBHPColor'].";
611
- border:none;
612
- }";
613
-
614
- if($borders['CBHP']) {
615
- foreach($borders['CBHP'] as $border){
616
- if($form_theme['CBHPBorderType'] == 'inherit' || $form_theme['CBHPBorderType'] == 'initial') {
617
- $css_content .="
618
- .fm-form-container.fm-theme" . $theme_id . " .closing-form:hover,
619
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form:hover {
620
- border-".$border.": ".$form_theme['CBHPBorderType']." !important;
621
- }";
622
- break;
623
- } else{
624
- $css_content .="
625
- .fm-form-container.fm-theme" . $theme_id . " .closing-form:hover,
626
- .fm-form-container.fm-theme" . $theme_id . " .minimize-form:hover {
627
- border-".$border.": ".$form_theme['CBHPBorderWidth']."px ".$form_theme['CBHPBorderType']." ".$form_theme['CBHPBorderColor']." !important;
628
- }";
629
- }
630
- }
631
- }
632
-
633
- $user_agent = $_SERVER['HTTP_USER_AGENT'];
634
- if(stripos( $user_agent, 'Safari') !== false && stripos( $user_agent, 'Chrome') === false) {
635
- $css_content .="
636
- .fm-popover-container:before {
637
- position:absolute;
638
- }";
639
- }
640
-
641
- $css_content .="
642
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-required {
643
- color: ".$form_theme['OPRColor'].";
644
- }
645
-
646
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .input_deactive {
647
- color: ".$form_theme['OPDeInputColor']." !important;
648
- font-style: ".$form_theme['OPFontStyle'].";
649
- }
650
-
651
-
652
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .file-picker{
653
- background: url(".WD_FM_URL.'/'.$form_theme['OPFBgUrl'].") ".$form_theme['OPFBGRepeat']." ".$form_theme['OPFPos1']." ".$form_theme['OPFPos2'].";
654
- display: inline-block;
655
- }
656
-
657
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-calendar-button {
658
- background: url(".WD_FM_URL.'/'.$form_theme['OPDPIcon'].") ".$form_theme['OPDPRepeat']." ".$form_theme['OPDPPos1']." ".$form_theme['OPDPPos2'].";
659
- margin: ".$form_theme['OPDPMargin'].";
660
- position: absolute;
661
- }
662
-
663
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-subscribe-reset{
664
- float: ".$form_theme['SPAlign'].";
665
- }
666
-
667
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-subscribe-reset div{
668
- text-align: ".$form_theme['SPAlign'].";
669
- }
670
-
671
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
672
- margin-right: 15px;
673
- }
674
-
675
- ";
676
-
677
- $defaultStyles =
678
- ".fm-form-container.fm-theme" . $theme_id . " .fm-form{
679
- font-family:".$form_theme['GPFontFamily'].";
680
- background:".$form_theme['GPBGColor'].";
681
- }\r\n
682
-
683
-
684
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section {
685
- background:".($form_theme['GPBGColor'] != $form_theme['SEPBGColor'] ? $form_theme['SEPBGColor'] : 'transparent').";
686
- }\r\n
687
-
688
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .captcha_img{
689
- height:".$form_theme['IPHeight']."px;
690
- }
691
-
692
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='text'],
693
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=password],
694
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=url],
695
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=email],
696
- .fm-form-container.fm-theme" . $theme_id . " .fm-form textarea,
697
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner-input,
698
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .file-upload-status,
699
- .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
700
- font-size:".$form_theme['IPFontSize']."px;
701
- font-weight:".$form_theme['IPFontWeight'].";
702
- height:".$form_theme['IPHeight']."px;
703
- line-height:".$form_theme['IPHeight']."px;
704
- background-color:".$form_theme['IPBGColor'].";
705
- color:".$form_theme['IPColor'].";
706
- padding:".$form_theme['IPPadding'].";
707
- margin:".$form_theme['IPMargin'].";
708
- border-radius:".$form_theme['IPBorderRadius']."px !important;
709
- box-shadow:".$form_theme['IPBoxShadow'].";
710
- border:none;
711
- }";
712
-
713
- if($borders['IP']) {
714
- foreach($borders['IP'] as $border){
715
- if($form_theme['IPBorderType'] == 'inherit' || $form_theme['IPBorderType'] == 'initial') {
716
- $defaultStyles .="
717
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='text']:not(.ui-spinner-input),
718
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=password],
719
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=url],
720
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=email],
721
- .fm-form-container.fm-theme" . $theme_id . " .fm-form textarea,
722
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner,
723
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider,
724
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-handle,
725
- .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
726
- border-".$border.": ".$form_theme['IPBorderType']." !important;
727
- }";
728
-
729
- $defaultStyles .="
730
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner-button,
731
- border-left: ".$form_theme['IPBorderType']." !important;
732
- }";
733
-
734
- $defaultStyles .="
735
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-range {
736
- }";
737
- break;
738
- } else {
739
- $defaultStyles .="
740
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='text']:not(.ui-spinner-input),
741
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=password],
742
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=url],
743
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=email],
744
- .fm-form-container.fm-theme" . $theme_id . " .fm-form textarea,
745
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner,
746
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider,
747
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-handle,
748
- .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
749
- border-".$border.": ".$form_theme['IPBorderWidth']."px ".$form_theme['IPBorderType']." ".$form_theme['IPBorderColor']." !important;
750
- }";
751
- if($border == 'left'){
752
- $defaultStyles .="
753
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner-button {
754
- border-left: ".$form_theme['IPBorderWidth']."px ".$form_theme['IPBorderType']." ".$form_theme['IPBorderColor']." !important;
755
- }";
756
- }
757
-
758
- $defaultStyles .="
759
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-range {
760
- background: ".$form_theme['IPBorderColor']." !important;
761
- }";
762
-
763
- }
764
- }
765
- }
766
-
767
- $defaultStyles .="
768
- .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
769
- appearance: ".$form_theme['SBPAppearance'].";
770
- -moz-appearance: ".$form_theme['SBPAppearance'].";
771
- -webkit-appearance: ".$form_theme['SBPAppearance'].";
772
- background:".$form_theme['IPBGColor']." url(".WD_FM_URL.'/'.$form_theme['SBPBackground'].") ".$form_theme['SBPBGRepeat']." ".$form_theme['SBPBGPos1']." ".$form_theme['SBPBGPos2'].";
773
- background-size: ".$form_theme['SBPBGSize1']." ".$form_theme['SBPBGSize2'].";
774
- }";
775
-
776
-
777
- $defaultStyles .="
778
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label span {
779
- height:".$form_theme['SCPHeight']."px;
780
- width:".$form_theme['SCPWidth']."px;
781
- background-color:".$form_theme['SCPBGColor'].";
782
- margin:".$form_theme['SCPMargin'].";
783
- box-shadow:".$form_theme['SCPBoxShadow'].";
784
- border-radius: ".$form_theme['SCPBorderRadius']."px;
785
- border: none;
786
- display: inline-block;
787
- vertical-align: middle;
788
- }";
789
-
790
- $defaultStyles .="
791
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div input[type='radio']:checked + label span:after {
792
- content: '';
793
- width:".$form_theme['SCCPWidth']."px;
794
- height:".$form_theme['SCCPHeight']."px;
795
- background:".$form_theme['SCCPBGColor'].";
796
- border-radius: ".$form_theme['SCCPBorderRadius']."px;
797
- margin: ".$form_theme['SCCPMargin']."px;
798
- display: block;
799
- }";
800
-
801
- if($borders['SCP']) {
802
- foreach($borders['SCP'] as $border){
803
- if($form_theme['SCPBorderType'] == 'inherit' || $form_theme['SCPBorderType'] == 'initial') {
804
- $defaultStyles .="
805
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label span {
806
- border-".$border.": ".$form_theme['SCPBorderType']." !important;
807
- }";
808
- break;
809
- } else{
810
- $defaultStyles .="
811
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label span {
812
- border-".$border.": ".$form_theme['SCPBorderWidth']."px ".$form_theme['SCPBorderType']." ".$form_theme['SCPBorderColor']." !important;
813
- }";
814
- }
815
- }
816
- }
817
-
818
- $defaultStyles .="
819
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label span {
820
- height:".$form_theme['MCPHeight']."px;
821
- width:".$form_theme['MCPWidth']."px;
822
- background-color:".$form_theme['MCPBGColor'].";
823
- margin:".$form_theme['MCPMargin'].";
824
- box-shadow:".$form_theme['MCPBoxShadow'].";
825
- border-radius: ".$form_theme['MCPBorderRadius']."px;
826
- border: none;
827
- display: inline-block;
828
- vertical-align: middle;
829
- }";
830
-
831
- $defaultStyles .="
832
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div input[type='checkbox']:checked + label span:after {
833
- content: '';
834
- width:".$form_theme['MCCPWidth']."px;
835
- height:".$form_theme['MCCPHeight']."px;
836
- background:".($form_theme['MCCPBackground'] ? ($form_theme['MCCPBGColor']." url(".WD_FM_URL.'/'.$form_theme['MCCPBackground'].") ".$form_theme['MCCPBGRepeat']." ".$form_theme['MCCPBGPos1']." ".$form_theme['MCCPBGPos2']) : $form_theme['MCCPBGColor']).";
837
- border-radius: ".$form_theme['MCCPBorderRadius']."px;
838
- margin: ".$form_theme['MCCPMargin']."px;
839
- display: block;
840
- }";
841
-
842
- if($borders['MCP']) {
843
- foreach($borders['MCP'] as $border){
844
- if($form_theme['MCPBorderType'] == 'inherit' || $form_theme['MCPBorderType'] == 'initial') {
845
- $defaultStyles .="
846
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label span {
847
- border-".$border.": ".$form_theme['MCPBorderType']." !important;
848
- }";
849
- break;
850
- } else{
851
- $defaultStyles .="
852
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label span {
853
- border-".$border.": ".$form_theme['MCPBorderWidth']."px ".$form_theme['MCPBorderType']." ".$form_theme['MCPBorderColor']." !important;
854
- }";
855
- }
856
- }
857
- }
858
-
859
- $defaultStyles .="
860
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
861
- background-color:".$form_theme['SPBGColor']." !important;
862
- font-size:".$form_theme['SPFontSize']."px !important;
863
- font-weight:".$form_theme['SPFontWeight']." !important;
864
- color:".$form_theme['SPColor']." !important;
865
- height:".$form_theme['SPHeight']."px !important;
866
- width:".$form_theme['SPWidth']."px !important;
867
- margin:".$form_theme['SPMargin']." !important;
868
- padding:".$form_theme['SPPadding']." !important;
869
- box-shadow:".$form_theme['SPBoxShadow']." !important;
870
- border-radius: ".$form_theme['SPBorderRadius']."px;
871
- border: none !important;
872
- }";
873
-
874
- if($borders['SP']) {
875
- foreach($borders['SP'] as $border){
876
- if($form_theme['SPBorderType'] == 'inherit' || $form_theme['SPBorderType'] == 'initial') {
877
- $defaultStyles .="
878
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
879
- border-".$border.": ".$form_theme['SPBorderType']." !important;
880
- }";
881
- break;
882
- } else{
883
- $defaultStyles .="
884
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
885
- border-".$border.": ".$form_theme['SPBorderWidth']."px ".$form_theme['SPBorderType']." ".$form_theme['SPBorderColor']." !important;
886
- }";
887
- }
888
- }
889
- }
890
-
891
- $defaultStyles .="
892
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit:hover {
893
- background-color:".$form_theme['SHPBGColor']." !important;
894
- color:".$form_theme['SHPColor']." !important;
895
- }";
896
-
897
- if($borders['SHP']) {
898
- foreach($borders['SHP'] as $border){
899
- if($form_theme['SHPBorderType'] == 'inherit' || $form_theme['SHPBorderType'] == 'initial') {
900
- $defaultStyles .="
901
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit:hover {
902
- border-".$border.": ".$form_theme['SHPBorderType']." !important;
903
- }";
904
- break;
905
- } else{
906
- $defaultStyles .="
907
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit:hover {
908
- border-".$border.": ".$form_theme['SHPBorderWidth']."px ".$form_theme['SHPBorderType']." ".$form_theme['SHPBorderColor']." !important;
909
- }";
910
- }
911
- }
912
- }
913
-
914
- $defaultStyles .="
915
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset,
916
- .fm-form-container.fm-theme" . $theme_id . " .fm-form button {
917
- background-color:".$form_theme['BPBGColor']." !important;
918
- font-size:".$form_theme['BPFontSize']."px !important;
919
- font-weight:".$form_theme['BPFontWeight']." !important;
920
- color:".$form_theme['BPColor']." !important;
921
- height:".$form_theme['BPHeight']."px !important;
922
- width:".$form_theme['BPWidth']."px !important;
923
- margin:".$form_theme['BPMargin']." !important;
924
- padding:".$form_theme['BPPadding']." !important;
925
- box-shadow:".$form_theme['BPBoxShadow']." !important;
926
- border-radius: ".$form_theme['BPBorderRadius']."px;
927
- border: none !important;
928
- }";
929
-
930
- if($borders['BP']) {
931
- foreach($borders['BP'] as $border){
932
- if($form_theme['BPBorderType'] == 'inherit' || $form_theme['BPBorderType'] == 'initial') {
933
- $defaultStyles .="
934
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset,
935
- .fm-form-container.fm-theme" . $theme_id . " .fm-form button {
936
- border-".$border.": ".$form_theme['BPBorderType']." !important;
937
- }";
938
- break;
939
- } else{
940
- $defaultStyles .= "
941
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset,
942
- .fm-form-container.fm-theme" . $theme_id . " .fm-form button {
943
- border-".$border.": ".$form_theme['BPBorderWidth']."px ".$form_theme['BPBorderType']." ".$form_theme['BPBorderColor']." !important;
944
- }";
945
- }
946
- }
947
- }
948
-
949
- $defaultStyles .="
950
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset:hover,
951
- .fm-form-container.fm-theme" . $theme_id . " .fm-form button:hover {
952
- background-color:".$form_theme['BHPBGColor']." !important;
953
- color:".$form_theme['BHPColor']." !important;
954
- }";
955
-
956
- if($borders['BHP']) {
957
- foreach($borders['BHP'] as $border){
958
- if($form_theme['BHPBorderType'] == 'inherit' || $form_theme['BHPBorderType'] == 'initial') {
959
- $defaultStyles .="
960
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset:hover,
961
- .fm-form-container.fm-theme" . $theme_id . " .fm-form button:hover{
962
- border-".$border.": ".$form_theme['BHPBorderType']." !important;
963
- }";
964
- break;
965
- } else {
966
- $defaultStyles .= "
967
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset:hover,
968
- .fm-form-container.fm-theme" . $theme_id . " .fm-form button:hover {
969
- border-".$border.": ".$form_theme['BHPBorderWidth']."px ".$form_theme['BHPBorderType']." ".$form_theme['BHPBorderColor']." !important;
970
- }";
971
- }
972
- }
973
- }
974
-
975
- $defaultStyles .="
976
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button {
977
- background-color:".$form_theme['NBPBGColor']." !important;
978
- font-size:".$form_theme['BPFontSize']."px !important;
979
- font-weight:".$form_theme['BPFontWeight']." !important;
980
- color:".$form_theme['NBPColor']." !important;
981
- height:".$form_theme['NBPHeight']."px !important;
982
- width:".$form_theme['NBPWidth']."px !important;
983
- margin:".$form_theme['NBPMargin']." !important;
984
- padding:".$form_theme['NBPPadding']." !important;
985
- box-shadow:".$form_theme['NBPBoxShadow']." !important;
986
- border-radius: ".$form_theme['NBPBorderRadius']."px;
987
- border: none !important;
988
- }";
989
-
990
- if($borders['NBP']) {
991
- foreach($borders['NBP'] as $border){
992
- if($form_theme['NBPBorderType'] == 'inherit' || $form_theme['NBPBorderType'] == 'initial') {
993
- $defaultStyles .="
994
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button {
995
- border-".$border.": ".$form_theme['NBPBorderType']." !important;
996
- }";
997
- break;
998
- } else {
999
- $defaultStyles .="
1000
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button {
1001
- border-".$border.": ".$form_theme['NBPBorderWidth']."px ".$form_theme['NBPBorderType']." ".$form_theme['NBPBorderColor']." !important;
1002
- }";
1003
- }
1004
- }
1005
- }
1006
-
1007
- $defaultStyles .="
1008
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button:hover {
1009
- background-color:".$form_theme['NBHPBGColor']." !important;
1010
- color:".$form_theme['NBHPColor']." !important;
1011
- }";
1012
-
1013
- $defaultStyles .=
1014
- ".fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
1015
- background-color:".$form_theme['MBPBGColor'].";
1016
- color:".$form_theme['MBPColor'].";
1017
- }\r\n";
1018
-
1019
- if($borders['NBHP']) {
1020
- foreach($borders['NBHP'] as $border){
1021
- if($form_theme['NBHPBorderType'] == 'inherit' || $form_theme['NBHPBorderType'] == 'initial') {
1022
- $defaultStyles .="
1023
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button:hover {
1024
- border-".$border.": ".$form_theme['NBHPBorderType']." !important;
1025
- }";
1026
- break;
1027
- } else {
1028
- $defaultStyles .="
1029
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button:hover {
1030
- border-".$border.": ".$form_theme['NBHPBorderWidth']."px ".$form_theme['NBHPBorderType']." ".$form_theme['NBHPBorderColor']." !important;
1031
- }";
1032
- }
1033
- }
1034
- }
1035
-
1036
- $defaultStyles .="
1037
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button {
1038
- background-color:".$form_theme['PBPBGColor']." !important;
1039
- font-size:".$form_theme['BPFontSize']."px !important;
1040
- font-weight:".$form_theme['BPFontWeight']." !important;
1041
- color:".$form_theme['PBPColor']." !important;
1042
- height:".$form_theme['PBPHeight']."px !important;
1043
- width:".$form_theme['PBPWidth']."px !important;
1044
- margin:".$form_theme['PBPMargin']." !important;
1045
- padding:".$form_theme['PBPPadding']." !important;
1046
- box-shadow:".$form_theme['PBPBoxShadow']." !important;
1047
- border-radius: ".$form_theme['PBPBorderRadius']."px;
1048
- border: none !important;
1049
- }";
1050
-
1051
- if($borders['PBP']) {
1052
- foreach($borders['PBP'] as $border){
1053
- if($form_theme['PBPBorderType'] == 'inherit' || $form_theme['PBPBorderType'] == 'initial') {
1054
- $defaultStyles .="
1055
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button {
1056
- border-".$border.": ".$form_theme['PBPBorderType']." !important;
1057
- }";
1058
- break;
1059
- } else {
1060
- $defaultStyles .="
1061
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button {
1062
- border-".$border.": ".$form_theme['PBPBorderWidth']."px ".$form_theme['PBPBorderType']." ".$form_theme['PBPBorderColor']." !important;
1063
- }";
1064
- }
1065
- }
1066
- }
1067
-
1068
- $defaultStyles .="
1069
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button:hover {
1070
- background-color:".$form_theme['PBHPBGColor']." !important;
1071
- color:".$form_theme['PBHPColor']." !important;
1072
- }";
1073
-
1074
- if($borders['PBHP']) {
1075
- foreach($borders['PBHP'] as $border){
1076
- if($form_theme['PBHPBorderType'] == 'inherit' || $form_theme['PBHPBorderType'] == 'initial') {
1077
- $defaultStyles .="
1078
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button:hover {
1079
- border-".$border.": ".$form_theme['PBHPBorderType']." !important;
1080
- }";
1081
- break;
1082
- } else {
1083
- $defaultStyles .="
1084
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button:hover{
1085
- border-".$border.": ".$form_theme['PBHPBorderWidth']."px ".$form_theme['PBHPBorderType']." ".$form_theme['PBHPBorderColor']." !important;
1086
- }";
1087
- }
1088
- }
1089
- }
1090
-
1091
- $defaultStyles .="
1092
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='checkbox'],
1093
- .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='radio'] {
1094
- display:none;
1095
- }";
1096
-
1097
-
1098
- if($theme_id != 0){
1099
- $css_content .= $defaultStyles;
1100
- }
1101
- else {
1102
- $css_content .="
1103
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div.fm-right input[type='checkbox'],
1104
- .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div.fm-right input[type='radio'] {
1105
- float: right;
1106
- margin: 5px;
1107
- }";
1108
- }
1109
- }
1110
- if($form_theme['CUPCSS']) {
1111
- $pattern = '/\/\/(.+)(\r\n|\r|\n)/';
1112
- $form_theme_css = $form_theme['CUPCSS'];
1113
- if (strpos($form_theme_css, ':checked + label') !== false) {
1114
- $form_theme_css .= '
1115
- .checkbox-div label span {
1116
- border: 1px solid #868686 !important;
1117
- display: inline-block;
1118
- height: 16px;
1119
- width: 16px;
1120
- }
1121
- .radio-div label span {
1122
- border: 1px solid #868686 !important;
1123
- border-radius: 100%;
1124
- display: inline-block;
1125
- height: 16px;
1126
- width: 16px;
1127
- }
1128
- .checkbox-div input[type=\'checkbox\']:checked + label span:after {
1129
- content: \'\';
1130
- width: 16px;
1131
- height: 16px;
1132
- background:transparent url([SITE_ROOT]/images/themes/checkboxes/1.png) no-repeat;
1133
- background-size: 100%;
1134
- border-radius: 0px;
1135
- margin: 0px;
1136
- display: block;
1137
- }
1138
- .radio-div input[type=\'radio\']:checked + label span:after {
1139
- content: \'\';
1140
- width: 6px;
1141
- height: 6px;
1142
- background: #777777;
1143
- border-radius: 10px;
1144
- margin: 5px;
1145
- display: block;
1146
- }
1147
- .checkbox-div, .radio-div {
1148
- border: none;
1149
- box-shadow: none;
1150
- height: 17px;
1151
- background: none;
1152
- }
1153
- .checkbox-div label, .radio-div label, .checkbox-div label:hover, .radio-div label:hover {
1154
- opacity: 1;
1155
- background: none;
1156
- border: none;
1157
- min-width: 140px;
1158
- line-height: 13px;
1159
- }';
1160
- }
1161
- $form_theme_css = explode('{', $form_theme_css);
1162
- $count_after_explod_theme = count($form_theme_css);
1163
- for ($i = 0; $i < $count_after_explod_theme; $i++) {
1164
- $body_or_classes[$i] = explode('}', $form_theme_css[$i]);
1165
- }
1166
- for ($i = 0; $i < $count_after_explod_theme; $i++) {
1167
- if ($i == 0) {
1168
- $body_or_classes[$i][0] = ".fm-form-container.fm-theme" . $theme_id . " .fm-form" . ' ' . str_replace(',', ", .fm-form-container.fm-theme" . $theme_id . " .fm-form", $body_or_classes[$i][0]);
1169
- }
1170
- else {
1171
- $body_or_classes[$i][1] = ".fm-form-container.fm-theme" . $theme_id . " .fm-form" . ' ' . str_replace(',', ", .fm-form-container.fm-theme" . $theme_id . " .fm-form", $body_or_classes[$i][1]);
1172
- }
1173
- }
1174
- for ($i = 0; $i < $count_after_explod_theme; $i++) {
1175
- $body_or_classes_implode[$i] = implode('}', $body_or_classes[$i]);
1176
- }
1177
- $theme = implode('{', $body_or_classes_implode);
1178
- $theme = preg_replace($pattern, ' ', $theme);
1179
- $css_content .= str_replace('[SITE_ROOT]', WD_FM_URL, $theme);
1180
- }
1181
-
1182
- $txtfilecontent = fwrite($cssfile, $css_content);
1183
- fclose($cssfile);
1184
- clearstatcache();
1185
- }
1186
-
1187
- public function savedata($form, $id) {
1188
- $fm_settings = get_option('fm_settings');
1189
- $all_files = array();
1190
- $correct = FALSE;
1191
- $id_for_old = $id;
1192
- if (!$form->form_front) {
1193
- $id = '';
1194
- }
1195
- if (isset($_POST["counter" . $id])) {
1196
- $counter = esc_html($_POST["counter" . $id]);
1197
-
1198
- if (isset($_POST["captcha_input"])) {
1199
- $captcha_input = esc_html($_POST["captcha_input"]);
1200
- $session_wd_captcha_code = isset($_SESSION[$id . '_wd_captcha_code']) ? $_SESSION[$id . '_wd_captcha_code'] : '-';
1201
- if (md5($captcha_input) == $session_wd_captcha_code) {
1202
- $correct = TRUE;
1203
- }
1204
- else {
1205
- $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1206
- $_SESSION['error_or_no' . $id] = 1;
1207
- }
1208
- }
1209
- elseif (isset($_POST["arithmetic_captcha_input"])) {
1210
- $arithmetic_captcha_input = esc_html($_POST["arithmetic_captcha_input"]);
1211
- $session_wd_arithmetic_captcha_code = isset($_SESSION[$id . '_wd_arithmetic_captcha_code']) ? $_SESSION[$id . '_wd_arithmetic_captcha_code'] : '-';
1212
- if (md5($arithmetic_captcha_input) == $session_wd_arithmetic_captcha_code) {
1213
- $correct = TRUE;
1214
- }
1215
- else {
1216
- $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1217
- $_SESSION['error_or_no' . $id] = 1;
1218
- }
1219
- }
1220
- elseif (isset($_POST["g-recaptcha-response"])) {
1221
- $privatekey = isset($fm_settings['private_key']) ? $fm_settings['private_key'] : '';
1222
- $captcha = $_POST['g-recaptcha-response'];
1223
- $url = 'https://www.google.com/recaptcha/api/siteverify';
1224
- $data = array(
1225
- 'secret' => $privatekey,
1226
- 'response' => $captcha,
1227
- 'remoteip' => $_SERVER['REMOTE_ADDR']
1228
- );
1229
-
1230
- $curlConfig = array(
1231
- CURLOPT_URL => $url,
1232
- CURLOPT_POST => true,
1233
- CURLOPT_RETURNTRANSFER => true,
1234
- CURLOPT_SSL_VERIFYPEER => false,
1235
- CURLOPT_POSTFIELDS => $data
1236
- );
1237
-
1238
- $ch = curl_init();
1239
- curl_setopt_array($ch, $curlConfig);
1240
- $response = curl_exec($ch);
1241
- curl_close($ch);
1242
-
1243
- $jsonResponse = json_decode($response);
1244
- if ($jsonResponse->success == "true") {
1245
- $correct = TRUE;
1246
- }
1247
- else {
1248
- $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1249
- $_SESSION['error_or_no' . $id] = 1;
1250
- }
1251
- }
1252
- else {
1253
- if (preg_match('(type_arithmetic_captcha|type_captcha|type_recaptcha)', $form->label_order_current) === 1) {
1254
- $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1255
- $_SESSION['error_or_no' . $id] = 1;
1256
- $correct = false;
1257
- }
1258
- else {
1259
- $correct = true;
1260
- }
1261
- }
1262
- if ($correct) {
1263
- $ip = $_SERVER['REMOTE_ADDR'];
1264
- global $wpdb;
1265
- $blocked_ip = $wpdb->get_var($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ip));
1266
- if ($blocked_ip) {
1267
- $_SESSION['massage_after_submit' . $id] = addslashes(__('Your ip is blacklisted. Please contact the website administrator.', 'form_maker'));
1268
- wp_redirect($_SERVER["REQUEST_URI"]);//to be checked
1269
- exit;
1270
- }
1271
-
1272
- if (isset($_POST["save_or_submit" . $id]) && $_POST["save_or_submit" . $id] == 'save') {
1273
- if (defined('WD_FM_SAVE_PROG') && is_plugin_active(constant('WD_FM_SAVE_PROG'))) {
1274
- $_GET['addon_task'] = 'save_progress';
1275
- $_GET['form_id'] = $id;
1276
- $_GET['form_currency'] = $form->payment_currency;
1277
- do_action('WD_FM_SAVE_PROG_init');
1278
-
1279
- return $all_files;
1280
- }
1281
- }
1282
- else {
1283
- $result_temp = $this->save_db($counter, $id_for_old);
1284
-
1285
- $all_files = $result_temp[0];
1286
- if (is_numeric($all_files)) {
1287
- $this->remove($all_files, $id_for_old);
1288
-
1289
- $_SESSION['massage_after_submit' . $id] = $result_temp[1];
1290
- $_SESSION['error_or_no' . $id] = 1;
1291
-
1292
- }
1293
- else {
1294
- if (defined('WD_FM_SAVE_PROG') && is_plugin_active(constant('WD_FM_SAVE_PROG'))) {
1295
- $_GET['addon_task'] = 'clear_data';
1296
- $_GET['form_id'] = $id;
1297
- do_action('WD_FM_SAVE_PROG_init');
1298
- }
1299
- if (isset($counter)) {
1300
- $this->gen_mail($counter, $all_files, $id_for_old, $result_temp[1]);
1301
- }
1302
- }
1303
- }
1304
- }
1305
- }
1306
- return $all_files;
1307
- }
1308
-
1309
- public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
1310
- global $wpdb;
1311
-
1312
- $query = "SELECT `" . $label_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
1313
- if ($db_info) {
1314
- $temp = explode('@@@wdfhostwdf@@@', $db_info);
1315
- $host = $temp[0];
1316
- $temp = explode('@@@wdfportwdf@@@', $temp[1]);
1317
- $port = $temp[0];
1318
- $temp = explode('@@@wdfusernamewdf@@@', $temp[1]);
1319
- $username = $temp[0];
1320
- $temp = explode('@@@wdfpasswordwdf@@@', $temp[1]);
1321
- $password = $temp[0];
1322
- $temp = explode('@@@wdfdatabasewdf@@@', $temp[1]);
1323
- $database = $temp[0];
1324
-
1325
- $wpdb_temp = new wpdb($username, $password, $database, $host);
1326
- $choices_labels = $wpdb_temp->get_results($query, ARRAY_N);
1327
- }
1328
- else {
1329
- $choices_labels = $wpdb->get_results($query, ARRAY_N);
1330
- }
1331
- return $choices_labels;
1332
- }
1333
-
1334
- public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
1335
- global $wpdb;
1336
- $query = "SELECT `" . $value_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
1337
- if ($db_info) {
1338
- $temp = explode('@@@wdfhostwdf@@@', $db_info);
1339
- $host = $temp[0];
1340
- $temp = explode('@@@wdfportwdf@@@', $temp[1]);
1341
- $port = $temp[0];
1342
- $temp = explode('@@@wdfusernamewdf@@@', $temp[1]);
1343
- $username = $temp[0];
1344
- $temp = explode('@@@wdfpasswordwdf@@@', $temp[1]);
1345
- $password = $temp[0];
1346
- $temp = explode('@@@wdfdatabasewdf@@@', $temp[1]);
1347
- $database = $temp[0];
1348
- $wpdb_temp = new wpdb($username, $password, $database, $host);
1349
- $choices_values = $wpdb_temp->get_results($query, ARRAY_N);
1350
- }
1351
- else {
1352
- $choices_values = $wpdb->get_results($query, ARRAY_N);
1353
- }
1354
- return $choices_values;
1355
- }
1356
-
1357
- public function save_db($counter, $id) {
1358
- global $wpdb;
1359
- $current_user = wp_get_current_user();
1360
- if ($current_user->ID != 0) {
1361
- $wp_userid = $current_user->ID;
1362
- $wp_username = $current_user->display_name;
1363
- $wp_useremail = $current_user->user_email;
1364
- }
1365
- else {
1366
- $wp_userid = '';
1367
- $wp_username = '';
1368
- $wp_useremail = '';
1369
- }
1370
- $ip = $_SERVER['REMOTE_ADDR'];
1371
-
1372
- $chgnac = TRUE;
1373
- $all_files = array();
1374
- $paypal = array();
1375
- $paypal['item_name'] = array();
1376
- $paypal['quantity'] = array();
1377
- $paypal['amount'] = array();
1378
- $is_amount = false;
1379
- $paypal['on_os'] = array();
1380
- $total = 0;
1381
- $form_currency = '$';
1382
- $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
1383
- $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
1384
- $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id= %d", $id));
1385
- if (!$form->form_front) {
1386
- $id = '';
1387
- }
1388
- if ($form->payment_currency) {
1389
- $form_currency = $currency_sign[array_search($form->payment_currency, $currency_code)];
1390
- }
1391
- $label_id = array();
1392
- $label_label = array();
1393
- $label_type = array();
1394
-
1395
- $disabled_fields = explode(',', (isset($_REQUEST["disabled_fields" . $id]) ? $_REQUEST["disabled_fields" . $id] : ""));
1396
- $disabled_fields = array_slice($disabled_fields, 0, count($disabled_fields) - 1);
1397
- $label_all = explode('#****#', $form->label_order_current);
1398
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
1399
- foreach ($label_all as $key => $label_each) {
1400
- $label_id_each = explode('#**id**#', $label_each);
1401
- array_push($label_id, $label_id_each[0]);
1402
- $label_order_each = explode('#**label**#', $label_id_each[1]);
1403
- array_push($label_label, $label_order_each[0]);
1404
- array_push($label_type, $label_order_each[1]);
1405
- }
1406
- $max = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
1407
- $fvals = array();
1408
- foreach ($label_type as $key => $type) {
1409
- $value = '';
1410
- if ($type == "type_submit_reset" or $type == "type_map" or $type == "type_editor" or $type == "type_captcha" or $type == "type_arithmetic_captcha" or $type == "type_recaptcha" or $type == "type_button" or $type == "type_paypal_total" or $type == "type_send_copy") {
1411
- continue;
1412
- }
1413
-
1414
- $i = $label_id[$key];
1415
- if (!in_array($i, $disabled_fields)) {
1416
- switch ($type) {
1417
- case 'type_text':
1418
- case 'type_password':
1419
- case "type_submitter_mail":
1420
- case "type_own_select":
1421
- case "type_country":
1422
- case "type_number":
1423
- case "type_phone_new": {
1424
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1425
- break;
1426
- }
1427
-
1428
- case "type_date": {
1429
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1430
- $date_format = isset($_POST['wdform_' . $i . "_date_format" . $id]) ? esc_html($_POST['wdform_' . $i . "_date_format" . $id]) : "";
1431
- if ($value) {
1432
- if (!$this->fm_validateDate($value, $date_format)) {
1433
- echo "<script> alert('" . addslashes(__("This is not a valid date format.", 'form_maker')) . "');</script>";
1434
- return array($max + 1);
1435
- }
1436
- }
1437
-
1438
- break;
1439
- }
1440
-
1441
- case "type_date_new": {
1442
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1443
-
1444
- break;
1445
- }
1446
-
1447
- case "type_date_range": {
1448
- $value = (isset($_POST['wdform_' . $i . "_element" . $id . "0"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . "0"]) : "") . ' - ' . (isset($_POST['wdform_' . $i . "_element" . $id . "1"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . "1"]) : "");
1449
-
1450
- break;
1451
- }
1452
-
1453
- case 'type_textarea': {
1454
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1455
- break;
1456
- }
1457
-
1458
- case "type_wdeditor": {
1459
- $value = isset($_POST['wdform_' . $i . '_wd_editor' . $id]) ? esc_html($_POST['wdform_' . $i . '_wd_editor' . $id]) : "";
1460
- break;
1461
- }
1462
- case "type_mark_map": {
1463
- $value = (isset($_POST['wdform_' . $i . "_long" . $id]) ? esc_html($_POST['wdform_' . $i . "_long" . $id]) : "") . '***map***' . (isset($_POST['wdform_' . $i . "_lat" . $id]) ? esc_html($_POST['wdform_' . $i . "_lat" . $id]) : "");
1464
- break;
1465
- }
1466
- case "type_date_fields": {
1467
- $value = (isset($_POST['wdform_' . $i . "_day" . $id]) ? esc_html($_POST['wdform_' . $i . "_day" . $id]) : "") . '-' . (isset($_POST['wdform_' . $i . "_month" . $id]) ? esc_html($_POST['wdform_' . $i . "_month" . $id]) : "") . '-' . (isset($_POST['wdform_' . $i . "_year" . $id]) ? esc_html($_POST['wdform_' . $i . "_year" . $id]) : "");
1468
- break;
1469
- }
1470
- case "type_time": {
1471
- $ss = isset($_POST['wdform_' . $i . "_ss" . $id]) ? esc_html($_POST['wdform_' . $i . "_ss" . $id]) : NULL;
1472
- if (isset($ss)) {
1473
- $value = (isset($_POST['wdform_' . $i . "_hh" . $id]) ? esc_html($_POST['wdform_' . $i . "_hh" . $id]) : "") . ':' . (isset($_POST['wdform_' . $i . "_mm" . $id]) ?esc_html( $_POST['wdform_' . $i . "_mm" . $id]) : "") . ':' . (isset($_POST['wdform_' . $i . "_ss" . $id]) ? esc_html($_POST['wdform_' . $i . "_ss" . $id]) : "");
1474
- }
1475
- else {
1476
- $value = (isset($_POST['wdform_' . $i . "_hh" . $id]) ? esc_html($_POST['wdform_' . $i . "_hh" . $id]) : "") . ':' . (isset($_POST['wdform_' . $i . "_mm" . $id]) ? esc_html($_POST['wdform_' . $i . "_mm" . $id]) : "");
1477
- }
1478
- $am_pm = isset($_POST['wdform_' . $i . "_am_pm" . $id]) ? esc_html($_POST['wdform_' . $i . "_am_pm" . $id]) : NULL;
1479
- if (isset($am_pm)) {
1480
- $value = $value . ' ' . $am_pm;
1481
- }
1482
- break;
1483
- }
1484
- case "type_phone": {
1485
- $value = (isset($_POST['wdform_' . $i . "_element_first" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_first" . $id]) : "") . ' ' . (isset($_POST['wdform_' . $i . "_element_last" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_last" . $id]) : "");
1486
- break;
1487
- }
1488
- case "type_name": {
1489
- $element_title = isset($_POST['wdform_' . $i . "_element_title" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_title" . $id]) : NULL;
1490
- $element_middle = isset($_POST['wdform_' . $i . "_element_middle" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_middle" . $id]) : NULL;
1491
- if (isset($element_title) || isset($element_middle)) {
1492
- $value = (isset($_POST['wdform_' . $i . "_element_title" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_title" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_first" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_first" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_last" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_last" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_middle" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_middle" . $id]) : "");
1493
- }
1494
- else {
1495
- $value = (isset($_POST['wdform_' . $i . "_element_first" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_first" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_last" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_last" . $id]) : "");
1496
- }
1497
- break;
1498
- }
1499
- case "type_file_upload": {
1500
- if (isset($_POST['wdform_' . $i . "_file_url" . $id . '_save'])) {
1501
- $file_url = isset($_POST['wdform_' . $i . "_file_url" . $id . '_save']) ? stripslashes($_POST['wdform_' . $i . "_file_url" . $id . '_save']) : NULL;
1502
- if (isset($file_url)) {
1503
- $all_files = isset($_POST['wdform_' . $i . "_all_files" . $id . '_save']) ? json_decode(stripslashes($_POST['wdform_' . $i . "_all_files" . $id . '_save']), true) : array();
1504
- $value = $file_url;
1505
- }
1506
- }
1507
- else {
1508
- $files = isset($_FILES['wdform_' . $i . '_file' . $id]) ? $_FILES['wdform_' . $i . '_file' . $id] : NULL;
1509
- foreach ($files['name'] as $file_key => $file_name) {
1510
- if ($file_name) {
1511
- $untilupload = $form->form_fields;
1512
- $untilupload = substr($untilupload, strpos($untilupload, $i . '*:*id*:*type_file_upload'), -1);
1513
- $untilupload = substr($untilupload, 0, strpos($untilupload, '*:*new_field*:'));
1514
- $untilupload = explode('*:*w_field_label_pos*:*', $untilupload);
1515
- $untilupload = $untilupload[1];
1516
- $untilupload = explode('*:*w_destination*:*', $untilupload);
1517
- $destination = explode('*:*w_hide_label*:*', $untilupload[0]);
1518
- $destination = $destination[1];
1519
- $destination = str_replace(site_url() . '/', '', $destination);
1520
- $untilupload = $untilupload[1];
1521
- $untilupload = explode('*:*w_extension*:*', $untilupload);
1522
- $extension = $untilupload[0];
1523
- $untilupload = $untilupload[1];
1524
- $untilupload = explode('*:*w_max_size*:*', $untilupload);
1525
- $max_size = $untilupload[0];
1526
- $untilupload = $untilupload[1];
1527
- $fileName = $files['name'][$file_key];
1528
- $fileSize = $files['size'][$file_key];
1529
-
1530
- if ($fileSize > $max_size * 1024) {
1531
- return array($max + 1, addslashes(__('The file exceeds the allowed size of', 'form_maker')) . $max_size . ' KB');
1532
- }
1533
-
1534
- $uploadedFileNameParts = explode('.', $fileName);
1535
- $uploadedFileExtension = array_pop($uploadedFileNameParts);
1536
- $to = strlen($fileName) - strlen($uploadedFileExtension) - 1;
1537
-
1538
- $fileNameFree = substr($fileName, 0, $to);
1539
- $invalidFileExts = explode(',', $extension);
1540
- $extOk = false;
1541
-
1542
- foreach ($invalidFileExts as $key => $valuee) {
1543
- if (is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension)))) {
1544
- $extOk = true;
1545
- }
1546
- }
1547
-
1548
- if ($extOk == false) {
1549
- return array($max + 1, addslashes(__('Can not upload this type of file', 'form_maker')));
1550
- }
1551
-
1552
- $fileTemp = $files['tmp_name'][$file_key];
1553
- $p = 1;
1554
-
1555
- if (!file_exists($destination)) {
1556
- mkdir($destination, 0777);
1557
- }
1558
- if (file_exists($destination . "/" . $fileName)) {
1559
- $fileName1 = $fileName;
1560
- while (file_exists($destination . "/" . $fileName1)) {
1561
- $to = strlen($file_name) - strlen($uploadedFileExtension) - 1;
1562
- $fileName1 = substr($fileName, 0, $to) . '(' . $p . ').' . $uploadedFileExtension;
1563
- // $file['name'] = $fileName;
1564
- $p++;
1565
- }
1566
- $fileName = $fileName1;
1567
- }
1568
-
1569
- // for dropbox & google drive integration addons
1570
- $check_both = 0;
1571
- if ($form->save_uploads == 0) {
1572
- if (defined('WD_FM_DBOX_INT') && is_plugin_active(constant('WD_FM_DBOX_INT'))) {
1573
- $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix . "formmaker_dbox_int WHERE form_id=" . $form->id);
1574
- if ($enable == 1) {
1575
- $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix . "formmaker_dbox_int WHERE form_id=" . $form->id);
1576
-
1577
- if ((int)$selectable_upload == 1) {
1578
- $temp_dir_dbox = explode('\\', $fileTemp);
1579
- $temp_dir_dbox = implode('%%', $temp_dir_dbox);
1580
-
1581
- $value .= $temp_dir_dbox . '*@@url@@*' . $fileName;
1582
- }
1583
- else {
1584
- $dlink_dbox = '<a href="' . add_query_arg(array('action' => 'WD_FM_DBOX_INT', 'addon_task' => 'upload_dbox_file', 'id' => $form->id), admin_url('admin-ajax.php')) . '&dbox_file_name=' . $fileName . '&dbox_folder_name=/' . $form->title . '" >' . $fileName . '</a>';
1585
-
1586
- $value .= $dlink_dbox;
1587
- }
1588
-
1589
- $files['tmp_name'][$file_key] = $fileTemp;
1590
- $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1591
- }
1592
- else {
1593
- $check_both++;
1594
- }
1595
-
1596
- }
1597
- else {
1598
- $check_both++;
1599
- }
1600
- if (defined('WD_FM_GDRIVE_INT') && is_plugin_active(constant('WD_FM_GDRIVE_INT'))) {
1601
- $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix . "formmaker_gdrive_int WHERE form_id=" . $form->id);
1602
- if ($enable == 1) {
1603
- $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix . "formmaker_gdrive_int WHERE form_id=" . $form->id);
1604
-
1605
- if ((int)$selectable_upload == 1) {
1606
- $temp_dir_dbox = explode('\\', $fileTemp);
1607
- $temp_dir_dbox = implode('%%', $temp_dir_dbox);
1608
- $value .= 'wdCloudAddon' . $temp_dir_dbox . '*@@url@@*' . $fileName . '*@@url@@*' . $files['type'][$file_key];
1609
- }
1610
- else {
1611
- $dlink_dbox = '<a target="_blank" href="' . add_query_arg(array('action' => 'WD_FM_GDRIVE_INT', 'addon_task' => 'create_drive_link', 'id' => $form->id), admin_url('admin-ajax.php')) . '&gdrive_file_name=' . $fileName . '&gdrive_folder_name=' . $form->title . '" >' . $fileName . '</a>';
1612
- $value .= $dlink_dbox;
1613
- }
1614
-
1615
- $files['tmp_name'][$file_key] = $fileTemp;
1616
- $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1617
- }
1618
- else {
1619
- $check_both++;
1620
- }
1621
-
1622
- }
1623
- else {
1624
- $check_both++;
1625
- }
1626
-
1627
- }
1628
- //
1629
- if ($check_both != 0) {
1630
- $value .= '';
1631
- $files['tmp_name'][$file_key] = $fileTemp;
1632
- $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1633
- }
1634
- // dropbox and google drive integration addons
1635
- if ($form->save_uploads == 1) {
1636
- if (!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
1637
- return array($max + 1, addslashes(__('Error, file cannot be moved.', 'form_maker')));
1638
- }
1639
- $value .= site_url() . '/' . $destination . '/' . $fileName . '*@@url@@*';
1640
- $files['tmp_name'][$file_key] = $destination . "/" . $fileName;
1641
- $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1642
-
1643
- }
1644
- array_push($all_files, $temp_file);
1645
- }
1646
- }
1647
- }
1648
- break;
1649
- }
1650
-
1651
- case 'type_address': {
1652
- $value = '*#*#*#';
1653
- $element = isset($_POST['wdform_' . $i . "_street1" . $id]) ? esc_html($_POST['wdform_' . $i . "_street1" . $id]) : NULL;
1654
- if (isset($element)) {
1655
- $value = $element;
1656
- break;
1657
- }
1658
-
1659
- $element = isset($_POST['wdform_' . $i . "_street2" . $id]) ? esc_html($_POST['wdform_' . $i . "_street2" . $id]) : NULL;
1660
- if (isset($element)) {
1661
- $value = $element;
1662
- break;
1663
- }
1664
-
1665
- $element = isset($_POST['wdform_' . $i . "_city" . $id]) ? esc_html($_POST['wdform_' . $i . "_city" . $id]) : NULL;
1666
- if (isset($element)) {
1667
- $value = $element;
1668
- break;
1669
- }
1670
-
1671
- $element = isset($_POST['wdform_' . $i . "_state" . $id]) ? esc_html($_POST['wdform_' . $i . "_state" . $id]) : NULL;
1672
- if (isset($element)) {
1673
- $value = $element;
1674
- break;
1675
- }
1676
-
1677
- $element = isset($_POST['wdform_' . $i . "_postal" . $id]) ? esc_html($_POST['wdform_' . $i . "_postal" . $id]) : NULL;
1678
- if (isset($element)) {
1679
- $value = $element;
1680
- break;
1681
- }
1682
-
1683
- $element = isset($_POST['wdform_' . $i . "_country" . $id]) ? esc_html($_POST['wdform_' . $i . "_country" . $id]) : NULL;
1684
- if (isset($element)) {
1685
- $value = $element;
1686
- break;
1687
- }
1688
- break;
1689
- }
1690
-
1691
- case "type_hidden": {
1692
- $value = isset($_POST[$label_label[$key]]) ? esc_html($_POST[$label_label[$key]]) : "";
1693
- break;
1694
- }
1695
-
1696
- case "type_radio": {
1697
- $element = isset($_POST['wdform_' . $i . "_other_input" . $id]) ? esc_html($_POST['wdform_' . $i . "_other_input" . $id]) : NULL;
1698
- if (isset($element)) {
1699
- $value = $element;
1700
- break;
1701
- }
1702
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1703
- break;
1704
- }
1705
-
1706
- case "type_checkbox": {
1707
- $start = -1;
1708
- $value = '';
1709
- for ($j = 0; $j < 100; $j++) {
1710
- $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1711
- if (isset($element)) {
1712
- $start = $j;
1713
- break;
1714
- }
1715
- }
1716
-
1717
- $other_element_id = -1;
1718
- $is_other = isset($_POST['wdform_' . $i . "_allow_other" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other" . $id]) : "";
1719
- if ($is_other == "yes") {
1720
- $other_element_id = isset($_POST['wdform_' . $i . "_allow_other_num" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other_num" . $id]) : "";
1721
- }
1722
-
1723
- if ($start != -1) {
1724
- for ($j = $start; $j < 100; $j++) {
1725
- $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1726
- if (isset($element)) {
1727
- if ($j == $other_element_id) {
1728
- $value = $value . (isset($_POST['wdform_' . $i . "_other_input" . $id]) ? esc_html($_POST['wdform_' . $i . "_other_input" . $id]) : "") . '***br***';
1729
- }
1730
- else {
1731
- $value = $value . (isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : "") . '***br***';
1732
- }
1733
- }
1734
- }
1735
- }
1736
- break;
1737
- }
1738
-
1739
- case "type_paypal_price": {
1740
- $value = isset($_POST['wdform_' . $i . "_element_dollars" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_dollars" . $id]) : 0;
1741
-
1742
- $value = (int)preg_replace('/\D/', '', $value);
1743
-
1744
- if (isset($_POST['wdform_' . $i . "_element_cents" . $id])) {
1745
- $value = $value . '.' . (preg_replace('/\D/', '', esc_html($_POST['wdform_' . $i . "_element_cents" . $id])));
1746
- }
1747
-
1748
- $total += (float)($value);
1749
- $paypal_option = array();
1750
-
1751
- if ($value != 0) {
1752
- $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1753
- array_push($paypal['item_name'], $label_label[$key]);
1754
- array_push($paypal['quantity'], $quantity);
1755
- array_push($paypal['amount'], $value);
1756
- $is_amount = true;
1757
- array_push($paypal['on_os'], $paypal_option);
1758
- }
1759
- $value = $value . $form_currency;
1760
- break;
1761
- }
1762
-
1763
- case "type_paypal_price_new": {
1764
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : 0;
1765
- $total += (float)($value);
1766
- $paypal_option = array();
1767
-
1768
- if ($value != 0) {
1769
- $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1770
- array_push($paypal['item_name'], $label_label[$key]);
1771
- array_push($paypal['quantity'], $quantity);
1772
- array_push($paypal['amount'], $value);
1773
- $is_amount = true;
1774
- array_push($paypal['on_os'], $paypal_option);
1775
- }
1776
- $value = $form_currency . $value;
1777
- break;
1778
- }
1779
-
1780
- case "type_paypal_select": {
1781
- if (isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] != '') {
1782
- $value = esc_html($_POST['wdform_' . $i . "_element_label" . $id]) . ' : ' . $form_currency . (isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "");
1783
- }
1784
- else {
1785
- $value = '';
1786
- }
1787
- $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1788
- $total += (float)(isset($_POST['wdform_' . $i . "_element" . $id]) ? $_POST['wdform_' . $i . "_element" . $id] : 0) * $quantity;
1789
- array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? $_POST['wdform_' . $i . "_element_label" . $id] : ""));
1790
- array_push($paypal['quantity'], $quantity);
1791
- array_push($paypal['amount'], (isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : ""));
1792
- if (isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] != 0) {
1793
- $is_amount = true;
1794
- }
1795
- $element_quantity = isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : NULL;
1796
- if (isset($element_quantity) && $value != '') {
1797
- $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_quantity_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity_label" . $id]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) . '***quantity***';
1798
- }
1799
- $paypal_option = array();
1800
- $paypal_option['on'] = array();
1801
- $paypal_option['os'] = array();
1802
-
1803
- for ($k = 0; $k < 50; $k++) {
1804
- $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1805
- if (isset($temp_val) && $value != '') {
1806
- array_push($paypal_option['on'], (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : ""));
1807
- array_push($paypal_option['os'], (isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : ""));
1808
- $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "") . ': ' . (isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : "") . '***property***';
1809
- }
1810
- }
1811
- array_push($paypal['on_os'], $paypal_option);
1812
- break;
1813
- }
1814
-
1815
- case "type_paypal_radio": {
1816
- $element = isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : '';
1817
- if ($element) {
1818
- $value = (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_label" . $id]) : '') . ' : ' . $form_currency . $element;
1819
- }
1820
- else {
1821
- $value = '';
1822
- }
1823
- $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1824
- $total += (float)(isset($_POST['wdform_' . $i . "_element" . $id]) ? $_POST['wdform_' . $i . "_element" . $id] : 0) * $quantity;
1825
- array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_label" . $id]) : ""));
1826
- array_push($paypal['quantity'], $quantity);
1827
- array_push($paypal['amount'], (isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : 0));
1828
- if (isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] != 0) {
1829
- $is_amount = true;
1830
- }
1831
-
1832
- $element_quantity = isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : NULL;
1833
- if (isset($element_quantity) && $value != '') {
1834
- $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_quantity_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity_label" . $id]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) . '***quantity***';
1835
- }
1836
-
1837
- $paypal_option = array();
1838
- $paypal_option['on'] = array();
1839
- $paypal_option['os'] = array();
1840
-
1841
- for ($k = 0; $k < 50; $k++) {
1842
- $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1843
- if (isset($temp_val) && $value != '') {
1844
- array_push($paypal_option['on'], (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : ""));
1845
- array_push($paypal_option['os'], esc_html($_POST['wdform_' . $i . "_property" . $id . $k]));
1846
- $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) . '***property***';
1847
- }
1848
- }
1849
- array_push($paypal['on_os'], $paypal_option);
1850
- break;
1851
- }
1852
-
1853
- case "type_paypal_shipping": {
1854
- $element = isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : '';
1855
- if ($element) {
1856
- $value = (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_label" . $id]) : '') . ' : ' . $form_currency . $element;
1857
- }
1858
- else {
1859
- $value = '';
1860
- }
1861
- $paypal['shipping'] = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1862
- break;
1863
- }
1864
-
1865
- case "type_paypal_checkbox": {
1866
- $start = -1;
1867
- $value = '';
1868
- for ($j = 0; $j < 100; $j++) {
1869
- $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1870
- if (isset($element)) {
1871
- $start = $j;
1872
- break;
1873
- }
1874
- }
1875
-
1876
- $other_element_id = -1;
1877
- $is_other = isset($_POST['wdform_' . $i . "_allow_other" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other" . $id]) : "";
1878
- if ($is_other == "yes") {
1879
- $other_element_id = isset($_POST['wdform_' . $i . "_allow_other_num" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other_num" . $id]) : "";
1880
- }
1881
-
1882
- if ($start != -1) {
1883
- for ($j = $start; $j < 100; $j++) {
1884
- $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1885
- if (isset($element)) {
1886
- if ($j == $other_element_id) {
1887
- $value = $value . (isset($_POST['wdform_' . $i . "_other_input" . $id]) ? esc_html($_POST['wdform_' . $i . "_other_input" . $id]) : "") . '***br***';
1888
- }
1889
- else {
1890
- $element = (isset($_POST['wdform_' . $i . "_element" . $id . $j]) && $_POST['wdform_' . $i . "_element" . $id . $j] ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : 0);
1891
- $value = $value . (isset($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) : "") . ' - ' . $form_currency . $element . '***br***';
1892
-
1893
- $quantity = ((isset($_POST['wdform_' . $i . "_element_quantity" . $id]) && ($_POST['wdform_' . $i . "_element_quantity" . $id] >= 1)) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1894
- $total += (float)(isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? $_POST['wdform_' . $i . "_element" . $id . $j] : 0) * (float)($quantity);
1895
- array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) : ""));
1896
- array_push($paypal['quantity'], $quantity);
1897
- array_push($paypal['amount'], (isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? ($_POST['wdform_' . $i . "_element" . $id . $j] == '' ? '0' : esc_html($_POST['wdform_' . $i . "_element" . $id . $j])) : ""));
1898
- if (isset($_POST['wdform_' . $i . "_element" . $id . $j]) && $_POST['wdform_' . $i . "_element" . $id . $j] != 0) {
1899
- $is_amount = TRUE;
1900
- }
1901
- $paypal_option = array();
1902
- $paypal_option['on'] = array();
1903
- $paypal_option['os'] = array();
1904
-
1905
- for ($k = 0; $k < 50; $k++) {
1906
- $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1907
- if (isset($temp_val)) {
1908
- array_push($paypal_option['on'], isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "");
1909
- array_push($paypal_option['os'], esc_html($_POST['wdform_' . $i . "_property" . $id . $k]));
1910
- }
1911
- }
1912
- array_push($paypal['on_os'], $paypal_option);
1913
- }
1914
- }
1915
- }
1916
-
1917
- $element_quantity = isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : NULL;
1918
- if (isset($element_quantity)) {
1919
- $value .= (isset($_POST['wdform_' . $i . "_element_quantity_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity_label" . $id]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) . '***quantity***';
1920
- }
1921
- for ($k = 0; $k < 50; $k++) {
1922
- $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1923
- if (isset($temp_val)) {
1924
- $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "") . ': ' . $_POST['wdform_' . $i . "_property" . $id . $k] . '***property***';
1925
- }
1926
- }
1927
- }
1928
- break;
1929
- }
1930
-
1931
- case "type_star_rating": {
1932
- if (isset($_POST['wdform_' . $i . "_selected_star_amount" . $id]) && $_POST['wdform_' . $i . "_selected_star_amount" . $id] == "") {
1933
- $selected_star_amount = 0;
1934
- }
1935
- else {
1936
- $selected_star_amount = isset($_POST['wdform_' . $i . "_selected_star_amount" . $id]) ? $_POST['wdform_' . $i . "_selected_star_amount" . $id] : 0;
1937
- }
1938
- $value = $selected_star_amount . '/' . (isset($_POST['wdform_' . $i . "_star_amount" . $id]) ? esc_html($_POST['wdform_' . $i . "_star_amount" . $id]) : "");
1939
- break;
1940
- }
1941
-
1942
- case "type_scale_rating": {
1943
- $value = (isset($_POST['wdform_' . $i . "_scale_radio" . $id]) ? esc_html($_POST['wdform_' . $i . "_scale_radio" . $id]) : 0) . '/' . (isset($_POST['wdform_' . $i . "_scale_amount" . $id]) ? esc_html($_POST['wdform_' . $i . "_scale_amount" . $id]) : "");
1944
- break;
1945
- }
1946
-
1947
- case "type_spinner": {
1948
- $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1949
- break;
1950
- }
1951
-
1952
- case "type_slider": {
1953
- $value = isset($_POST['wdform_' . $i . "_slider_value" . $id]) ? esc_html($_POST['wdform_' . $i . "_slider_value" . $id]) : "";
1954
- break;
1955
- }
1956
-
1957
- case "type_range": {
1958
- $value = (isset($_POST['wdform_' . $i . "_element" . $id . '0']) ? esc_html($_POST['wdform_' . $i . "_element" . $id . '0']) : "") . '-' . (isset($_POST['wdform_' . $i . "_element" . $id . '1']) ? esc_html($_POST['wdform_' . $i . "_element" . $id . '1']) : "");
1959
- break;
1960
- }
1961
-
1962
- case "type_grading": {
1963
- $value = "";
1964
- $items = explode(":", isset($_POST['wdform_' . $i . "_hidden_item" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_item" . $id]) : "");
1965
- for ($k = 0; $k < sizeof($items) - 1; $k++) {
1966
- $value .= (isset($_POST['wdform_' . $i . "_element" . $id . '_' . $k]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . '_' . $k]) : "") . ':';
1967
- }
1968
- $value .= (isset($_POST['wdform_' . $i . "_hidden_item" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_item" . $id]) : "") . '***grading***';
1969
- break;
1970
- }
1971
-
1972
- case "type_matrix": {
1973
- $rows_of_matrix = explode("***", isset($_POST['wdform_' . $i . "_hidden_row" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_row" . $id]) : "");
1974
- $rows_count = sizeof($rows_of_matrix) - 1;
1975
- $column_of_matrix = explode("***", isset($_POST['wdform_' . $i . "_hidden_column" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_column" . $id]) : "");
1976
- $columns_count = sizeof($column_of_matrix) - 1;
1977
-
1978
- if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "radio") {
1979
- $input_value = "";
1980
- for ($k = 1; $k <= $rows_count; $k++) {
1981
- $input_value .= (isset($_POST['wdform_' . $i . "_input_element" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_input_element" . $id . $k]) : 0) . "***";
1982
- }
1983
- }
1984
- if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "checkbox") {
1985
- $input_value = "";
1986
- for ($k = 1; $k <= $rows_count; $k++) {
1987
- for ($j = 1; $j <= $columns_count; $j++) {
1988
- $input_value .= (isset($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) ? esc_html($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) : 0) . "***";
1989
- }
1990
- }
1991
- }
1992
-
1993
- if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "text") {
1994
- $input_value = "";
1995
- for ($k = 1; $k <= $rows_count; $k++) {
1996
- for ($j = 1; $j <= $columns_count; $j++) {
1997
- $input_value .= (isset($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) ? esc_html($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) : "") . "***";
1998
- }
1999
- }
2000
- }
2001
-
2002
- if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "select") {
2003
- $input_value = "";
2004
- for ($k = 1; $k <= $rows_count; $k++) {
2005
- for ($j = 1; $j <= $columns_count; $j++) {
2006
- $input_value .= (isset($_POST['wdform_' . $i . "_select_yes_no" . $id . $k . '_' . $j]) ? esc_html($_POST['wdform_' . $i . "_select_yes_no" . $id . $k . '_' . $j]) : "") . "***";
2007
- }
2008
- }
2009
- }
2010
-
2011
- $value = $rows_count . (isset($_POST['wdform_' . $i . "_hidden_row" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_row" . $id]) : "") . '***' . $columns_count . (isset($_POST['wdform_' . $i . "_hidden_column" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_column" . $id]) : "") . '***' . (isset($_POST['wdform_' . $i . "_input_type" . $id]) ? esc_html($_POST['wdform_' . $i . "_input_type" . $id]) : "") . '***' . $input_value . '***matrix***';
2012
- break;
2013
- }
2014
-
2015
- }
2016
-
2017
- if ($type == "type_address") {
2018
- if ($value == '*#*#*#') {
2019
- continue;
2020
- }
2021
- }
2022
- if ($type == "type_text" or $type == "type_password" or $type == "type_textarea" or $type == "type_name" or $type == "type_submitter_mail" or $type == "type_number" or $type == "type_phone" or $type == "type_phone_new") {
2023
- $untilupload = $form->form_fields;
2024
- $untilupload = substr($untilupload, strpos($untilupload, $i . '*:*id*:*' . $type), -1);
2025
- $untilupload = substr($untilupload, 0, strpos($untilupload, '*:*new_field*:'));
2026
- $untilupload = explode('*:*w_required*:*', $untilupload);
2027
- $untilupload = $untilupload[1];
2028
- $untilupload = explode('*:*w_unique*:*', $untilupload);
2029
- $unique_element = $untilupload[0];
2030
- if (strlen($unique_element) > 3) {
2031
- $unique_element = substr($unique_element, -3);
2032
- }
2033
-
2034
- if ($unique_element == 'yes') {
2035
- $unique = $wpdb->get_col($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id= %d and element_label= %s and element_value= %s", $id, $i, addslashes($value)));
2036
- if ($unique) {
2037
- return array(($max + 1), addslashes(addslashes(sprintf(__('This field %s requires a unique entry.', 'form_maker'), $label_label[$key]))));
2038
- }
2039
- }
2040
- }
2041
- $save_or_no = TRUE;
2042
- $fvals['{' . $i . '}'] = str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***"), array(" ", "", " ", " ", " ", ", "), addslashes($value));
2043
-
2044
- if ($form->savedb) {
2045
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2046
- 'form_id' => $id,
2047
- 'element_label' => $i,
2048
- 'element_value' => stripslashes($value),
2049
- 'group_id' => ($max + 1),
2050
- 'date' => date('Y-m-d H:i:s'),
2051
- 'ip' => $_SERVER['REMOTE_ADDR'],
2052
- 'user_id_wd' => $current_user->ID,
2053
- ), array(
2054
- '%d',
2055
- '%s',
2056
- '%s',
2057
- '%d',
2058
- '%s',
2059
- '%s',
2060
- '%d'
2061
- ));
2062
- }
2063
- if (!$save_or_no) {
2064
- return FALSE;
2065
- }
2066
- $chgnac = FALSE;
2067
- }
2068
- else {
2069
- $fvals['{' . $i . '}'] = '';
2070
- }
2071
- }
2072
-
2073
- $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
2074
- $user_fields = array("subid" => $subid, "ip" => $ip, "userid" => $wp_userid, "username" => $wp_username, "useremail" => $wp_useremail);
2075
-
2076
- $queries = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=%d", (int)$id));
2077
- if ($queries) {
2078
- foreach ($queries as $query) {
2079
- $temp = explode('***wdfcon_typewdf***', $query->details);
2080
- $con_type = $temp[0];
2081
- $temp = explode('***wdfcon_methodwdf***', $temp[1]);
2082
- $con_method = $temp[0];
2083
- $temp = explode('***wdftablewdf***', $temp[1]);
2084
- $table_cur = $temp[0];
2085
- $temp = explode('***wdfhostwdf***', $temp[1]);
2086
- $host = $temp[0];
2087
- $temp = explode('***wdfportwdf***', $temp[1]);
2088
- $port = $temp[0];
2089
- $temp = explode('***wdfusernamewdf***', $temp[1]);
2090
- $username = $temp[0];
2091
- $temp = explode('***wdfpasswordwdf***', $temp[1]);
2092
- $password = $temp[0];
2093
- $temp = explode('***wdfdatabasewdf***', $temp[1]);
2094
- $database = $temp[0];
2095
-
2096
- $query = str_replace(array_keys($fvals), $fvals, $query->query);
2097
- foreach ($user_fields as $user_key => $user_field) {
2098
- $query = str_replace('{' . $user_key . '}', $user_field, $query);
2099
- }
2100
-
2101
- if ($con_type == 'remote') {
2102
- $wpdb_temp = new wpdb($username, $password, $database, $host);
2103
- $wpdb_temp->query($query);
2104
- }
2105
- else {
2106
- $wpdb->query($query);
2107
- }
2108
- }
2109
- // $wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
2110
- }
2111
-
2112
- $addons = array('WD_FM_MAILCHIMP' => 'MailChimp', 'WD_FM_REG' => 'Registration');
2113
- foreach ($addons as $addon => $addon_name) {
2114
- if (defined($addon) && is_plugin_active(constant($addon))) {
2115
- $_GET['addon_task'] = 'frontend';
2116
- $_GET['form_id'] = $id;
2117
- $GLOBALS['fvals'] = $fvals;
2118
- do_action($addon . '_init');
2119
- }
2120
- }
2121
-
2122
- $addons = array('WD_FM_STRIPE' => 'Stripe');
2123
- foreach ($addons as $addon => $addon_name) {
2124
- if (defined($addon) && is_plugin_active(constant($addon))) {
2125
- $_GET['addon_task'] = 'pay_with_stripe';
2126
- $_GET['form_id'] = $id;
2127
-
2128
- $GLOBALS['wdstripe_stripeToken'] = isset($_POST['stripeToken' . $id]) ? $_POST['stripeToken' . $id] : '';
2129
-
2130
- if ($is_amount && isset($_POST['stripeToken' . $id])) {
2131
- $wdstripe_products_data = new stdClass();
2132
- $tax = $form->tax;
2133
- $total = $total + ($total * $tax) / 100;
2134
- $shipping = isset($paypal['shipping']) ? $paypal['shipping'] : 0;
2135
- $total = $total + $shipping;
2136
- $total = round($total, 2);
2137
- $wdstripe_products_data->currency = $form->payment_currency;
2138
- $wdstripe_products_data->amount = $total;
2139
- $wdstripe_products_data->shipping = $shipping;
2140
- $wdstripe_products_data = json_encode($wdstripe_products_data);
2141
- $GLOBALS['wdstripe_products_data'] = $wdstripe_products_data;
2142
- do_action($addon . '_init');
2143
- if (isset($GLOBALS['wdstripe_error'])) {
2144
- return array($max + 1);
2145
- }
2146
- }
2147
- }
2148
- }
2149
-
2150
- $str = '';
2151
-
2152
- if ($form->paypal_mode) {
2153
- if ($paypal['item_name']) {
2154
- if ($is_amount) {
2155
- $tax = $form->tax;
2156
- $currency = $form->payment_currency;
2157
- $business = $form->paypal_email;
2158
- $ip = $_SERVER['REMOTE_ADDR'];
2159
- $total2 = round($total, 2);
2160
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2161
- 'form_id' => $id,
2162
- 'element_label' => 'item_total',
2163
- 'element_value' => $form_currency . $total2,
2164
- 'group_id' => ($max + 1),
2165
- 'date' => date('Y-m-d H:i:s'),
2166
- 'ip' => $ip,
2167
- 'user_id_wd' => $current_user->ID,
2168
- ), array(
2169
- '%d',
2170
- '%s',
2171
- '%s',
2172
- '%d',
2173
- '%s',
2174
- '%s',
2175
- '%d'
2176
- ));
2177
- if (!$save_or_no) {
2178
- return false;
2179
- }
2180
- $total = $total + ($total * $tax) / 100;
2181
- if (isset($paypal['shipping'])) {
2182
- $total = $total + $paypal['shipping'];
2183
- }
2184
- $total = round($total, 2);
2185
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2186
- 'form_id' => $id,
2187
- 'element_label' => 'total',
2188
- 'element_value' => $form_currency . $total,
2189
- 'group_id' => ($max + 1),
2190
- 'date' => date('Y-m-d H:i:s'),
2191
- 'ip' => $ip,
2192
- 'user_id_wd' => $current_user->ID,
2193
- ), array(
2194
- '%d',
2195
- '%s',
2196
- '%s',
2197
- '%d',
2198
- '%s',
2199
- '%s',
2200
- '%d'
2201
- ));
2202
- if (!$save_or_no) {
2203
- return false;
2204
- }
2205
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2206
- 'form_id' => $id,
2207
- 'element_label' => '0',
2208
- 'element_value' => 'In progress',
2209
- 'group_id' => ($max + 1),
2210
- 'date' => date('Y-m-d H:i:s'),
2211
- 'ip' => $ip,
2212
- 'user_id_wd' => $current_user->ID,
2213
- ), array(
2214
- '%d',
2215
- '%s',
2216
- '%s',
2217
- '%d',
2218
- '%s',
2219
- '%s',
2220
- '%d'
2221
- ));
2222
- if (!$save_or_no) {
2223
- return false;
2224
- }
2225
- $str = '';
2226
-
2227
- if ($form->checkout_mode == 1 || $form->checkout_mode == "production") {
2228
- $str .= "https://www.paypal.com/cgi-bin/webscr?";
2229
- }
2230
- else {
2231
- $str .= "https://www.sandbox.paypal.com/cgi-bin/webscr?";
2232
- }
2233
- $str .= "currency_code=" . $currency;
2234
- $str .= "&business=" . urlencode($business);
2235
- $str .= "&cmd=" . "_cart";
2236
- $str .= "&notify_url=" . admin_url('admin-ajax.php?action=checkpaypal%26form_id=' . $id . '%26group_id=' . ($max + 1));
2237
- $str .= "&upload=" . "1";
2238
- $str .= "&charset=UTF-8";
2239
- if (isset($paypal['shipping'])) {
2240
- $str = $str . "&shipping_1=" . $paypal['shipping'];
2241
- // $str=$str."&weight_cart=".$paypal['shipping'];
2242
- // $str=$str."&shipping2=3".$paypal['shipping'];
2243
- $str = $str . "&no_shipping=2";
2244
- }
2245
- $i = 0;
2246
- foreach ($paypal['item_name'] as $pkey => $pitem_name) {
2247
- if ($paypal['amount'][$pkey]) {
2248
- $i++;
2249
- $str = $str . "&item_name_" . $i . "=" . urlencode($pitem_name);
2250
- $str = $str . "&amount_" . $i . "=" . $paypal['amount'][$pkey];
2251
- $str = $str . "&quantity_" . $i . "=" . $paypal['quantity'][$pkey];
2252
- if ($tax) {
2253
- $str = $str . "&tax_rate_" . $i . "=" . $tax;
2254
- }
2255
- if ($paypal['on_os'][$pkey]) {
2256
- foreach ($paypal['on_os'][$pkey]['on'] as $on_os_key => $on_item_name) {
2257
- $str = $str . "&on" . $on_os_key . "_" . $i . "=" . $on_item_name;
2258
- $str = $str . "&os" . $on_os_key . "_" . $i . "=" . $paypal['on_os'][$pkey]['os'][$on_os_key];
2259
- }
2260
- }
2261
- }
2262
- }
2263
- }
2264
- }
2265
- }
2266
-
2267
- if ($form->mail_verify) {
2268
- unset($_SESSION['hash']);
2269
- unset($_SESSION['gid']);
2270
- $ip = $_SERVER['REMOTE_ADDR'];
2271
- $_SESSION['gid'] = $max + 1;
2272
- $send_tos = explode('**', $form->send_to);
2273
- if ($send_tos) {
2274
- foreach ($send_tos as $send_index => $send_to) {
2275
- $_SESSION['hash'][] = md5($ip . time() . rand());
2276
- $send_to = str_replace('*', '', $send_to);
2277
- $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2278
- 'form_id' => $id,
2279
- 'element_label' => 'verifyInfo@' . $send_to,
2280
- 'element_value' => $_SESSION['hash'][$send_index] . "**" . $form->mail_verify_expiretime . "**" . $send_to,
2281
- 'group_id' => ($max + 1),
2282
- 'date' => date('Y-m-d H:i:s'),
2283
- 'ip' => $ip,
2284
- 'user_id_wd' => $current_user->ID,
2285
- ), array(
2286
- '%d',
2287
- '%s',
2288
- '%s',
2289
- '%d',
2290
- '%s',
2291
- '%s',
2292
- '%d'
2293
- ));
2294
- if (!$save_or_no) {
2295
- return false;
2296
- }
2297
- }
2298
- }
2299
- }
2300
-
2301
- if ($chgnac) {
2302
- if ($form->submit_text_type != 4) {
2303
- $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Nothing was submitted.', 'form_maker')));
2304
- }
2305
- $_SESSION['error_or_no' . $id] = 1;
2306
- $_SESSION['form_submit_type' . $id] = $form->submit_text_type . "," . $form->id;
2307
- wp_redirect($_SERVER["REQUEST_URI"]);
2308
- exit;
2309
- }
2310
-
2311
- $addons = array('WD_FM_GDRIVE_INT' => 'GDriveInt', 'WD_FM_DBOX_INT' => 'DboxInt', 'WD_FM_POST_GEN' => 'PostGen', 'WD_FM_PUSHOVER' => 'Pushover'); // the sequence is important for google drive and drop box addons !!!!!!!!!!
2312
- foreach ($addons as $addon => $addon_name) {
2313
- if (defined($addon) && is_plugin_active(constant($addon))) {
2314
- $_GET['addon_task'] = 'frontend';
2315
- $_GET['form_id'] = $id;
2316
- $GLOBALS['all_files'] = json_encode($all_files);
2317
- $GLOBALS['form_currency'] = $form_currency;
2318
- do_action($addon . '_init');
2319
- }
2320
- }
2321
- return array($all_files, $str);
2322
- }
2323
-
2324
- public function remove($group_id) {
2325
- global $wpdb;
2326
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id= %d', $group_id));
2327
- }
2328
-
2329
- public function get_after_submission_text($form_id) {
2330
- global $wpdb;
2331
- $submit_text = $wpdb->get_var("SELECT submit_text FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
2332
- $current_user = wp_get_current_user();
2333
- if ($current_user->ID != 0) {
2334
- $userid = $current_user->ID;
2335
- $username = $current_user->display_name;
2336
- $useremail = $current_user->user_email;
2337
- }
2338
- else {
2339
- $userid = '';
2340
- $username = '';
2341
- $useremail = '';
2342
- }
2343
- $ip = $_SERVER['REMOTE_ADDR'];
2344
- $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
2345
- $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $form_id));
2346
-
2347
- $label_order_original = array();
2348
- $label_order_ids = array();
2349
- $submission_array = array();
2350
- $label_all = explode('#****#', $row->label_order_current);
2351
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
2352
- foreach ($label_all as $key => $label_each) {
2353
- $label_id_each = explode('#**id**#', $label_each);
2354
- $label_id = $label_id_each[0];
2355
- array_push($label_order_ids, $label_id);
2356
- $label_order_each = explode('#**label**#', $label_id_each[1]);
2357
- $label_order_original[$label_id] = $label_order_each[0];
2358
- }
2359
-
2360
- $submissions_row = $wpdb->get_results($wpdb->prepare("SELECT `element_label`, `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=%d AND group_id=%d", $form_id, $subid));
2361
- foreach ($submissions_row as $sub_row) {
2362
- $submission_array[$sub_row->element_label] = $sub_row->element_value;
2363
- }
2364
-
2365
- foreach ($label_order_original as $key => $label_each) {
2366
- if (strpos($submit_text, "%" . $label_each . "%") > -1) {
2367
- $submit_text = str_replace("%" . $label_each . "%", $submission_array[$key], $submit_text);
2368
- }
2369
- }
2370
-
2371
- $custom_fields = array("subid" => $subid, "ip" => $ip, "userid" => $userid, "username" => $username, "useremail" => $useremail);
2372
- foreach ($custom_fields as $key => $custom_field) {
2373
- if (strpos($submit_text, "%" . $key . "%") > -1) {
2374
- $submit_text = str_replace("%" . $key . "%", $custom_field, $submit_text);
2375
- }
2376
- }
2377
- $submit_text = str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***", "***star_rating***"), array(" ", "", " ", " ", " ", ", ", " "), $submit_text);
2378
-
2379
- return $submit_text;
2380
- }
2381
-
2382
- public function increment_views_count($id) {
2383
- global $wpdb;
2384
- $vives_form = $wpdb->get_var($wpdb->prepare("SELECT views FROM " . $wpdb->prefix . "formmaker_views WHERE form_id=%d", $id));
2385
- if (isset($vives_form)) {
2386
- $vives_form = $vives_form + 1;
2387
- $wpdb->update($wpdb->prefix . "formmaker_views", array(
2388
- 'views' => $vives_form,
2389
- ), array('form_id' => $id), array(
2390
- '%d',
2391
- ), array('%d'));
2392
- }
2393
- else {
2394
- $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
2395
- 'form_id' => $id,
2396
- 'views' => 1
2397
- ), array(
2398
- '%d',
2399
- '%d'
2400
- ));
2401
- }
2402
- }
2403
-
2404
- public function gen_mail($counter, $all_files, $id, $str) {
2405
- // checking save uploads option
2406
- global $wpdb;
2407
- $save_uploads = $wpdb->get_var("SELECT save_uploads FROM " . $wpdb->prefix ."formmaker WHERE id=" . $id);
2408
- if($save_uploads == 0){
2409
- $destination = 'wp-content/uploads/tmpAddon';
2410
- if(!file_exists($destination))
2411
- mkdir($destination , 0777);
2412
-
2413
- foreach($all_files as &$all_file){
2414
- $fileTemp = $all_file['tmp_name'];
2415
- $fileName = $all_file['name'];
2416
- if(!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
2417
- return array($max+1, addslashes(__('Error, file cannot be moved.', 'form_maker')));
2418
- }
2419
-
2420
- $all_file['tmp_name'] = $destination . "/" . $fileName;
2421
- }
2422
- }
2423
- $ip = $_SERVER['REMOTE_ADDR'];
2424
- $replyto = '';
2425
- global $wpdb;
2426
- $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $id));
2427
- if (!$row->form_front) {
2428
- $id = '';
2429
- }
2430
-
2431
- $custom_fields = array('ip', 'useremail', 'username', 'subid', 'all' );
2432
- $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
2433
-
2434
- $current_user = wp_get_current_user();
2435
- if ($current_user->ID != 0)
2436
- {
2437
- $username = $current_user->display_name;
2438
- $useremail = $current_user->user_email;
2439
- }
2440
- else
2441
- {
2442
- $username = '';
2443
- $useremail = '';
2444
- }
2445
-
2446
- $label_order_original = array();
2447
- $label_order_ids = array();
2448
- $label_label = array();
2449
- $label_type = array();
2450
- $total = 0;
2451
- $form_currency = '$';
2452
- $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
2453
- $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
2454
- if ($row->payment_currency) {
2455
- $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
2456
- }
2457
-
2458
- $cc = array();
2459
- $row_mail_one_time = 1;
2460
- $label_type = array();
2461
- $label_all = explode('#****#',$row->label_order_current);
2462
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
2463
- foreach ($label_all as $key => $label_each) {
2464
- $label_id_each = explode('#**id**#', $label_each);
2465
- $label_id = $label_id_each[0];
2466
- array_push($label_order_ids, $label_id);
2467
- $label_order_each = explode('#**label**#', $label_id_each[1]);
2468
- $label_order_original[$label_id] = $label_order_each[0];
2469
- $label_type[$label_id] = $label_order_each[1];
2470
- array_push($label_label, $label_order_each[0]);
2471
- array_push($label_type, $label_order_each[1]);
2472
- }
2473
-
2474
- $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
2475
- $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
2476
-
2477
- $list='<table border="1" cellpadding="3" cellspacing="0" style="width:600px;">';
2478
- $list_text_mode = '';
2479
- foreach($label_order_ids as $key => $label_order_id) {
2480
- $i = $label_order_id;
2481
- $type = $label_type[$i];
2482
-
2483
- if($type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button") {
2484
- $element_label=$label_order_original[$i];
2485
- if(!in_array($i,$disabled_fields)) {
2486
- switch ($type) {
2487
- case 'type_text':
2488
- case 'type_password':
2489
- case "type_date":
2490
- case "type_date_new":
2491
- case "type_own_select":
2492
- case "type_country":
2493
- case "type_number":
2494
- case "type_phone_new":
2495
- {
2496
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2497
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2498
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2499
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2500
- }
2501
-
2502
- break;
2503
- }
2504
- case "type_date_range":{
2505
- $element0 = isset($_POST['wdform_'.$i."_element".$id."0"]) ? $_POST['wdform_'.$i."_element".$id."0"] : NULL;
2506
- $element1 = isset($_POST['wdform_'.$i."_element".$id."1"]) ? $_POST['wdform_'.$i."_element".$id."1"] : NULL;
2507
-
2508
- if(isset($element0) && $this->empty_field($element0, $row->mail_emptyfields) && $this->empty_field($element1, $row->mail_emptyfields)) {
2509
- $element = $element0.' - '.$element1;
2510
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2511
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2512
- }
2513
-
2514
- break;
2515
- }
2516
- case 'type_textarea': {
2517
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? wpautop($_POST['wdform_'.$i."_element".$id]) : NULL;
2518
-
2519
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2520
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2521
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2522
- }
2523
- break;
2524
- }
2525
-
2526
- case "type_hidden": {
2527
- $element = isset($_POST[$element_label]) ? $_POST[$element_label] : NULL;
2528
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2529
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2530
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2531
- }
2532
- break;
2533
- }
2534
- case "type_mark_map": {
2535
- $element = isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : NULL;
2536
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2537
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "") . '</td></tr>';
2538
- $list_text_mode=$list_text_mode.$element_label.' - Longitude:'.$element.' Latitude:'.(isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "")."\r\n";
2539
- }
2540
- break;
2541
- }
2542
- case "type_submitter_mail": {
2543
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2544
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2545
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2546
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2547
- }
2548
- break;
2549
- }
2550
-
2551
- case "type_time": {
2552
- $hh = isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : NULL;
2553
- if(isset($hh) && ($this->empty_field($hh, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_mm".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_ss".$id], $row->mail_emptyfields))) {
2554
- $ss = isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL;
2555
- if(isset($ss)) {
2556
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "") . ':' . $ss;
2557
- $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "").':'.$ss;
2558
- }
2559
- else {
2560
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
2561
- $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
2562
- }
2563
- $am_pm = isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL;
2564
- if(isset($am_pm)) {
2565
- $list = $list . ' ' . $am_pm . '</td></tr>';
2566
- $list_text_mode=$list_text_mode.$am_pm."\r\n";
2567
- }
2568
- else {
2569
- $list = $list.'</td></tr>';
2570
- $list_text_mode=$list_text_mode."\r\n";
2571
- }
2572
- }
2573
- break;
2574
- }
2575
-
2576
- case "type_phone": {
2577
- $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
2578
- if(isset($element_first) && $this->empty_field($element_first, $row->mail_emptyfields)) {
2579
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
2580
- $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
2581
- }
2582
- break;
2583
- }
2584
-
2585
- case "type_name": {
2586
- $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
2587
- if(isset($element_first)) {
2588
- $element_title = isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : NULL;
2589
- $element_middle = isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : NULL;
2590
- if((isset($element_title) || isset($element_middle)) && ($this->empty_field($element_title, $row->mail_emptyfields) || $this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_middle".$id], $row->mail_emptyfields))) {
2591
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . (isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '') . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "") . '</td></tr>';
2592
- $list_text_mode=$list_text_mode.$element_label.' - '.(isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '').' '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "").' '.(isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "")."\r\n";
2593
- }
2594
- else {
2595
- if($this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields)) {
2596
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
2597
- $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
2598
- }
2599
- }
2600
- }
2601
- break;
2602
- }
2603
-
2604
- case "type_address": {
2605
- $element = isset($_POST['wdform_'.$i."_street1".$id]) ? $_POST['wdform_'.$i."_street1".$id] : NULL;
2606
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2607
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2608
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2609
- break;
2610
- }
2611
- $element = isset($_POST['wdform_'.$i."_street2".$id]) ? $_POST['wdform_'.$i."_street2".$id] : NULL;
2612
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2613
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2614
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2615
- break;
2616
- }
2617
- $element = isset($_POST['wdform_'.$i."_city".$id]) ? $_POST['wdform_'.$i."_city".$id] : NULL;
2618
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2619
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2620
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2621
- break;
2622
- }
2623
- $element = isset($_POST['wdform_'.$i."_state".$id]) ? $_POST['wdform_'.$i."_state".$id] : NULL;
2624
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2625
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2626
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2627
- break;
2628
- }
2629
- $element = isset($_POST['wdform_'.$i."_postal".$id]) ? $_POST['wdform_'.$i."_postal".$id] : NULL;
2630
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2631
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2632
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2633
- break;
2634
- }
2635
- $element = isset($_POST['wdform_'.$i."_country".$id]) ? $_POST['wdform_'.$i."_country".$id] : NULL;
2636
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2637
- $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2638
- $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2639
- break;
2640
- }
2641
- break;
2642
- }
2643
-
2644
- case "type_date_fields": {
2645
- $day = isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : NULL;
2646
- $month = isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : "";
2647
- $year = isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : "";
2648
- if(isset($day) && $this->empty_field($day, $row->mail_emptyfields)) {
2649
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' .(($day || $month || $year) ? $day . '-' . $month . '-' . $year : '' ). '</td></tr>';
2650
- $list_text_mode=$list_text_mode.$element_label.(($day || $month || $year) ? $day.'-'.$month.'-'.$year : '')."\r\n";
2651
- }
2652
- break;
2653
- }
2654
-
2655
- case "type_radio": {
2656
- $element = isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL;
2657
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2658
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2659
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2660
- break;
2661
- }
2662
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2663
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2664
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2665
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2666
- }
2667
- break;
2668
- }
2669
-
2670
- case "type_checkbox": {
2671
- $start = -1;
2672
- for($j = 0; $j < 100; $j++) {
2673
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2674
- if(isset($element)) {
2675
- $start = $j;
2676
- break;
2677
- }
2678
- }
2679
- $other_element_id = -1;
2680
- $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
2681
- if($is_other == "yes") {
2682
- $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
2683
- }
2684
-
2685
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2686
- {
2687
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2688
- $list_text_mode=$list_text_mode.$element_label.' - ';
2689
- }
2690
-
2691
- if($start != -1) {
2692
- for($j = $start; $j < 100; $j++) {
2693
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2694
- if(isset($element)) {
2695
- if($j == $other_element_id) {
2696
- $list = $list . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '<br>';
2697
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "").', ';
2698
- }
2699
- else {
2700
- $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "") . '<br>';
2701
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "").', ';
2702
- }
2703
- }
2704
- }
2705
- }
2706
-
2707
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2708
- {
2709
- $list = $list . '</td></tr>';
2710
- $list_text_mode=$list_text_mode."\r\n";
2711
- }
2712
- break;
2713
- }
2714
-
2715
- case "type_paypal_price": {
2716
- $value = 0;
2717
- if(isset($_POST['wdform_'.$i."_element_dollars".$id])) {
2718
- $value = $_POST['wdform_'.$i."_element_dollars".$id];
2719
- }
2720
- if(isset($_POST['wdform_'.$i."_element_cents".$id]) && $_POST['wdform_'.$i."_element_cents".$id]) {
2721
- $value = $value . '.' . $_POST['wdform_'.$i."_element_cents".$id];
2722
- }
2723
-
2724
- if($this->empty_field($value, $row->mail_emptyfields) && $value!='.')
2725
- {
2726
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . $form_currency . '</td></tr>';
2727
- $list_text_mode=$list_text_mode.$element_label.' - '.$value.$form_currency."\r\n";
2728
- }
2729
- break;
2730
- }
2731
-
2732
- case "type_paypal_price_new": {
2733
- $value = 0;
2734
- if(isset($_POST['wdform_'.$i."_element".$id])) {
2735
- $value = $_POST['wdform_'.$i."_element".$id];
2736
- }
2737
-
2738
- if($this->empty_field($value, $row->mail_emptyfields) && $value!='.')
2739
- {
2740
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . ($value == '' ? '' : $form_currency) . $value . '</td></tr>';
2741
- $list_text_mode=$list_text_mode.$element_label.' - '.$value.$form_currency."\r\n";
2742
- }
2743
- break;
2744
- }
2745
-
2746
- case "type_paypal_select": {
2747
- $value='';
2748
- if(isset($_POST['wdform_'.$i."_element_label".$id]) && $_POST['wdform_'.$i."_element".$id] != '') {
2749
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . $form_currency . $_POST['wdform_'.$i."_element".$id];
2750
- }
2751
-
2752
- $element_quantity_label = (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) && $_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2753
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2754
- if($value != ''){
2755
-
2756
- if(isset($element_quantity)) {
2757
- $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2758
- }
2759
-
2760
- for($k = 0; $k < 50; $k++) {
2761
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
2762
- if(isset($temp_val)) {
2763
- $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2764
- }
2765
- }
2766
- }
2767
-
2768
- if($this->empty_field($value, $row->mail_emptyfields))
2769
- {
2770
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2771
- $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
2772
- }
2773
-
2774
- break;
2775
- }
2776
-
2777
- case "type_paypal_radio": {
2778
- if(isset($_POST['wdform_'.$i."_element".$id])) {
2779
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . $form_currency . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "");
2780
-
2781
- $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2782
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2783
- if (isset($element_quantity)) {
2784
- $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2785
- }
2786
- for($k = 0; $k < 50; $k++) {
2787
- $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
2788
- if(isset($temp_val)) {
2789
- $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2790
- }
2791
- }
2792
- }
2793
- else {
2794
- $value='';
2795
- }
2796
-
2797
- if($this->empty_field($value, $row->mail_emptyfields))
2798
- {
2799
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2800
- $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
2801
- }
2802
- break;
2803
- }
2804
-
2805
- case "type_paypal_shipping": {
2806
- if(isset($_POST['wdform_'.$i."_element".$id])) {
2807
- $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . $form_currency . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "");
2808
-
2809
- if($this->empty_field($value, $row->mail_emptyfields))
2810
- {
2811
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2812
- $list_text_mode=$list_text_mode.$element_label.' - '.$value."\r\n";
2813
- }
2814
- }
2815
- else {
2816
- $value='';
2817
- }
2818
-
2819
- break;
2820
- }
2821
-
2822
- case "type_paypal_checkbox": {
2823
-
2824
- $start = -1;
2825
- for($j = 0; $j < 300; $j++) {
2826
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2827
- if(isset($element)) {
2828
- $start=$j;
2829
- break;
2830
- }
2831
- }
2832
-
2833
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2834
- {
2835
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2836
- $list_text_mode=$list_text_mode.$element_label.' - ';
2837
- }
2838
- if($start!=-1) {
2839
- for($j = $start; $j < 300; $j++) {
2840
- $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2841
- if(isset($element)) {
2842
- $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "") . ' - ' . $form_currency . ($element == '' ? '0' : $element) . '<br>';
2843
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "").' - '.($element == '' ? '0' . $form_currency : $element).$form_currency.', ';
2844
- }
2845
- }
2846
- }
2847
- $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2848
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2849
- if (isset($element_quantity)) {
2850
- $list = $list . '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2851
- $list_text_mode=$list_text_mode.$element_quantity_label . ': ' . $element_quantity.', ';
2852
- }
2853
- for($k = 0; $k < 50; $k++) {
2854
- $temp_val = isset($_POST['wdform_'.$i."_element_property_value".$id.$k]) ? $_POST['wdform_'.$i."_element_property_value".$id.$k] : NULL;
2855
- if(isset($temp_val)) {
2856
- $list = $list . '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2857
- $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val.', ';
2858
- }
2859
- }
2860
- if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2861
- {
2862
- $list = $list . '</td></tr>';
2863
- $list_text_mode=$list_text_mode."\r\n";
2864
- }
2865
- break;
2866
- }
2867
-
2868
- case "type_paypal_total": {
2869
- $element = isset($_POST['wdform_'.$i."_paypal_total".$id]) ? $_POST['wdform_'.$i."_paypal_total".$id] : "";
2870
- if($this->empty_field($element, $row->mail_emptyfields))
2871
- {
2872
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2873
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2874
- }
2875
- break;
2876
- }
2877
-
2878
- case "type_star_rating": {
2879
- $element = isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : NULL;
2880
- $selected = isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : 0;
2881
- if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2882
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2883
- $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2884
- }
2885
- break;
2886
- }
2887
-
2888
- case "type_scale_rating": {
2889
- $element = isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : NULL;
2890
- $selected = isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0;
2891
- if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2892
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2893
- $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2894
- }
2895
- break;
2896
- }
2897
-
2898
- case "type_spinner": {
2899
- $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2900
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2901
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2902
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2903
- }
2904
- break;
2905
- }
2906
-
2907
- case "type_slider": {
2908
- $element = isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : NULL;
2909
- if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2910
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2911
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2912
- }
2913
- break;
2914
- }
2915
-
2916
- case "type_range": {
2917
- $element0 = isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : NULL;
2918
- $element1 = isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : NULL;
2919
- if((isset($element0) && $this->empty_field($element0, $row->mail_emptyfields)) || (isset($element1) && $this->empty_field($element1, $row->mail_emptyfields))) {
2920
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >From:' . $element0 . '<span style="margin-left:6px">To</span>:' . $element1 . '</td></tr>';
2921
- $list_text_mode=$list_text_mode.$element_label.' - From:'.$element0.' To:'.$element1."\r\n";
2922
- }
2923
- break;
2924
- }
2925
-
2926
- case "type_grading": {
2927
- $element = isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "";
2928
- $grading = explode(":", $element);
2929
- $items_count = sizeof($grading) - 1;
2930
- $element = "";
2931
- $total = "";
2932
- $form_empty_field = 1;
2933
- for($k = 0;$k < $items_count; $k++) {
2934
- $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : "") . " ";
2935
- $total += (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : 0);
2936
- if(isset($_POST['wdform_'.$i."_element".$id.'_'.$k]))
2937
- $form_empty_field = 0;
2938
- }
2939
- $element .= "Total:" . $total;
2940
- if(isset($element) && $this->empty_field($form_empty_field, $row->mail_emptyfields)) {
2941
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2942
- $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2943
- }
2944
- break;
2945
- }
2946
-
2947
- case "type_matrix": {
2948
- $input_type = isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : "";
2949
- $mat_rows = explode("***", isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "");
2950
- $rows_count = sizeof($mat_rows) - 1;
2951
- $mat_columns = explode("***", isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "");
2952
- $columns_count = sizeof($mat_columns) - 1;
2953
- $matrix = "<table>";
2954
- $matrix .= '<tr><td></td>';
2955
- for($k = 1; $k < count($mat_columns); $k++) {
2956
- $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
2957
- }
2958
- $matrix .= '</tr>';
2959
- $aaa = Array();
2960
- for($k = 1; $k <= $rows_count; $k++) {
2961
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
2962
- if($input_type == "radio") {
2963
- $mat_radio = isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0;
2964
- if($mat_radio == 0) {
2965
- $checked = "";
2966
- $aaa[1] = "";
2967
- }
2968
- else {
2969
- $aaa = explode("_", $mat_radio);
2970
- }
2971
- for($j = 1; $j <= $columns_count; $j++) {
2972
- if($aaa[1] == $j) {
2973
- $checked = "checked";
2974
- }
2975
- else {
2976
- $checked = "";
2977
- }
2978
- $sign = $checked == 'checked' ? '&#x2714;' : '';
2979
- $matrix .= '<td style="text-align:center">'.$sign.'</td>';
2980
- }
2981
- }
2982
- else {
2983
- if($input_type == "checkbox") {
2984
- for($j = 1; $j <= $columns_count; $j++) {
2985
- $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : "";
2986
- if($checked == 1) {
2987
- $checked = "checked";
2988
- }
2989
- else {
2990
- $checked = "";
2991
- }
2992
- $sign = $checked == 'checked' ? '&#x2714;' : '';
2993
- $matrix .= '<td style="text-align:center">'.$sign.'</td>';
2994
- }
2995
- }
2996
- else {
2997
- if($input_type == "text") {
2998
- for($j = 1; $j <= $columns_count; $j++) {
2999
- $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? esc_html($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) : "";
3000
- $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
3001
- }
3002
- }
3003
- else {
3004
- for($j = 1; $j <= $columns_count; $j++) {
3005
- $checked = isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : "";
3006
- $matrix .= '<td style="text-align:center">' . $checked . '</td>';
3007
- }
3008
- }
3009
- }
3010
- }
3011
- $matrix .= '</tr>';
3012
- }
3013
- $matrix .= '</table>';
3014
- if(isset($matrix)) {
3015
- $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $matrix . '</td></tr>';
3016
- }
3017
- break;
3018
- }
3019
- default: break;
3020
- }
3021
- }
3022
- }
3023
- }
3024
-
3025
- $list = $list . '</table>';
3026
- if($row->sendemail) {
3027
- $fromname = $row->mail_from_name_user;
3028
- if($row->mail_subject_user)
3029
- $subject = $row->mail_subject_user;
3030
- else
3031
- $subject = $row->title;
3032
- if($row->reply_to_user) {
3033
- $replyto = $row->reply_to_user;
3034
- }
3035
- $attachment_user = array();
3036
- if ($row->mail_attachment_user) {
3037
- for ($k = 0; $k < count($all_files); $k++) {
3038
- if (isset($all_files[$k]['tmp_name'])) {
3039
- if(!isset($attachment_user[$all_files[$k]['field_key']]))
3040
- $attachment_user[$all_files[$k]['field_key']] = array();
3041
- array_push($attachment_user[$all_files[$k]['field_key']], $all_files[$k]['tmp_name']);
3042
- }
3043
- }
3044
- }
3045
-
3046
- if ($row->mail_mode_user) {
3047
- $content_type = "text/html";
3048
- $mode = 1;
3049
- $list_user = wordwrap($list, 100, "\n", true);
3050
- $new_script = wpautop($row->script_mail_user);
3051
- }
3052
- else {
3053
- $content_type = "text/plain";
3054
- $mode = 0;
3055
- $list_user = wordwrap($list_text_mode, 1000, "\n", true);
3056
- $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail_user);
3057
- }
3058
-
3059
- foreach($label_order_original as $key => $label_each) {
3060
- $type=$label_type[$key];
3061
- $key1 = $type == 'type_hidden' ? $label_each : $key;
3062
- if(strpos($new_script, "%".$label_each."%") > -1) {
3063
- $new_value = $this->custom_fields_mail($type, $key1, $id, $attachment_user, $form_currency);
3064
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3065
- }
3066
-
3067
- if($type == "type_file_upload" && strpos($new_script, "%".$label_each."(link)%") > -1) {
3068
- $new_value = $this->custom_fields_mail($type, $key, $id, $attachment_user, $form_currency, 1);
3069
- $new_script = str_replace("%".$label_each."(link)%", $new_value, $new_script);
3070
- }
3071
-
3072
-
3073
- if(strpos($fromname, "%".$label_each."%")>-1) {
3074
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
3075
- if(substr($new_value, -2)==', ') {
3076
- $new_value = substr($new_value, 0, -2);
3077
- }
3078
- $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
3079
- }
3080
-
3081
- if(strpos($subject, "%".$label_each."%")>-1) {
3082
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', $form_currency));
3083
- if(substr($new_value, -2)==', ') {
3084
- $new_value = substr($new_value, 0, -2);
3085
- }
3086
- $subject = str_replace("%".$label_each."%", $new_value, $subject);
3087
- }
3088
- }
3089
-
3090
- $recipient = '';
3091
- $cca = $row->mail_cc_user;
3092
- $bcc = $row->mail_bcc_user;
3093
- if ($row->mail_from_user != '') {
3094
- if ($fromname != '') {
3095
- $from = "From: '" . $fromname . "' <" . $row->mail_from_user . ">" . "\r\n";
3096
- }
3097
- else {
3098
- $from = "From: '' <" . $row->mail_from_user . ">" . "\r\n";
3099
- }
3100
- }
3101
- else {
3102
- $from = '';
3103
- }
3104
-
3105
- $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
3106
- if ($replyto) {
3107
- $headers .= "Reply-To: <" . $replyto . ">\r\n";
3108
- }
3109
- if ($cca) {
3110
- $headers .= "Cc: " . $cca . "\r\n";
3111
- }
3112
- if ($bcc) {
3113
- $headers .= "Bcc: " . $bcc . "\r\n";
3114
- }
3115
-
3116
- $custom_fields_value = array( $ip, $useremail, $username, $subid, $list_user );
3117
- foreach($custom_fields as $key=>$custom_field)
3118
- {
3119
- if(strpos($new_script, "%".$custom_field."%")>-1)
3120
- $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
3121
-
3122
- if($key==2 || $key==3)
3123
- {
3124
- if(strpos($fromname, "%".$custom_field."%")>-1)
3125
- $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
3126
-
3127
- if(strpos($subject, "%".$custom_field."%")>-1)
3128
- $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
3129
- }
3130
- }
3131
- $body = $new_script;
3132
- $GLOBALS['attachment_user'] = '';
3133
- $GLOBALS['attachment'] = '';
3134
- if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
3135
- $_GET['addon_task'] = 'frontend';
3136
- $_GET['form_id'] = $id;
3137
- $_GET['form_currency'] = $form_currency;
3138
- $GLOBALS['custom_fields_value'] = $custom_fields_value;
3139
- do_action('WD_FM_PDF_init');
3140
- }
3141
-
3142
- if($GLOBALS['attachment_user']){
3143
- array_push($attachment_user, $GLOBALS['attachment_user']);
3144
- }
3145
-
3146
- if($row->send_to) {
3147
- $send_tos = explode('**',$row->send_to);
3148
- $send_copy = isset($_POST["wdform_send_copy_".$id]) ? $_POST["wdform_send_copy_".$id] : NULL;
3149
- if(isset($send_copy)) {
3150
- $send=true;
3151
- }
3152
- else {
3153
- $mail_verification_post_id = (int)$wpdb->get_var($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
3154
- $verification_link = get_post( $mail_verification_post_id );
3155
- foreach($send_tos as $index => $send_to) {
3156
- $recipient = isset($_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id]) ? $_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id] : NULL;
3157
- if(strpos($new_script, "%Verification link%")>-1 && $verification_link !== NULL) {
3158
- $ver_link = $row->mail_mode_user ? "<a href =".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id)).">".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id))."</a><br/>" : add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id));
3159
-
3160
- $body = $row->mail_verify ? str_replace("%Verification link%", $ver_link, $new_script) : str_replace("%Verification link%", '', $new_script);
3161
- }
3162
-
3163
-
3164
-
3165
- if($recipient) {
3166
- $remove_parrent_array_user = new RecursiveIteratorIterator(new RecursiveArrayIterator($attachment_user));
3167
-
3168
-
3169
-
3170
- $attachment_user = iterator_to_array($remove_parrent_array_user, false);
3171
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment_user);
3172
- }
3173
- }
3174
- }
3175
- }
3176
- }
3177
-
3178
- if($row->sendemail) {
3179
- if($row->reply_to) {
3180
- $replyto = isset($_POST['wdform_'.$row->reply_to."_element".$id]) ? $_POST['wdform_'.$row->reply_to."_element".$id] : NULL;
3181
- if(!isset($replyto)) {
3182
- $replyto = $row->reply_to;
3183
- }
3184
- }
3185
- $recipient = $row->mail;
3186
- if($row->mail_subject) {
3187
- $subject = $row->mail_subject;
3188
- }
3189
- else {
3190
- $subject = $row->title;
3191
- }
3192
-
3193
- $fromname = $row->from_name;
3194
- $attachment = array();
3195
- if ($row->mail_attachment) {
3196
- for ($k = 0; $k < count($all_files); $k++) {
3197
- if (isset($all_files[$k]['tmp_name'])) {
3198
- if(!isset($attachment[$all_files[$k]['field_key']]))
3199
- $attachment[$all_files[$k]['field_key']] = array();
3200
- array_push($attachment[$all_files[$k]['field_key']], $all_files[$k]['tmp_name']);
3201
- }
3202
- }
3203
- }
3204
- if($GLOBALS['attachment']){
3205
- array_push($attachment, $GLOBALS['attachment']);
3206
- }
3207
-
3208
- if ($row->mail_mode) {
3209
- $content_type = "text/html";
3210
- $mode = 1;
3211
- $list = wordwrap($list, 100, "\n", true);
3212
- $new_script = wpautop($row->script_mail);
3213
- }
3214
- else {
3215
- $content_type = "text/plain";
3216
- $mode = 0;
3217
- $list = $list_text_mode;
3218
- $list = wordwrap($list, 1000, "\n", true);
3219
- $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail);
3220
- }
3221
-
3222
-
3223
- foreach($label_order_original as $key => $label_each) {
3224
- $type=$label_type[$key];
3225
- $key1 = $type == 'type_hidden' ? $label_each : $key;
3226
- if(strpos($new_script, "%".$label_each."%") > -1) {
3227
- $new_value = $this->custom_fields_mail($type, $key1, $id, $attachment, $form_currency);
3228
- $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3229
- }
3230
-
3231
- if($type == "type_file_upload" && strpos($new_script, "%".$label_each."(link)%") > -1) {
3232
-
3233
- $new_value = $this->custom_fields_mail($type, $key, $id, $attachment, $form_currency, 1);
3234
- $new_script = str_replace("%".$label_each."(link)%", $new_value, $new_script);
3235
- }
3236
-
3237
- if(strpos($fromname, "%".$label_each."%")>-1) {
3238
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', $form_currency));
3239
- if(substr($new_value, -2)==', ') {
3240
- $new_value = substr($new_value, 0, -2);
3241
- }
3242
- $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
3243
- }
3244
-
3245
- if(strpos($fromname, "%username%")>-1){
3246
- $fromname = str_replace("%username%", $username, $fromname);
3247
- }
3248
-
3249
- if(strpos($subject, "%".$label_each."%")>-1) {
3250
- $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', $form_currency));
3251
- if(substr($new_value, -2)==', ') {
3252
- $new_value = substr($new_value, 0, -2);
3253
- }
3254
- $subject = str_replace("%".$label_each."%", $new_value, $subject);
3255
- }
3256
- }
3257
-
3258
- if ($row->from_mail) {
3259
- $from = isset($_POST['wdform_'.$row->from_mail."_element".$id]) ? $_POST['wdform_'.$row->from_mail."_element".$id] : NULL;
3260
- if (!isset($from)) {
3261
- $from = $row->from_mail;
3262
- }
3263
-
3264
- if ($fromname != '') {
3265
- $from = "From: '" . $fromname . "' <" . $from . ">" . "\r\n";
3266
- }
3267
- else {
3268
- $from = "From: '' <" . $from . ">" . "\r\n";
3269
- }
3270
- }
3271
- else {
3272
- $from = "";
3273
- }
3274
-
3275
- $cca = $row->mail_cc;
3276
- $bcc = $row->mail_bcc;
3277
- $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
3278
- if ($replyto) {
3279
- $headers .= "Reply-To: <" . $replyto . ">\r\n";
3280
- }
3281
- if ($cca) {
3282
- $headers .= "Cc: " . $cca . "\r\n";
3283
- }
3284
- if ($bcc) {
3285
- $headers .= "Bcc: " . $bcc . "\r\n";
3286
- }
3287
-
3288
- $custom_fields_value = array( $ip, $useremail, $username, $subid, $list );
3289
- foreach($custom_fields as $key=>$custom_field)
3290
- {
3291
- if(strpos($new_script, "%".$custom_field."%")>-1)
3292
- $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
3293
-
3294
- if($key==2 || $key==3)
3295
- {
3296
- if(strpos($fromname, "%".$custom_field."%")>-1)
3297
- $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
3298
-
3299
- if(strpos($subject, "%".$custom_field."%")>-1)
3300
- $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
3301
- }
3302
- }
3303
- $admin_body = $new_script;
3304
- $remove_parrent_array = new RecursiveIteratorIterator(new RecursiveArrayIterator($attachment));
3305
- $attachment = iterator_to_array($remove_parrent_array, false);
3306
-
3307
- if($recipient) {
3308
- $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($admin_body), $headers, $attachment);
3309
- }
3310
- }
3311
-
3312
- $_SESSION['error_or_no' . $id] = 0;
3313
- $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
3314
- $succes = 1;
3315
-
3316
- if($row->sendemail)
3317
- if($row->mail || $row->send_to) {
3318
- if ($send) {
3319
- if ($send !== true ) {
3320
- $_SESSION['error_or_no' . $id] = 1;
3321
- $msg = addslashes(__('Error, email was not sent.', 'form_maker'));
3322
- $succes = 0;
3323
- }
3324
- else {
3325
- $_SESSION['error_or_no' . $id] = 0;
3326
- $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
3327
- }
3328
- }
3329
- }
3330
-
3331
- $fm_email_params = $row->sendemail ? array('admin_body' => $admin_body, 'body' => $body, 'subject' => $subject, 'headers' => $headers, 'attachment' => $attachment, 'attachment_user' => $attachment_user) : array();
3332
-
3333
- $addons = array('WD_FM_EMAIL_COND' => 'Email Conditions');
3334
- $addons_array = array();
3335
- foreach($addons as $addon => $addon_name) {
3336
- if (defined($addon) && is_plugin_active(constant($addon))) {
3337
- $_GET['addon_task'] = 'frontend';
3338
- $_GET['form_id'] = $id;
3339
- $GLOBALS['fm_email_params'] = $fm_email_params;
3340
- $GLOBALS['form_currency'] = $form_currency;
3341
- $GLOBALS['custom_fields_value'] = isset($custom_fields_value) ? $custom_fields_value : array();
3342
- do_action($addon.'_init');
3343
- }
3344
- }
3345
- // delete files from uploads (save_upload = 0)
3346
- if($row->save_uploads == 0){
3347
- foreach ($all_files as &$all_file) {
3348
- if (file_exists(ABSPATH.'/'.$all_file['tmp_name'])) {
3349
- unlink(ABSPATH.'/'.$all_file['tmp_name']);
3350
- }
3351
- }
3352
-
3353
- }
3354
- $https = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
3355
- if ($row->submit_text_type == 0 || $row->submit_text_type == 1 || $row->submit_text_type == 3) {
3356
- $_SESSION['massage_after_submit' . $id] = $msg;
3357
- if($row->type == 'popover' || $row->type == 'topbar' || $row->type == 'scrollbox'){
3358
- $_SESSION['fm_hide_form_after_submit' . $id] = 1;
3359
- }
3360
- }
3361
- switch ($row->submit_text_type) {
3362
- case "2":
3363
- case "5": {
3364
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3365
- if ($row->article_id) {
3366
- $redirect_url = $row->article_id;
3367
- }
3368
- else {
3369
- $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
3370
- }
3371
- break;
3372
- }
3373
- case "3": {
3374
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3375
- $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
3376
- break;
3377
- }
3378
- case "4": {
3379
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3380
- $redirect_url = $row->url;
3381
- break;
3382
- }
3383
- default: {
3384
- $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3385
- $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
3386
- break;
3387
- }
3388
- }
3389
- if (!$str) {
3390
- wp_redirect(html_entity_decode($redirect_url));
3391
- exit;
3392
- }
3393
- else {
3394
- $_SESSION['redirect_paypal'.$id] = 1;
3395
-
3396
- $str .= "&return=" . urlencode($redirect_url);
3397
- wp_redirect($str);
3398
- exit;
3399
- }
3400
- }
3401
-
3402
- public static function custom_fields_mail($type, $key, $id, $attachment, $form_currency, $file_upload_link = 0)
3403
- {
3404
- $new_value ="";
3405
-
3406
- $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
3407
- $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
3408
-
3409
- if($type!="type_submit_reset" or $type!="type_map" or $type!="type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
3410
- switch ($type) {
3411
- case 'type_text':
3412
- case 'type_password':
3413
- case 'type_textarea':
3414
- case "type_date":
3415
- case "type_date_new":
3416
- case "type_own_select":
3417
- case "type_country":
3418
- case "type_number":
3419
- {
3420
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3421
- if(isset($element)) {
3422
- $new_value = $element;
3423
- }
3424
- break;
3425
- }
3426
- case 'type_date_range' :{
3427
- $element0 = isset($_POST['wdform_'.$key."_element".$id."0"]) ? $_POST['wdform_'.$key."_element".$id."0"] : NULL;
3428
- $element1 = isset($_POST['wdform_'.$key."_element".$id."1"]) ? $_POST['wdform_'.$key."_element".$id."1"] : NULL;
3429
- $element = $element0.' - '.$element1;
3430
- $new_value = $element;
3431
- }
3432
- case "type_file_upload": {
3433
- if(isset($attachment[$key])) {
3434
- foreach($attachment[$key] as $attach) {
3435
- $uploadedFileNameParts = explode('.', $attach);
3436
- $uploadedFileExtension = array_pop($uploadedFileNameParts);
3437
- if($file_upload_link == 1){
3438
- $new_value .= '<a href="'.site_url().'/'.$attach.'"/>'.site_url().'/'.$attach.'</a><br />';
3439
- }
3440
- else {
3441
- $invalidFileExts = array('gif', 'jpg', 'jpeg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'jpc', 'jp2', 'jpf', 'jb2', 'swc', 'aiff', 'wbmp', 'xbm' );
3442
- $extOk = false;
3443
-
3444
- foreach($invalidFileExts as $key => $valuee)
3445
- {
3446
- if(is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension) )) )
3447
- $extOk = true;
3448
- }
3449
-
3450
- if ($extOk == true)
3451
- $new_value .= '<img src="'.site_url().'/'.$attach.'" alt="'.$attach.'"/>';
3452
-
3453
- }
3454
- }
3455
- }
3456
-
3457
- break;
3458
- }
3459
- case "type_hidden": {
3460
- $element = isset($_POST[$key]) ? $_POST[$key] : NULL;
3461
- if(isset($element)) {
3462
- $new_value = $element;
3463
- }
3464
- break;
3465
- }
3466
- case "type_mark_map": {
3467
- $element = isset($_POST['wdform_'.$key."_long".$id]) ? $_POST['wdform_'.$key."_long".$id] : NULL;
3468
- if(isset($element)) {
3469
- $new_value = 'Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$key."_lat".$id]) ? $_POST['wdform_'.$key."_lat".$id] : "");
3470
- }
3471
- break;
3472
- }
3473
- case "type_submitter_mail": {
3474
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3475
- if(isset($element)) {
3476
- $new_value = $element;
3477
- }
3478
- break;
3479
- }
3480
- case "type_time": {
3481
- $hh = isset($_POST['wdform_'.$key."_hh".$id]) ? $_POST['wdform_'.$key."_hh".$id] : NULL;
3482
- if(isset($hh)) {
3483
- $ss = isset($_POST['wdform_'.$key."_ss".$id]) ? $_POST['wdform_'.$key."_ss".$id] : NULL;
3484
- if(isset($ss)) {
3485
- $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "") . ':' . $ss;
3486
- }
3487
- else {
3488
- $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "");
3489
- }
3490
- $am_pm = isset($_POST['wdform_'.$key."_am_pm".$id]) ? $_POST['wdform_'.$key."_am_pm".$id] : NULL;
3491
- if(isset($am_pm)) {
3492
- $new_value = $new_value . ' ' . $am_pm;
3493
- }
3494
- }
3495
- break;
3496
- }
3497
-
3498
- case "type_phone": {
3499
- $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
3500
- if(isset($element_first)) {
3501
- $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
3502
- }
3503
- break;
3504
- }
3505
- case "type_name": {
3506
- $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
3507
- if(isset($element_first)) {
3508
- $element_title = isset($_POST['wdform_'.$key."_element_title".$id]) ? $_POST['wdform_'.$key."_element_title".$id] : NULL;
3509
- if(isset($element_title)) {
3510
- $new_value = $element_title . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$key."_element_middle".$id]) ? $_POST['wdform_'.$key."_element_middle".$id] : "");
3511
- }
3512
- else {
3513
- $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
3514
- }
3515
- }
3516
- break;
3517
- }
3518
- case "type_address": {
3519
- $street1 = isset($_POST['wdform_'.$key."_street1".$id]) ? $_POST['wdform_'.$key."_street1".$id] : NULL;
3520
- if(isset($street1)) {
3521
- $new_value = $street1;
3522
- break;
3523
- }
3524
- $street2 = isset($_POST['wdform_'.$key."_street2".$id]) ? $_POST['wdform_'.$key."_street2".$id] : NULL;
3525
- if(isset($street2)) {
3526
- $new_value = $street2;
3527
- break;
3528
- }
3529
- $city = isset($_POST['wdform_'.$key."_city".$id]) ? $_POST['wdform_'.$key."_city".$id] : NULL;
3530
- if(isset($city)) {
3531
- $new_value = $city;
3532
- break;
3533
- }
3534
- $state = isset($_POST['wdform_'.$key."_state".$id]) ? $_POST['wdform_'.$key."_state".$id] : NULL;
3535
- if(isset($state)) {
3536
- $new_value = $state;
3537
- break;
3538
- }
3539
- $postal = isset($_POST['wdform_'.$key."_postal".$id]) ? $_POST['wdform_'.$key."_postal".$id] : NULL;
3540
- if(isset($postal)) {
3541
- $new_value = $postal;
3542
- break;
3543
- }
3544
- $country = isset($_POST['wdform_'.$key."_country".$id]) ? $_POST['wdform_'.$key."_country".$id] : NULL;
3545
- if(isset($country)) {
3546
- $new_value = $country;
3547
- break;
3548
- }
3549
- break;
3550
- }
3551
- case "type_date_fields": {
3552
- $day = isset($_POST['wdform_'.$key."_day".$id]) ? $_POST['wdform_'.$key."_day".$id] : NULL;
3553
- if(isset($day)) {
3554
- $new_value = $day . '-' . (isset($_POST['wdform_'.$key."_month".$id]) ? $_POST['wdform_'.$key."_month".$id] : "") . '-' . (isset($_POST['wdform_'.$key."_year".$id]) ? $_POST['wdform_'.$key."_year".$id] : "");
3555
- }
3556
- break;
3557
- }
3558
-
3559
- case "type_radio": {
3560
- $element = isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : NULL;
3561
- if(isset($element)) {
3562
- $new_value = $element;
3563
- break;
3564
- }
3565
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3566
- if(isset($element)) {
3567
- $new_value = $element;
3568
- }
3569
- break;
3570
- }
3571
- case "type_checkbox": {
3572
- $start = -1;
3573
- for($j = 0; $j < 100; $j++) {
3574
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3575
- if(isset($element)) {
3576
- $start = $j;
3577
- break;
3578
- }
3579
- }
3580
- $other_element_id = -1;
3581
- $is_other = isset($_POST['wdform_'.$key."_allow_other".$id]) ? $_POST['wdform_'.$key."_allow_other".$id] : "";
3582
- if($is_other == "yes") {
3583
- $other_element_id = isset($_POST['wdform_'.$key."_allow_other_num".$id]) ? $_POST['wdform_'.$key."_allow_other_num".$id] : "";
3584
- }
3585
- if($start != -1) {
3586
- for($j = $start; $j < 100; $j++) {
3587
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3588
- if(isset($element)) {
3589
- if($j == $other_element_id) {
3590
- $new_value = $new_value . (isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : "") . '<br>';
3591
- }
3592
- else {
3593
- $new_value = $new_value . $element . '<br>';
3594
- }
3595
- }
3596
- }
3597
- }
3598
- break;
3599
- }
3600
- case "type_paypal_price": {
3601
- $new_value = 0;
3602
- if(isset($_POST['wdform_'.$key."_element_dollars".$id])) {
3603
- $new_value = $_POST['wdform_'.$key."_element_dollars".$id];
3604
- }
3605
- if(isset($_POST['wdform_'.$key."_element_cents".$id])) {
3606
- $new_value = $new_value . '.' . $_POST['wdform_'.$key."_element_cents".$id];
3607
- }
3608
- $new_value = $new_value . $form_currency;
3609
- break;
3610
- }
3611
-
3612
- case "type_paypal_price_new": {
3613
- $new_value = '';
3614
- if(isset($_POST['wdform_'.$key."_element".$id] ) && $_POST['wdform_'.$key."_element".$id]) {
3615
- $new_value = $form_currency . $_POST['wdform_'.$key."_element".$id];
3616
- }
3617
- $new_value = $new_value;
3618
- break;
3619
- }
3620
-
3621
- case "type_paypal_select": {
3622
- $element = isset($_POST['wdform_'.$key."_element".$id]) && $_POST['wdform_'.$key."_element".$id] ? $_POST['wdform_'.$key."_element".$id] : '';
3623
- if($element){
3624
- $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ' : ' . $form_currency. $element;
3625
-
3626
- $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
3627
- $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
3628
- if (isset($element_quantity)) {
3629
- $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
3630
- }
3631
- for($k = 0; $k < 50; $k++) {
3632
- $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
3633
- if(isset($temp_val)) {
3634
- $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
3635
- }
3636
- }
3637
- }
3638
- break;
3639
- }
3640
- case "type_paypal_radio": {
3641
-
3642
-
3643
- $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . (isset($_POST['wdform_'.$key."_element".$id]) && $_POST['wdform_'.$key."_element".$id] ? ' - ' . $form_currency . $_POST['wdform_'.$key."_element".$id] : "") ;
3644
- $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
3645
- $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
3646
- if (isset($element_quantity)) {
3647
- $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
3648
- }
3649
- for($k = 0; $k < 50; $k++) {
3650
- $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
3651
- if(isset($temp_val)) {
3652
- $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
3653
- }
3654
- }
3655
- break;
3656
- }
3657
- case "type_paypal_shipping": {
3658
- $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . (isset($_POST['wdform_'.$key."_element".$id]) && $_POST['wdform_'.$key."_element".$id] ? ' : ' . $form_currency . $_POST['wdform_'.$key."_element".$id] : "");
3659
- break;
3660
- }
3661
- case "type_paypal_checkbox": {
3662
- $start = -1;
3663
- for($j = 0; $j < 100; $j++) {
3664
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3665
- if(isset($element)) {
3666
- $start = $j;
3667
- break;
3668
- }
3669
- }
3670
- if($start != -1) {
3671
- for($j = $start; $j < 100; $j++) {
3672
- $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3673
- if(isset($element)) {
3674
- $new_value = $new_value . (isset($_POST['wdform_'.$key."_element".$id.$j."_label"]) ? $_POST['wdform_'.$key."_element".$id.$j."_label"] : "") . ' - ' . (isset($element) ? $form_currency . ($element == '' ? '0' : $element) : "") . '<br>';
3675
- }
3676
- }
3677
- }
3678
- $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
3679
- $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
3680
- if (isset($element_quantity)) {
3681
- $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
3682
- }
3683
- for($k = 0; $k < 50; $k++) {
3684
- $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
3685
- if(isset($temp_val)) {
3686
- $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
3687
- }
3688
- }
3689
- break;
3690
- }
3691
- case "type_paypal_total": {
3692
- $element = isset($_POST['wdform_'.$key."_paypal_total".$id]) ? $_POST['wdform_'.$key."_paypal_total".$id] : "";
3693
- $new_value = $new_value . $element;
3694
- break;
3695
- }
3696
- case "type_star_rating": {
3697
- $element = isset($_POST['wdform_'.$key."_star_amount".$id]) ? $_POST['wdform_'.$key."_star_amount".$id] : NULL;
3698
- $selected = isset($_POST['wdform_'.$key."_selected_star_amount".$id]) ? $_POST['wdform_'.$key."_selected_star_amount".$id] : 0;
3699
- if(isset($element)) {
3700
- $new_value = $new_value . $selected . '/' . $element;
3701
- }
3702
- break;
3703
- }
3704
- case "type_scale_rating": {
3705
- $element = isset($_POST['wdform_'.$key."_scale_amount".$id]) ? $_POST['wdform_'.$key."_scale_amount".$id] : NULL;
3706
- $selected = isset($_POST['wdform_'.$key."_scale_radio".$id]) ? $_POST['wdform_'.$key."_scale_radio".$id] : 0;
3707
- if(isset($element)) {
3708
- $new_value = $new_value . $selected . '/' . $element;
3709
- }
3710
- break;
3711
- }
3712
- case "type_spinner": {
3713
- $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3714
- if(isset($element)) {
3715
- $new_value = $new_value . $element;
3716
- }
3717
- break;
3718
- }
3719
- case "type_slider": {
3720
- $element = isset($_POST['wdform_'.$key."_slider_value".$id]) ? $_POST['wdform_'.$key."_slider_value".$id] : NULL;
3721
- if(isset($element)) {
3722
- $new_value = $new_value . $element;
3723
- }
3724
- break;
3725
- }
3726
- case "type_range": {
3727
- $element0 = isset($_POST['wdform_'.$key."_element".$id.'0']) ? $_POST['wdform_'.$key."_element".$id.'0'] : NULL;
3728
- $element1 = isset($_POST['wdform_'.$key."_element".$id.'1']) ? $_POST['wdform_'.$key."_element".$id.'1'] : NULL;
3729
- if(isset($element0) || isset($element1)) {
3730
- $new_value = $new_value . $element0 . '-' . $element1;
3731
- }
3732
- break;
3733
- }
3734
- case "type_grading": {
3735
- $element = isset($_POST['wdform_'.$key."_hidden_item".$id]) ? $_POST['wdform_'.$key."_hidden_item".$id] : "";
3736
- $grading = explode(":", $element);
3737
- $items_count = sizeof($grading) - 1;
3738
- $element = "";
3739
- $total = "";
3740
- for($k = 0;$k < $items_count; $k++) {
3741
- $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : "") . " ";
3742
- $total += (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : 0);
3743
- }
3744
- $element .="Total:" . $total;
3745
- if(isset($element)) {
3746
- $new_value = $new_value . $element;
3747
- }
3748
- break;
3749
- }
3750
- case "type_matrix": {
3751
- $input_type = isset($_POST['wdform_'.$key."_input_type".$id]) ? $_POST['wdform_'.$key."_input_type".$id] : "";
3752
- $mat_rows = explode("***", isset($_POST['wdform_'.$key."_hidden_row".$id]) ? $_POST['wdform_'.$key."_hidden_row".$id] : "");
3753
- $rows_count = sizeof($mat_rows) - 1;
3754
- $mat_columns = explode("***", isset($_POST['wdform_'.$key."_hidden_column".$id]) ? $_POST['wdform_'.$key."_hidden_column".$id] : "");
3755
- $columns_count = sizeof($mat_columns) - 1;
3756
- $matrix="<table>";
3757
- $matrix .='<tr><td></td>';
3758
- for( $k=1;$k< count($mat_columns) ;$k++) {
3759
- $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
3760
- }
3761
- $matrix .= '</tr>';
3762
- $aaa=Array();
3763
- for($k=1; $k<=$rows_count; $k++) {
3764
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
3765
- if($input_type=="radio") {
3766
- $mat_radio = isset($_POST['wdform_'.$key."_input_element".$id.$k]) ? $_POST['wdform_'.$key."_input_element".$id.$k] : 0;
3767
- if($mat_radio == 0) {
3768
- $checked = "";
3769
- $aaa[1] = "";
3770
- }
3771
- else {
3772
- $aaa = explode("_", $mat_radio);
3773
- }
3774
-
3775
- for($j = 1; $j <= $columns_count; $j++) {
3776
- if($aaa[1]==$j) {
3777
- $checked="checked";
3778
- }
3779
- else {
3780
- $checked="";
3781
- }
3782
- $matrix .= '<td style="text-align:center"><input type="radio" ' . $checked . ' disabled /></td>';
3783
- }
3784
- }
3785
- else {
3786
- if($input_type == "checkbox") {
3787
- for($j = 1; $j <= $columns_count; $j++) {
3788
- $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j] : 0;
3789
- if($checked==1) {
3790
- $checked = "checked";
3791
- }
3792
- else {
3793
- $checked = "";
3794
- }
3795
- $matrix .= '<td style="text-align:center"><input type="checkbox" ' . $checked . ' disabled /></td>';
3796
- }
3797
- }
3798
- else {
3799
- if($input_type == "text") {
3800
- for($j = 1; $j <= $columns_count; $j++) {
3801
- $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? esc_html($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) : "";
3802
- $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
3803
- }
3804
- }
3805
- else {
3806
- for($j = 1; $j <= $columns_count; $j++) {
3807
- $checked = isset($_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j] : "";
3808
- $matrix .= '<td style="text-align:center">' . $checked . '</td>';
3809
- }
3810
- }
3811
- }
3812
- }
3813
- $matrix .= '</tr>';
3814
- }
3815
- $matrix .= '</table>';
3816
- if(isset($matrix)) {
3817
- $new_value = $new_value . $matrix;
3818
- }
3819
- break;
3820
- }
3821
- default: break;
3822
- }
3823
- // $new_script = str_replace("%" . $label_each . "%", $new_value, $new_script);
3824
- }
3825
-
3826
- return $new_value;
3827
- }
3828
-
3829
- public function empty_field($element, $mail_emptyfields) {
3830
- if(!$mail_emptyfields)
3831
- if(empty($element))
3832
- return 0;
3833
-
3834
- return 1;
3835
- }
3836
-
3837
- public function fm_validateDate($date, $format = 'Y-m-d H:i:s'){
3838
- $d = DateTime::createFromFormat($format, $date);
3839
- return $d && $d->format($format) == $date;
3840
- }
3841
-
3842
- public function all_forms() {
3843
- global $wpdb;
3844
- $forms = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix .'formmaker_display_options as display INNER JOIN ' . $wpdb->prefix . 'formmaker as forms ON display.form_id = forms.id WHERE display.type != "embedded" and forms.published=1');
3845
- return $forms;
3846
- }
3847
-
3848
- public function display_options($id){
3849
- global $wpdb;
3850
- $row = $wpdb->get_row('SELECT * FROM '.$wpdb->prefix .'formmaker_display_options as display WHERE form_id = '.(int)$id);
3851
- if (!$row) {
3852
- $row = new stdClass();
3853
- $row->form_id = $id;
3854
- $row->type = 'embedded';
3855
- $row->scrollbox_loading_delay = 0;
3856
- $row->popover_animate_effect = '';
3857
- $row->popover_loading_delay = 0;
3858
- $row->popover_frequency = 0;
3859
- $row->topbar_position = 1;
3860
- $row->topbar_remain_top = 1;
3861
- $row->topbar_closing = 1;
3862
- $row->topbar_hide_duration = 0;
3863
- $row->scrollbox_position = 1;
3864
- $row->scrollbox_trigger_point = 20;
3865
- $row->scrollbox_hide_duration = 0;
3866
- $row->scrollbox_auto_hide = 1;
3867
- $row->hide_mobile = 0;
3868
- $row->scrollbox_closing = 1;
3869
- $row->scrollbox_minimize = 1;
3870
- $row->scrollbox_minimize_text = '';
3871
- $row->display_on = 'everything';
3872
- $row->posts_include = '';
3873
- $row->pages_include = '';
3874
- $row->display_on_categories = '';
3875
- $row->current_categories = '';
3876
- $row->show_for_admin = 0;
3877
- }
3878
- return $row;
3879
- }
3880
- ////////////////////////////////////////////////////////////////////////////////////////
3881
- // Getters & Setters //
3882
- ////////////////////////////////////////////////////////////////////////////////////////
3883
- ////////////////////////////////////////////////////////////////////////////////////////
3884
- // Private Methods //
3885
- ////////////////////////////////////////////////////////////////////////////////////////
3886
- ////////////////////////////////////////////////////////////////////////////////////////
3887
- // Listeners //
3888
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
3889
  }
1
+ <?php
2
+
3
+ class FMModelForm_maker {
4
+
5
+ public function showform($id, $type = 'embedded') {
6
+ global $wpdb;
7
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d" AND id NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')', $id));
8
+ $form_preview = isset($_GET['form_preview']) ? $_GET['form_preview'] : '';
9
+ if (!$row || !$row->published || (!$form_preview && $row->type != $type)) {
10
+ return FALSE;
11
+ }
12
+ if (isset($_GET['test_theme']) && (esc_html(stripslashes($_GET['test_theme'])) != '')) {
13
+ /* From preview.*/
14
+ $theme_id = esc_html(stripslashes($_GET['test_theme']));
15
+ }
16
+ else {
17
+ $theme_id = $row->theme;
18
+ }
19
+ $form_theme = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
20
+ if (!$form_theme) {
21
+ $form_theme = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes');
22
+ if (!$form_theme) {
23
+ return FALSE;
24
+ }
25
+ }
26
+
27
+ $params_decoded = json_decode(html_entity_decode($form_theme->css), true);
28
+ if ($params_decoded != null) {
29
+ $old = $form_theme->version == 1;
30
+ $form_theme = $params_decoded;
31
+ }
32
+ else {
33
+ $old = true;
34
+ $form_theme = array("CUPCSS" => $form_theme->css);
35
+ }
36
+
37
+ $cssver = isset($form_theme['nonce_fm']) ? $form_theme['nonce_fm'] : rand();
38
+ $create_css_data = $this->create_css($theme_id, $form_theme, $old);
39
+ wp_register_style('fm-style-' . $theme_id, WD_FM_URL . '/css/frontend/fm-style-' . $theme_id . '.css', array(), $cssver);
40
+
41
+ $fm_settings = get_option('fm_settings');
42
+ $fm_shortcode = isset($fm_settings['fm_shortcode']) ? $fm_settings['fm_shortcode'] : '';
43
+ if ($form_preview || $fm_shortcode) {
44
+ wp_print_styles('fm-style-' . $theme_id);
45
+ }
46
+ else {
47
+ wp_enqueue_style('fm-style-' . $theme_id);
48
+ }
49
+ $label_id = array();
50
+ $label_type = array();
51
+ $label_all = explode('#****#', $row->label_order);
52
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
53
+ foreach ($label_all as $key => $label_each) {
54
+ $label_id_each = explode('#**id**#', $label_each);
55
+ array_push($label_id, $label_id_each[0]);
56
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
57
+ array_push($label_type, $label_order_each[1]);
58
+ }
59
+ return array(
60
+ $row,
61
+ 1,
62
+ $label_id,
63
+ $label_type,
64
+ $form_theme
65
+ );
66
+ }
67
+
68
+ public static function set_empty_values_transparent(&$value, $key) {
69
+ if(strpos($key, 'Color') > -1) {
70
+ /*
71
+ * New themes colorpicker conflict with others.
72
+ * Remove comments if no '#' is beeing saved with colors.
73
+ * */
74
+ if ($value == '') {
75
+ $value = 'transparent';
76
+ }
77
+ /*elseif (strpos($value, '#') === false) {
78
+ $value = '#' . $value;
79
+ }*/
80
+ }
81
+ }
82
+
83
+ public function create_css($theme_id, $form_theme, $old = true, $force_rewrite = false) {
84
+ $frontend_css = WD_FM_DIR . '/css/frontend/fm-style-' . $theme_id . '.css';
85
+ if ($theme_id && !$force_rewrite && file_exists($frontend_css)) {
86
+ return;
87
+ }
88
+ $prefixes = array('HP', 'AGP', 'GP', 'IP', 'SBP', 'SCP', 'MCP', 'SP', 'SHP', 'BP', 'BHP', 'NBP', 'NBHP', 'PBP', 'PBHP', 'PSAP', 'PSDP', 'CBP', 'CBHP', 'MBP', 'MBHP');
89
+ $border_types = array('top', 'left','right', 'bottom');
90
+ $borders = array();
91
+ foreach ($prefixes as $prefix) {
92
+ $borders[$prefix] = array();
93
+ foreach ($border_types as $border_type) {
94
+ if (isset($form_theme[$prefix.'Border'.ucfirst($border_type)])) {
95
+ array_push($borders[$prefix], $form_theme[$prefix.'Border'.ucfirst($border_type)]);
96
+ }
97
+ }
98
+ }
99
+ clearstatcache();
100
+ $cssfile = fopen($frontend_css, "w");
101
+
102
+ array_walk($form_theme, 'self::set_empty_values_transparent');
103
+
104
+ $css_content = '';
105
+ if (!$old) {
106
+ $css_content =
107
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form {
108
+ padding:".$form_theme['AGPPadding']." !important;
109
+ border-radius:".$form_theme['AGPBorderRadius']."px;
110
+ box-shadow:".$form_theme['AGPBoxShadow'].";
111
+ background: transparent;
112
+ border:none !important;
113
+ display:table;
114
+ width:".$form_theme['AGPWidth']."%;
115
+ margin:".$form_theme['AGPMargin'].";
116
+ }\r\n";
117
+
118
+
119
+ if($borders['AGP']) {
120
+ foreach($borders['AGP'] as $border){
121
+ if($form_theme['AGPBorderType'] == 'inherit' || $form_theme['AGPBorderType'] == 'initial') {
122
+ $css_content .="
123
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form {
124
+ border-".$border.": ".$form_theme['AGPBorderType']." !important;
125
+ }";
126
+ break;
127
+ } else{
128
+ $css_content .="
129
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form {
130
+ border-".$border.": ".$form_theme['AGPBorderWidth']."px ".$form_theme['AGPBorderType']." ".$form_theme['AGPBorderColor']." !important;
131
+ }";
132
+ }
133
+ }
134
+ }
135
+
136
+ $css_content .=
137
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header-bg{
138
+ background-color:".$form_theme['HPBGColor'].";
139
+ display: " . ($form_theme['HPAlign'] == 'left' || $form_theme['HPAlign'] == 'right' ? "table-cell" : "block") . ";
140
+ vertical-align: top;
141
+ width: ".$form_theme['HPWidth']."%;
142
+ }\r\n";
143
+
144
+
145
+ $css_content .=
146
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
147
+ width:".$form_theme['HPWidth']."%;
148
+ margin:".$form_theme['HPMargin'].";
149
+ border-radius:".$form_theme['HPBorderRadius']."px;
150
+ text-align: ".$form_theme['HPTextAlign'].";
151
+ padding:".$form_theme['HPPadding']." !important;
152
+ border:none !important;
153
+ }\r\n";
154
+
155
+ $css_content .=
156
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .image_left_right.fm-header {
157
+ padding: 0 !important;
158
+ }\r\n";
159
+
160
+ $css_content .=
161
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .image_left_right > div {
162
+ padding:".$form_theme['HPPadding']." !important;
163
+ }\r\n";
164
+
165
+
166
+ if($borders['HP']) {
167
+ foreach($borders['HP'] as $border){
168
+ if($form_theme['HPBorderType'] == 'inherit' || $form_theme['HPBorderType'] == 'initial') {
169
+ $css_content .="
170
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
171
+ border-".$border.": ".$form_theme['HPBorderType']." !important;
172
+ }";
173
+ break;
174
+ } else{
175
+ $css_content .="
176
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
177
+ border-".$border.": ".$form_theme['HPBorderWidth']."px ".$form_theme['HPBorderType']." ".$form_theme['HPBorderColor']." !important;
178
+ }";
179
+ }
180
+ }
181
+ }
182
+
183
+ $css_content .=
184
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form.header_left_right .wdform-page-and-images{
185
+ display: table-cell;
186
+ width:".$form_theme['GPWidth']."%;
187
+ }\r\n";
188
+
189
+
190
+ $css_content .=
191
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form.header_left_right .fm-header{
192
+ display: table-cell !important;
193
+ width:".$form_theme['HPWidth']."%;
194
+ vertical-align:middle;
195
+ }\r\n";
196
+
197
+ $css_content .=
198
+ ".fm-topbar .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header{
199
+ width:".$form_theme['HTPWidth']."% !important;
200
+ }\r\n";
201
+
202
+ $css_content .=
203
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header-title{
204
+ font-size:".$form_theme['HTPFontSize']."px;
205
+ color:".$form_theme['HTPColor'].";
206
+ }\r\n";
207
+
208
+ $css_content .=
209
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-header-description{
210
+ font-size:".$form_theme['HDPFontSize']."px;
211
+ color:".$form_theme['HDPColor'].";
212
+ }\r\n";
213
+
214
+ $css_content .=
215
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form-message {
216
+ font-family:".$form_theme['GPFontFamily'].";
217
+ font-size:".$form_theme['GPFontSize']."px;
218
+ font-weight:".$form_theme['GPFontWeight'].";
219
+ width:100%;
220
+ padding:".$form_theme['GPPadding']." !important;
221
+ margin:".$form_theme['GPMargin'].";
222
+ border-radius:".$form_theme['GPBorderRadius']."px;
223
+ border:none !important;
224
+ background-color:".$form_theme['GPBGColor'].";
225
+ text-align: center;
226
+ }\r\n";
227
+
228
+ $css_content .=
229
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-success.fm-form-message {
230
+ color:".$form_theme['GPColor'].";
231
+ }\r\n";
232
+
233
+ $css_content .=
234
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-scrollbox {
235
+ width:".$form_theme['AGPSPWidth']."%;
236
+ }\r\n";
237
+
238
+ $css_content .=
239
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
240
+ background-color: #fff;
241
+ font-size:".$form_theme['MBPFontSize']."px;
242
+ font-weight:".$form_theme['MBPFontWeight'].";
243
+ color: #444;
244
+ padding:".$form_theme['MBPPadding']." !important;
245
+ margin:".$form_theme['MBPMargin'].";
246
+ border-radius:".$form_theme['MBPBorderRadius']."px;
247
+ text-align: ".$form_theme['MBPTextAlign'].";
248
+ border:none !important;
249
+ cursor: pointer;
250
+ }\r\n";
251
+
252
+ if($borders['MBP']) {
253
+ foreach($borders['MBP'] as $border){
254
+ if($form_theme['MBPBorderType'] == 'inherit' || $form_theme['MBPBorderType'] == 'initial') {
255
+ $css_content .="
256
+ .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
257
+ border-".$border.": ".$form_theme['MBPBorderType']." !important;
258
+ }";
259
+ break;
260
+ } else{
261
+ $css_content .="
262
+ .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
263
+ border-".$border.": ".$form_theme['MBPBorderWidth']."px ".$form_theme['MBPBorderType']." ".$form_theme['MBPBorderColor']." !important;
264
+ }";
265
+ }
266
+ }
267
+ }
268
+
269
+ $css_content .=
270
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div:hover {
271
+ background-color:".$form_theme['MBHPBGColor'].";
272
+ color:".$form_theme['MBHPColor'].";
273
+ outline: none;
274
+ border: none !important;
275
+ cursor: pointer;
276
+ }\r\n";
277
+
278
+ if($borders['MBHP']) {
279
+ foreach($borders['MBHP'] as $border){
280
+ if($form_theme['MBHPBorderType'] == 'inherit' || $form_theme['MBHPBorderType'] == 'initial') {
281
+ $css_content .="
282
+ .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div:hover {
283
+ border-".$border.": ".$form_theme['MBHPBorderType']." !important;
284
+ }";
285
+ break;
286
+ } else{
287
+ $css_content .="
288
+ .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div:hover {
289
+ border-".$border.": ".$form_theme['MBHPBorderWidth']."px ".$form_theme['MBHPBorderType']." ".$form_theme['MBHPBorderColor']." !important;
290
+ }";
291
+ }
292
+ }
293
+ }
294
+
295
+ $css_content .=
296
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images{
297
+ font-size:".$form_theme['GPFontSize']."px;
298
+ font-weight:".$form_theme['GPFontWeight'].";
299
+ width:".$form_theme['GPWidth']."%;
300
+ color:".$form_theme['GPColor'].";
301
+ padding:".$form_theme['GPPadding'].";
302
+ margin:".$form_theme['GPMargin'].";
303
+ border-radius:".$form_theme['GPBorderRadius']."px;
304
+ border:none !important;
305
+ }\r\n";
306
+
307
+ $css_content .=
308
+ ".fm-topbar .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images{
309
+ width:".$form_theme['GTPWidth']."% !important;
310
+ }\r\n";
311
+
312
+ if($borders['GP']) {
313
+ foreach($borders['GP'] as $border){
314
+ if($form_theme['GPBorderType'] == 'inherit' || $form_theme['GPBorderType'] == 'initial') {
315
+ $css_content .="
316
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images,
317
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form-message,
318
+ .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text {
319
+ border-".$border.": ".$form_theme['GPBorderType']." !important;
320
+ }";
321
+ break;
322
+ } else{
323
+ $css_content .="
324
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images,
325
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form-message,
326
+ .fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text {
327
+ border-".$border.": ".$form_theme['GPBorderWidth']."px ".$form_theme['GPBorderType']." ".$form_theme['GPBorderColor']." !important;
328
+ }";
329
+ }
330
+ }
331
+ }
332
+
333
+ $css_content .="
334
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .mini_label {
335
+ font-size:".$form_theme['GPMLFontSize']."px !important;
336
+ font-weight:".$form_theme['GPMLFontWeight'].";
337
+ color:".$form_theme['GPMLColor'].";
338
+ padding:".$form_theme['GPMLPadding']." !important;
339
+ margin:".$form_theme['GPMLMargin'].";
340
+ }";
341
+
342
+ $css_content .="
343
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label,
344
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label{
345
+ font-size:".$form_theme['GPMLFontSize']."px !important;
346
+ }\r\n";
347
+
348
+
349
+ $css_content .="
350
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-page-and-images label{
351
+ font-size:".$form_theme['GPFontSize']."px;
352
+ }\r\n";
353
+
354
+
355
+ if($form_theme['GPAlign'] == 'center'){
356
+ $css_content .="
357
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section{
358
+ margin:0 auto;
359
+ }\r\n";
360
+
361
+ /* $css_content .=
362
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_column{
363
+ float:none;
364
+ }\r\n"; */
365
+ } else{
366
+ $css_content .="
367
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section{
368
+ float:".$form_theme['GPAlign'].";
369
+ }\r\n";
370
+
371
+ }
372
+
373
+ $css_content .="
374
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section {
375
+ padding:".$form_theme['SEPPadding'].";
376
+ margin:".$form_theme['SEPMargin'].";
377
+ background: transparent;
378
+ }";
379
+
380
+ $css_content .="
381
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_column {
382
+ padding:".$form_theme['COPPadding'].";
383
+ margin:".$form_theme['COPMargin'].";
384
+ }";
385
+
386
+
387
+ $css_content .="
388
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider {
389
+ background: ".$form_theme['IPBGColor']." !important;
390
+ }";
391
+
392
+ $css_content .="
393
+ .fm-form-container.fm-theme" . $theme_id . " .fm-scrollbox .fm-scrollbox-form {
394
+ margin:".$form_theme['AGPMargin'].";
395
+ position: relative;
396
+ }";
397
+
398
+ $css_content .="
399
+ .fm-form-container.fm-theme" . $theme_id . " .fm-popover .fm-popover-content {
400
+ margin:".$form_theme['AGPMargin'].";
401
+ position: relative;
402
+ }";
403
+
404
+
405
+ $css_content .="
406
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages.wdform_page_navigation {
407
+ width:".$form_theme['AGPWidth']."%;
408
+ margin:".$form_theme['AGPMargin'].";
409
+ }";
410
+
411
+ $css_content .="
412
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_footer {
413
+ font-size: ".$form_theme['GPFontSize']."px;
414
+ font-weight: ".$form_theme['GPFontWeight'].";
415
+ color: ".$form_theme['GPColor'].";
416
+ width: ".$form_theme['FPWidth']."%;
417
+ margin: ".$form_theme['FPMargin'].";
418
+ padding: ".$form_theme['FPPadding'].";
419
+ /* clear: both; */
420
+ }";
421
+
422
+ $css_content .="
423
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_active {
424
+ background-color: ".$form_theme['PSAPBGColor'].";
425
+ font-size: ".$form_theme['PSAPFontSize']."px;
426
+ font-weight: ".$form_theme['PSAPFontWeight'].";
427
+ color: ".$form_theme['PSAPColor'].";
428
+ width: ".$form_theme['PSAPWidth']."px;
429
+ height: ".$form_theme['PSAPHeight']."px;
430
+ line-height: ".$form_theme['PSAPLineHeight']."px;
431
+ margin: ".$form_theme['PSAPMargin'].";
432
+ padding: ".$form_theme['PSAPPadding'].";
433
+ border-radius: ".$form_theme['PSAPBorderRadius']."px;
434
+ cursor: pointer;
435
+ }";
436
+
437
+ if($borders['PSAP']) {
438
+ foreach($borders['PSAP'] as $border){
439
+ if($form_theme['PSAPBorderType'] == 'inherit' || $form_theme['PSAPBorderType'] == 'initial') {
440
+ $css_content .="
441
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_active {
442
+ border: ".$form_theme['PSAPBorderType']." !important;
443
+ }";
444
+ break;
445
+ } else {
446
+ $css_content .="
447
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_active {
448
+ border-".$border.": ".$form_theme['PSAPBorderWidth']."px ".$form_theme['PSAPBorderType']." ".$form_theme['PSAPBorderColor']." !important;
449
+ }";
450
+ }
451
+ }
452
+ }
453
+
454
+ $css_content .="
455
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_deactive {
456
+ background-color: ".$form_theme['PSDPBGColor'].";
457
+ font-size: ".$form_theme['PSDPFontSize']."px;
458
+ font-weight: ".$form_theme['PSDPFontWeight'].";
459
+ color: ".$form_theme['PSDPColor'].";
460
+ width: ".$form_theme['PSAPWidth']."px;
461
+ height: ".$form_theme['PSDPHeight']."px;
462
+ line-height: ".$form_theme['PSDPLineHeight']."px;
463
+ margin: ".$form_theme['PSDPMargin'].";
464
+ padding: ".$form_theme['PSDPPadding'].";
465
+ border-radius: ".$form_theme['PSAPBorderRadius']."px;
466
+ cursor: pointer;
467
+ }";
468
+
469
+ if($borders['PSDP']) {
470
+ foreach($borders['PSDP'] as $border){
471
+ if($form_theme['PSDPBorderType'] == 'inherit' || $form_theme['PSDPBorderType'] == 'initial') {
472
+ $css_content .="
473
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_deactive {
474
+ border: ".$form_theme['PSDPBorderType']." !important;
475
+ }";
476
+ break;
477
+ } else {
478
+ $css_content .="
479
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_deactive {
480
+ border-".$border.": ".$form_theme['PSDPBorderWidth']."px ".$form_theme['PSDPBorderType']." ".$form_theme['PSDPBorderColor']." !important;
481
+ }";
482
+ }
483
+ }
484
+ }
485
+
486
+ $css_content .="
487
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_active {
488
+ background-color: ".$form_theme['PSAPBGColor'].";
489
+ font-size: ".$form_theme['PSAPFontSize']."px;
490
+ font-weight: ".$form_theme['PSAPFontWeight'].";
491
+ color: ".$form_theme['PSAPColor'].";
492
+ width: ".$form_theme['PSAPWidth'].";
493
+ height: ".$form_theme['PSAPHeight']."px;
494
+ line-height: ".$form_theme['PSAPLineHeight']."px;
495
+ margin: ".$form_theme['PSAPMargin'].";
496
+ padding: ".$form_theme['PSAPPadding'].";
497
+ border-radius: ".$form_theme['PSAPBorderRadius']."px;
498
+ min-width: 7%;
499
+ }";
500
+
501
+ if($borders['PSAP']) {
502
+ foreach($borders['PSAP'] as $border){
503
+ if($form_theme['PSAPBorderType'] == 'inherit' || $form_theme['PSAPBorderType'] == 'initial') {
504
+ $css_content .="
505
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_active {
506
+ border: ".$form_theme['PSAPBorderType']." !important;
507
+ }";
508
+ break;
509
+ } else {
510
+ $css_content .="
511
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_active {
512
+ border-".$border.": ".$form_theme['PSAPBorderWidth']."px ".$form_theme['PSAPBorderType']." ".$form_theme['PSAPBorderColor']." !important;
513
+ }";
514
+ }
515
+ }
516
+ }
517
+
518
+ $css_content .="
519
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_deactive {
520
+ background-color: ".$form_theme['PSDPBGColor'].";
521
+ font-size: ".$form_theme['PSDPFontSize']."px;
522
+ font-weight: ".$form_theme['PSDPFontWeight'].";
523
+ color: ".$form_theme['PSDPColor'].";
524
+ width: ".$form_theme['PPAPWidth'].";
525
+ height: ".$form_theme['PSDPHeight']."px;
526
+ line-height: ".$form_theme['PSDPLineHeight']."px;
527
+ margin: ".$form_theme['PSDPMargin'].";
528
+ padding: ".$form_theme['PSDPPadding'].";
529
+ border-radius: ".$form_theme['PSDPBorderRadius']."px;
530
+ }";
531
+
532
+ if($borders['PSDP']) {
533
+ foreach($borders['PSDP'] as $border){
534
+ if($form_theme['PSDPBorderType'] == 'inherit' || $form_theme['PSDPBorderType'] == 'initial') {
535
+ $css_content .="
536
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_deactive {
537
+ border: ".$form_theme['PSDPBorderType']." !important;
538
+ }";
539
+ break;
540
+ } else {
541
+ $css_content .="
542
+ .fm-form-container.fm-theme" . $theme_id . " .fm-pages .page_percentage_deactive {
543
+ border-".$border.": ".$form_theme['PSDPBorderWidth']."px ".$form_theme['PSDPBorderType']." ".$form_theme['PSDPBorderColor']." !important;
544
+ }";
545
+ }
546
+ }
547
+ }
548
+
549
+ $css_content .="
550
+ .fm-form-container.fm-theme" . $theme_id . " .fm-action-buttons {
551
+ font-size:".$form_theme['CBPFontSize']."px;
552
+ font-weight:".$form_theme['CBPFontWeight'].";
553
+ color:".$form_theme['CBPColor'].";
554
+ text-align: center;
555
+ cursor: pointer;
556
+ font-family: monospace;
557
+ }";
558
+
559
+ $css_content .="
560
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form,
561
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
562
+ position: ".$form_theme['CBPPosition'].";
563
+ background:".$form_theme['CBPBGColor'].";
564
+ padding:".$form_theme['CBPPadding'].";
565
+ margin:".$form_theme['CBPMargin'].";
566
+ border-radius:".$form_theme['CBPBorderRadius']."px;
567
+ border:none;
568
+ }";
569
+
570
+ $css_content .="
571
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form {
572
+ top: ".$form_theme['CBPTop'].";
573
+ right: ".$form_theme['CBPRight'].";
574
+ bottom: ".$form_theme['CBPBottom'].";
575
+ left: ".$form_theme['CBPLeft'].";
576
+ }";
577
+
578
+
579
+ $for_mini = $form_theme['CBPLeft'] ? 'left' : 'right';
580
+ $css_content .="
581
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
582
+ top: ".$form_theme['CBPTop'].";
583
+ ".$for_mini.": ".(2 * $form_theme['CBP'.ucfirst($for_mini)] + $form_theme['CBPFontSize'] + 3)."px;
584
+ bottom: ".$form_theme['CBPBottom'].";
585
+ }";
586
+
587
+ if($borders['CBP']) {
588
+ foreach($borders['CBP'] as $border){
589
+ if($form_theme['CBPBorderType'] == 'inherit' || $form_theme['CBPBorderType'] == 'initial') {
590
+ $css_content .="
591
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form,
592
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
593
+ border-".$border.": ".$form_theme['CBPBorderType']." !important;
594
+ }";
595
+ break;
596
+ } else{
597
+ $css_content .="
598
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form,
599
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form {
600
+ border-".$border.": ".$form_theme['CBPBorderWidth']."px ".$form_theme['CBPBorderType']." ".$form_theme['CBPBorderColor']." !important;
601
+ }";
602
+ }
603
+ }
604
+ }
605
+
606
+ $css_content .="
607
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form:hover,
608
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form:hover {
609
+ background:".$form_theme['CBHPBGColor'].";
610
+ color:".$form_theme['CBHPColor'].";
611
+ border:none;
612
+ }";
613
+
614
+ if($borders['CBHP']) {
615
+ foreach($borders['CBHP'] as $border){
616
+ if($form_theme['CBHPBorderType'] == 'inherit' || $form_theme['CBHPBorderType'] == 'initial') {
617
+ $css_content .="
618
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form:hover,
619
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form:hover {
620
+ border-".$border.": ".$form_theme['CBHPBorderType']." !important;
621
+ }";
622
+ break;
623
+ } else{
624
+ $css_content .="
625
+ .fm-form-container.fm-theme" . $theme_id . " .closing-form:hover,
626
+ .fm-form-container.fm-theme" . $theme_id . " .minimize-form:hover {
627
+ border-".$border.": ".$form_theme['CBHPBorderWidth']."px ".$form_theme['CBHPBorderType']." ".$form_theme['CBHPBorderColor']." !important;
628
+ }";
629
+ }
630
+ }
631
+ }
632
+
633
+ $user_agent = $_SERVER['HTTP_USER_AGENT'];
634
+ if(stripos( $user_agent, 'Safari') !== false && stripos( $user_agent, 'Chrome') === false) {
635
+ $css_content .="
636
+ .fm-popover-container:before {
637
+ position:absolute;
638
+ }";
639
+ }
640
+
641
+ $css_content .="
642
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-required {
643
+ color: ".$form_theme['OPRColor'].";
644
+ }
645
+
646
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .input_deactive {
647
+ color: ".$form_theme['OPDeInputColor']." !important;
648
+ font-style: ".$form_theme['OPFontStyle'].";
649
+ }
650
+
651
+
652
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .file-picker{
653
+ background: url(".WD_FM_URL.'/'.$form_theme['OPFBgUrl'].") ".$form_theme['OPFBGRepeat']." ".$form_theme['OPFPos1']." ".$form_theme['OPFPos2'].";
654
+ display: inline-block;
655
+ }
656
+
657
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform-calendar-button {
658
+ background: url(".WD_FM_URL.'/'.$form_theme['OPDPIcon'].") ".$form_theme['OPDPRepeat']." ".$form_theme['OPDPPos1']." ".$form_theme['OPDPPos2'].";
659
+ margin: ".$form_theme['OPDPMargin'].";
660
+ position: absolute;
661
+ }
662
+
663
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-subscribe-reset{
664
+ float: ".$form_theme['SPAlign'].";
665
+ }
666
+
667
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .fm-subscribe-reset div{
668
+ text-align: ".$form_theme['SPAlign'].";
669
+ }
670
+
671
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
672
+ margin-right: 15px;
673
+ }
674
+
675
+ ";
676
+
677
+ $defaultStyles =
678
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-form{
679
+ font-family:".$form_theme['GPFontFamily'].";
680
+ background:".$form_theme['GPBGColor'].";
681
+ }\r\n
682
+
683
+
684
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .wdform_section {
685
+ background:".($form_theme['GPBGColor'] != $form_theme['SEPBGColor'] ? $form_theme['SEPBGColor'] : 'transparent').";
686
+ }\r\n
687
+
688
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .captcha_img{
689
+ height:".$form_theme['IPHeight']."px;
690
+ }
691
+
692
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='text'],
693
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=password],
694
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=url],
695
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=email],
696
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form textarea,
697
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner-input,
698
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .file-upload-status,
699
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
700
+ font-size:".$form_theme['IPFontSize']."px;
701
+ font-weight:".$form_theme['IPFontWeight'].";
702
+ height:".$form_theme['IPHeight']."px;
703
+ line-height:".$form_theme['IPHeight']."px;
704
+ background-color:".$form_theme['IPBGColor'].";
705
+ color:".$form_theme['IPColor'].";
706
+ padding:".$form_theme['IPPadding'].";
707
+ margin:".$form_theme['IPMargin'].";
708
+ border-radius:".$form_theme['IPBorderRadius']."px !important;
709
+ box-shadow:".$form_theme['IPBoxShadow'].";
710
+ border:none;
711
+ }";
712
+
713
+ if($borders['IP']) {
714
+ foreach($borders['IP'] as $border){
715
+ if($form_theme['IPBorderType'] == 'inherit' || $form_theme['IPBorderType'] == 'initial') {
716
+ $defaultStyles .="
717
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='text']:not(.ui-spinner-input),
718
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=password],
719
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=url],
720
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=email],
721
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form textarea,
722
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner,
723
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider,
724
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-handle,
725
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
726
+ border-".$border.": ".$form_theme['IPBorderType']." !important;
727
+ }";
728
+
729
+ $defaultStyles .="
730
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner-button,
731
+ border-left: ".$form_theme['IPBorderType']." !important;
732
+ }";
733
+
734
+ $defaultStyles .="
735
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-range {
736
+ }";
737
+ break;
738
+ } else {
739
+ $defaultStyles .="
740
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='text']:not(.ui-spinner-input),
741
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=password],
742
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=url],
743
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type=email],
744
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form textarea,
745
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner,
746
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider,
747
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-handle,
748
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
749
+ border-".$border.": ".$form_theme['IPBorderWidth']."px ".$form_theme['IPBorderType']." ".$form_theme['IPBorderColor']." !important;
750
+ }";
751
+ if($border == 'left'){
752
+ $defaultStyles .="
753
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-spinner-button {
754
+ border-left: ".$form_theme['IPBorderWidth']."px ".$form_theme['IPBorderType']." ".$form_theme['IPBorderColor']." !important;
755
+ }";
756
+ }
757
+
758
+ $defaultStyles .="
759
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .ui-slider-range {
760
+ background: ".$form_theme['IPBorderColor']." !important;
761
+ }";
762
+
763
+ }
764
+ }
765
+ }
766
+
767
+ $defaultStyles .="
768
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form select {
769
+ appearance: ".$form_theme['SBPAppearance'].";
770
+ -moz-appearance: ".$form_theme['SBPAppearance'].";
771
+ -webkit-appearance: ".$form_theme['SBPAppearance'].";
772
+ background:".$form_theme['IPBGColor']." url(".WD_FM_URL.'/'.$form_theme['SBPBackground'].") ".$form_theme['SBPBGRepeat']." ".$form_theme['SBPBGPos1']." ".$form_theme['SBPBGPos2'].";
773
+ background-size: ".$form_theme['SBPBGSize1']." ".$form_theme['SBPBGSize2'].";
774
+ }";
775
+
776
+
777
+ $defaultStyles .="
778
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label span {
779
+ height:".$form_theme['SCPHeight']."px;
780
+ width:".$form_theme['SCPWidth']."px;
781
+ background-color:".$form_theme['SCPBGColor'].";
782
+ margin:".$form_theme['SCPMargin'].";
783
+ box-shadow:".$form_theme['SCPBoxShadow'].";
784
+ border-radius: ".$form_theme['SCPBorderRadius']."px;
785
+ border: none;
786
+ display: inline-block;
787
+ vertical-align: middle;
788
+ }";
789
+
790
+ $defaultStyles .="
791
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div input[type='radio']:checked + label span:after {
792
+ content: '';
793
+ width:".$form_theme['SCCPWidth']."px;
794
+ height:".$form_theme['SCCPHeight']."px;
795
+ background:".$form_theme['SCCPBGColor'].";
796
+ border-radius: ".$form_theme['SCCPBorderRadius']."px;
797
+ margin: ".$form_theme['SCCPMargin']."px;
798
+ display: block;
799
+ }";
800
+
801
+ if($borders['SCP']) {
802
+ foreach($borders['SCP'] as $border){
803
+ if($form_theme['SCPBorderType'] == 'inherit' || $form_theme['SCPBorderType'] == 'initial') {
804
+ $defaultStyles .="
805
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label span {
806
+ border-".$border.": ".$form_theme['SCPBorderType']." !important;
807
+ }";
808
+ break;
809
+ } else{
810
+ $defaultStyles .="
811
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div label span {
812
+ border-".$border.": ".$form_theme['SCPBorderWidth']."px ".$form_theme['SCPBorderType']." ".$form_theme['SCPBorderColor']." !important;
813
+ }";
814
+ }
815
+ }
816
+ }
817
+
818
+ $defaultStyles .="
819
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label span {
820
+ height:".$form_theme['MCPHeight']."px;
821
+ width:".$form_theme['MCPWidth']."px;
822
+ background-color:".$form_theme['MCPBGColor'].";
823
+ margin:".$form_theme['MCPMargin'].";
824
+ box-shadow:".$form_theme['MCPBoxShadow'].";
825
+ border-radius: ".$form_theme['MCPBorderRadius']."px;
826
+ border: none;
827
+ display: inline-block;
828
+ vertical-align: middle;
829
+ }";
830
+
831
+ $defaultStyles .="
832
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div input[type='checkbox']:checked + label span:after {
833
+ content: '';
834
+ width:".$form_theme['MCCPWidth']."px;
835
+ height:".$form_theme['MCCPHeight']."px;
836
+ background:".($form_theme['MCCPBackground'] ? ($form_theme['MCCPBGColor']." url(".WD_FM_URL.'/'.$form_theme['MCCPBackground'].") ".$form_theme['MCCPBGRepeat']." ".$form_theme['MCCPBGPos1']." ".$form_theme['MCCPBGPos2']) : $form_theme['MCCPBGColor']).";
837
+ border-radius: ".$form_theme['MCCPBorderRadius']."px;
838
+ margin: ".$form_theme['MCCPMargin']."px;
839
+ display: block;
840
+ }";
841
+
842
+ if($borders['MCP']) {
843
+ foreach($borders['MCP'] as $border){
844
+ if($form_theme['MCPBorderType'] == 'inherit' || $form_theme['MCPBorderType'] == 'initial') {
845
+ $defaultStyles .="
846
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label span {
847
+ border-".$border.": ".$form_theme['MCPBorderType']." !important;
848
+ }";
849
+ break;
850
+ } else{
851
+ $defaultStyles .="
852
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div label span {
853
+ border-".$border.": ".$form_theme['MCPBorderWidth']."px ".$form_theme['MCPBorderType']." ".$form_theme['MCPBorderColor']." !important;
854
+ }";
855
+ }
856
+ }
857
+ }
858
+
859
+ $defaultStyles .="
860
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
861
+ background-color:".$form_theme['SPBGColor']." !important;
862
+ font-size:".$form_theme['SPFontSize']."px !important;
863
+ font-weight:".$form_theme['SPFontWeight']." !important;
864
+ color:".$form_theme['SPColor']." !important;
865
+ height:".$form_theme['SPHeight']."px !important;
866
+ width:".$form_theme['SPWidth']."px !important;
867
+ margin:".$form_theme['SPMargin']." !important;
868
+ padding:".$form_theme['SPPadding']." !important;
869
+ box-shadow:".$form_theme['SPBoxShadow']." !important;
870
+ border-radius: ".$form_theme['SPBorderRadius']."px;
871
+ border: none !important;
872
+ }";
873
+
874
+ if($borders['SP']) {
875
+ foreach($borders['SP'] as $border){
876
+ if($form_theme['SPBorderType'] == 'inherit' || $form_theme['SPBorderType'] == 'initial') {
877
+ $defaultStyles .="
878
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
879
+ border-".$border.": ".$form_theme['SPBorderType']." !important;
880
+ }";
881
+ break;
882
+ } else{
883
+ $defaultStyles .="
884
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit {
885
+ border-".$border.": ".$form_theme['SPBorderWidth']."px ".$form_theme['SPBorderType']." ".$form_theme['SPBorderColor']." !important;
886
+ }";
887
+ }
888
+ }
889
+ }
890
+
891
+ $defaultStyles .="
892
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit:hover {
893
+ background-color:".$form_theme['SHPBGColor']." !important;
894
+ color:".$form_theme['SHPColor']." !important;
895
+ }";
896
+
897
+ if($borders['SHP']) {
898
+ foreach($borders['SHP'] as $border){
899
+ if($form_theme['SHPBorderType'] == 'inherit' || $form_theme['SHPBorderType'] == 'initial') {
900
+ $defaultStyles .="
901
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit:hover {
902
+ border-".$border.": ".$form_theme['SHPBorderType']." !important;
903
+ }";
904
+ break;
905
+ } else{
906
+ $defaultStyles .="
907
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-submit:hover {
908
+ border-".$border.": ".$form_theme['SHPBorderWidth']."px ".$form_theme['SHPBorderType']." ".$form_theme['SHPBorderColor']." !important;
909
+ }";
910
+ }
911
+ }
912
+ }
913
+
914
+ $defaultStyles .="
915
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset,
916
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form button {
917
+ background-color:".$form_theme['BPBGColor']." !important;
918
+ font-size:".$form_theme['BPFontSize']."px !important;
919
+ font-weight:".$form_theme['BPFontWeight']." !important;
920
+ color:".$form_theme['BPColor']." !important;
921
+ height:".$form_theme['BPHeight']."px !important;
922
+ width:".$form_theme['BPWidth']."px !important;
923
+ margin:".$form_theme['BPMargin']." !important;
924
+ padding:".$form_theme['BPPadding']." !important;
925
+ box-shadow:".$form_theme['BPBoxShadow']." !important;
926
+ border-radius: ".$form_theme['BPBorderRadius']."px;
927
+ border: none !important;
928
+ }";
929
+
930
+ if($borders['BP']) {
931
+ foreach($borders['BP'] as $border){
932
+ if($form_theme['BPBorderType'] == 'inherit' || $form_theme['BPBorderType'] == 'initial') {
933
+ $defaultStyles .="
934
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset,
935
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form button {
936
+ border-".$border.": ".$form_theme['BPBorderType']." !important;
937
+ }";
938
+ break;
939
+ } else{
940
+ $defaultStyles .= "
941
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset,
942
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form button {
943
+ border-".$border.": ".$form_theme['BPBorderWidth']."px ".$form_theme['BPBorderType']." ".$form_theme['BPBorderColor']." !important;
944
+ }";
945
+ }
946
+ }
947
+ }
948
+
949
+ $defaultStyles .="
950
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset:hover,
951
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form button:hover {
952
+ background-color:".$form_theme['BHPBGColor']." !important;
953
+ color:".$form_theme['BHPColor']." !important;
954
+ }";
955
+
956
+ if($borders['BHP']) {
957
+ foreach($borders['BHP'] as $border){
958
+ if($form_theme['BHPBorderType'] == 'inherit' || $form_theme['BHPBorderType'] == 'initial') {
959
+ $defaultStyles .="
960
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset:hover,
961
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form button:hover{
962
+ border-".$border.": ".$form_theme['BHPBorderType']." !important;
963
+ }";
964
+ break;
965
+ } else {
966
+ $defaultStyles .= "
967
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .button-reset:hover,
968
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form button:hover {
969
+ border-".$border.": ".$form_theme['BHPBorderWidth']."px ".$form_theme['BHPBorderType']." ".$form_theme['BHPBorderColor']." !important;
970
+ }";
971
+ }
972
+ }
973
+ }
974
+
975
+ $defaultStyles .="
976
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button {
977
+ background-color:".$form_theme['NBPBGColor']." !important;
978
+ font-size:".$form_theme['BPFontSize']."px !important;
979
+ font-weight:".$form_theme['BPFontWeight']." !important;
980
+ color:".$form_theme['NBPColor']." !important;
981
+ height:".$form_theme['NBPHeight']."px !important;
982
+ width:".$form_theme['NBPWidth']."px !important;
983
+ margin:".$form_theme['NBPMargin']." !important;
984
+ padding:".$form_theme['NBPPadding']." !important;
985
+ box-shadow:".$form_theme['NBPBoxShadow']." !important;
986
+ border-radius: ".$form_theme['NBPBorderRadius']."px;
987
+ border: none !important;
988
+ }";
989
+
990
+ if($borders['NBP']) {
991
+ foreach($borders['NBP'] as $border){
992
+ if($form_theme['NBPBorderType'] == 'inherit' || $form_theme['NBPBorderType'] == 'initial') {
993
+ $defaultStyles .="
994
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button {
995
+ border-".$border.": ".$form_theme['NBPBorderType']." !important;
996
+ }";
997
+ break;
998
+ } else {
999
+ $defaultStyles .="
1000
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button {
1001
+ border-".$border.": ".$form_theme['NBPBorderWidth']."px ".$form_theme['NBPBorderType']." ".$form_theme['NBPBorderColor']." !important;
1002
+ }";
1003
+ }
1004
+ }
1005
+ }
1006
+
1007
+ $defaultStyles .="
1008
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button:hover {
1009
+ background-color:".$form_theme['NBHPBGColor']." !important;
1010
+ color:".$form_theme['NBHPColor']." !important;
1011
+ }";
1012
+
1013
+ $defaultStyles .=
1014
+ ".fm-form-container.fm-theme" . $theme_id . " .fm-minimize-text div{
1015
+ background-color:".$form_theme['MBPBGColor'].";
1016
+ color:".$form_theme['MBPColor'].";
1017
+ }\r\n";
1018
+
1019
+ if($borders['NBHP']) {
1020
+ foreach($borders['NBHP'] as $border){
1021
+ if($form_theme['NBHPBorderType'] == 'inherit' || $form_theme['NBHPBorderType'] == 'initial') {
1022
+ $defaultStyles .="
1023
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button:hover {
1024
+ border-".$border.": ".$form_theme['NBHPBorderType']." !important;
1025
+ }";
1026
+ break;
1027
+ } else {
1028
+ $defaultStyles .="
1029
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .next-page div.wdform-page-button:hover {
1030
+ border-".$border.": ".$form_theme['NBHPBorderWidth']."px ".$form_theme['NBHPBorderType']." ".$form_theme['NBHPBorderColor']." !important;
1031
+ }";
1032
+ }
1033
+ }
1034
+ }
1035
+
1036
+ $defaultStyles .="
1037
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button {
1038
+ background-color:".$form_theme['PBPBGColor']." !important;
1039
+ font-size:".$form_theme['BPFontSize']."px !important;
1040
+ font-weight:".$form_theme['BPFontWeight']." !important;
1041
+ color:".$form_theme['PBPColor']." !important;
1042
+ height:".$form_theme['PBPHeight']."px !important;
1043
+ width:".$form_theme['PBPWidth']."px !important;
1044
+ margin:".$form_theme['PBPMargin']." !important;
1045
+ padding:".$form_theme['PBPPadding']." !important;
1046
+ box-shadow:".$form_theme['PBPBoxShadow']." !important;
1047
+ border-radius: ".$form_theme['PBPBorderRadius']."px;
1048
+ border: none !important;
1049
+ }";
1050
+
1051
+ if($borders['PBP']) {
1052
+ foreach($borders['PBP'] as $border){
1053
+ if($form_theme['PBPBorderType'] == 'inherit' || $form_theme['PBPBorderType'] == 'initial') {
1054
+ $defaultStyles .="
1055
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button {
1056
+ border-".$border.": ".$form_theme['PBPBorderType']." !important;
1057
+ }";
1058
+ break;
1059
+ } else {
1060
+ $defaultStyles .="
1061
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button {
1062
+ border-".$border.": ".$form_theme['PBPBorderWidth']."px ".$form_theme['PBPBorderType']." ".$form_theme['PBPBorderColor']." !important;
1063
+ }";
1064
+ }
1065
+ }
1066
+ }
1067
+
1068
+ $defaultStyles .="
1069
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button:hover {
1070
+ background-color:".$form_theme['PBHPBGColor']." !important;
1071
+ color:".$form_theme['PBHPColor']." !important;
1072
+ }";
1073
+
1074
+ if($borders['PBHP']) {
1075
+ foreach($borders['PBHP'] as $border){
1076
+ if($form_theme['PBHPBorderType'] == 'inherit' || $form_theme['PBHPBorderType'] == 'initial') {
1077
+ $defaultStyles .="
1078
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button:hover {
1079
+ border-".$border.": ".$form_theme['PBHPBorderType']." !important;
1080
+ }";
1081
+ break;
1082
+ } else {
1083
+ $defaultStyles .="
1084
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .previous-page div.wdform-page-button:hover{
1085
+ border-".$border.": ".$form_theme['PBHPBorderWidth']."px ".$form_theme['PBHPBorderType']." ".$form_theme['PBHPBorderColor']." !important;
1086
+ }";
1087
+ }
1088
+ }
1089
+ }
1090
+
1091
+ $defaultStyles .="
1092
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='checkbox'],
1093
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form input[type='radio'] {
1094
+ display:none;
1095
+ }";
1096
+
1097
+
1098
+ if($theme_id != 0){
1099
+ $css_content .= $defaultStyles;
1100
+ }
1101
+ else {
1102
+ $css_content .="
1103
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .checkbox-div.fm-right input[type='checkbox'],
1104
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .radio-div.fm-right input[type='radio'] {
1105
+ float: right;
1106
+ margin: 5px;
1107
+ }
1108
+
1109
+ .fm-form-container.fm-theme" . $theme_id . " .fm-form .file-picker{
1110
+ display: none;
1111
+ }
1112
+
1113
+ .fm-form .file-upload input{
1114
+ visibility: visible;
1115
+ }";
1116
+ }
1117
+ }
1118
+ if($form_theme['CUPCSS']) {
1119
+ $pattern = '/\/\/(.+)(\r\n|\r|\n)/';
1120
+ $form_theme_css = $form_theme['CUPCSS'];
1121
+ if (strpos($form_theme_css, ':checked + label') !== false) {
1122
+ $form_theme_css .= '
1123
+ .checkbox-div label span {
1124
+ border: 1px solid #868686 !important;
1125
+ display: inline-block;
1126
+ height: 16px;
1127
+ width: 16px;
1128
+ }
1129
+ .radio-div label span {
1130
+ border: 1px solid #868686 !important;
1131
+ border-radius: 100%;
1132
+ display: inline-block;
1133
+ height: 16px;
1134
+ width: 16px;
1135
+ }
1136
+ .checkbox-div input[type=\'checkbox\']:checked + label span:after {
1137
+ content: \'\';
1138
+ width: 16px;
1139
+ height: 16px;
1140
+ background:transparent url([SITE_ROOT]/images/themes/checkboxes/1.png) no-repeat;
1141
+ background-size: 100%;
1142
+ border-radius: 0px;
1143
+ margin: 0px;
1144
+ display: block;
1145
+ }
1146
+ .radio-div input[type=\'radio\']:checked + label span:after {
1147
+ content: \'\';
1148
+ width: 6px;
1149
+ height: 6px;
1150
+ background: #777777;
1151
+ border-radius: 10px;
1152
+ margin: 5px;
1153
+ display: block;
1154
+ }
1155
+ .checkbox-div, .radio-div {
1156
+ border: none;
1157
+ box-shadow: none;
1158
+ height: 17px;
1159
+ background: none;
1160
+ }
1161
+ .checkbox-div label, .radio-div label, .checkbox-div label:hover, .radio-div label:hover {
1162
+ opacity: 1;
1163
+ background: none;
1164
+ border: none;
1165
+ min-width: 140px;
1166
+ line-height: 13px;
1167
+ }';
1168
+ }
1169
+ $form_theme_css = explode('{', $form_theme_css);
1170
+ $count_after_explod_theme = count($form_theme_css);
1171
+ for ($i = 0; $i < $count_after_explod_theme; $i++) {
1172
+ $body_or_classes[$i] = explode('}', $form_theme_css[$i]);
1173
+ }
1174
+ for ($i = 0; $i < $count_after_explod_theme; $i++) {
1175
+ if ($i == 0) {
1176
+ $body_or_classes[$i][0] = ".fm-form-container.fm-theme" . $theme_id . " .fm-form" . ' ' . str_replace(',', ", .fm-form-container.fm-theme" . $theme_id . " .fm-form", $body_or_classes[$i][0]);
1177
+ }
1178
+ else {
1179
+ $body_or_classes[$i][1] = ".fm-form-container.fm-theme" . $theme_id . " .fm-form" . ' ' . str_replace(',', ", .fm-form-container.fm-theme" . $theme_id . " .fm-form", $body_or_classes[$i][1]);
1180
+ }
1181
+ }
1182
+ for ($i = 0; $i < $count_after_explod_theme; $i++) {
1183
+ $body_or_classes_implode[$i] = implode('}', $body_or_classes[$i]);
1184
+ }
1185
+ $theme = implode('{', $body_or_classes_implode);
1186
+ $theme = preg_replace($pattern, ' ', $theme);
1187
+ $css_content .= str_replace('[SITE_ROOT]', WD_FM_URL, $theme);
1188
+ }
1189
+
1190
+ $txtfilecontent = fwrite($cssfile, $css_content);
1191
+ fclose($cssfile);
1192
+ clearstatcache();
1193
+ }
1194
+
1195
+ public function savedata($form, $id) {
1196
+ $fm_settings = get_option('fm_settings');
1197
+ $all_files = array();
1198
+ $correct = FALSE;
1199
+ $id_for_old = $id;
1200
+ if (!$form->form_front) {
1201
+ $id = '';
1202
+ }
1203
+ if (isset($_POST["counter" . $id])) {
1204
+ $counter = esc_html($_POST["counter" . $id]);
1205
+
1206
+ if (isset($_POST["captcha_input"])) {
1207
+ $captcha_input = esc_html($_POST["captcha_input"]);
1208
+ $session_wd_captcha_code = isset($_SESSION[$id . '_wd_captcha_code']) ? $_SESSION[$id . '_wd_captcha_code'] : '-';
1209
+ if (md5($captcha_input) == $session_wd_captcha_code) {
1210
+ $correct = TRUE;
1211
+ }
1212
+ else {
1213
+ $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1214
+ $_SESSION['error_or_no' . $id] = 1;
1215
+ }
1216
+ }
1217
+ elseif (isset($_POST["arithmetic_captcha_input"])) {
1218
+ $arithmetic_captcha_input = esc_html($_POST["arithmetic_captcha_input"]);
1219
+ $session_wd_arithmetic_captcha_code = isset($_SESSION[$id . '_wd_arithmetic_captcha_code']) ? $_SESSION[$id . '_wd_arithmetic_captcha_code'] : '-';
1220
+ if (md5($arithmetic_captcha_input) == $session_wd_arithmetic_captcha_code) {
1221
+ $correct = TRUE;
1222
+ }
1223
+ else {
1224
+ $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1225
+ $_SESSION['error_or_no' . $id] = 1;
1226
+ }
1227
+ }
1228
+ elseif (isset($_POST["g-recaptcha-response"])) {
1229
+ $privatekey = isset($fm_settings['private_key']) ? $fm_settings['private_key'] : '';
1230
+ $captcha = $_POST['g-recaptcha-response'];
1231
+ $url = 'https://www.google.com/recaptcha/api/siteverify';
1232
+ $data = array(
1233
+ 'secret' => $privatekey,
1234
+ 'response' => $captcha,
1235
+ 'remoteip' => $_SERVER['REMOTE_ADDR']
1236
+ );
1237
+
1238
+ $curlConfig = array(
1239
+ CURLOPT_URL => $url,
1240
+ CURLOPT_POST => true,
1241
+ CURLOPT_RETURNTRANSFER => true,
1242
+ CURLOPT_SSL_VERIFYPEER => false,
1243
+ CURLOPT_POSTFIELDS => $data
1244
+ );
1245
+
1246
+ $ch = curl_init();
1247
+ curl_setopt_array($ch, $curlConfig);
1248
+ $response = curl_exec($ch);
1249
+ curl_close($ch);
1250
+
1251
+ $jsonResponse = json_decode($response);
1252
+ if ($jsonResponse->success == "true") {
1253
+ $correct = TRUE;
1254
+ }
1255
+ else {
1256
+ $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1257
+ $_SESSION['error_or_no' . $id] = 1;
1258
+ }
1259
+ }
1260
+ else {
1261
+ if (preg_match('(type_arithmetic_captcha|type_captcha|type_recaptcha)', $form->label_order_current) === 1) {
1262
+ $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Error, incorrect Security code.', 'form_maker')));
1263
+ $_SESSION['error_or_no' . $id] = 1;
1264
+ $correct = false;
1265
+ }
1266
+ else {
1267
+ $correct = true;
1268
+ }
1269
+ }
1270
+ if ($correct) {
1271
+ $ip = $_SERVER['REMOTE_ADDR'];
1272
+ global $wpdb;
1273
+ $blocked_ip = $wpdb->get_var($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ip));
1274
+ if ($blocked_ip) {
1275
+ $_SESSION['massage_after_submit' . $id] = addslashes(__('Your ip is blacklisted. Please contact the website administrator.', 'form_maker'));
1276
+ wp_redirect($_SERVER["REQUEST_URI"]);//to be checked
1277
+ exit;
1278
+ }
1279
+
1280
+ if (isset($_POST["save_or_submit" . $id]) && $_POST["save_or_submit" . $id] == 'save') {
1281
+ if (defined('WD_FM_SAVE_PROG') && is_plugin_active(constant('WD_FM_SAVE_PROG'))) {
1282
+ $_GET['addon_task'] = 'save_progress';
1283
+ $_GET['form_id'] = $id;
1284
+ $_GET['form_currency'] = $form->payment_currency;
1285
+ do_action('WD_FM_SAVE_PROG_init');
1286
+
1287
+ return $all_files;
1288
+ }
1289
+ }
1290
+ else {
1291
+ $result_temp = $this->save_db($counter, $id_for_old);
1292
+
1293
+ $all_files = $result_temp[0];
1294
+ if (is_numeric($all_files)) {
1295
+ $this->remove($all_files, $id_for_old);
1296
+
1297
+ $_SESSION['massage_after_submit' . $id] = $result_temp[1];
1298
+ $_SESSION['error_or_no' . $id] = 1;
1299
+
1300
+ }
1301
+ else {
1302
+ if (defined('WD_FM_SAVE_PROG') && is_plugin_active(constant('WD_FM_SAVE_PROG'))) {
1303
+ $_GET['addon_task'] = 'clear_data';
1304
+ $_GET['form_id'] = $id;
1305
+ do_action('WD_FM_SAVE_PROG_init');
1306
+ }
1307
+ if (isset($counter)) {
1308
+ $this->gen_mail($counter, $all_files, $id_for_old, $result_temp[1]);
1309
+ }
1310
+ }
1311
+ }
1312
+ }
1313
+ }
1314
+ return $all_files;
1315
+ }
1316
+
1317
+ public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
1318
+ global $wpdb;
1319
+
1320
+ $query = "SELECT `" . $label_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
1321
+ if ($db_info) {
1322
+ $temp = explode('@@@wdfhostwdf@@@', $db_info);
1323
+ $host = $temp[0];
1324
+ $temp = explode('@@@wdfportwdf@@@', $temp[1]);
1325
+ $port = $temp[0];
1326
+ $temp = explode('@@@wdfusernamewdf@@@', $temp[1]);
1327
+ $username = $temp[0];
1328
+ $temp = explode('@@@wdfpasswordwdf@@@', $temp[1]);
1329
+ $password = $temp[0];
1330
+ $temp = explode('@@@wdfdatabasewdf@@@', $temp[1]);
1331
+ $database = $temp[0];
1332
+
1333
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
1334
+ $choices_labels = $wpdb_temp->get_results($query, ARRAY_N);
1335
+ }
1336
+ else {
1337
+ $choices_labels = $wpdb->get_results($query, ARRAY_N);
1338
+ }
1339
+ return $choices_labels;
1340
+ }
1341
+
1342
+ public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
1343
+ global $wpdb;
1344
+ $query = "SELECT `" . $value_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
1345
+ if ($db_info) {
1346
+ $temp = explode('@@@wdfhostwdf@@@', $db_info);
1347
+ $host = $temp[0];
1348
+ $temp = explode('@@@wdfportwdf@@@', $temp[1]);
1349
+ $port = $temp[0];
1350
+ $temp = explode('@@@wdfusernamewdf@@@', $temp[1]);
1351
+ $username = $temp[0];
1352
+ $temp = explode('@@@wdfpasswordwdf@@@', $temp[1]);
1353
+ $password = $temp[0];
1354
+ $temp = explode('@@@wdfdatabasewdf@@@', $temp[1]);
1355
+ $database = $temp[0];
1356
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
1357
+ $choices_values = $wpdb_temp->get_results($query, ARRAY_N);
1358
+ }
1359
+ else {
1360
+ $choices_values = $wpdb->get_results($query, ARRAY_N);
1361
+ }
1362
+ return $choices_values;
1363
+ }
1364
+
1365
+ public function save_db($counter, $id) {
1366
+ global $wpdb;
1367
+ $current_user = wp_get_current_user();
1368
+ if ($current_user->ID != 0) {
1369
+ $wp_userid = $current_user->ID;
1370
+ $wp_username = $current_user->display_name;
1371
+ $wp_useremail = $current_user->user_email;
1372
+ }
1373
+ else {
1374
+ $wp_userid = '';
1375
+ $wp_username = '';
1376
+ $wp_useremail = '';
1377
+ }
1378
+ $ip = $_SERVER['REMOTE_ADDR'];
1379
+
1380
+ $chgnac = TRUE;
1381
+ $all_files = array();
1382
+ $paypal = array();
1383
+ $paypal['item_name'] = array();
1384
+ $paypal['quantity'] = array();
1385
+ $paypal['amount'] = array();
1386
+ $is_amount = false;
1387
+ $paypal['on_os'] = array();
1388
+ $total = 0;
1389
+ $form_currency = '$';
1390
+ $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
1391
+ $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
1392
+ $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id= %d", $id));
1393
+ if (!$form->form_front) {
1394
+ $id = '';
1395
+ }
1396
+ if ($form->payment_currency) {
1397
+ $form_currency = $currency_sign[array_search($form->payment_currency, $currency_code)];
1398
+ }
1399
+ $label_id = array();
1400
+ $label_label = array();
1401
+ $label_type = array();
1402
+
1403
+ $disabled_fields = explode(',', (isset($_REQUEST["disabled_fields" . $id]) ? $_REQUEST["disabled_fields" . $id] : ""));
1404
+ $disabled_fields = array_slice($disabled_fields, 0, count($disabled_fields) - 1);
1405
+ $label_all = explode('#****#', $form->label_order_current);
1406
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
1407
+ foreach ($label_all as $key => $label_each) {
1408
+ $label_id_each = explode('#**id**#', $label_each);
1409
+ array_push($label_id, $label_id_each[0]);
1410
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
1411
+ array_push($label_label, $label_order_each[0]);
1412
+ array_push($label_type, $label_order_each[1]);
1413
+ }
1414
+ $max = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
1415
+ $fvals = array();
1416
+ foreach ($label_type as $key => $type) {
1417
+ $value = '';
1418
+ if ($type == "type_submit_reset" or $type == "type_map" or $type == "type_editor" or $type == "type_captcha" or $type == "type_arithmetic_captcha" or $type == "type_recaptcha" or $type == "type_button" or $type == "type_paypal_total" or $type == "type_send_copy") {
1419
+ continue;
1420
+ }
1421
+
1422
+ $i = $label_id[$key];
1423
+ if (!in_array($i, $disabled_fields)) {
1424
+ switch ($type) {
1425
+ case 'type_text':
1426
+ case 'type_password':
1427
+ case "type_submitter_mail":
1428
+ case "type_own_select":
1429
+ case "type_country":
1430
+ case "type_number":
1431
+ case "type_phone_new": {
1432
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1433
+ break;
1434
+ }
1435
+
1436
+ case "type_date": {
1437
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1438
+ $date_format = isset($_POST['wdform_' . $i . "_date_format" . $id]) ? esc_html($_POST['wdform_' . $i . "_date_format" . $id]) : "";
1439
+ if ($value) {
1440
+ if (!$this->fm_validateDate($value, $date_format)) {
1441
+ echo "<script> alert('" . addslashes(__("This is not a valid date format.", 'form_maker')) . "');</script>";
1442
+ return array($max + 1);
1443
+ }
1444
+ }
1445
+
1446
+ break;
1447
+ }
1448
+
1449
+ case "type_date_new": {
1450
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1451
+
1452
+ break;
1453
+ }
1454
+
1455
+ case "type_date_range": {
1456
+ $value = (isset($_POST['wdform_' . $i . "_element" . $id . "0"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . "0"]) : "") . ' - ' . (isset($_POST['wdform_' . $i . "_element" . $id . "1"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . "1"]) : "");
1457
+
1458
+ break;
1459
+ }
1460
+
1461
+ case 'type_textarea': {
1462
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1463
+ break;
1464
+ }
1465
+
1466
+ case "type_wdeditor": {
1467
+ $value = isset($_POST['wdform_' . $i . '_wd_editor' . $id]) ? esc_html($_POST['wdform_' . $i . '_wd_editor' . $id]) : "";
1468
+ break;
1469
+ }
1470
+ case "type_mark_map": {
1471
+ $value = (isset($_POST['wdform_' . $i . "_long" . $id]) ? esc_html($_POST['wdform_' . $i . "_long" . $id]) : "") . '***map***' . (isset($_POST['wdform_' . $i . "_lat" . $id]) ? esc_html($_POST['wdform_' . $i . "_lat" . $id]) : "");
1472
+ break;
1473
+ }
1474
+ case "type_date_fields": {
1475
+ $value = (isset($_POST['wdform_' . $i . "_day" . $id]) ? esc_html($_POST['wdform_' . $i . "_day" . $id]) : "") . '-' . (isset($_POST['wdform_' . $i . "_month" . $id]) ? esc_html($_POST['wdform_' . $i . "_month" . $id]) : "") . '-' . (isset($_POST['wdform_' . $i . "_year" . $id]) ? esc_html($_POST['wdform_' . $i . "_year" . $id]) : "");
1476
+ break;
1477
+ }
1478
+ case "type_time": {
1479
+ $ss = isset($_POST['wdform_' . $i . "_ss" . $id]) ? esc_html($_POST['wdform_' . $i . "_ss" . $id]) : NULL;
1480
+ if (isset($ss)) {
1481
+ $value = (isset($_POST['wdform_' . $i . "_hh" . $id]) ? esc_html($_POST['wdform_' . $i . "_hh" . $id]) : "") . ':' . (isset($_POST['wdform_' . $i . "_mm" . $id]) ?esc_html( $_POST['wdform_' . $i . "_mm" . $id]) : "") . ':' . (isset($_POST['wdform_' . $i . "_ss" . $id]) ? esc_html($_POST['wdform_' . $i . "_ss" . $id]) : "");
1482
+ }
1483
+ else {
1484
+ $value = (isset($_POST['wdform_' . $i . "_hh" . $id]) ? esc_html($_POST['wdform_' . $i . "_hh" . $id]) : "") . ':' . (isset($_POST['wdform_' . $i . "_mm" . $id]) ? esc_html($_POST['wdform_' . $i . "_mm" . $id]) : "");
1485
+ }
1486
+ $am_pm = isset($_POST['wdform_' . $i . "_am_pm" . $id]) ? esc_html($_POST['wdform_' . $i . "_am_pm" . $id]) : NULL;
1487
+ if (isset($am_pm)) {
1488
+ $value = $value . ' ' . $am_pm;
1489
+ }
1490
+ break;
1491
+ }
1492
+ case "type_phone": {
1493
+ $value = (isset($_POST['wdform_' . $i . "_element_first" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_first" . $id]) : "") . ' ' . (isset($_POST['wdform_' . $i . "_element_last" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_last" . $id]) : "");
1494
+ break;
1495
+ }
1496
+ case "type_name": {
1497
+ $element_title = isset($_POST['wdform_' . $i . "_element_title" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_title" . $id]) : NULL;
1498
+ $element_middle = isset($_POST['wdform_' . $i . "_element_middle" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_middle" . $id]) : NULL;
1499
+ if (isset($element_title) || isset($element_middle)) {
1500
+ $value = (isset($_POST['wdform_' . $i . "_element_title" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_title" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_first" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_first" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_last" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_last" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_middle" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_middle" . $id]) : "");
1501
+ }
1502
+ else {
1503
+ $value = (isset($_POST['wdform_' . $i . "_element_first" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_first" . $id]) : "") . '@@@' . (isset($_POST['wdform_' . $i . "_element_last" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_last" . $id]) : "");
1504
+ }
1505
+ break;
1506
+ }
1507
+ case "type_file_upload": {
1508
+ if (isset($_POST['wdform_' . $i . "_file_url" . $id . '_save'])) {
1509
+ $file_url = isset($_POST['wdform_' . $i . "_file_url" . $id . '_save']) ? stripslashes($_POST['wdform_' . $i . "_file_url" . $id . '_save']) : NULL;
1510
+ if (isset($file_url)) {
1511
+ $all_files = isset($_POST['wdform_' . $i . "_all_files" . $id . '_save']) ? json_decode(stripslashes($_POST['wdform_' . $i . "_all_files" . $id . '_save']), true) : array();
1512
+ $value = $file_url;
1513
+ }
1514
+ }
1515
+ else {
1516
+ $files = isset($_FILES['wdform_' . $i . '_file' . $id]) ? $_FILES['wdform_' . $i . '_file' . $id] : NULL;
1517
+ foreach ($files['name'] as $file_key => $file_name) {
1518
+ if ($file_name) {
1519
+ $untilupload = $form->form_fields;
1520
+ $untilupload = substr($untilupload, strpos($untilupload, $i . '*:*id*:*type_file_upload'), -1);
1521
+ $untilupload = substr($untilupload, 0, strpos($untilupload, '*:*new_field*:'));
1522
+ $untilupload = explode('*:*w_field_label_pos*:*', $untilupload);
1523
+ $untilupload = $untilupload[1];
1524
+ $untilupload = explode('*:*w_destination*:*', $untilupload);
1525
+ $destination = explode('*:*w_hide_label*:*', $untilupload[0]);
1526
+ $destination = $destination[1];
1527
+ $destination = str_replace(site_url() . '/', '', $destination);
1528
+ $untilupload = $untilupload[1];
1529
+ $untilupload = explode('*:*w_extension*:*', $untilupload);
1530
+ $extension = $untilupload[0];
1531
+ $untilupload = $untilupload[1];
1532
+ $untilupload = explode('*:*w_max_size*:*', $untilupload);
1533
+ $max_size = $untilupload[0];
1534
+ $untilupload = $untilupload[1];
1535
+ $fileName = $files['name'][$file_key];
1536
+ $fileSize = $files['size'][$file_key];
1537
+
1538
+ if ($fileSize > $max_size * 1024) {
1539
+ return array($max + 1, addslashes(__('The file exceeds the allowed size of', 'form_maker')) . $max_size . ' KB');
1540
+ }
1541
+
1542
+ $uploadedFileNameParts = explode('.', $fileName);
1543
+ $uploadedFileExtension = array_pop($uploadedFileNameParts);
1544
+ $to = strlen($fileName) - strlen($uploadedFileExtension) - 1;
1545
+
1546
+ $fileNameFree = substr($fileName, 0, $to);
1547
+ $invalidFileExts = explode(',', $extension);
1548
+ $extOk = false;
1549
+
1550
+ foreach ($invalidFileExts as $key => $valuee) {
1551
+ if (is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension)))) {
1552
+ $extOk = true;
1553
+ }
1554
+ }
1555
+
1556
+ if ($extOk == false) {
1557
+ return array($max + 1, addslashes(__('Can not upload this type of file', 'form_maker')));
1558
+ }
1559
+
1560
+ $fileTemp = $files['tmp_name'][$file_key];
1561
+ $p = 1;
1562
+
1563
+ if (!file_exists($destination)) {
1564
+ mkdir($destination, 0777);
1565
+ }
1566
+ if (file_exists($destination . "/" . $fileName)) {
1567
+ $fileName1 = $fileName;
1568
+ while (file_exists($destination . "/" . $fileName1)) {
1569
+ $to = strlen($file_name) - strlen($uploadedFileExtension) - 1;
1570
+ $fileName1 = substr($fileName, 0, $to) . '(' . $p . ').' . $uploadedFileExtension;
1571
+ // $file['name'] = $fileName;
1572
+ $p++;
1573
+ }
1574
+ $fileName = $fileName1;
1575
+ }
1576
+
1577
+ // for dropbox & google drive integration addons
1578
+ $check_both = 0;
1579
+ if ($form->save_uploads == 0) {
1580
+ if (defined('WD_FM_DBOX_INT') && is_plugin_active(constant('WD_FM_DBOX_INT'))) {
1581
+ $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix . "formmaker_dbox_int WHERE form_id=" . $form->id);
1582
+ if ($enable == 1) {
1583
+ $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix . "formmaker_dbox_int WHERE form_id=" . $form->id);
1584
+
1585
+ if ((int)$selectable_upload == 1) {
1586
+ $temp_dir_dbox = explode('\\', $fileTemp);
1587
+ $temp_dir_dbox = implode('%%', $temp_dir_dbox);
1588
+
1589
+ $value .= $temp_dir_dbox . '*@@url@@*' . $fileName;
1590
+ }
1591
+ else {
1592
+ $dlink_dbox = '<a href="' . add_query_arg(array('action' => 'WD_FM_DBOX_INT', 'addon_task' => 'upload_dbox_file', 'id' => $form->id), admin_url('admin-ajax.php')) . '&dbox_file_name=' . $fileName . '&dbox_folder_name=/' . $form->title . '" >' . $fileName . '</a>';
1593
+
1594
+ $value .= $dlink_dbox;
1595
+ }
1596
+
1597
+ $files['tmp_name'][$file_key] = $fileTemp;
1598
+ $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1599
+ }
1600
+ else {
1601
+ $check_both++;
1602
+ }
1603
+
1604
+ }
1605
+ else {
1606
+ $check_both++;
1607
+ }
1608
+ if (defined('WD_FM_GDRIVE_INT') && is_plugin_active(constant('WD_FM_GDRIVE_INT'))) {
1609
+ $enable = $wpdb->get_var("SELECT enable FROM " . $wpdb->prefix . "formmaker_gdrive_int WHERE form_id=" . $form->id);
1610
+ if ($enable == 1) {
1611
+ $selectable_upload = $wpdb->get_var("SELECT selectable_upload FROM " . $wpdb->prefix . "formmaker_gdrive_int WHERE form_id=" . $form->id);
1612
+
1613
+ if ((int)$selectable_upload == 1) {
1614
+ $temp_dir_dbox = explode('\\', $fileTemp);
1615
+ $temp_dir_dbox = implode('%%', $temp_dir_dbox);
1616
+ $value .= 'wdCloudAddon' . $temp_dir_dbox . '*@@url@@*' . $fileName . '*@@url@@*' . $files['type'][$file_key];
1617
+ }
1618
+ else {
1619
+ $dlink_dbox = '<a target="_blank" href="' . add_query_arg(array('action' => 'WD_FM_GDRIVE_INT', 'addon_task' => 'create_drive_link', 'id' => $form->id), admin_url('admin-ajax.php')) . '&gdrive_file_name=' . $fileName . '&gdrive_folder_name=' . $form->title . '" >' . $fileName . '</a>';
1620
+ $value .= $dlink_dbox;
1621
+ }
1622
+
1623
+ $files['tmp_name'][$file_key] = $fileTemp;
1624
+ $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1625
+ }
1626
+ else {
1627
+ $check_both++;
1628
+ }
1629
+
1630
+ }
1631
+ else {
1632
+ $check_both++;
1633
+ }
1634
+
1635
+ }
1636
+ //
1637
+ if ($check_both != 0) {
1638
+ $value .= '';
1639
+ $files['tmp_name'][$file_key] = $fileTemp;
1640
+ $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1641
+ }
1642
+ // dropbox and google drive integration addons
1643
+ if ($form->save_uploads == 1) {
1644
+ if (!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
1645
+ return array($max + 1, addslashes(__('Error, file cannot be moved.', 'form_maker')));
1646
+ }
1647
+ $value .= site_url() . '/' . $destination . '/' . $fileName . '*@@url@@*';
1648
+ $files['tmp_name'][$file_key] = $destination . "/" . $fileName;
1649
+ $temp_file = array("name" => $files['name'][$file_key], "type" => $files['type'][$file_key], "tmp_name" => $files['tmp_name'][$file_key], 'field_key' => $i);
1650
+
1651
+ }
1652
+ array_push($all_files, $temp_file);
1653
+ }
1654
+ }
1655
+ }
1656
+ break;
1657
+ }
1658
+
1659
+ case 'type_address': {
1660
+ $value = '*#*#*#';
1661
+ $element = isset($_POST['wdform_' . $i . "_street1" . $id]) ? esc_html($_POST['wdform_' . $i . "_street1" . $id]) : NULL;
1662
+ if (isset($element)) {
1663
+ $value = $element;
1664
+ break;
1665
+ }
1666
+
1667
+ $element = isset($_POST['wdform_' . $i . "_street2" . $id]) ? esc_html($_POST['wdform_' . $i . "_street2" . $id]) : NULL;
1668
+ if (isset($element)) {
1669
+ $value = $element;
1670
+ break;
1671
+ }
1672
+
1673
+ $element = isset($_POST['wdform_' . $i . "_city" . $id]) ? esc_html($_POST['wdform_' . $i . "_city" . $id]) : NULL;
1674
+ if (isset($element)) {
1675
+ $value = $element;
1676
+ break;
1677
+ }
1678
+
1679
+ $element = isset($_POST['wdform_' . $i . "_state" . $id]) ? esc_html($_POST['wdform_' . $i . "_state" . $id]) : NULL;
1680
+ if (isset($element)) {
1681
+ $value = $element;
1682
+ break;
1683
+ }
1684
+
1685
+ $element = isset($_POST['wdform_' . $i . "_postal" . $id]) ? esc_html($_POST['wdform_' . $i . "_postal" . $id]) : NULL;
1686
+ if (isset($element)) {
1687
+ $value = $element;
1688
+ break;
1689
+ }
1690
+
1691
+ $element = isset($_POST['wdform_' . $i . "_country" . $id]) ? esc_html($_POST['wdform_' . $i . "_country" . $id]) : NULL;
1692
+ if (isset($element)) {
1693
+ $value = $element;
1694
+ break;
1695
+ }
1696
+ break;
1697
+ }
1698
+
1699
+ case "type_hidden": {
1700
+ $value = isset($_POST[$label_label[$key]]) ? esc_html($_POST[$label_label[$key]]) : "";
1701
+ break;
1702
+ }
1703
+
1704
+ case "type_radio": {
1705
+ $element = isset($_POST['wdform_' . $i . "_other_input" . $id]) ? esc_html($_POST['wdform_' . $i . "_other_input" . $id]) : NULL;
1706
+ if (isset($element)) {
1707
+ $value = $element;
1708
+ break;
1709
+ }
1710
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1711
+ break;
1712
+ }
1713
+
1714
+ case "type_checkbox": {
1715
+ $start = -1;
1716
+ $value = '';
1717
+ for ($j = 0; $j < 100; $j++) {
1718
+ $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1719
+ if (isset($element)) {
1720
+ $start = $j;
1721
+ break;
1722
+ }
1723
+ }
1724
+
1725
+ $other_element_id = -1;
1726
+ $is_other = isset($_POST['wdform_' . $i . "_allow_other" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other" . $id]) : "";
1727
+ if ($is_other == "yes") {
1728
+ $other_element_id = isset($_POST['wdform_' . $i . "_allow_other_num" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other_num" . $id]) : "";
1729
+ }
1730
+
1731
+ if ($start != -1) {
1732
+ for ($j = $start; $j < 100; $j++) {
1733
+ $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1734
+ if (isset($element)) {
1735
+ if ($j == $other_element_id) {
1736
+ $value = $value . (isset($_POST['wdform_' . $i . "_other_input" . $id]) ? esc_html($_POST['wdform_' . $i . "_other_input" . $id]) : "") . '***br***';
1737
+ }
1738
+ else {
1739
+ $value = $value . (isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : "") . '***br***';
1740
+ }
1741
+ }
1742
+ }
1743
+ }
1744
+ break;
1745
+ }
1746
+
1747
+ case "type_paypal_price": {
1748
+ $value = isset($_POST['wdform_' . $i . "_element_dollars" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_dollars" . $id]) : 0;
1749
+
1750
+ $value = (int)preg_replace('/\D/', '', $value);
1751
+
1752
+ if (isset($_POST['wdform_' . $i . "_element_cents" . $id])) {
1753
+ $value = $value . '.' . (preg_replace('/\D/', '', esc_html($_POST['wdform_' . $i . "_element_cents" . $id])));
1754
+ }
1755
+
1756
+ $total += (float)($value);
1757
+ $paypal_option = array();
1758
+
1759
+ if ($value != 0) {
1760
+ $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1761
+ array_push($paypal['item_name'], $label_label[$key]);
1762
+ array_push($paypal['quantity'], $quantity);
1763
+ array_push($paypal['amount'], $value);
1764
+ $is_amount = true;
1765
+ array_push($paypal['on_os'], $paypal_option);
1766
+ }
1767
+ $value = $value . $form_currency;
1768
+ break;
1769
+ }
1770
+
1771
+ case "type_paypal_price_new": {
1772
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : 0;
1773
+ $total += (float)($value);
1774
+ $paypal_option = array();
1775
+
1776
+ if ($value != 0) {
1777
+ $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1778
+ array_push($paypal['item_name'], $label_label[$key]);
1779
+ array_push($paypal['quantity'], $quantity);
1780
+ array_push($paypal['amount'], $value);
1781
+ $is_amount = true;
1782
+ array_push($paypal['on_os'], $paypal_option);
1783
+ }
1784
+ $value = $form_currency . $value;
1785
+ break;
1786
+ }
1787
+
1788
+ case "type_paypal_select": {
1789
+ if (isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] != '') {
1790
+ $value = esc_html($_POST['wdform_' . $i . "_element_label" . $id]) . ' : ' . $form_currency . (isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "");
1791
+ }
1792
+ else {
1793
+ $value = '';
1794
+ }
1795
+ $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1796
+ $total += (float)(isset($_POST['wdform_' . $i . "_element" . $id]) ? $_POST['wdform_' . $i . "_element" . $id] : 0) * $quantity;
1797
+ array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? $_POST['wdform_' . $i . "_element_label" . $id] : ""));
1798
+ array_push($paypal['quantity'], $quantity);
1799
+ array_push($paypal['amount'], (isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : ""));
1800
+ if (isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] != 0) {
1801
+ $is_amount = true;
1802
+ }
1803
+ $element_quantity = isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : NULL;
1804
+ if (isset($element_quantity) && $value != '') {
1805
+ $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_quantity_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity_label" . $id]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) . '***quantity***';
1806
+ }
1807
+ $paypal_option = array();
1808
+ $paypal_option['on'] = array();
1809
+ $paypal_option['os'] = array();
1810
+
1811
+ for ($k = 0; $k < 50; $k++) {
1812
+ $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1813
+ if (isset($temp_val) && $value != '') {
1814
+ array_push($paypal_option['on'], (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : ""));
1815
+ array_push($paypal_option['os'], (isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : ""));
1816
+ $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "") . ': ' . (isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : "") . '***property***';
1817
+ }
1818
+ }
1819
+ array_push($paypal['on_os'], $paypal_option);
1820
+ break;
1821
+ }
1822
+
1823
+ case "type_paypal_radio": {
1824
+ $element = isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : '';
1825
+ if ($element) {
1826
+ $value = (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_label" . $id]) : '') . ' : ' . $form_currency . $element;
1827
+ }
1828
+ else {
1829
+ $value = '';
1830
+ }
1831
+ $quantity = (isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1832
+ $total += (float)(isset($_POST['wdform_' . $i . "_element" . $id]) ? $_POST['wdform_' . $i . "_element" . $id] : 0) * $quantity;
1833
+ array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_label" . $id]) : ""));
1834
+ array_push($paypal['quantity'], $quantity);
1835
+ array_push($paypal['amount'], (isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : 0));
1836
+ if (isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] != 0) {
1837
+ $is_amount = true;
1838
+ }
1839
+
1840
+ $element_quantity = isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : NULL;
1841
+ if (isset($element_quantity) && $value != '') {
1842
+ $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_quantity_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity_label" . $id]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) . '***quantity***';
1843
+ }
1844
+
1845
+ $paypal_option = array();
1846
+ $paypal_option['on'] = array();
1847
+ $paypal_option['os'] = array();
1848
+
1849
+ for ($k = 0; $k < 50; $k++) {
1850
+ $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1851
+ if (isset($temp_val) && $value != '') {
1852
+ array_push($paypal_option['on'], (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : ""));
1853
+ array_push($paypal_option['os'], esc_html($_POST['wdform_' . $i . "_property" . $id . $k]));
1854
+ $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) . '***property***';
1855
+ }
1856
+ }
1857
+ array_push($paypal['on_os'], $paypal_option);
1858
+ break;
1859
+ }
1860
+
1861
+ case "type_paypal_shipping": {
1862
+ $element = isset($_POST['wdform_' . $i . "_element" . $id]) && $_POST['wdform_' . $i . "_element" . $id] ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : '';
1863
+ if ($element) {
1864
+ $value = (isset($_POST['wdform_' . $i . "_element_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_label" . $id]) : '') . ' : ' . $form_currency . $element;
1865
+ }
1866
+ else {
1867
+ $value = '';
1868
+ }
1869
+ $paypal['shipping'] = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1870
+ break;
1871
+ }
1872
+
1873
+ case "type_paypal_checkbox": {
1874
+ $start = -1;
1875
+ $value = '';
1876
+ for ($j = 0; $j < 100; $j++) {
1877
+ $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1878
+ if (isset($element)) {
1879
+ $start = $j;
1880
+ break;
1881
+ }
1882
+ }
1883
+
1884
+ $other_element_id = -1;
1885
+ $is_other = isset($_POST['wdform_' . $i . "_allow_other" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other" . $id]) : "";
1886
+ if ($is_other == "yes") {
1887
+ $other_element_id = isset($_POST['wdform_' . $i . "_allow_other_num" . $id]) ? esc_html($_POST['wdform_' . $i . "_allow_other_num" . $id]) : "";
1888
+ }
1889
+
1890
+ if ($start != -1) {
1891
+ for ($j = $start; $j < 100; $j++) {
1892
+ $element = isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : NULL;
1893
+ if (isset($element)) {
1894
+ if ($j == $other_element_id) {
1895
+ $value = $value . (isset($_POST['wdform_' . $i . "_other_input" . $id]) ? esc_html($_POST['wdform_' . $i . "_other_input" . $id]) : "") . '***br***';
1896
+ }
1897
+ else {
1898
+ $element = (isset($_POST['wdform_' . $i . "_element" . $id . $j]) && $_POST['wdform_' . $i . "_element" . $id . $j] ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j]) : 0);
1899
+ $value = $value . (isset($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) : "") . ' - ' . $form_currency . $element . '***br***';
1900
+
1901
+ $quantity = ((isset($_POST['wdform_' . $i . "_element_quantity" . $id]) && ($_POST['wdform_' . $i . "_element_quantity" . $id] >= 1)) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : 1);
1902
+ $total += (float)(isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? $_POST['wdform_' . $i . "_element" . $id . $j] : 0) * (float)($quantity);
1903
+ array_push($paypal['item_name'], $label_label[$key] . ' ' . (isset($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . $j . "_label"]) : ""));
1904
+ array_push($paypal['quantity'], $quantity);
1905
+ array_push($paypal['amount'], (isset($_POST['wdform_' . $i . "_element" . $id . $j]) ? ($_POST['wdform_' . $i . "_element" . $id . $j] == '' ? '0' : esc_html($_POST['wdform_' . $i . "_element" . $id . $j])) : ""));
1906
+ if (isset($_POST['wdform_' . $i . "_element" . $id . $j]) && $_POST['wdform_' . $i . "_element" . $id . $j] != 0) {
1907
+ $is_amount = TRUE;
1908
+ }
1909
+ $paypal_option = array();
1910
+ $paypal_option['on'] = array();
1911
+ $paypal_option['os'] = array();
1912
+
1913
+ for ($k = 0; $k < 50; $k++) {
1914
+ $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1915
+ if (isset($temp_val)) {
1916
+ array_push($paypal_option['on'], isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "");
1917
+ array_push($paypal_option['os'], esc_html($_POST['wdform_' . $i . "_property" . $id . $k]));
1918
+ }
1919
+ }
1920
+ array_push($paypal['on_os'], $paypal_option);
1921
+ }
1922
+ }
1923
+ }
1924
+
1925
+ $element_quantity = isset($_POST['wdform_' . $i . "_element_quantity" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) : NULL;
1926
+ if (isset($element_quantity)) {
1927
+ $value .= (isset($_POST['wdform_' . $i . "_element_quantity_label" . $id]) ? esc_html($_POST['wdform_' . $i . "_element_quantity_label" . $id]) : "") . ': ' . esc_html($_POST['wdform_' . $i . "_element_quantity" . $id]) . '***quantity***';
1928
+ }
1929
+ for ($k = 0; $k < 50; $k++) {
1930
+ $temp_val = isset($_POST['wdform_' . $i . "_property" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_property" . $id . $k]) : NULL;
1931
+ if (isset($temp_val)) {
1932
+ $value .= '***br***' . (isset($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_element_property_label" . $id . $k]) : "") . ': ' . $_POST['wdform_' . $i . "_property" . $id . $k] . '***property***';
1933
+ }
1934
+ }
1935
+ }
1936
+ break;
1937
+ }
1938
+
1939
+ case "type_star_rating": {
1940
+ if (isset($_POST['wdform_' . $i . "_selected_star_amount" . $id]) && $_POST['wdform_' . $i . "_selected_star_amount" . $id] == "") {
1941
+ $selected_star_amount = 0;
1942
+ }
1943
+ else {
1944
+ $selected_star_amount = isset($_POST['wdform_' . $i . "_selected_star_amount" . $id]) ? $_POST['wdform_' . $i . "_selected_star_amount" . $id] : 0;
1945
+ }
1946
+ $value = $selected_star_amount . '/' . (isset($_POST['wdform_' . $i . "_star_amount" . $id]) ? esc_html($_POST['wdform_' . $i . "_star_amount" . $id]) : "");
1947
+ break;
1948
+ }
1949
+
1950
+ case "type_scale_rating": {
1951
+ $value = (isset($_POST['wdform_' . $i . "_scale_radio" . $id]) ? esc_html($_POST['wdform_' . $i . "_scale_radio" . $id]) : 0) . '/' . (isset($_POST['wdform_' . $i . "_scale_amount" . $id]) ? esc_html($_POST['wdform_' . $i . "_scale_amount" . $id]) : "");
1952
+ break;
1953
+ }
1954
+
1955
+ case "type_spinner": {
1956
+ $value = isset($_POST['wdform_' . $i . "_element" . $id]) ? esc_html($_POST['wdform_' . $i . "_element" . $id]) : "";
1957
+ break;
1958
+ }
1959
+
1960
+ case "type_slider": {
1961
+ $value = isset($_POST['wdform_' . $i . "_slider_value" . $id]) ? esc_html($_POST['wdform_' . $i . "_slider_value" . $id]) : "";
1962
+ break;
1963
+ }
1964
+
1965
+ case "type_range": {
1966
+ $value = (isset($_POST['wdform_' . $i . "_element" . $id . '0']) ? esc_html($_POST['wdform_' . $i . "_element" . $id . '0']) : "") . '-' . (isset($_POST['wdform_' . $i . "_element" . $id . '1']) ? esc_html($_POST['wdform_' . $i . "_element" . $id . '1']) : "");
1967
+ break;
1968
+ }
1969
+
1970
+ case "type_grading": {
1971
+ $value = "";
1972
+ $items = explode(":", isset($_POST['wdform_' . $i . "_hidden_item" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_item" . $id]) : "");
1973
+ for ($k = 0; $k < sizeof($items) - 1; $k++) {
1974
+ $value .= (isset($_POST['wdform_' . $i . "_element" . $id . '_' . $k]) ? esc_html($_POST['wdform_' . $i . "_element" . $id . '_' . $k]) : "") . ':';
1975
+ }
1976
+ $value .= (isset($_POST['wdform_' . $i . "_hidden_item" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_item" . $id]) : "") . '***grading***';
1977
+ break;
1978
+ }
1979
+
1980
+ case "type_matrix": {
1981
+ $rows_of_matrix = explode("***", isset($_POST['wdform_' . $i . "_hidden_row" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_row" . $id]) : "");
1982
+ $rows_count = sizeof($rows_of_matrix) - 1;
1983
+ $column_of_matrix = explode("***", isset($_POST['wdform_' . $i . "_hidden_column" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_column" . $id]) : "");
1984
+ $columns_count = sizeof($column_of_matrix) - 1;
1985
+
1986
+ if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "radio") {
1987
+ $input_value = "";
1988
+ for ($k = 1; $k <= $rows_count; $k++) {
1989
+ $input_value .= (isset($_POST['wdform_' . $i . "_input_element" . $id . $k]) ? esc_html($_POST['wdform_' . $i . "_input_element" . $id . $k]) : 0) . "***";
1990
+ }
1991
+ }
1992
+ if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "checkbox") {
1993
+ $input_value = "";
1994
+ for ($k = 1; $k <= $rows_count; $k++) {
1995
+ for ($j = 1; $j <= $columns_count; $j++) {
1996
+ $input_value .= (isset($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) ? esc_html($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) : 0) . "***";
1997
+ }
1998
+ }
1999
+ }
2000
+
2001
+ if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "text") {
2002
+ $input_value = "";
2003
+ for ($k = 1; $k <= $rows_count; $k++) {
2004
+ for ($j = 1; $j <= $columns_count; $j++) {
2005
+ $input_value .= (isset($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) ? esc_html($_POST['wdform_' . $i . "_input_element" . $id . $k . '_' . $j]) : "") . "***";
2006
+ }
2007
+ }
2008
+ }
2009
+
2010
+ if (isset($_POST['wdform_' . $i . "_input_type" . $id]) && $_POST['wdform_' . $i . "_input_type" . $id] == "select") {
2011
+ $input_value = "";
2012
+ for ($k = 1; $k <= $rows_count; $k++) {
2013
+ for ($j = 1; $j <= $columns_count; $j++) {
2014
+ $input_value .= (isset($_POST['wdform_' . $i . "_select_yes_no" . $id . $k . '_' . $j]) ? esc_html($_POST['wdform_' . $i . "_select_yes_no" . $id . $k . '_' . $j]) : "") . "***";
2015
+ }
2016
+ }
2017
+ }
2018
+
2019
+ $value = $rows_count . (isset($_POST['wdform_' . $i . "_hidden_row" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_row" . $id]) : "") . '***' . $columns_count . (isset($_POST['wdform_' . $i . "_hidden_column" . $id]) ? esc_html($_POST['wdform_' . $i . "_hidden_column" . $id]) : "") . '***' . (isset($_POST['wdform_' . $i . "_input_type" . $id]) ? esc_html($_POST['wdform_' . $i . "_input_type" . $id]) : "") . '***' . $input_value . '***matrix***';
2020
+ break;
2021
+ }
2022
+
2023
+ }
2024
+
2025
+ if ($type == "type_address") {
2026
+ if ($value == '*#*#*#') {
2027
+ continue;
2028
+ }
2029
+ }
2030
+ if ($type == "type_text" or $type == "type_password" or $type == "type_textarea" or $type == "type_name" or $type == "type_submitter_mail" or $type == "type_number" or $type == "type_phone" or $type == "type_phone_new") {
2031
+ $untilupload = $form->form_fields;
2032
+ $untilupload = substr($untilupload, strpos($untilupload, $i . '*:*id*:*' . $type), -1);
2033
+ $untilupload = substr($untilupload, 0, strpos($untilupload, '*:*new_field*:'));
2034
+ $untilupload = explode('*:*w_required*:*', $untilupload);
2035
+ $untilupload = $untilupload[1];
2036
+ $untilupload = explode('*:*w_unique*:*', $untilupload);
2037
+ $unique_element = $untilupload[0];
2038
+ if (strlen($unique_element) > 3) {
2039
+ $unique_element = substr($unique_element, -3);
2040
+ }
2041
+
2042
+ if ($unique_element == 'yes') {
2043
+ $unique = $wpdb->get_col($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id= %d and element_label= %s and element_value= %s", $id, $i, addslashes($value)));
2044
+ if ($unique) {
2045
+ return array(($max + 1), addslashes(addslashes(sprintf(__('This field %s requires a unique entry.', 'form_maker'), $label_label[$key]))));
2046
+ }
2047
+ }
2048
+ }
2049
+ $save_or_no = TRUE;
2050
+ $fvals['{' . $i . '}'] = str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***"), array(" ", "", " ", " ", " ", ", "), addslashes($value));
2051
+
2052
+ if ($form->savedb) {
2053
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2054
+ 'form_id' => $id,
2055
+ 'element_label' => $i,
2056
+ 'element_value' => stripslashes($value),
2057
+ 'group_id' => ($max + 1),
2058
+ 'date' => date('Y-m-d H:i:s'),
2059
+ 'ip' => $_SERVER['REMOTE_ADDR'],
2060
+ 'user_id_wd' => $current_user->ID,
2061
+ ), array(
2062
+ '%d',
2063
+ '%s',
2064
+ '%s',
2065
+ '%d',
2066
+ '%s',
2067
+ '%s',
2068
+ '%d'
2069
+ ));
2070
+ }
2071
+ if (!$save_or_no) {
2072
+ return FALSE;
2073
+ }
2074
+ $chgnac = FALSE;
2075
+ }
2076
+ else {
2077
+ $fvals['{' . $i . '}'] = '';
2078
+ }
2079
+ }
2080
+
2081
+ $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
2082
+ $user_fields = array("subid" => $subid, "ip" => $ip, "userid" => $wp_userid, "username" => $wp_username, "useremail" => $wp_useremail);
2083
+
2084
+ $queries = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=%d", (int)$id));
2085
+ if ($queries) {
2086
+ foreach ($queries as $query) {
2087
+ $temp = explode('***wdfcon_typewdf***', $query->details);
2088
+ $con_type = $temp[0];
2089
+ $temp = explode('***wdfcon_methodwdf***', $temp[1]);
2090
+ $con_method = $temp[0];
2091
+ $temp = explode('***wdftablewdf***', $temp[1]);
2092
+ $table_cur = $temp[0];
2093
+ $temp = explode('***wdfhostwdf***', $temp[1]);
2094
+ $host = $temp[0];
2095
+ $temp = explode('***wdfportwdf***', $temp[1]);
2096
+ $port = $temp[0];
2097
+ $temp = explode('***wdfusernamewdf***', $temp[1]);
2098
+ $username = $temp[0];
2099
+ $temp = explode('***wdfpasswordwdf***', $temp[1]);
2100
+ $password = $temp[0];
2101
+ $temp = explode('***wdfdatabasewdf***', $temp[1]);
2102
+ $database = $temp[0];
2103
+
2104
+ $query = str_replace(array_keys($fvals), $fvals, $query->query);
2105
+ foreach ($user_fields as $user_key => $user_field) {
2106
+ $query = str_replace('{' . $user_key . '}', $user_field, $query);
2107
+ }
2108
+
2109
+ if ($con_type == 'remote') {
2110
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
2111
+ $wpdb_temp->query($query);
2112
+ }
2113
+ else {
2114
+ $wpdb->query($query);
2115
+ }
2116
+ }
2117
+ // $wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
2118
+ }
2119
+
2120
+ $addons = array('WD_FM_MAILCHIMP' => 'MailChimp', 'WD_FM_REG' => 'Registration');
2121
+ foreach ($addons as $addon => $addon_name) {
2122
+ if (defined($addon) && is_plugin_active(constant($addon))) {
2123
+ $_GET['addon_task'] = 'frontend';
2124
+ $_GET['form_id'] = $id;
2125
+ $GLOBALS['fvals'] = $fvals;
2126
+ do_action($addon . '_init');
2127
+ }
2128
+ }
2129
+
2130
+ $addons = array('WD_FM_STRIPE' => 'Stripe');
2131
+ foreach ($addons as $addon => $addon_name) {
2132
+ if (defined($addon) && is_plugin_active(constant($addon))) {
2133
+ $_GET['addon_task'] = 'pay_with_stripe';
2134
+ $_GET['form_id'] = $id;
2135
+
2136
+ $GLOBALS['wdstripe_stripeToken'] = isset($_POST['stripeToken' . $id]) ? $_POST['stripeToken' . $id] : '';
2137
+
2138
+ if ($is_amount && isset($_POST['stripeToken' . $id])) {
2139
+ $wdstripe_products_data = new stdClass();
2140
+ $tax = $form->tax;
2141
+ $total = $total + ($total * $tax) / 100;
2142
+ $shipping = isset($paypal['shipping']) ? $paypal['shipping'] : 0;
2143
+ $total = $total + $shipping;
2144
+ $total = round($total, 2);
2145
+ $wdstripe_products_data->currency = $form->payment_currency;
2146
+ $wdstripe_products_data->amount = $total;
2147
+ $wdstripe_products_data->shipping = $shipping;
2148
+ $wdstripe_products_data = json_encode($wdstripe_products_data);
2149
+ $GLOBALS['wdstripe_products_data'] = $wdstripe_products_data;
2150
+ do_action($addon . '_init');
2151
+ if (isset($GLOBALS['wdstripe_error'])) {
2152
+ return array($max + 1);
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+
2158
+ $str = '';
2159
+
2160
+ if ($form->paypal_mode) {
2161
+ if ($paypal['item_name']) {
2162
+ if ($is_amount) {
2163
+ $tax = $form->tax;
2164
+ $currency = $form->payment_currency;
2165
+ $business = $form->paypal_email;
2166
+ $ip = $_SERVER['REMOTE_ADDR'];
2167
+ $total2 = round($total, 2);
2168
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2169
+ 'form_id' => $id,
2170
+ 'element_label' => 'item_total',
2171
+ 'element_value' => $form_currency . $total2,
2172
+ 'group_id' => ($max + 1),
2173
+ 'date' => date('Y-m-d H:i:s'),
2174
+ 'ip' => $ip,
2175
+ 'user_id_wd' => $current_user->ID,
2176
+ ), array(
2177
+ '%d',
2178
+ '%s',
2179
+ '%s',
2180
+ '%d',
2181
+ '%s',
2182
+ '%s',
2183
+ '%d'
2184
+ ));
2185
+ if (!$save_or_no) {
2186
+ return false;
2187
+ }
2188
+ $total = $total + ($total * $tax) / 100;
2189
+ if (isset($paypal['shipping'])) {
2190
+ $total = $total + $paypal['shipping'];
2191
+ }
2192
+ $total = round($total, 2);
2193
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2194
+ 'form_id' => $id,
2195
+ 'element_label' => 'total',
2196
+ 'element_value' => $form_currency . $total,
2197
+ 'group_id' => ($max + 1),
2198
+ 'date' => date('Y-m-d H:i:s'),
2199
+ 'ip' => $ip,
2200
+ 'user_id_wd' => $current_user->ID,
2201
+ ), array(
2202
+ '%d',
2203
+ '%s',
2204
+ '%s',
2205
+ '%d',
2206
+ '%s',
2207
+ '%s',
2208
+ '%d'
2209
+ ));
2210
+ if (!$save_or_no) {
2211
+ return false;
2212
+ }
2213
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2214
+ 'form_id' => $id,
2215
+ 'element_label' => '0',
2216
+ 'element_value' => 'In progress',
2217
+ 'group_id' => ($max + 1),
2218
+ 'date' => date('Y-m-d H:i:s'),
2219
+ 'ip' => $ip,
2220
+ 'user_id_wd' => $current_user->ID,
2221
+ ), array(
2222
+ '%d',
2223
+ '%s',
2224
+ '%s',
2225
+ '%d',
2226
+ '%s',
2227
+ '%s',
2228
+ '%d'
2229
+ ));
2230
+ if (!$save_or_no) {
2231
+ return false;
2232
+ }
2233
+ $str = '';
2234
+
2235
+ if ($form->checkout_mode == 1 || $form->checkout_mode == "production") {
2236
+ $str .= "https://www.paypal.com/cgi-bin/webscr?";
2237
+ }
2238
+ else {
2239
+ $str .= "https://www.sandbox.paypal.com/cgi-bin/webscr?";
2240
+ }
2241
+ $str .= "currency_code=" . $currency;
2242
+ $str .= "&business=" . urlencode($business);
2243
+ $str .= "&cmd=" . "_cart";
2244
+ $str .= "&notify_url=" . admin_url('admin-ajax.php?action=checkpaypal%26form_id=' . $id . '%26group_id=' . ($max + 1));
2245
+ $str .= "&upload=" . "1";
2246
+ $str .= "&charset=UTF-8";
2247
+ if (isset($paypal['shipping'])) {
2248
+ $str = $str . "&shipping_1=" . $paypal['shipping'];
2249
+ // $str=$str."&weight_cart=".$paypal['shipping'];
2250
+ // $str=$str."&shipping2=3".$paypal['shipping'];
2251
+ $str = $str . "&no_shipping=2";
2252
+ }
2253
+ $i = 0;
2254
+ foreach ($paypal['item_name'] as $pkey => $pitem_name) {
2255
+ if ($paypal['amount'][$pkey]) {
2256
+ $i++;
2257
+ $str = $str . "&item_name_" . $i . "=" . urlencode($pitem_name);
2258
+ $str = $str . "&amount_" . $i . "=" . $paypal['amount'][$pkey];
2259
+ $str = $str . "&quantity_" . $i . "=" . $paypal['quantity'][$pkey];
2260
+ if ($tax) {
2261
+ $str = $str . "&tax_rate_" . $i . "=" . $tax;
2262
+ }
2263
+ if ($paypal['on_os'][$pkey]) {
2264
+ foreach ($paypal['on_os'][$pkey]['on'] as $on_os_key => $on_item_name) {
2265
+ $str = $str . "&on" . $on_os_key . "_" . $i . "=" . $on_item_name;
2266
+ $str = $str . "&os" . $on_os_key . "_" . $i . "=" . $paypal['on_os'][$pkey]['os'][$on_os_key];
2267
+ }
2268
+ }
2269
+ }
2270
+ }
2271
+ }
2272
+ }
2273
+ }
2274
+
2275
+ if ($form->mail_verify) {
2276
+ unset($_SESSION['hash']);
2277
+ unset($_SESSION['gid']);
2278
+ $ip = $_SERVER['REMOTE_ADDR'];
2279
+ $_SESSION['gid'] = $max + 1;
2280
+ $send_tos = explode('**', $form->send_to);
2281
+ if ($send_tos) {
2282
+ foreach ($send_tos as $send_index => $send_to) {
2283
+ $_SESSION['hash'][] = md5($ip . time() . rand());
2284
+ $send_to = str_replace('*', '', $send_to);
2285
+ $save_or_no = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
2286
+ 'form_id' => $id,
2287
+ 'element_label' => 'verifyInfo@' . $send_to,
2288
+ 'element_value' => $_SESSION['hash'][$send_index] . "**" . $form->mail_verify_expiretime . "**" . $send_to,
2289
+ 'group_id' => ($max + 1),
2290
+ 'date' => date('Y-m-d H:i:s'),
2291
+ 'ip' => $ip,
2292
+ 'user_id_wd' => $current_user->ID,
2293
+ ), array(
2294
+ '%d',
2295
+ '%s',
2296
+ '%s',
2297
+ '%d',
2298
+ '%s',
2299
+ '%s',
2300
+ '%d'
2301
+ ));
2302
+ if (!$save_or_no) {
2303
+ return false;
2304
+ }
2305
+ }
2306
+ }
2307
+ }
2308
+
2309
+ if ($chgnac) {
2310
+ if ($form->submit_text_type != 4) {
2311
+ $_SESSION['massage_after_submit' . $id] = addslashes(addslashes(__('Nothing was submitted.', 'form_maker')));
2312
+ }
2313
+ $_SESSION['error_or_no' . $id] = 1;
2314
+ $_SESSION['form_submit_type' . $id] = $form->submit_text_type . "," . $form->id;
2315
+ wp_redirect($_SERVER["REQUEST_URI"]);
2316
+ exit;
2317
+ }
2318
+
2319
+ $addons = array('WD_FM_GDRIVE_INT' => 'GDriveInt', 'WD_FM_DBOX_INT' => 'DboxInt', 'WD_FM_POST_GEN' => 'PostGen', 'WD_FM_PUSHOVER' => 'Pushover'); // the sequence is important for google drive and drop box addons !!!!!!!!!!
2320
+ foreach ($addons as $addon => $addon_name) {
2321
+ if (defined($addon) && is_plugin_active(constant($addon))) {
2322
+ $_GET['addon_task'] = 'frontend';
2323
+ $_GET['form_id'] = $id;
2324
+ $GLOBALS['all_files'] = json_encode($all_files);
2325
+ $GLOBALS['form_currency'] = $form_currency;
2326
+ do_action($addon . '_init');
2327
+ }
2328
+ }
2329
+ return array($all_files, $str);
2330
+ }
2331
+
2332
+ public function remove($group_id) {
2333
+ global $wpdb;
2334
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id= %d', $group_id));
2335
+ }
2336
+
2337
+ public function get_after_submission_text($form_id) {
2338
+ global $wpdb;
2339
+ $submit_text = $wpdb->get_var("SELECT submit_text FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
2340
+ $current_user = wp_get_current_user();
2341
+ if ($current_user->ID != 0) {
2342
+ $userid = $current_user->ID;
2343
+ $username = $current_user->display_name;
2344
+ $useremail = $current_user->user_email;
2345
+ }
2346
+ else {
2347
+ $userid = '';
2348
+ $username = '';
2349
+ $useremail = '';
2350
+ }
2351
+ $ip = $_SERVER['REMOTE_ADDR'];
2352
+ $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix . "formmaker_submits");
2353
+ $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $form_id));
2354
+
2355
+ $label_order_original = array();
2356
+ $label_order_ids = array();
2357
+ $submission_array = array();
2358
+ $label_all = explode('#****#', $row->label_order_current);
2359
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
2360
+ foreach ($label_all as $key => $label_each) {
2361
+ $label_id_each = explode('#**id**#', $label_each);
2362
+ $label_id = $label_id_each[0];
2363
+ array_push($label_order_ids, $label_id);
2364
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
2365
+ $label_order_original[$label_id] = $label_order_each[0];
2366
+ }
2367
+
2368
+ $submissions_row = $wpdb->get_results($wpdb->prepare("SELECT `element_label`, `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=%d AND group_id=%d", $form_id, $subid));
2369
+ foreach ($submissions_row as $sub_row) {
2370
+ $submission_array[$sub_row->element_label] = $sub_row->element_value;
2371
+ }
2372
+
2373
+ foreach ($label_order_original as $key => $label_each) {
2374
+ if (strpos($submit_text, "%" . $label_each . "%") > -1) {
2375
+ $submit_text = str_replace("%" . $label_each . "%", $submission_array[$key], $submit_text);
2376
+ }
2377
+ }
2378
+
2379
+ $custom_fields = array("subid" => $subid, "ip" => $ip, "userid" => $userid, "username" => $username, "useremail" => $useremail);
2380
+ foreach ($custom_fields as $key => $custom_field) {
2381
+ if (strpos($submit_text, "%" . $key . "%") > -1) {
2382
+ $submit_text = str_replace("%" . $key . "%", $custom_field, $submit_text);
2383
+ }
2384
+ }
2385
+ $submit_text = str_replace(array("***map***", "*@@url@@*", "@@@@@@@@@", "@@@", "***grading***", "***br***", "***star_rating***"), array(" ", "", " ", " ", " ", ", ", " "), $submit_text);
2386
+
2387
+ return $submit_text;
2388
+ }
2389
+
2390
+ public function increment_views_count($id) {
2391
+ global $wpdb;
2392
+ $vives_form = $wpdb->get_var($wpdb->prepare("SELECT views FROM " . $wpdb->prefix . "formmaker_views WHERE form_id=%d", $id));
2393
+ if (isset($vives_form)) {
2394
+ $vives_form = $vives_form + 1;
2395
+ $wpdb->update($wpdb->prefix . "formmaker_views", array(
2396
+ 'views' => $vives_form,
2397
+ ), array('form_id' => $id), array(
2398
+ '%d',
2399
+ ), array('%d'));
2400
+ }
2401
+ else {
2402
+ $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
2403
+ 'form_id' => $id,
2404
+ 'views' => 1
2405
+ ), array(
2406
+ '%d',
2407
+ '%d'
2408
+ ));
2409
+ }
2410
+ }
2411
+
2412
+ public function gen_mail($counter, $all_files, $id, $str) {
2413
+ // checking save uploads option
2414
+ global $wpdb;
2415
+ $save_uploads = $wpdb->get_var("SELECT save_uploads FROM " . $wpdb->prefix ."formmaker WHERE id=" . $id);
2416
+ if($save_uploads == 0){
2417
+ $destination = 'wp-content/uploads/tmpAddon';
2418
+ if(!file_exists($destination))
2419
+ mkdir($destination , 0777);
2420
+
2421
+ foreach($all_files as &$all_file){
2422
+ $fileTemp = $all_file['tmp_name'];
2423
+ $fileName = $all_file['name'];
2424
+ if(!move_uploaded_file($fileTemp, ABSPATH . $destination . '/' . $fileName)) {
2425
+ return array($max+1, addslashes(__('Error, file cannot be moved.', 'form_maker')));
2426
+ }
2427
+
2428
+ $all_file['tmp_name'] = $destination . "/" . $fileName;
2429
+ }
2430
+ }
2431
+ $ip = $_SERVER['REMOTE_ADDR'];
2432
+ $replyto = '';
2433
+ global $wpdb;
2434
+ $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=%d", $id));
2435
+ if (!$row->form_front) {
2436
+ $id = '';
2437
+ }
2438
+
2439
+ $custom_fields = array('ip', 'useremail', 'username', 'subid', 'all' );
2440
+ $subid = $wpdb->get_var("SELECT MAX( group_id ) FROM " . $wpdb->prefix ."formmaker_submits" );
2441
+
2442
+ $current_user = wp_get_current_user();
2443
+ if ($current_user->ID != 0)
2444
+ {
2445
+ $username = $current_user->display_name;
2446
+ $useremail = $current_user->user_email;
2447
+ }
2448
+ else
2449
+ {
2450
+ $username = '';
2451
+ $useremail = '';
2452
+ }
2453
+
2454
+ $label_order_original = array();
2455
+ $label_order_ids = array();
2456
+ $label_label = array();
2457
+ $label_type = array();
2458
+ $total = 0;
2459
+ $form_currency = '$';
2460
+ $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
2461
+ $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
2462
+ if ($row->payment_currency) {
2463
+ $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
2464
+ }
2465
+
2466
+ $cc = array();
2467
+ $row_mail_one_time = 1;
2468
+ $label_type = array();
2469
+ $label_all = explode('#****#',$row->label_order_current);
2470
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
2471
+ foreach ($label_all as $key => $label_each) {
2472
+ $label_id_each = explode('#**id**#', $label_each);
2473
+ $label_id = $label_id_each[0];
2474
+ array_push($label_order_ids, $label_id);
2475
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
2476
+ $label_order_original[$label_id] = $label_order_each[0];
2477
+ $label_type[$label_id] = $label_order_each[1];
2478
+ array_push($label_label, $label_order_each[0]);
2479
+ array_push($label_type, $label_order_each[1]);
2480
+ }
2481
+
2482
+ $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
2483
+ $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
2484
+
2485
+ $list='<table border="1" cellpadding="3" cellspacing="0" style="width:600px;">';
2486
+ $list_text_mode = '';
2487
+ foreach($label_order_ids as $key => $label_order_id) {
2488
+ $i = $label_order_id;
2489
+ $type = $label_type[$i];
2490
+
2491
+ if($type != "type_map" and $type != "type_submit_reset" and $type != "type_editor" and $type != "type_captcha" and $type != "type_arithmetic_captcha" and $type != "type_recaptcha" and $type != "type_button") {
2492
+ $element_label=$label_order_original[$i];
2493
+ if(!in_array($i,$disabled_fields)) {
2494
+ switch ($type) {
2495
+ case 'type_text':
2496
+ case 'type_password':
2497
+ case "type_date":
2498
+ case "type_date_new":
2499
+ case "type_own_select":
2500
+ case "type_country":
2501
+ case "type_number":
2502
+ case "type_phone_new":
2503
+ {
2504
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2505
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2506
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2507
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2508
+ }
2509
+
2510
+ break;
2511
+ }
2512
+ case "type_date_range":{
2513
+ $element0 = isset($_POST['wdform_'.$i."_element".$id."0"]) ? $_POST['wdform_'.$i."_element".$id."0"] : NULL;
2514
+ $element1 = isset($_POST['wdform_'.$i."_element".$id."1"]) ? $_POST['wdform_'.$i."_element".$id."1"] : NULL;
2515
+
2516
+ if(isset($element0) && $this->empty_field($element0, $row->mail_emptyfields) && $this->empty_field($element1, $row->mail_emptyfields)) {
2517
+ $element = $element0.' - '.$element1;
2518
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2519
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2520
+ }
2521
+
2522
+ break;
2523
+ }
2524
+ case 'type_textarea': {
2525
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? wpautop($_POST['wdform_'.$i."_element".$id]) : NULL;
2526
+
2527
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2528
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2529
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2530
+ }
2531
+ break;
2532
+ }
2533
+
2534
+ case "type_hidden": {
2535
+ $element = isset($_POST[$element_label]) ? $_POST[$element_label] : NULL;
2536
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2537
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
2538
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2539
+ }
2540
+ break;
2541
+ }
2542
+ case "type_mark_map": {
2543
+ $element = isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : NULL;
2544
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2545
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "") . '</td></tr>';
2546
+ $list_text_mode=$list_text_mode.$element_label.' - Longitude:'.$element.' Latitude:'.(isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : "")."\r\n";
2547
+ }
2548
+ break;
2549
+ }
2550
+ case "type_submitter_mail": {
2551
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2552
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2553
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2554
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2555
+ }
2556
+ break;
2557
+ }
2558
+
2559
+ case "type_time": {
2560
+ $hh = isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : NULL;
2561
+ if(isset($hh) && ($this->empty_field($hh, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_mm".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_ss".$id], $row->mail_emptyfields))) {
2562
+ $ss = isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL;
2563
+ if(isset($ss)) {
2564
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "") . ':' . $ss;
2565
+ $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "").':'.$ss;
2566
+ }
2567
+ else {
2568
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $hh . ':' . (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
2569
+ $list_text_mode=$list_text_mode.$element_label.' - '.$hh.':'.(isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : "");
2570
+ }
2571
+ $am_pm = isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL;
2572
+ if(isset($am_pm)) {
2573
+ $list = $list . ' ' . $am_pm . '</td></tr>';
2574
+ $list_text_mode=$list_text_mode.$am_pm."\r\n";
2575
+ }
2576
+ else {
2577
+ $list = $list.'</td></tr>';
2578
+ $list_text_mode=$list_text_mode."\r\n";
2579
+ }
2580
+ }
2581
+ break;
2582
+ }
2583
+
2584
+ case "type_phone": {
2585
+ $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
2586
+ if(isset($element_first) && $this->empty_field($element_first, $row->mail_emptyfields)) {
2587
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
2588
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
2589
+ }
2590
+ break;
2591
+ }
2592
+
2593
+ case "type_name": {
2594
+ $element_first = isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL;
2595
+ if(isset($element_first)) {
2596
+ $element_title = isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : NULL;
2597
+ $element_middle = isset($_POST['wdform_'.$i."_element_middle".$id]) ? esc_html($_POST['wdform_'.$i."_element_middle".$id]) : NULL;
2598
+ if((isset($element_title) || isset($element_middle)) && ($this->empty_field($element_title, $row->mail_emptyfields) || $this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_middle".$id], $row->mail_emptyfields))) {
2599
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . (isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '') . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "") . '</td></tr>';
2600
+ $list_text_mode=$list_text_mode.$element_label.' - '.(isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : '').' '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "").' '.(isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : "")."\r\n";
2601
+ }
2602
+ else {
2603
+ if($this->empty_field($element_first, $row->mail_emptyfields) || $this->empty_field($_POST['wdform_'.$i."_element_last".$id], $row->mail_emptyfields)) {
2604
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element_first . ' ' . (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "") . '</td></tr>';
2605
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element_first.' '.(isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : "")."\r\n";
2606
+ }
2607
+ }
2608
+ }
2609
+ break;
2610
+ }
2611
+
2612
+ case "type_address": {
2613
+ $element = isset($_POST['wdform_'.$i."_street1".$id]) ? $_POST['wdform_'.$i."_street1".$id] : NULL;
2614
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2615
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2616
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2617
+ break;
2618
+ }
2619
+ $element = isset($_POST['wdform_'.$i."_street2".$id]) ? $_POST['wdform_'.$i."_street2".$id] : NULL;
2620
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2621
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2622
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2623
+ break;
2624
+ }
2625
+ $element = isset($_POST['wdform_'.$i."_city".$id]) ? $_POST['wdform_'.$i."_city".$id] : NULL;
2626
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2627
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2628
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2629
+ break;
2630
+ }
2631
+ $element = isset($_POST['wdform_'.$i."_state".$id]) ? $_POST['wdform_'.$i."_state".$id] : NULL;
2632
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2633
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2634
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2635
+ break;
2636
+ }
2637
+ $element = isset($_POST['wdform_'.$i."_postal".$id]) ? $_POST['wdform_'.$i."_postal".$id] : NULL;
2638
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2639
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2640
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2641
+ break;
2642
+ }
2643
+ $element = isset($_POST['wdform_'.$i."_country".$id]) ? $_POST['wdform_'.$i."_country".$id] : NULL;
2644
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2645
+ $list = $list . '<tr valign="top"><td >' . $label_order_original[$i] . '</td><td >' . $element . '</td></tr>';
2646
+ $list_text_mode=$list_text_mode.$label_order_original[$i].' - '.$element."\r\n";
2647
+ break;
2648
+ }
2649
+ break;
2650
+ }
2651
+
2652
+ case "type_date_fields": {
2653
+ $day = isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : NULL;
2654
+ $month = isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : "";
2655
+ $year = isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : "";
2656
+ if(isset($day) && $this->empty_field($day, $row->mail_emptyfields)) {
2657
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' .(($day || $month || $year) ? $day . '-' . $month . '-' . $year : '' ). '</td></tr>';
2658
+ $list_text_mode=$list_text_mode.$element_label.(($day || $month || $year) ? $day.'-'.$month.'-'.$year : '')."\r\n";
2659
+ }
2660
+ break;
2661
+ }
2662
+
2663
+ case "type_radio": {
2664
+ $element = isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL;
2665
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2666
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2667
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2668
+ break;
2669
+ }
2670
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2671
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2672
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2673
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2674
+ }
2675
+ break;
2676
+ }
2677
+
2678
+ case "type_checkbox": {
2679
+ $start = -1;
2680
+ for($j = 0; $j < 100; $j++) {
2681
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2682
+ if(isset($element)) {
2683
+ $start = $j;
2684
+ break;
2685
+ }
2686
+ }
2687
+ $other_element_id = -1;
2688
+ $is_other = isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : "";
2689
+ if($is_other == "yes") {
2690
+ $other_element_id = isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : "";
2691
+ }
2692
+
2693
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2694
+ {
2695
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2696
+ $list_text_mode=$list_text_mode.$element_label.' - ';
2697
+ }
2698
+
2699
+ if($start != -1) {
2700
+ for($j = $start; $j < 100; $j++) {
2701
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2702
+ if(isset($element)) {
2703
+ if($j == $other_element_id) {
2704
+ $list = $list . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "") . '<br>';
2705
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : "").', ';
2706
+ }
2707
+ else {
2708
+ $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "") . '<br>';
2709
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : "").', ';
2710
+ }
2711
+ }
2712
+ }
2713
+ }
2714
+
2715
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2716
+ {
2717
+ $list = $list . '</td></tr>';
2718
+ $list_text_mode=$list_text_mode."\r\n";
2719
+ }
2720
+ break;
2721
+ }
2722
+
2723
+ case "type_paypal_price": {
2724
+ $value = 0;
2725
+ if(isset($_POST['wdform_'.$i."_element_dollars".$id])) {
2726
+ $value = $_POST['wdform_'.$i."_element_dollars".$id];
2727
+ }
2728
+ if(isset($_POST['wdform_'.$i."_element_cents".$id]) && $_POST['wdform_'.$i."_element_cents".$id]) {
2729
+ $value = $value . '.' . $_POST['wdform_'.$i."_element_cents".$id];
2730
+ }
2731
+
2732
+ if($this->empty_field($value, $row->mail_emptyfields) && $value!='.')
2733
+ {
2734
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . $form_currency . '</td></tr>';
2735
+ $list_text_mode=$list_text_mode.$element_label.' - '.$value.$form_currency."\r\n";
2736
+ }
2737
+ break;
2738
+ }
2739
+
2740
+ case "type_paypal_price_new": {
2741
+ $value = 0;
2742
+ if(isset($_POST['wdform_'.$i."_element".$id])) {
2743
+ $value = $_POST['wdform_'.$i."_element".$id];
2744
+ }
2745
+
2746
+ if($this->empty_field($value, $row->mail_emptyfields) && $value!='.')
2747
+ {
2748
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . ($value == '' ? '' : $form_currency) . $value . '</td></tr>';
2749
+ $list_text_mode=$list_text_mode.$element_label.' - '.$value.$form_currency."\r\n";
2750
+ }
2751
+ break;
2752
+ }
2753
+
2754
+ case "type_paypal_select": {
2755
+ $value='';
2756
+ if(isset($_POST['wdform_'.$i."_element_label".$id]) && $_POST['wdform_'.$i."_element".$id] != '') {
2757
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . $form_currency . $_POST['wdform_'.$i."_element".$id];
2758
+ }
2759
+
2760
+ $element_quantity_label = (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) && $_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2761
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2762
+ if($value != ''){
2763
+
2764
+ if(isset($element_quantity)) {
2765
+ $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2766
+ }
2767
+
2768
+ for($k = 0; $k < 50; $k++) {
2769
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
2770
+ if(isset($temp_val)) {
2771
+ $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2772
+ }
2773
+ }
2774
+ }
2775
+
2776
+ if($this->empty_field($value, $row->mail_emptyfields))
2777
+ {
2778
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2779
+ $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
2780
+ }
2781
+
2782
+ break;
2783
+ }
2784
+
2785
+ case "type_paypal_radio": {
2786
+ if(isset($_POST['wdform_'.$i."_element".$id])) {
2787
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . $form_currency . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "");
2788
+
2789
+ $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2790
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2791
+ if (isset($element_quantity)) {
2792
+ $value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2793
+ }
2794
+ for($k = 0; $k < 50; $k++) {
2795
+ $temp_val = isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL;
2796
+ if(isset($temp_val)) {
2797
+ $value .= '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2798
+ }
2799
+ }
2800
+ }
2801
+ else {
2802
+ $value='';
2803
+ }
2804
+
2805
+ if($this->empty_field($value, $row->mail_emptyfields))
2806
+ {
2807
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2808
+ $list_text_mode=$list_text_mode.$element_label.' - '.str_replace('<br/>',', ',$value)."\r\n";
2809
+ }
2810
+ break;
2811
+ }
2812
+
2813
+ case "type_paypal_shipping": {
2814
+ if(isset($_POST['wdform_'.$i."_element".$id])) {
2815
+ $value = $_POST['wdform_'.$i."_element_label".$id] . ' : ' . $form_currency . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : "");
2816
+
2817
+ if($this->empty_field($value, $row->mail_emptyfields))
2818
+ {
2819
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $value . '</td></tr>';
2820
+ $list_text_mode=$list_text_mode.$element_label.' - '.$value."\r\n";
2821
+ }
2822
+ }
2823
+ else {
2824
+ $value='';
2825
+ }
2826
+
2827
+ break;
2828
+ }
2829
+
2830
+ case "type_paypal_checkbox": {
2831
+
2832
+ $start = -1;
2833
+ for($j = 0; $j < 300; $j++) {
2834
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2835
+ if(isset($element)) {
2836
+ $start=$j;
2837
+ break;
2838
+ }
2839
+ }
2840
+
2841
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2842
+ {
2843
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >';
2844
+ $list_text_mode=$list_text_mode.$element_label.' - ';
2845
+ }
2846
+ if($start!=-1) {
2847
+ for($j = $start; $j < 300; $j++) {
2848
+ $element = isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL;
2849
+ if(isset($element)) {
2850
+ $list = $list . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "") . ' - ' . $form_currency . ($element == '' ? '0' : $element) . '<br>';
2851
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : "").' - '.($element == '' ? '0' . $form_currency : $element).$form_currency.', ';
2852
+ }
2853
+ }
2854
+ }
2855
+ $element_quantity_label = isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL;
2856
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
2857
+ if (isset($element_quantity)) {
2858
+ $list = $list . '<br/>' . $element_quantity_label . ': ' . $element_quantity;
2859
+ $list_text_mode=$list_text_mode.$element_quantity_label . ': ' . $element_quantity.', ';
2860
+ }
2861
+ for($k = 0; $k < 50; $k++) {
2862
+ $temp_val = isset($_POST['wdform_'.$i."_element_property_value".$id.$k]) ? $_POST['wdform_'.$i."_element_property_value".$id.$k] : NULL;
2863
+ if(isset($temp_val)) {
2864
+ $list = $list . '<br/>' . (isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
2865
+ $list_text_mode=$list_text_mode.(isset($_POST['wdform_'.$i."_element_property_label".$id.$k]) ? $_POST['wdform_'.$i."_element_property_label".$id.$k] : "") . ': ' . $temp_val.', ';
2866
+ }
2867
+ }
2868
+ if($start != -1 || ($start == -1 && $row->mail_emptyfields))
2869
+ {
2870
+ $list = $list . '</td></tr>';
2871
+ $list_text_mode=$list_text_mode."\r\n";
2872
+ }
2873
+ break;
2874
+ }
2875
+
2876
+ case "type_paypal_total": {
2877
+ $element = isset($_POST['wdform_'.$i."_paypal_total".$id]) ? $_POST['wdform_'.$i."_paypal_total".$id] : "";
2878
+ if($this->empty_field($element, $row->mail_emptyfields))
2879
+ {
2880
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2881
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2882
+ }
2883
+ break;
2884
+ }
2885
+
2886
+ case "type_star_rating": {
2887
+ $element = isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : NULL;
2888
+ $selected = isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : 0;
2889
+ if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2890
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2891
+ $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2892
+ }
2893
+ break;
2894
+ }
2895
+
2896
+ case "type_scale_rating": {
2897
+ $element = isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : NULL;
2898
+ $selected = isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0;
2899
+ if(isset($element) && $this->empty_field($selected, $row->mail_emptyfields)) {
2900
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $selected . '/' . $element . '</td></tr>';
2901
+ $list_text_mode=$list_text_mode.$element_label.' - '.$selected.'/'.$element."\r\n";
2902
+ }
2903
+ break;
2904
+ }
2905
+
2906
+ case "type_spinner": {
2907
+ $element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
2908
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2909
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2910
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2911
+ }
2912
+ break;
2913
+ }
2914
+
2915
+ case "type_slider": {
2916
+ $element = isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : NULL;
2917
+ if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
2918
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2919
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2920
+ }
2921
+ break;
2922
+ }
2923
+
2924
+ case "type_range": {
2925
+ $element0 = isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : NULL;
2926
+ $element1 = isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : NULL;
2927
+ if((isset($element0) && $this->empty_field($element0, $row->mail_emptyfields)) || (isset($element1) && $this->empty_field($element1, $row->mail_emptyfields))) {
2928
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >From:' . $element0 . '<span style="margin-left:6px">To</span>:' . $element1 . '</td></tr>';
2929
+ $list_text_mode=$list_text_mode.$element_label.' - From:'.$element0.' To:'.$element1."\r\n";
2930
+ }
2931
+ break;
2932
+ }
2933
+
2934
+ case "type_grading": {
2935
+ $element = isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : "";
2936
+ $grading = explode(":", $element);
2937
+ $items_count = sizeof($grading) - 1;
2938
+ $element = "";
2939
+ $total = "";
2940
+ $form_empty_field = 1;
2941
+ for($k = 0;$k < $items_count; $k++) {
2942
+ $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : "") . " ";
2943
+ $total += (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : 0);
2944
+ if(isset($_POST['wdform_'.$i."_element".$id.'_'.$k]))
2945
+ $form_empty_field = 0;
2946
+ }
2947
+ $element .= "Total:" . $total;
2948
+ if(isset($element) && $this->empty_field($form_empty_field, $row->mail_emptyfields)) {
2949
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $element . '</td></tr>';
2950
+ $list_text_mode=$list_text_mode.$element_label.' - '.$element."\r\n";
2951
+ }
2952
+ break;
2953
+ }
2954
+
2955
+ case "type_matrix": {
2956
+ $input_type = isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : "";
2957
+ $mat_rows = explode("***", isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : "");
2958
+ $rows_count = sizeof($mat_rows) - 1;
2959
+ $mat_columns = explode("***", isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : "");
2960
+ $columns_count = sizeof($mat_columns) - 1;
2961
+ $matrix = "<table>";
2962
+ $matrix .= '<tr><td></td>';
2963
+ for($k = 1; $k < count($mat_columns); $k++) {
2964
+ $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
2965
+ }
2966
+ $matrix .= '</tr>';
2967
+ $aaa = Array();
2968
+ for($k = 1; $k <= $rows_count; $k++) {
2969
+ $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
2970
+ if($input_type == "radio") {
2971
+ $mat_radio = isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0;
2972
+ if($mat_radio == 0) {
2973
+ $checked = "";
2974
+ $aaa[1] = "";
2975
+ }
2976
+ else {
2977
+ $aaa = explode("_", $mat_radio);
2978
+ }
2979
+ for($j = 1; $j <= $columns_count; $j++) {
2980
+ if($aaa[1] == $j) {
2981
+ $checked = "checked";
2982
+ }
2983
+ else {
2984
+ $checked = "";
2985
+ }
2986
+ $sign = $checked == 'checked' ? '&#x2714;' : '';
2987
+ $matrix .= '<td style="text-align:center">'.$sign.'</td>';
2988
+ }
2989
+ }
2990
+ else {
2991
+ if($input_type == "checkbox") {
2992
+ for($j = 1; $j <= $columns_count; $j++) {
2993
+ $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : "";
2994
+ if($checked == 1) {
2995
+ $checked = "checked";
2996
+ }
2997
+ else {
2998
+ $checked = "";
2999
+ }
3000
+ $sign = $checked == 'checked' ? '&#x2714;' : '';
3001
+ $matrix .= '<td style="text-align:center">'.$sign.'</td>';
3002
+ }
3003
+ }
3004
+ else {
3005
+ if($input_type == "text") {
3006
+ for($j = 1; $j <= $columns_count; $j++) {
3007
+ $checked = isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? esc_html($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) : "";
3008
+ $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
3009
+ }
3010
+ }
3011
+ else {
3012
+ for($j = 1; $j <= $columns_count; $j++) {
3013
+ $checked = isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : "";
3014
+ $matrix .= '<td style="text-align:center">' . $checked . '</td>';
3015
+ }
3016
+ }
3017
+ }
3018
+ }
3019
+ $matrix .= '</tr>';
3020
+ }
3021
+ $matrix .= '</table>';
3022
+ if(isset($matrix)) {
3023
+ $list = $list . '<tr valign="top"><td >' . $element_label . '</td><td >' . $matrix . '</td></tr>';
3024
+ }
3025
+ break;
3026
+ }
3027
+ default: break;
3028
+ }
3029
+ }
3030
+ }
3031
+ }
3032
+
3033
+ $list = $list . '</table>';
3034
+ if($row->sendemail) {
3035
+ $fromname = $row->mail_from_name_user;
3036
+ if($row->mail_subject_user)
3037
+ $subject = $row->mail_subject_user;
3038
+ else
3039
+ $subject = $row->title;
3040
+ if($row->reply_to_user) {
3041
+ $replyto = $row->reply_to_user;
3042
+ }
3043
+ $attachment_user = array();
3044
+ if ($row->mail_attachment_user) {
3045
+ for ($k = 0; $k < count($all_files); $k++) {
3046
+ if (isset($all_files[$k]['tmp_name'])) {
3047
+ if(!isset($attachment_user[$all_files[$k]['field_key']]))
3048
+ $attachment_user[$all_files[$k]['field_key']] = array();
3049
+ array_push($attachment_user[$all_files[$k]['field_key']], $all_files[$k]['tmp_name']);
3050
+ }
3051
+ }
3052
+ }
3053
+
3054
+ if ($row->mail_mode_user) {
3055
+ $content_type = "text/html";
3056
+ $mode = 1;
3057
+ $list_user = wordwrap($list, 100, "\n", true);
3058
+ $new_script = wpautop($row->script_mail_user);
3059
+ }
3060
+ else {
3061
+ $content_type = "text/plain";
3062
+ $mode = 0;
3063
+ $list_user = wordwrap($list_text_mode, 1000, "\n", true);
3064
+ $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail_user);
3065
+ }
3066
+
3067
+ foreach($label_order_original as $key => $label_each) {
3068
+ $type=$label_type[$key];
3069
+ $key1 = $type == 'type_hidden' ? $label_each : $key;
3070
+ if(strpos($new_script, "%".$label_each."%") > -1) {
3071
+ $new_value = $this->custom_fields_mail($type, $key1, $id, $attachment_user, $form_currency);
3072
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3073
+ }
3074
+
3075
+ if($type == "type_file_upload" && strpos($new_script, "%".$label_each."(link)%") > -1) {
3076
+ $new_value = $this->custom_fields_mail($type, $key, $id, $attachment_user, $form_currency, 1);
3077
+ $new_script = str_replace("%".$label_each."(link)%", $new_value, $new_script);
3078
+ }
3079
+
3080
+
3081
+ if(strpos($fromname, "%".$label_each."%")>-1) {
3082
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', ''));
3083
+ if(substr($new_value, -2)==', ') {
3084
+ $new_value = substr($new_value, 0, -2);
3085
+ }
3086
+ $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
3087
+ }
3088
+
3089
+ if(strpos($subject, "%".$label_each."%")>-1) {
3090
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', $form_currency));
3091
+ if(substr($new_value, -2)==', ') {
3092
+ $new_value = substr($new_value, 0, -2);
3093
+ }
3094
+ $subject = str_replace("%".$label_each."%", $new_value, $subject);
3095
+ }
3096
+ }
3097
+
3098
+ $recipient = '';
3099
+ $cca = $row->mail_cc_user;
3100
+ $bcc = $row->mail_bcc_user;
3101
+ if ($row->mail_from_user != '') {
3102
+ if ($fromname != '') {
3103
+ $from = "From: '" . $fromname . "' <" . $row->mail_from_user . ">" . "\r\n";
3104
+ }
3105
+ else {
3106
+ $from = "From: '' <" . $row->mail_from_user . ">" . "\r\n";
3107
+ }
3108
+ }
3109
+ else {
3110
+ $from = '';
3111
+ }
3112
+
3113
+ $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
3114
+ if ($replyto) {
3115
+ $headers .= "Reply-To: <" . $replyto . ">\r\n";
3116
+ }
3117
+ if ($cca) {
3118
+ $headers .= "Cc: " . $cca . "\r\n";
3119
+ }
3120
+ if ($bcc) {
3121
+ $headers .= "Bcc: " . $bcc . "\r\n";
3122
+ }
3123
+
3124
+ $custom_fields_value = array( $ip, $useremail, $username, $subid, $list_user );
3125
+ foreach($custom_fields as $key=>$custom_field)
3126
+ {
3127
+ if(strpos($new_script, "%".$custom_field."%")>-1)
3128
+ $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
3129
+
3130
+ if($key==2 || $key==3)
3131
+ {
3132
+ if(strpos($fromname, "%".$custom_field."%")>-1)
3133
+ $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
3134
+
3135
+ if(strpos($subject, "%".$custom_field."%")>-1)
3136
+ $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
3137
+ }
3138
+ }
3139
+ $body = $new_script;
3140
+ $GLOBALS['attachment_user'] = '';
3141
+ $GLOBALS['attachment'] = '';
3142
+ if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
3143
+ $_GET['addon_task'] = 'frontend';
3144
+ $_GET['form_id'] = $id;
3145
+ $_GET['form_currency'] = $form_currency;
3146
+ $GLOBALS['custom_fields_value'] = $custom_fields_value;
3147
+ do_action('WD_FM_PDF_init');
3148
+ }
3149
+
3150
+ if($GLOBALS['attachment_user']){
3151
+ array_push($attachment_user, $GLOBALS['attachment_user']);
3152
+ }
3153
+
3154
+ if($row->send_to) {
3155
+ $send_tos = explode('**',$row->send_to);
3156
+ $send_copy = isset($_POST["wdform_send_copy_".$id]) ? $_POST["wdform_send_copy_".$id] : NULL;
3157
+ if(isset($send_copy)) {
3158
+ $send=true;
3159
+ }
3160
+ else {
3161
+ $mail_verification_post_id = (int)$wpdb->get_var($wpdb->prepare('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
3162
+ $verification_link = get_post( $mail_verification_post_id );
3163
+ foreach($send_tos as $index => $send_to) {
3164
+ $recipient = isset($_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id]) ? $_POST['wdform_'.str_replace('*', '', $send_to)."_element".$id] : NULL;
3165
+ if(strpos($new_script, "%Verification link%")>-1 && $verification_link !== NULL) {
3166
+ $ver_link = $row->mail_mode_user ? "<a href =".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id)).">".add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id))."</a><br/>" : add_query_arg(array('gid' => $_SESSION['gid'], 'h' => $_SESSION['hash'][$index].'@'.str_replace("*", "", $send_to)), get_post_permalink($mail_verification_post_id));
3167
+
3168
+ $body = $row->mail_verify ? str_replace("%Verification link%", $ver_link, $new_script) : str_replace("%Verification link%", '', $new_script);
3169
+ }
3170
+
3171
+
3172
+
3173
+ if($recipient) {
3174
+ $remove_parrent_array_user = new RecursiveIteratorIterator(new RecursiveArrayIterator($attachment_user));
3175
+
3176
+
3177
+
3178
+ $attachment_user = iterator_to_array($remove_parrent_array_user, false);
3179
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($body), $headers, $attachment_user);
3180
+ }
3181
+ }
3182
+ }
3183
+ }
3184
+ }
3185
+
3186
+ if($row->sendemail) {
3187
+ if($row->reply_to) {
3188
+ $replyto = isset($_POST['wdform_'.$row->reply_to."_element".$id]) ? $_POST['wdform_'.$row->reply_to."_element".$id] : NULL;
3189
+ if(!isset($replyto)) {
3190
+ $replyto = $row->reply_to;
3191
+ }
3192
+ }
3193
+ $recipient = $row->mail;
3194
+ if($row->mail_subject) {
3195
+ $subject = $row->mail_subject;
3196
+ }
3197
+ else {
3198
+ $subject = $row->title;
3199
+ }
3200
+
3201
+ $fromname = $row->from_name;
3202
+ $attachment = array();
3203
+ if ($row->mail_attachment) {
3204
+ for ($k = 0; $k < count($all_files); $k++) {
3205
+ if (isset($all_files[$k]['tmp_name'])) {
3206
+ if(!isset($attachment[$all_files[$k]['field_key']]))
3207
+ $attachment[$all_files[$k]['field_key']] = array();
3208
+ array_push($attachment[$all_files[$k]['field_key']], $all_files[$k]['tmp_name']);
3209
+ }
3210
+ }
3211
+ }
3212
+ if($GLOBALS['attachment']){
3213
+ array_push($attachment, $GLOBALS['attachment']);
3214
+ }
3215
+
3216
+ if ($row->mail_mode) {
3217
+ $content_type = "text/html";
3218
+ $mode = 1;
3219
+ $list = wordwrap($list, 100, "\n", true);
3220
+ $new_script = wpautop($row->script_mail);
3221
+ }
3222
+ else {
3223
+ $content_type = "text/plain";
3224
+ $mode = 0;
3225
+ $list = $list_text_mode;
3226
+ $list = wordwrap($list, 1000, "\n", true);
3227
+ $new_script = str_replace(array('<p>','</p>'),'',$row->script_mail);
3228
+ }
3229
+
3230
+
3231
+ foreach($label_order_original as $key => $label_each) {
3232
+ $type=$label_type[$key];
3233
+ $key1 = $type == 'type_hidden' ? $label_each : $key;
3234
+ if(strpos($new_script, "%".$label_each."%") > -1) {
3235
+ $new_value = $this->custom_fields_mail($type, $key1, $id, $attachment, $form_currency);
3236
+ $new_script = str_replace("%".$label_each."%", $new_value, $new_script);
3237
+ }
3238
+
3239
+ if($type == "type_file_upload" && strpos($new_script, "%".$label_each."(link)%") > -1) {
3240
+
3241
+ $new_value = $this->custom_fields_mail($type, $key, $id, $attachment, $form_currency, 1);
3242
+ $new_script = str_replace("%".$label_each."(link)%", $new_value, $new_script);
3243
+ }
3244
+
3245
+ if(strpos($fromname, "%".$label_each."%")>-1) {
3246
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', $form_currency));
3247
+ if(substr($new_value, -2)==', ') {
3248
+ $new_value = substr($new_value, 0, -2);
3249
+ }
3250
+ $fromname = str_replace("%".$label_each."%", $new_value, $fromname);
3251
+ }
3252
+
3253
+ if(strpos($fromname, "%username%")>-1){
3254
+ $fromname = str_replace("%username%", $username, $fromname);
3255
+ }
3256
+
3257
+ if(strpos($subject, "%".$label_each."%")>-1) {
3258
+ $new_value = str_replace('<br>',', ',$this->custom_fields_mail($type, $key, $id, '', $form_currency));
3259
+ if(substr($new_value, -2)==', ') {
3260
+ $new_value = substr($new_value, 0, -2);
3261
+ }
3262
+ $subject = str_replace("%".$label_each."%", $new_value, $subject);
3263
+ }
3264
+ }
3265
+
3266
+ if ($row->from_mail) {
3267
+ $from = isset($_POST['wdform_'.$row->from_mail."_element".$id]) ? $_POST['wdform_'.$row->from_mail."_element".$id] : NULL;
3268
+ if (!isset($from)) {
3269
+ $from = $row->from_mail;
3270
+ }
3271
+
3272
+ if ($fromname != '') {
3273
+ $from = "From: '" . $fromname . "' <" . $from . ">" . "\r\n";
3274
+ }
3275
+ else {
3276
+ $from = "From: '' <" . $from . ">" . "\r\n";
3277
+ }
3278
+ }
3279
+ else {
3280
+ $from = "";
3281
+ }
3282
+
3283
+ $cca = $row->mail_cc;
3284
+ $bcc = $row->mail_bcc;
3285
+ $headers = $from . " Content-Type: " . $content_type . "; charset=\"" . get_option('blog_charset') . "\"\n";
3286
+ if ($replyto) {
3287
+ $headers .= "Reply-To: <" . $replyto . ">\r\n";
3288
+ }
3289
+ if ($cca) {
3290
+ $headers .= "Cc: " . $cca . "\r\n";
3291
+ }
3292
+ if ($bcc) {
3293
+ $headers .= "Bcc: " . $bcc . "\r\n";
3294
+ }
3295
+
3296
+ $custom_fields_value = array( $ip, $useremail, $username, $subid, $list );
3297
+ foreach($custom_fields as $key=>$custom_field)
3298
+ {
3299
+ if(strpos($new_script, "%".$custom_field."%")>-1)
3300
+ $new_script = str_replace("%".$custom_field."%", $custom_fields_value[$key], $new_script);
3301
+
3302
+ if($key==2 || $key==3)
3303
+ {
3304
+ if(strpos($fromname, "%".$custom_field."%")>-1)
3305
+ $fromname = str_replace("%".$custom_field."%", $custom_fields_value[$key], $fromname);
3306
+
3307
+ if(strpos($subject, "%".$custom_field."%")>-1)
3308
+ $subject = str_replace("%".$custom_field."%", $custom_fields_value[$key], $subject);
3309
+ }
3310
+ }
3311
+ $admin_body = $new_script;
3312
+ $remove_parrent_array = new RecursiveIteratorIterator(new RecursiveArrayIterator($attachment));
3313
+ $attachment = iterator_to_array($remove_parrent_array, false);
3314
+
3315
+ if($recipient) {
3316
+ $send = wp_mail(str_replace(' ', '', $recipient), $subject, stripslashes($admin_body), $headers, $attachment);
3317
+ }
3318
+ }
3319
+
3320
+ $_SESSION['error_or_no' . $id] = 0;
3321
+ $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
3322
+ $succes = 1;
3323
+
3324
+ if($row->sendemail)
3325
+ if($row->mail || $row->send_to) {
3326
+ if ($send) {
3327
+ if ($send !== true ) {
3328
+ $_SESSION['error_or_no' . $id] = 1;
3329
+ $msg = addslashes(__('Error, email was not sent.', 'form_maker'));
3330
+ $succes = 0;
3331
+ }
3332
+ else {
3333
+ $_SESSION['error_or_no' . $id] = 0;
3334
+ $msg = addslashes(__('Your form was successfully submitted.', 'form_maker'));
3335
+ }
3336
+ }
3337
+ }
3338
+
3339
+ $fm_email_params = $row->sendemail ? array('admin_body' => $admin_body, 'body' => $body, 'subject' => $subject, 'headers' => $headers, 'attachment' => $attachment, 'attachment_user' => $attachment_user) : array();
3340
+
3341
+ $addons = array('WD_FM_EMAIL_COND' => 'Email Conditions');
3342
+ $addons_array = array();
3343
+ foreach($addons as $addon => $addon_name) {
3344
+ if (defined($addon) && is_plugin_active(constant($addon))) {
3345
+ $_GET['addon_task'] = 'frontend';
3346
+ $_GET['form_id'] = $id;
3347
+ $GLOBALS['fm_email_params'] = $fm_email_params;
3348
+ $GLOBALS['form_currency'] = $form_currency;
3349
+ $GLOBALS['custom_fields_value'] = isset($custom_fields_value) ? $custom_fields_value : array();
3350
+ do_action($addon.'_init');
3351
+ }
3352
+ }
3353
+ // delete files from uploads (save_upload = 0)
3354
+ if($row->save_uploads == 0){
3355
+ foreach ($all_files as &$all_file) {
3356
+ if (file_exists(ABSPATH.'/'.$all_file['tmp_name'])) {
3357
+ unlink(ABSPATH.'/'.$all_file['tmp_name']);
3358
+ }
3359
+ }
3360
+
3361
+ }
3362
+ $https = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
3363
+ if ($row->submit_text_type == 0 || $row->submit_text_type == 1 || $row->submit_text_type == 3) {
3364
+ $_SESSION['massage_after_submit' . $id] = $msg;
3365
+ if($row->type == 'popover' || $row->type == 'topbar' || $row->type == 'scrollbox'){
3366
+ $_SESSION['fm_hide_form_after_submit' . $id] = 1;
3367
+ }
3368
+ }
3369
+ switch ($row->submit_text_type) {
3370
+ case "2":
3371
+ case "5": {
3372
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3373
+ if ($row->article_id) {
3374
+ $redirect_url = $row->article_id;
3375
+ }
3376
+ else {
3377
+ $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
3378
+ }
3379
+ break;
3380
+ }
3381
+ case "3": {
3382
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3383
+ $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
3384
+ break;
3385
+ }
3386
+ case "4": {
3387
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3388
+ $redirect_url = $row->url;
3389
+ break;
3390
+ }
3391
+ default: {
3392
+ $_SESSION['form_submit_type' . $id] = $row->submit_text_type . "," . $row->id;
3393
+ $redirect_url = $https . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
3394
+ break;
3395
+ }
3396
+ }
3397
+ if (!$str) {
3398
+ wp_redirect(html_entity_decode($redirect_url));
3399
+ exit;
3400
+ }
3401
+ else {
3402
+ $_SESSION['redirect_paypal'.$id] = 1;
3403
+
3404
+ $str .= "&return=" . urlencode($redirect_url);
3405
+ wp_redirect($str);
3406
+ exit;
3407
+ }
3408
+ }
3409
+
3410
+ public static function custom_fields_mail($type, $key, $id, $attachment, $form_currency, $file_upload_link = 0)
3411
+ {
3412
+ $new_value ="";
3413
+
3414
+ $disabled_fields = explode(',', isset($_REQUEST["disabled_fields".$id]) ? $_REQUEST["disabled_fields".$id] : "");
3415
+ $disabled_fields = array_slice($disabled_fields,0, count($disabled_fields)-1);
3416
+
3417
+ if($type!="type_submit_reset" or $type!="type_map" or $type!="type_editor" or $type!="type_captcha" or $type != "type_arithmetic_captcha" or $type!="type_recaptcha" or $type!="type_button") {
3418
+ switch ($type) {
3419
+ case 'type_text':
3420
+ case 'type_password':
3421
+ case 'type_textarea':
3422
+ case "type_date":
3423
+ case "type_date_new":
3424
+ case "type_own_select":
3425
+ case "type_country":
3426
+ case "type_number":
3427
+ {
3428
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3429
+ if(isset($element)) {
3430
+ $new_value = $element;
3431
+ }
3432
+ break;
3433
+ }
3434
+ case 'type_date_range' :{
3435
+ $element0 = isset($_POST['wdform_'.$key."_element".$id."0"]) ? $_POST['wdform_'.$key."_element".$id."0"] : NULL;
3436
+ $element1 = isset($_POST['wdform_'.$key."_element".$id."1"]) ? $_POST['wdform_'.$key."_element".$id."1"] : NULL;
3437
+ $element = $element0.' - '.$element1;
3438
+ $new_value = $element;
3439
+ }
3440
+ case "type_file_upload": {
3441
+ if(isset($attachment[$key])) {
3442
+ foreach($attachment[$key] as $attach) {
3443
+ $uploadedFileNameParts = explode('.', $attach);
3444
+ $uploadedFileExtension = array_pop($uploadedFileNameParts);
3445
+ if($file_upload_link == 1){
3446
+ $new_value .= '<a href="'.site_url().'/'.$attach.'"/>'.site_url().'/'.$attach.'</a><br />';
3447
+ }
3448
+ else {
3449
+ $invalidFileExts = array('gif', 'jpg', 'jpeg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'jpc', 'jp2', 'jpf', 'jb2', 'swc', 'aiff', 'wbmp', 'xbm' );
3450
+ $extOk = false;
3451
+
3452
+ foreach($invalidFileExts as $key => $valuee)
3453
+ {
3454
+ if(is_numeric(strpos(strtolower($valuee), strtolower($uploadedFileExtension) )) )
3455
+ $extOk = true;
3456
+ }
3457
+
3458
+ if ($extOk == true)
3459
+ $new_value .= '<img src="'.site_url().'/'.$attach.'" alt="'.$attach.'"/>';
3460
+
3461
+ }
3462
+ }
3463
+ }
3464
+
3465
+ break;
3466
+ }
3467
+ case "type_hidden": {
3468
+ $element = isset($_POST[$key]) ? $_POST[$key] : NULL;
3469
+ if(isset($element)) {
3470
+ $new_value = $element;
3471
+ }
3472
+ break;
3473
+ }
3474
+ case "type_mark_map": {
3475
+ $element = isset($_POST['wdform_'.$key."_long".$id]) ? $_POST['wdform_'.$key."_long".$id] : NULL;
3476
+ if(isset($element)) {
3477
+ $new_value = 'Longitude:' . $element . '<br/>Latitude:' . (isset($_POST['wdform_'.$key."_lat".$id]) ? $_POST['wdform_'.$key."_lat".$id] : "");
3478
+ }
3479
+ break;
3480
+ }
3481
+ case "type_submitter_mail": {
3482
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3483
+ if(isset($element)) {
3484
+ $new_value = $element;
3485
+ }
3486
+ break;
3487
+ }
3488
+ case "type_time": {
3489
+ $hh = isset($_POST['wdform_'.$key."_hh".$id]) ? $_POST['wdform_'.$key."_hh".$id] : NULL;
3490
+ if(isset($hh)) {
3491
+ $ss = isset($_POST['wdform_'.$key."_ss".$id]) ? $_POST['wdform_'.$key."_ss".$id] : NULL;
3492
+ if(isset($ss)) {
3493
+ $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "") . ':' . $ss;
3494
+ }
3495
+ else {
3496
+ $new_value = $hh . ':' . (isset($_POST['wdform_'.$key."_mm".$id]) ? $_POST['wdform_'.$key."_mm".$id] : "");
3497
+ }
3498
+ $am_pm = isset($_POST['wdform_'.$key."_am_pm".$id]) ? $_POST['wdform_'.$key."_am_pm".$id] : NULL;
3499
+ if(isset($am_pm)) {
3500
+ $new_value = $new_value . ' ' . $am_pm;
3501
+ }
3502
+ }
3503
+ break;
3504
+ }
3505
+
3506
+ case "type_phone": {
3507
+ $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
3508
+ if(isset($element_first)) {
3509
+ $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
3510
+ }
3511
+ break;
3512
+ }
3513
+ case "type_name": {
3514
+ $element_first = isset($_POST['wdform_'.$key."_element_first".$id]) ? $_POST['wdform_'.$key."_element_first".$id] : NULL;
3515
+ if(isset($element_first)) {
3516
+ $element_title = isset($_POST['wdform_'.$key."_element_title".$id]) ? $_POST['wdform_'.$key."_element_title".$id] : NULL;
3517
+ if(isset($element_title)) {
3518
+ $new_value = $element_title . ' ' . $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "") . ' ' . (isset($_POST['wdform_'.$key."_element_middle".$id]) ? $_POST['wdform_'.$key."_element_middle".$id] : "");
3519
+ }
3520
+ else {
3521
+ $new_value = $element_first . ' ' . (isset($_POST['wdform_'.$key."_element_last".$id]) ? $_POST['wdform_'.$key."_element_last".$id] : "");
3522
+ }
3523
+ }
3524
+ break;
3525
+ }
3526
+ case "type_address": {
3527
+ $street1 = isset($_POST['wdform_'.$key."_street1".$id]) ? $_POST['wdform_'.$key."_street1".$id] : NULL;
3528
+ if(isset($street1)) {
3529
+ $new_value = $street1;
3530
+ break;
3531
+ }
3532
+ $street2 = isset($_POST['wdform_'.$key."_street2".$id]) ? $_POST['wdform_'.$key."_street2".$id] : NULL;
3533
+ if(isset($street2)) {
3534
+ $new_value = $street2;
3535
+ break;
3536
+ }
3537
+ $city = isset($_POST['wdform_'.$key."_city".$id]) ? $_POST['wdform_'.$key."_city".$id] : NULL;
3538
+ if(isset($city)) {
3539
+ $new_value = $city;
3540
+ break;
3541
+ }
3542
+ $state = isset($_POST['wdform_'.$key."_state".$id]) ? $_POST['wdform_'.$key."_state".$id] : NULL;
3543
+ if(isset($state)) {
3544
+ $new_value = $state;
3545
+ break;
3546
+ }
3547
+ $postal = isset($_POST['wdform_'.$key."_postal".$id]) ? $_POST['wdform_'.$key."_postal".$id] : NULL;
3548
+ if(isset($postal)) {
3549
+ $new_value = $postal;
3550
+ break;
3551
+ }
3552
+ $country = isset($_POST['wdform_'.$key."_country".$id]) ? $_POST['wdform_'.$key."_country".$id] : NULL;
3553
+ if(isset($country)) {
3554
+ $new_value = $country;
3555
+ break;
3556
+ }
3557
+ break;
3558
+ }
3559
+ case "type_date_fields": {
3560
+ $day = isset($_POST['wdform_'.$key."_day".$id]) ? $_POST['wdform_'.$key."_day".$id] : NULL;
3561
+ if(isset($day)) {
3562
+ $new_value = $day . '-' . (isset($_POST['wdform_'.$key."_month".$id]) ? $_POST['wdform_'.$key."_month".$id] : "") . '-' . (isset($_POST['wdform_'.$key."_year".$id]) ? $_POST['wdform_'.$key."_year".$id] : "");
3563
+ }
3564
+ break;
3565
+ }
3566
+
3567
+ case "type_radio": {
3568
+ $element = isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : NULL;
3569
+ if(isset($element)) {
3570
+ $new_value = $element;
3571
+ break;
3572
+ }
3573
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3574
+ if(isset($element)) {
3575
+ $new_value = $element;
3576
+ }
3577
+ break;
3578
+ }
3579
+ case "type_checkbox": {
3580
+ $start = -1;
3581
+ for($j = 0; $j < 100; $j++) {
3582
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3583
+ if(isset($element)) {
3584
+ $start = $j;
3585
+ break;
3586
+ }
3587
+ }
3588
+ $other_element_id = -1;
3589
+ $is_other = isset($_POST['wdform_'.$key."_allow_other".$id]) ? $_POST['wdform_'.$key."_allow_other".$id] : "";
3590
+ if($is_other == "yes") {
3591
+ $other_element_id = isset($_POST['wdform_'.$key."_allow_other_num".$id]) ? $_POST['wdform_'.$key."_allow_other_num".$id] : "";
3592
+ }
3593
+ if($start != -1) {
3594
+ for($j = $start; $j < 100; $j++) {
3595
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3596
+ if(isset($element)) {
3597
+ if($j == $other_element_id) {
3598
+ $new_value = $new_value . (isset($_POST['wdform_'.$key."_other_input".$id]) ? $_POST['wdform_'.$key."_other_input".$id] : "") . '<br>';
3599
+ }
3600
+ else {
3601
+ $new_value = $new_value . $element . '<br>';
3602
+ }
3603
+ }
3604
+ }
3605
+ }
3606
+ break;
3607
+ }
3608
+ case "type_paypal_price": {
3609
+ $new_value = 0;
3610
+ if(isset($_POST['wdform_'.$key."_element_dollars".$id])) {
3611
+ $new_value = $_POST['wdform_'.$key."_element_dollars".$id];
3612
+ }
3613
+ if(isset($_POST['wdform_'.$key."_element_cents".$id])) {
3614
+ $new_value = $new_value . '.' . $_POST['wdform_'.$key."_element_cents".$id];
3615
+ }
3616
+ $new_value = $new_value . $form_currency;
3617
+ break;
3618
+ }
3619
+
3620
+ case "type_paypal_price_new": {
3621
+ $new_value = '';
3622
+ if(isset($_POST['wdform_'.$key."_element".$id] ) && $_POST['wdform_'.$key."_element".$id]) {
3623
+ $new_value = $form_currency . $_POST['wdform_'.$key."_element".$id];
3624
+ }
3625
+ $new_value = $new_value;
3626
+ break;
3627
+ }
3628
+
3629
+ case "type_paypal_select": {
3630
+ $element = isset($_POST['wdform_'.$key."_element".$id]) && $_POST['wdform_'.$key."_element".$id] ? $_POST['wdform_'.$key."_element".$id] : '';
3631
+ if($element){
3632
+ $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . ' : ' . $form_currency. $element;
3633
+
3634
+ $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
3635
+ $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
3636
+ if (isset($element_quantity)) {
3637
+ $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
3638
+ }
3639
+ for($k = 0; $k < 50; $k++) {
3640
+ $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
3641
+ if(isset($temp_val)) {
3642
+ $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
3643
+ }
3644
+ }
3645
+ }
3646
+ break;
3647
+ }
3648
+ case "type_paypal_radio": {
3649
+
3650
+
3651
+ $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . (isset($_POST['wdform_'.$key."_element".$id]) && $_POST['wdform_'.$key."_element".$id] ? ' - ' . $form_currency . $_POST['wdform_'.$key."_element".$id] : "") ;
3652
+ $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
3653
+ $element_quantity = (isset($_POST['wdform_'.$i."_element_quantity".$id]) && $_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL;
3654
+ if (isset($element_quantity)) {
3655
+ $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
3656
+ }
3657
+ for($k = 0; $k < 50; $k++) {
3658
+ $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
3659
+ if(isset($temp_val)) {
3660
+ $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
3661
+ }
3662
+ }
3663
+ break;
3664
+ }
3665
+ case "type_paypal_shipping": {
3666
+ $new_value = (isset($_POST['wdform_'.$key."_element_label".$id]) ? $_POST['wdform_'.$key."_element_label".$id] : "") . (isset($_POST['wdform_'.$key."_element".$id]) && $_POST['wdform_'.$key."_element".$id] ? ' : ' . $form_currency . $_POST['wdform_'.$key."_element".$id] : "");
3667
+ break;
3668
+ }
3669
+ case "type_paypal_checkbox": {
3670
+ $start = -1;
3671
+ for($j = 0; $j < 100; $j++) {
3672
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3673
+ if(isset($element)) {
3674
+ $start = $j;
3675
+ break;
3676
+ }
3677
+ }
3678
+ if($start != -1) {
3679
+ for($j = $start; $j < 100; $j++) {
3680
+ $element = isset($_POST['wdform_'.$key."_element".$id.$j]) ? $_POST['wdform_'.$key."_element".$id.$j] : NULL;
3681
+ if(isset($element)) {
3682
+ $new_value = $new_value . (isset($_POST['wdform_'.$key."_element".$id.$j."_label"]) ? $_POST['wdform_'.$key."_element".$id.$j."_label"] : "") . ' - ' . (isset($element) ? $form_currency . ($element == '' ? '0' : $element) : "") . '<br>';
3683
+ }
3684
+ }
3685
+ }
3686
+ $element_quantity_label = isset($_POST['wdform_'.$key."_element_quantity_label".$id]) ? $_POST['wdform_'.$key."_element_quantity_label".$id] : NULL;
3687
+ $element_quantity = (isset($_POST['wdform_'.$key."_element_quantity".$id]) && $_POST['wdform_'.$key."_element_quantity".$id]) ? $_POST['wdform_'.$key."_element_quantity".$id] : NULL;
3688
+ if (isset($element_quantity)) {
3689
+ $new_value .= '<br/>' . $element_quantity_label . ': ' . $element_quantity;
3690
+ }
3691
+ for($k = 0; $k < 50; $k++) {
3692
+ $temp_val = isset($_POST['wdform_'.$key."_property".$id.$k]) ? $_POST['wdform_'.$key."_property".$id.$k] : NULL;
3693
+ if(isset($temp_val)) {
3694
+ $new_value .= '<br/>' . (isset($_POST['wdform_'.$key."_element_property_label".$id.$k]) ? $_POST['wdform_'.$key."_element_property_label".$id.$k] : "") . ': ' . $temp_val;
3695
+ }
3696
+ }
3697
+ break;
3698
+ }
3699
+ case "type_paypal_total": {
3700
+ $element = isset($_POST['wdform_'.$key."_paypal_total".$id]) ? $_POST['wdform_'.$key."_paypal_total".$id] : "";
3701
+ $new_value = $new_value . $element;
3702
+ break;
3703
+ }
3704
+ case "type_star_rating": {
3705
+ $element = isset($_POST['wdform_'.$key."_star_amount".$id]) ? $_POST['wdform_'.$key."_star_amount".$id] : NULL;
3706
+ $selected = isset($_POST['wdform_'.$key."_selected_star_amount".$id]) ? $_POST['wdform_'.$key."_selected_star_amount".$id] : 0;
3707
+ if(isset($element)) {
3708
+ $new_value = $new_value . $selected . '/' . $element;
3709
+ }
3710
+ break;
3711
+ }
3712
+ case "type_scale_rating": {
3713
+ $element = isset($_POST['wdform_'.$key."_scale_amount".$id]) ? $_POST['wdform_'.$key."_scale_amount".$id] : NULL;
3714
+ $selected = isset($_POST['wdform_'.$key."_scale_radio".$id]) ? $_POST['wdform_'.$key."_scale_radio".$id] : 0;
3715
+ if(isset($element)) {
3716
+ $new_value = $new_value . $selected . '/' . $element;
3717
+ }
3718
+ break;
3719
+ }
3720
+ case "type_spinner": {
3721
+ $element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
3722
+ if(isset($element)) {
3723
+ $new_value = $new_value . $element;
3724
+ }
3725
+ break;
3726
+ }
3727
+ case "type_slider": {
3728
+ $element = isset($_POST['wdform_'.$key."_slider_value".$id]) ? $_POST['wdform_'.$key."_slider_value".$id] : NULL;
3729
+ if(isset($element)) {
3730
+ $new_value = $new_value . $element;
3731
+ }
3732
+ break;
3733
+ }
3734
+ case "type_range": {
3735
+ $element0 = isset($_POST['wdform_'.$key."_element".$id.'0']) ? $_POST['wdform_'.$key."_element".$id.'0'] : NULL;
3736
+ $element1 = isset($_POST['wdform_'.$key."_element".$id.'1']) ? $_POST['wdform_'.$key."_element".$id.'1'] : NULL;
3737
+ if(isset($element0) || isset($element1)) {
3738
+ $new_value = $new_value . $element0 . '-' . $element1;
3739
+ }
3740
+ break;
3741
+ }
3742
+ case "type_grading": {
3743
+ $element = isset($_POST['wdform_'.$key."_hidden_item".$id]) ? $_POST['wdform_'.$key."_hidden_item".$id] : "";
3744
+ $grading = explode(":", $element);
3745
+ $items_count = sizeof($grading) - 1;
3746
+ $element = "";
3747
+ $total = "";
3748
+ for($k = 0;$k < $items_count; $k++) {
3749
+ $element .= $grading[$k] . ":" . (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : "") . " ";
3750
+ $total += (isset($_POST['wdform_'.$key."_element".$id.'_'.$k]) ? $_POST['wdform_'.$key."_element".$id.'_'.$k] : 0);
3751
+ }
3752
+ $element .="Total:" . $total;
3753
+ if(isset($element)) {
3754
+ $new_value = $new_value . $element;
3755
+ }
3756
+ break;
3757
+ }
3758
+ case "type_matrix": {
3759
+ $input_type = isset($_POST['wdform_'.$key."_input_type".$id]) ? $_POST['wdform_'.$key."_input_type".$id] : "";
3760
+ $mat_rows = explode("***", isset($_POST['wdform_'.$key."_hidden_row".$id]) ? $_POST['wdform_'.$key."_hidden_row".$id] : "");
3761
+ $rows_count = sizeof($mat_rows) - 1;
3762
+ $mat_columns = explode("***", isset($_POST['wdform_'.$key."_hidden_column".$id]) ? $_POST['wdform_'.$key."_hidden_column".$id] : "");
3763
+ $columns_count = sizeof($mat_columns) - 1;
3764
+ $matrix="<table>";
3765
+ $matrix .='<tr><td></td>';
3766
+ for( $k=1;$k< count($mat_columns) ;$k++) {
3767
+ $matrix .= '<td style="background-color:#BBBBBB; padding:5px; ">' . $mat_columns[$k] . '</td>';
3768
+ }
3769
+ $matrix .= '</tr>';
3770
+ $aaa=Array();
3771
+ for($k=1; $k<=$rows_count; $k++) {
3772
+ $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px;">' . $mat_rows[$k] . '</td>';
3773
+ if($input_type=="radio") {
3774
+ $mat_radio = isset($_POST['wdform_'.$key."_input_element".$id.$k]) ? $_POST['wdform_'.$key."_input_element".$id.$k] : 0;
3775
+ if($mat_radio == 0) {
3776
+ $checked = "";
3777
+ $aaa[1] = "";
3778
+ }
3779
+ else {
3780
+ $aaa = explode("_", $mat_radio);
3781
+ }
3782
+
3783
+ for($j = 1; $j <= $columns_count; $j++) {
3784
+ if($aaa[1]==$j) {
3785
+ $checked="checked";
3786
+ }
3787
+ else {
3788
+ $checked="";
3789
+ }
3790
+ $matrix .= '<td style="text-align:center"><input type="radio" ' . $checked . ' disabled /></td>';
3791
+ }
3792
+ }
3793
+ else {
3794
+ if($input_type == "checkbox") {
3795
+ for($j = 1; $j <= $columns_count; $j++) {
3796
+ $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j] : 0;
3797
+ if($checked==1) {
3798
+ $checked = "checked";
3799
+ }
3800
+ else {
3801
+ $checked = "";
3802
+ }
3803
+ $matrix .= '<td style="text-align:center"><input type="checkbox" ' . $checked . ' disabled /></td>';
3804
+ }
3805
+ }
3806
+ else {
3807
+ if($input_type == "text") {
3808
+ for($j = 1; $j <= $columns_count; $j++) {
3809
+ $checked = isset($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) ? esc_html($_POST['wdform_'.$key."_input_element".$id.$k.'_'.$j]) : "";
3810
+ $matrix .= '<td style="text-align:center"><input type="text" value="' . $checked . '" disabled /></td>';
3811
+ }
3812
+ }
3813
+ else {
3814
+ for($j = 1; $j <= $columns_count; $j++) {
3815
+ $checked = isset($_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$key."_select_yes_no".$id.$k.'_'.$j] : "";
3816
+ $matrix .= '<td style="text-align:center">' . $checked . '</td>';
3817
+ }
3818
+ }
3819
+ }
3820
+ }
3821
+ $matrix .= '</tr>';
3822
+ }
3823
+ $matrix .= '</table>';
3824
+ if(isset($matrix)) {
3825
+ $new_value = $new_value . $matrix;
3826
+ }
3827
+ break;
3828
+ }
3829
+ default: break;
3830
+ }
3831
+ // $new_script = str_replace("%" . $label_each . "%", $new_value, $new_script);
3832
+ }
3833
+
3834
+ return $new_value;
3835
+ }
3836
+
3837
+ public function empty_field($element, $mail_emptyfields) {
3838
+ if(!$mail_emptyfields)
3839
+ if(empty($element))
3840
+ return 0;
3841
+
3842
+ return 1;
3843
+ }
3844
+
3845
+ public function fm_validateDate($date, $format = 'Y-m-d H:i:s'){
3846
+ $d = DateTime::createFromFormat($format, $date);
3847
+ return $d && $d->format($format) == $date;
3848
+ }
3849
+
3850
+ public function all_forms() {
3851
+ global $wpdb;
3852
+ $forms = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix .'formmaker_display_options as display INNER JOIN ' . $wpdb->prefix . 'formmaker as forms ON display.form_id = forms.id WHERE display.type != "embedded" and forms.published=1');
3853
+ return $forms;
3854
+ }
3855
+
3856
+ public function display_options($id){
3857
+ global $wpdb;
3858
+ $row = $wpdb->get_row('SELECT * FROM '.$wpdb->prefix .'formmaker_display_options as display WHERE form_id = '.(int)$id);
3859
+ if (!$row) {
3860
+ $row = new stdClass();
3861
+ $row->form_id = $id;
3862
+ $row->type = 'embedded';
3863
+ $row->scrollbox_loading_delay = 0;
3864
+ $row->popover_animate_effect = '';
3865
+ $row->popover_loading_delay = 0;
3866
+ $row->popover_frequency = 0;
3867
+ $row->topbar_position = 1;
3868
+ $row->topbar_remain_top = 1;
3869
+ $row->topbar_closing = 1;
3870
+ $row->topbar_hide_duration = 0;
3871
+ $row->scrollbox_position = 1;
3872
+ $row->scrollbox_trigger_point = 20;
3873
+ $row->scrollbox_hide_duration = 0;
3874
+ $row->scrollbox_auto_hide = 1;
3875
+ $row->hide_mobile = 0;
3876
+ $row->scrollbox_closing = 1;
3877
+ $row->scrollbox_minimize = 1;
3878
+ $row->scrollbox_minimize_text = '';
3879
+ $row->display_on = 'everything';
3880
+ $row->posts_include = '';
3881
+ $row->pages_include = '';
3882
+ $row->display_on_categories = '';
3883
+ $row->current_categories = '';
3884
+ $row->show_for_admin = 0;
3885
+ }
3886
+ return $row;
3887
+ }
3888
+ ////////////////////////////////////////////////////////////////////////////////////////
3889
+ // Getters & Setters //
3890
+ ////////////////////////////////////////////////////////////////////////////////////////
3891
+ ////////////////////////////////////////////////////////////////////////////////////////
3892
+ // Private Methods //
3893
+ ////////////////////////////////////////////////////////////////////////////////////////
3894
+ ////////////////////////////////////////////////////////////////////////////////////////
3895
+ // Listeners //
3896
+ ////////////////////////////////////////////////////////////////////////////////////////
3897
  }
frontend/views/FMViewForm_maker.php CHANGED
@@ -1,4820 +1,4820 @@
1
- <?php
2
-
3
- class FMViewForm_maker {
4
- private $model;
5
- public function __construct($model) {
6
- $this->model = $model;
7
- }
8
-
9
- public function display($id, $formType = 'embedded', $onload_js = '') {
10
- global $wpdb;
11
- require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
12
- $fm_settings = get_option('fm_settings');
13
- $current_user = wp_get_current_user();
14
- if ($current_user->ID != 0) {
15
- $wp_userid = $current_user->ID;
16
- $wp_username = $current_user->display_name;
17
- $wp_useremail = $current_user->user_email;
18
- }
19
- else {
20
- $wp_userid = '';
21
- $wp_username = '';
22
- $wp_useremail = '';
23
- }
24
- $current_url = htmlentities($_SERVER['REQUEST_URI']);
25
- $pattern = '/\/\/(.+)(\r\n|\r|\n)/';
26
- $result = $this->model->showform($id, $formType);
27
- if (!$result) {
28
- return;
29
- }
30
- $ok = $this->model->savedata($result[0], $id);
31
- if (is_numeric($ok)) {
32
- $this->model->remove($ok);
33
- }
34
- $row = $result[0];
35
- $label_id = $result[2];
36
- $label_type = $result[3];
37
- $form_theme = $result[4];
38
- if (isset($_GET['test_theme']) && (esc_html(stripslashes($_GET['test_theme'])) != '')) {
39
- /* From preview.*/
40
- $theme_id = esc_html(stripslashes($_GET['test_theme']));
41
- }
42
- else {
43
- $theme_id = $row->theme;
44
- }
45
- $form_maker_front_end = '';
46
- $row_display = $this->model->display_options($id);
47
- $this->model->increment_views_count($id);
48
- $article = $row->article_id;
49
-
50
- $header_pos = isset($form_theme['HPAlign']) && ($form_theme['HPAlign'] == 'left' || $form_theme['HPAlign'] == 'right') ? (($row->header_title || $row->header_description || $row->header_image_url) ? 'header_left_right' : 'no_header') : '';
51
- $pagination_align = $row->pagination == 'steps' && isset($form_theme['PSAPAlign']) ? 'fm-align-' . $form_theme['PSAPAlign'] : '';
52
- $form_maker_front_end .= '<script type="text/javascript">' . preg_replace($pattern, ' ', $row->javascript) . '</script>';
53
- $form_currency = '$';
54
- $check_js = '';
55
- // $onload_js = '';
56
- $onsubmit_js = '';
57
- $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
58
- $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
59
- if ($row->payment_currency) {
60
- $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
61
- }
62
- $form_paypal_tax = $row->tax;
63
- $form_maker_front_end .= '<div id="fm-pages' . $id . '" class="fm-pages wdform_page_navigation ' . $pagination_align . '" show_title="' . $row->show_title . '" show_numbers="' . $row->show_numbers . '" type="' . $row->pagination . '"></div>';
64
- $form_maker_front_end .= '<form name="form' . $id . '" action="' . $current_url . '" method="post" id="form' . $id . '" class="fm-form form' . $id . ' ' . $header_pos . '" enctype="multipart/form-data" onsubmit="check_required' . $id . '(\'submit\', \'' . $id . '\'); return false;">
65
- <input type="hidden" id="counter' . $id . '" value="' . $row->counter . '" name="counter' . $id . '" />
66
- <input type="hidden" id="Itemid' . $id . '" value="" name="Itemid' . $id . '" />';
67
- $image_pos = isset($form_theme['HIPAlign']) && ($form_theme['HIPAlign'] == 'left' || $form_theme['HIPAlign'] == 'right') ? 'image_left_right' : '';
68
- $image_width = isset($form_theme['HIPWidth']) && $form_theme['HIPWidth'] ? 'width="' . $form_theme['HIPWidth'] . 'px"' : '';
69
- $image_height = isset($form_theme['HIPHeight']) && $form_theme['HIPHeight'] ? 'height="' . $form_theme['HIPHeight'] . 'px"' : '';
70
- $hide_header_image_class = wp_is_mobile() && $row->header_hide_image ? 'fm_hide_mobile' : '';
71
- $header_image_animation = $formType == 'embedded' ? $row->header_image_animation : '';
72
- if (!isset($form_theme['HPAlign']) || ($form_theme['HPAlign'] == 'left' || $form_theme['HPAlign'] == 'top')) {
73
- if ($row->header_title || $row->header_description || $row->header_image_url) {
74
- $form_maker_front_end .= '<div class="fm-header-bg"><div class="fm-header ' . $image_pos . '">';
75
- if (!isset($form_theme['HIPAlign']) || $form_theme['HIPAlign'] == 'left' || $form_theme['HIPAlign'] == 'top') {
76
- if ($row->header_image_url) {
77
- $form_maker_front_end .= '<div class="fm-header-img ' . $hide_header_image_class . ' fm-animated ' . $header_image_animation . '"><img src="' . $row->header_image_url . '" ' . $image_width . ' ' . $image_height . '/></div>';
78
- }
79
- }
80
- if ($row->header_title || $row->header_description) {
81
- $form_maker_front_end .= '<div class="fm-header-text">
82
- <div class="fm-header-title">
83
- ' . $row->header_title . '
84
- </div>
85
- <div class="fm-header-description">
86
- ' . $row->header_description . '
87
- </div>
88
- </div>';
89
- }
90
- if (isset($form_theme['HIPAlign']) && ($form_theme['HIPAlign'] == 'right' || $form_theme['HIPAlign'] == 'bottom')) {
91
- if ($row->header_image_url) {
92
- $form_maker_front_end .= '<div class="fm-header-img"><img src="' . $row->header_image_url . '" ' . $image_width . ' ' . $image_height . '/></div>';
93
- }
94
- }
95
- $form_maker_front_end .= '</div></div>';
96
- }
97
- }
98
-
99
- $fm_hide_form_after_submit = 0;
100
- if (isset($_SESSION['form_submit_type' . $id])) {
101
- $type_and_id = $_SESSION['form_submit_type' . $id];
102
- $type_and_id = explode(',', $type_and_id);
103
- $form_get_type = $type_and_id[0];
104
- $form_get_id = isset($type_and_id[1]) ? $type_and_id[1] : '';
105
- $_SESSION['form_submit_type' . $id] = 0;
106
- if ($form_get_type == 3) {
107
- $_SESSION['massage_after_submit' . $id] = "";
108
- $after_submission_text = $this->model->get_after_submission_text($form_get_id);
109
- $form_maker_front_end .= WDW_FM_Library::message(wpautop(html_entity_decode($after_submission_text)), 'warning', $id);
110
- $fm_hide_form_after_submit = 1;
111
- }
112
- }
113
- if (isset($_SESSION['redirect_paypal' . $id]) && ($_SESSION['redirect_paypal' . $id] == 1)) {
114
- $_SESSION['redirect_paypal' . $id] = 0;
115
- if (isset($_GET['succes'])) {
116
- if ($_GET['succes'] == 0) {
117
- $form_maker_front_end .= WDW_FM_Library::message(__('Error, email was not sent.', 'form_maker'), 'error', $id);
118
- }
119
- else {
120
- $form_maker_front_end .= WDW_FM_Library::message(__('Your form was successfully submitted.', 'form_maker'), 'warning', $id);
121
- }
122
- }
123
- }
124
- elseif (isset($_SESSION['massage_after_submit' . $id]) && $_SESSION['massage_after_submit' . $id] != "") {
125
- $message = $_SESSION['massage_after_submit' . $id];
126
- $_SESSION['massage_after_submit' . $id] = "";
127
- if ($_SESSION['error_or_no' . $id]) {
128
- $error = 'error';
129
- }
130
- else {
131
- $error = 'warning';
132
- }
133
- $form_maker_front_end .= WDW_FM_Library::message($message, $error, $id);
134
- }
135
- if (isset($_SESSION['massage_after_save' . $id]) && $_SESSION['massage_after_save' . $id] != "") {
136
- $save_message = $_SESSION['massage_after_save' . $id];
137
- $_SESSION['massage_after_save' . $id] = '';
138
- if (isset($_SESSION['save_error' . $id]) && $_SESSION['save_error' . $id] == 2) {
139
- echo $save_message;
140
- }
141
- else {
142
- $save_error = $_SESSION['save_error' . $id] ? 'error' : 'warning';
143
- $form_maker_front_end .= WDW_FM_Library::message($save_message, $save_error, $id);
144
- }
145
- }
146
- if (isset($_SESSION['show_submit_text' . $id])) {
147
- if ($_SESSION['show_submit_text' . $id] == 1) {
148
- $_SESSION['show_submit_text' . $id] = 0;
149
- $form_maker_front_end .= $row->submit_text;
150
- }
151
- }
152
- if (isset($_SESSION['fm_hide_form_after_submit' . $id]) && $_SESSION['fm_hide_form_after_submit' . $id] == 1) {
153
- $_SESSION['fm_hide_form_after_submit' . $id] = 0;
154
- $fm_hide_form_after_submit = 1;
155
- }
156
-
157
- $stripe_enable = 0;
158
- $is_type = array();
159
- $id1s = array();
160
- $types = array();
161
- $labels = array();
162
- $paramss = array();
163
- $required_sym = $row->requiredmark;
164
- $fields = explode('*:*new_field*:*', $row->form_fields);
165
- $fields = array_slice($fields, 0, count($fields) - 1);
166
- foreach ($fields as $field) {
167
- $temp = explode('*:*id*:*', $field);
168
- array_push($id1s, $temp[0]);
169
- $temp = explode('*:*type*:*', $temp[1]);
170
- array_push($types, $temp[0]);
171
- $temp = explode('*:*w_field_label*:*', $temp[1]);
172
- array_push($labels, $temp[0]);
173
- array_push($paramss, $temp[1]);
174
- }
175
-
176
- $labels_and_ids = array_combine($id1s, $types);
177
- $form_id = $id;
178
- $symbol_begin = array();
179
- $symbol_end = array();
180
- if (defined('WD_FM_CALCULATOR') && is_plugin_active(constant('WD_FM_CALCULATOR'))) {
181
- $row_calc = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'formmaker_calculator WHERE form_id=' . $form_id, ARRAY_A);
182
- $symbol_end = json_decode($row_calc['symbol_end'], true);
183
- $symbol_begin = json_decode($row_calc['symbol_begin'], true);
184
- }
185
- $show_hide = array();
186
- $field_label = array();
187
- $all_any = array();
188
- $condition_params = array();
189
- $type_and_id = array();
190
- $condition_js = '';
191
- if ($row->condition != "") {
192
- $conditions = explode('*:*new_condition*:*', $row->condition);
193
- $conditions = array_slice($conditions, 0, count($conditions) - 1);
194
- $count_of_conditions = count($conditions);
195
- foreach ($conditions as $condition) {
196
- $temp = explode('*:*show_hide*:*', $condition);
197
- array_push($show_hide, $temp[0]);
198
- $temp = explode('*:*field_label*:*', $temp[1]);
199
- array_push($field_label, $temp[0]);
200
- $temp = explode('*:*all_any*:*', $temp[1]);
201
- array_push($all_any, $temp[0]);
202
- array_push($condition_params, $temp[1]);
203
- }
204
- foreach ($id1s as $id1s_key => $id1) {
205
- $type_and_id[$id1] = $types[$id1s_key];
206
- }
207
- for ($k = 0; $k < $count_of_conditions; $k++) {
208
- if ($show_hide[$k]) {
209
- $display = 'removeAttr("style")';
210
- $display_none = 'css("display", "none")';
211
- }
212
- else {
213
- $display = 'css("display", "none")';
214
- $display_none = 'removeAttr("style")';
215
- }
216
- if ($all_any[$k] == "and") {
217
- $or_and = '&&';
218
- }
219
- else {
220
- $or_and = '||';
221
- }
222
- if ($condition_params[$k]) {
223
- $cond_params = explode('*:*next_condition*:*', $condition_params[$k]);
224
- $cond_params = array_slice($cond_params, 0, count($cond_params) - 1);
225
- for ($l = 0; $l < count($cond_params); $l++) {
226
- $params_value = explode('***', $cond_params[$l]);
227
- if (!isset($type_and_id[$params_value[0]])) {
228
- unset($cond_params[$l]);
229
- }
230
- }
231
- $cond_params = array_values($cond_params);
232
- $if = '';
233
- $keyup = '';
234
- $change = '';
235
- $click = '';
236
- $blur = '';
237
- for ($m = 0; $m < count($cond_params); $m++) {
238
- $params_value = explode('***', wp_specialchars_decode($cond_params[$m], 'single'));
239
- switch ($type_and_id[$params_value[0]]) {
240
- case "type_text":
241
- case "type_password":
242
- case "type_textarea":
243
- case "type_number":
244
- case "type_submitter_mail":
245
- case "type_spinner":
246
- case "type_paypal_price_new":
247
- case "type_date_new":
248
- case "type_phone_new":
249
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
250
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
251
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
252
- }
253
- else {
254
- if ($params_value[1] == "=" || $params_value[1] == "!") {
255
- $params_value[2] = "";
256
- $params_value[1] = $params_value[1] . "=";
257
- }
258
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
259
- }
260
- $keyup .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
261
- if ($type_and_id[$params_value[0]] == "type_date_new") {
262
- $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
263
- }
264
- if ($type_and_id[$params_value[0]] == "type_spinner") {
265
- $click .= '#wdform_' . $params_value[0] . '_element' . $form_id . ' ~ a, ';
266
- }
267
- if ($type_and_id[$params_value[0]] == "type_phone_new") {
268
- $blur = '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
269
- }
270
- break;
271
- case "type_name":
272
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
273
- $extended0 = '';
274
- $extended1 = '';
275
- $extended2 = '';
276
- $extended3 = '';
277
- $normal0 = '';
278
- $normal1 = '';
279
- $normal2 = '';
280
- $normal3 = '';
281
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
282
- $name_fields = explode(' ', $params_value[2]);
283
- if ($name_fields[0] != '') {
284
- $extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 ';
285
- $normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 ';
286
- }
287
- if (isset($name_fields[1]) && $name_fields[1] != '') {
288
- $extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 ';
289
- $normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 ';
290
- }
291
- if (isset($name_fields[2]) && $name_fields[2] != '') {
292
- $extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[2] . '")' . $like_or_not . '-1 ';
293
- $normal2 = '';
294
- }
295
- if (isset($name_fields[3]) && $name_fields[3] != '') {
296
- $extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val().indexOf("' . $name_fields[3] . '")' . $like_or_not . '-1 ';
297
- $normal3 = '';
298
- }
299
- if (isset($name_fields[3])) {
300
- $extended = '';
301
- $normal = '';
302
- if ($extended0) {
303
- $extended = $extended0;
304
- if ($extended1) {
305
- $extended .= ' && ' . $extended1;
306
- if ($extended2) {
307
- $extended .= ' && ' . $extended2;
308
- }
309
- if ($extended3) {
310
- $extended .= ' && ' . $extended3;
311
- }
312
- }
313
- else {
314
- if ($extended2) {
315
- $extended .= ' && ' . $extended2;
316
- }
317
- if ($extended3) {
318
- $extended .= ' && ' . $extended3;
319
- }
320
- }
321
- }
322
- else {
323
- if ($extended1) {
324
- $extended = $extended1;
325
- if ($extended2) {
326
- $extended .= ' && ' . $extended2;
327
- }
328
- if ($extended3) {
329
- $extended .= ' && ' . $extended3;
330
- }
331
- }
332
- else {
333
- if ($extended2) {
334
- $extended = $extended2;
335
- if ($extended3) {
336
- $extended .= ' && ' . $extended3;
337
- }
338
- }
339
- else {
340
- if ($extended3) {
341
- $extended = $extended3;
342
- }
343
- }
344
- }
345
- }
346
- if ($normal0) {
347
- $normal = $normal0;
348
- if ($normal1) {
349
- $normal .= ' && ' . $normal1;
350
- }
351
- }
352
- else {
353
- if ($normal1) {
354
- $normal = $normal1;
355
- }
356
- }
357
- }
358
- else {
359
- if (isset($name_fields[2])) {
360
- $extended = "";
361
- $normal = "";
362
- if ($extended0) {
363
- $extended = $extended0;
364
- if ($extended1) {
365
- $extended .= ' && ' . $extended1;
366
- }
367
- if ($extended2) {
368
- $extended .= ' && ' . $extended2;
369
- }
370
- }
371
- else {
372
- if ($extended1) {
373
- $extended = $extended1;
374
- if ($extended2) {
375
- $extended .= ' && ' . $extended2;
376
- }
377
- }
378
- else {
379
- if ($extended2) {
380
- $extended = $extended2;
381
- }
382
- }
383
- }
384
- if ($normal0) {
385
- $normal = $normal0;
386
- if ($normal1) {
387
- $normal .= ' && ' . $normal1;
388
- }
389
- }
390
- else {
391
- if ($normal1) {
392
- $normal = $normal1;
393
- }
394
- }
395
- }
396
- else {
397
- if (isset($name_fields[1])) {
398
- $extended = '';
399
- $normal = '';
400
- if ($extended0) {
401
- if ($extended1) {
402
- $extended = $extended0 . ' && ' . $extended1;
403
- }
404
- else {
405
- $extended = $extended0;
406
- }
407
- }
408
- else {
409
- if ($extended1) {
410
- $extended = $extended1;
411
- }
412
- }
413
- if ($normal0) {
414
- if ($normal1) {
415
- $normal = $normal0 . ' && ' . $normal1;
416
- }
417
- else {
418
- $normal = $normal0;
419
- }
420
- }
421
- else {
422
- if ($normal1) {
423
- $normal = $normal1;
424
- }
425
- }
426
- }
427
- else {
428
- $extended = $extended0;
429
- $normal = $normal0;
430
- }
431
- }
432
- }
433
- if ($extended != "" && $normal != "") {
434
- $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') ';
435
- }
436
- else {
437
- $if .= ' true';
438
- }
439
- }
440
- else {
441
- if ($params_value[1] == "=" || $params_value[1] == "!") {
442
- $name_and_or = $params_value[1] == "=" ? "&&" : "||";
443
- $name_empty_or_not = $params_value[1] . "=";
444
- $extended = ' (jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $name_empty_or_not . '"") ';
445
- $normal = ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"") ';
446
- $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') ';
447
- }
448
- else {
449
- $extended0 = '';
450
- $extended1 = '';
451
- $extended2 = '';
452
- $extended3 = '';
453
- $normal0 = '';
454
- $normal1 = '';
455
- $normal2 = '';
456
- $normal3 = '';
457
- $name_fields = explode(' ', $params_value[2]);
458
- if ($name_fields[0] != '') {
459
- $extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"';
460
- $normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"';
461
- }
462
- if (isset($name_fields[1]) && $name_fields[1] != '') {
463
- $extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"';
464
- $normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"';
465
- }
466
- if (isset($name_fields[2]) && $name_fields[2] != '') {
467
- $extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[2] . '"';
468
- $normal2 = '';
469
- }
470
- if (isset($name_fields[3]) && $name_fields[3] != '') {
471
- $extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[3] . '"';
472
- $normal3 = '';
473
- }
474
- if (isset($name_fields[3])) {
475
- $extended = '';
476
- $normal = '';
477
- if ($extended0) {
478
- $extended = $extended0;
479
- if ($extended1) {
480
- $extended .= ' && ' . $extended1;
481
- if ($extended2) {
482
- $extended .= ' && ' . $extended2;
483
- }
484
- if ($extended3) {
485
- $extended .= ' && ' . $extended3;
486
- }
487
- }
488
- else {
489
- if ($extended2) {
490
- $extended .= ' && ' . $extended2;
491
- }
492
- if ($extended3) {
493
- $extended .= ' && ' . $extended3;
494
- }
495
- }
496
- }
497
- else {
498
- if ($extended1) {
499
- $extended = $extended1;
500
- if ($extended2) {
501
- $extended .= ' && ' . $extended2;
502
- }
503
- if ($extended3) {
504
- $extended .= ' && ' . $extended3;
505
- }
506
- }
507
- else {
508
- if ($extended2) {
509
- $extended = $extended2;
510
- if ($extended3) {
511
- $extended .= ' && ' . $extended3;
512
- }
513
- }
514
- else {
515
- if ($extended3) {
516
- $extended = $extended3;
517
- }
518
- }
519
- }
520
- }
521
- if ($normal0) {
522
- $normal = $normal0;
523
- if ($normal1) {
524
- $normal .= ' && ' . $normal1;
525
- }
526
- }
527
- else {
528
- if ($normal1) {
529
- $normal = $normal1;
530
- }
531
- }
532
- }
533
- else {
534
- if (isset($name_fields[2])) {
535
- $extended = "";
536
- $normal = "";
537
- if ($extended0) {
538
- $extended = $extended0;
539
- if ($extended1) {
540
- $extended .= ' && ' . $extended1;
541
- }
542
- if ($extended2) {
543
- $extended .= ' && ' . $extended2;
544
- }
545
- }
546
- else {
547
- if ($extended1) {
548
- $extended = $extended1;
549
- if ($extended2) {
550
- $extended .= ' && ' . $extended2;
551
- }
552
- }
553
- else {
554
- if ($extended2) {
555
- $extended = $extended2;
556
- }
557
- }
558
- }
559
- if ($normal0) {
560
- $normal = $normal0;
561
- if ($normal1) {
562
- $normal .= ' && ' . $normal1;
563
- }
564
- }
565
- else {
566
- if ($normal1) {
567
- $normal = $normal1;
568
- }
569
- }
570
- }
571
- else {
572
- if (isset($name_fields[1])) {
573
- $extended = '';
574
- $normal = '';
575
- if ($extended0) {
576
- if ($extended1) {
577
- $extended = $extended0 . ' && ' . $extended1;
578
- }
579
- else {
580
- $extended = $extended0;
581
- }
582
- }
583
- else {
584
- if ($extended1) {
585
- $extended = $extended1;
586
- }
587
- }
588
- if ($normal0) {
589
- if ($normal1) {
590
- $normal = $normal0 . ' && ' . $normal1;
591
- }
592
- else {
593
- $normal = $normal0;
594
- }
595
- }
596
- else {
597
- if ($normal1) {
598
- $normal = $normal1;
599
- }
600
- }
601
- }
602
- else {
603
- $extended = $extended0;
604
- $normal = $normal0;
605
- }
606
- }
607
- }
608
- if ($extended != "" && $normal != "") {
609
- $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') ';
610
- }
611
- else {
612
- $if .= ' true';
613
- }
614
- }
615
- }
616
- $keyup .= '#wdform_' . $params_value[0] . '_element_title' . $form_id . ', #wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', #wdform_' . $params_value[0] . '_element_middle' . $form_id . ', ';
617
- break;
618
- case "type_phone":
619
- if ($params_value[1] == "==" || $params_value[1] == "!=") {
620
- $phone_fields = explode(' ', $params_value[2]);
621
- if (isset($phone_fields[1])) {
622
- if ($phone_fields[0] != '' && $phone_fields[1] != '') {
623
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[0] . '" && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
624
- }
625
- else {
626
- if ($phone_fields[0] == '') {
627
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
628
- }
629
- else {
630
- if ($phone_fields[1] == '') {
631
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
632
- }
633
- }
634
- }
635
- }
636
- else {
637
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
638
- }
639
- }
640
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
641
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
642
- $phone_fields = explode(' ', $params_value[2]);
643
- if (isset($phone_fields[1])) {
644
- if ($phone_fields[0] != '' && $phone_fields[1] != '') {
645
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1 && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1)';
646
- }
647
- else {
648
- if ($phone_fields[0] == '') {
649
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1) ';
650
- }
651
- else {
652
- if ($phone_fields[1] == '') {
653
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) ';
654
- }
655
- }
656
- }
657
- }
658
- else {
659
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) ';
660
- }
661
- }
662
- if ($params_value[1] == "=" || $params_value[1] == "!") {
663
- $params_value[2] = "";
664
- $and_or_phone = ($params_value[1] == "=" ? "&&" : "||");
665
- $params_value[1] = $params_value[1] . "=";
666
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_phone . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '") ';
667
- }
668
- $keyup .= '#wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', ';
669
- break;
670
- case "type_paypal_price":
671
- if ($params_value[1] == "==" || $params_value[1] == "!=") {
672
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : parseFloat(jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val())' . $params_value[1] . 'parseFloat("' . str_replace('.0', '.', $params_value[2]) . '"))';
673
- }
674
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
675
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
676
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()).indexOf("' . str_replace('.0', '.', $params_value[2]) . '")' . $like_or_not . '-1) ';
677
- }
678
- if ($params_value[1] == "=" || $params_value[1] == "!") {
679
- $params_value[2] = "";
680
- $and_or_price = ($params_value[1] == "=" ? "&&" : "||");
681
- $params_value[1] = $params_value[1] . "=";
682
- $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_price . ' jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"))';
683
- }
684
- $keyup .= '#wdform_' . $params_value[0] . '_element_dollars' . $form_id . ', #wdform_' . $params_value[0] . '_element_cents' . $form_id . ', ';
685
- break;
686
- case "type_own_select":
687
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
688
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
689
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
690
- }
691
- else {
692
- if ($params_value[1] == "=" || $params_value[1] == "!") {
693
- $params_value[2] = "";
694
- $params_value[1] = $params_value[1] . "=";
695
- }
696
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
697
- }
698
- $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
699
- break;
700
- case "type_paypal_select":
701
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
702
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
703
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
704
- }
705
- else {
706
- if ($params_value[1] == "=" || $params_value[1] == "!") {
707
- $params_value[2] = "";
708
- $params_value[1] = $params_value[1] . "=";
709
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"';
710
- }
711
- else {
712
- if (strpos($params_value[2], '*:*value*:*') > -1) {
713
- $and_or = $params_value[1] == "==" ? '&&' : '||';
714
- $choise_and_value = explode("*:*value*:*", $params_value[2]);
715
- $params_value[2] = $choise_and_value[1];
716
- $params_label = $choise_and_value[0];
717
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or . ' jQuery("div[wdid=' . $params_value[0] . '] select option:selected").text()' . $params_value[1] . '"' . $params_label . '" ';
718
- }
719
- else {
720
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
721
- }
722
- }
723
- }
724
- $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
725
- break;
726
- case "type_address":
727
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
728
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
729
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
730
- }
731
- else {
732
- if ($params_value[1] == "=" || $params_value[1] == "!") {
733
- $params_value[2] = "";
734
- $params_value[1] = $params_value[1] . "=";
735
- }
736
- $if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
737
- }
738
- $change .= '#wdform_' . $params_value[0] . '_country' . $form_id . ', ';
739
- break;
740
- case "type_country":
741
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
742
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
743
- $if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
744
- }
745
- else {
746
- if ($params_value[1] == "=" || $params_value[1] == "!") {
747
- $params_value[2] = "";
748
- $params_value[1] = $params_value[1] . "=";
749
- }
750
- $if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
751
- }
752
- $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
753
- break;
754
- case "type_radio":
755
- case "type_paypal_radio":
756
- case "type_paypal_shipping":
757
- if ($params_value[1] == "==" || $params_value[1] == "!=") {
758
- if (strpos($params_value[2], '*:*value*:*') > -1) {
759
- $and_or = $params_value[1] == "==" ? '&&' : '||';
760
- $choise_and_value = explode("*:*value*:*", $params_value[2]);
761
- $params_value[2] = $choise_and_value[1];
762
- $params_label = $choise_and_value[0];
763
- $if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or . ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("title")' . $params_value[1] . '"' . $params_label . '" ';
764
- }
765
- else {
766
- $if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
767
- }
768
- $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
769
- }
770
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
771
- $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
772
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
773
- $if .= ' (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val() ? (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("other") ? false : (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 )) : false) ';
774
- }
775
- if ($params_value[1] == "=" || $params_value[1] == "!") {
776
- $ckecked_or_no = ($params_value[1] == "=" ? "!" : "");
777
- $if .= ' ' . $ckecked_or_no . 'jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()';
778
- $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
779
- }
780
- break;
781
- case "type_checkbox":
782
- case "type_paypal_checkbox":
783
- if ($params_value[1] == "==" || $params_value[1] == "!=") {
784
- if ($params_value[2]) {
785
- $choises = explode('@@@', $params_value[2]);
786
- $choises = array_slice($choises, 0, count($choises) - 1);
787
- if ($params_value[1] == "!=") {
788
- $is = "!";
789
- }
790
- else {
791
- $is = "";
792
- }
793
- foreach ($choises as $key1 => $choise) {
794
- if ($type_and_id[$params_value[0]] == "type_paypal_checkbox") {
795
- $choise_and_value = explode("*:*value*:*", $choise);
796
- $if .= ' ' . $is . '(jQuery("#form' . $form_id . ' div[wdid=' . $params_value[0] . '] input[value=\"' . $choise_and_value[1] . '\"]").is(":checked") && jQuery("div[wdid=' . $params_value[0] . '] input[title=\"' . $choise_and_value[0] . '\"]"))';
797
- }
798
- else {
799
- $if .= ' ' . $is . 'jQuery("#form' . $form_id . ' div[wdid=' . $params_value[0] . '] input[value=\"' . $choise . '\"]").is(":checked") ';
800
- }
801
- if ($key1 != count($choises) - 1) {
802
- $if .= '&&';
803
- }
804
- }
805
- $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
806
- }
807
- else {
808
- if ($or_and == '&&') {
809
- $if .= ' true';
810
- }
811
- else {
812
- $if .= ' false';
813
- }
814
- }
815
- }
816
- if ($params_value[1] == "%" || $params_value[1] == "!%") {
817
- $like_or_not = ($params_value[1] == "%" ? ">" : "==");
818
- if ($params_value[2]) {
819
- $choises = explode('@@@', $params_value[2]);
820
- $choises = array_slice($choises, 0, count($choises) - 1);
821
- if ($type_and_id[$params_value[0]] == "type_paypal_checkbox") {
822
- foreach ($choises as $key1 => $choise) {
823
- $choise_and_value = explode("*:*value*:*", $choise);
824
- $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").serialize().indexOf("' . $choise_and_value[1] . '")' . $like_or_not . '-1 ';
825
- if ($key1 != count($choises) - 1) {
826
- $if .= '&&';
827
- }
828
- }
829
- }
830
- else {
831
- foreach ($choises as $key1 => $choise) {
832
- $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").serialize().indexOf("' . str_replace(" ", "+", $choise) . '")' . $like_or_not . '-1 ';
833
- if ($key1 != count($choises) - 1) {
834
- $if .= '&&';
835
- }
836
- }
837
- }
838
- $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
839
- }
840
- else {
841
- if ($or_and == '&&') {
842
- $if .= ' true';
843
- }
844
- else {
845
- $if .= ' false';
846
- }
847
- }
848
- }
849
- if ($params_value[1] == "=" || $params_value[1] == "!") {
850
- $ckecked_or_no = ($params_value[1] == "=" ? "==" : ">");
851
- $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").length' . $ckecked_or_no . '0 ';
852
- $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
853
- }
854
- break;
855
- }
856
- if ($m != count($cond_params) - 1) {
857
- $params_value_next = explode('***', $cond_params[$m + 1]);
858
- if (isset($type_and_id[$params_value_next[0]])) {
859
- $if .= $or_and;
860
- }
861
- }
862
- }
863
- if ($if) {
864
- $condition_js .= '
865
- if(' . $if . ')
866
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
867
- else
868
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . ';';
869
- }
870
- if ($keyup) {
871
- $condition_js .= '
872
- jQuery("' . substr($keyup, 0, -2) . '").keyup(function() {
873
- if(' . $if . ')
874
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
875
- else
876
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
877
- }
878
- if ($change) {
879
- $condition_js .= '
880
- jQuery("' . substr($change, 0, -2) . '").change(function() {
881
- if(' . $if . ')
882
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
883
- else
884
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
885
- }
886
- if ($blur) {
887
- $condition_js .= '
888
- jQuery("' . substr($blur, 0, -2) . '").blur(function() {
889
- if(' . $if . ')
890
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
891
- else
892
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
893
- }
894
- if ($click) {
895
- $condition_js .= '
896
- jQuery("' . substr($click, 0, -2) . '").click(function() {
897
- if(' . $if . ')
898
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
899
- else
900
- jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
901
- }
902
- }
903
- }
904
- }
905
-
906
- if ($row->autogen_layout == 0) {
907
- $form = $row->custom_front;
908
- }
909
- else {
910
- $form = $row->form_front;
911
- }
912
-
913
- $req_fields = array();
914
- $check_regExp_all = array();
915
- $check_paypal_price_min_max = array();
916
- $file_upload_check = array();
917
- $spinner_check = array();
918
-
919
- $GLOBALS['map_include'] = false;
920
-
921
- foreach ($id1s as $id1s_key => $id1) {
922
- $label = $labels[$id1s_key];
923
- $type = $types[$id1s_key];
924
- $params = $paramss[$id1s_key];
925
- if (strpos($form, '%' . $id1 . ' - ' . $label . '%') || strpos($form, '%' . $id1 . ' -' . $label . '%')) {
926
- $rep = '';
927
- $required = false;
928
- $param = array();
929
- $param['attributes'] = '';
930
- $is_type[$type] = true;
931
- switch ($type) {
932
- case 'type_section_break': {
933
- $params_names = array('w_editor');
934
- $temp = $params;
935
- foreach ($params_names as $params_name) {
936
- $temp = explode('*:*' . $params_name . '*:*', $temp);
937
- $param[$params_name] = $temp[0];
938
- $temp = $temp[1];
939
- }
940
- $rep = '<div type="type_section_break" class="wdform-field-section-break"><div class="wdform_section_break">' . html_entity_decode($param['w_editor']) . '</div></div>';
941
- break;
942
- }
943
- case 'type_editor': {
944
- $params_names = array('w_editor');
945
- $temp = $params;
946
- foreach ($params_names as $params_name) {
947
- $temp = explode('*:*' . $params_name . '*:*', $temp);
948
- $param[$params_name] = $temp[0];
949
- $temp = $temp[1];
950
- }
951
- $rep = '<div type="type_editor" class="wdform-field">' . html_entity_decode($param['w_editor']) . '</div>';
952
- break;
953
- }
954
- case 'type_send_copy': {
955
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required');
956
- $temp = $params;
957
- if (strpos($temp, 'w_hide_label') > -1) {
958
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_first_val', 'w_required');
959
- }
960
- foreach ($params_names as $params_name) {
961
- $temp = explode('*:*' . $params_name . '*:*', $temp);
962
- $param[$params_name] = $temp[0];
963
- $temp = $temp[1];
964
- }
965
- if ($temp) {
966
- $temp = explode('*:*w_attr_name*:*', $temp);
967
- $attrs = array_slice($temp, 0, count($temp) - 1);
968
- foreach ($attrs as $attr) {
969
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
970
- }
971
- }
972
- $input_active = ($param['w_first_val'] == 'true' ? "checked='checked'" : "");
973
- $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
974
- if (isset($post_value)) {
975
- $post_temp = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : "";
976
- $input_active = (isset($post_temp) ? "checked='checked'" : "");
977
- }
978
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
979
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
980
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
981
- if ($param['w_hide_label'] == "yes") {
982
- $param['w_field_label_pos1'] = "display:none;";
983
- }
984
- $required = ($param['w_required'] == "yes" ? true : false);
985
- $rep = '<div type="type_send_copy" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label"><label for="wdform_' . $id1 . '_element' . $form_id . '">' . $label . '</label></span>';
986
- if ($required) {
987
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
988
- }
989
- $rep .= '</div>
990
- <div class="wdform-element-section" style="' . $param['w_field_label_pos2'] . '" >
991
- <div class="checkbox-div" style="left:3px">
992
- <input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" ' . $input_active . ' ' . $param['attributes'] . '/>
993
- <label for="wdform_' . $id1 . '_element' . $form_id . '"><span></span></label>
994
- </div>
995
- </div></div>';
996
- $onsubmit_js .= '
997
- if(!jQuery("#wdform_' . $id1 . '_element' . $form_id . '").is(":checked"))
998
- jQuery("<input type=\"hidden\" name=\"wdform_send_copy_' . $form_id . '\" value = \"1\" />").appendTo("#form' . $form_id . '");';
999
- if ($required) {
1000
- array_push($req_fields, $id1);
1001
- }
1002
- break;
1003
- }
1004
-
1005
- case 'type_text': {
1006
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique');
1007
- $temp = $params;
1008
- if (strpos($temp, 'w_regExp_status') > -1) {
1009
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique');
1010
- }
1011
- if (strpos($temp, 'w_readonly') > -1) {
1012
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique', 'w_readonly');
1013
- }
1014
- if (strpos($temp, 'w_hide_label') > -1) {
1015
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique', 'w_readonly');
1016
- }
1017
- foreach ($params_names as $params_name) {
1018
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1019
- $param[$params_name] = $temp[0];
1020
- $temp = $temp[1];
1021
- }
1022
- if ($temp) {
1023
- $temp = explode('*:*w_attr_name*:*', $temp);
1024
- $attrs = array_slice($temp, 0, count($temp) - 1);
1025
- foreach ($attrs as $attr) {
1026
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1027
- }
1028
- }
1029
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1030
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 50 : max($param['w_field_label_size'], $param['w_size']));
1031
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1032
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1033
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1034
- if ($param['w_hide_label'] == "yes") {
1035
- $param['w_field_label_pos1'] = "display:none;";
1036
- }
1037
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1038
- $required = ($param['w_required'] == "yes" ? true : false);
1039
- $param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no");
1040
- $readonly = (isset($param['w_readonly']) && $param['w_readonly'] == "yes" ? "readonly='readonly'" : '');
1041
- $symbol_begin_text = isset($symbol_begin[$id1]) ? $symbol_begin[$id1] : '';
1042
- $symbol_end_text = isset($symbol_end[$id1]) ? $symbol_end[$id1] : '';
1043
- $display_begin = $symbol_begin ? 'display:table-cell' : 'display:none;';
1044
- $display_end = $symbol_end != '' ? 'display:table-cell' : 'display:none;';
1045
- $input_width = $symbol_begin_text || $symbol_end_text ? '' : 'width:100%';
1046
- $check_regExp = '';
1047
- $rep = '<div type="type_text" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1048
- if ($required) {
1049
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1050
- }
1051
- $rep .= '</div><div class="wdform-element-section" style="' . $param['w_field_label_pos2'] . '; width:' . $param['w_size'] . 'px;">
1052
- <div style="display:table; width: 100%;">
1053
- <div style="display:table-row;">
1054
- <div style="' . $display_begin . ';"><span style="vertical-align:middle;">' . $symbol_begin_text . '</span></div>
1055
- <div style="display:table-cell;">
1056
- <input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" ' . $readonly . ' ' . $param['attributes'] . ' style="' . $input_width . '"></div><div style="' . $display_end . ';"><span style="vertical-align:middle;">' . $symbol_end_text . '</span></div>
1057
- </div>
1058
- </div>
1059
- </div></div>';
1060
- if ($required) {
1061
- array_push($req_fields, $id1);
1062
- }
1063
- if ($param['w_regExp_status'] == 'yes') {
1064
- $check_regExp_all[$id1] = array($param["w_regExp_value"], $param["w_regExp_arg"], $param["w_regExp_alert"]);
1065
- }
1066
- break;
1067
- }
1068
-
1069
- case 'type_number': {
1070
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1071
- $temp = $params;
1072
- foreach ($params_names as $params_name) {
1073
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1074
- $param[$params_name] = $temp[0];
1075
- $temp = $temp[1];
1076
- }
1077
- if ($temp) {
1078
- $temp = explode('*:*w_attr_name*:*', $temp);
1079
- $attrs = array_slice($temp, 0, count($temp) - 1);
1080
- foreach ($attrs as $attr) {
1081
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1082
- }
1083
- }
1084
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1085
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']));
1086
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1087
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1088
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1089
- $required = ($param['w_required'] == "yes" ? true : false);
1090
- $rep = '<div type="type_number" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" class="' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1091
- if ($required) {
1092
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1093
- }
1094
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" style="width: 100%;" ' . $param['attributes'] . '></div></div>';
1095
- if ($required) {
1096
- array_push($req_fields, $id1);
1097
- }
1098
- break;
1099
- }
1100
-
1101
- case 'type_password': {
1102
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_required', 'w_unique', 'w_class');
1103
- $temp = $params;
1104
- if (strpos($temp, 'w_hide_label') > -1) {
1105
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_required', 'w_unique', 'w_class');
1106
- }
1107
- if (strpos($temp, 'w_verification') > -1) {
1108
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_required', 'w_unique', 'w_class', 'w_verification', 'w_verification_label');
1109
- }
1110
- foreach ($params_names as $params_name) {
1111
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1112
- $param[$params_name] = $temp[0];
1113
- $temp = $temp[1];
1114
- }
1115
- if ($temp) {
1116
- $temp = explode('*:*w_attr_name*:*', $temp);
1117
- $attrs = array_slice($temp, 0, count($temp) - 1);
1118
- foreach ($attrs as $attr) {
1119
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1120
- }
1121
- }
1122
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']));
1123
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1124
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1125
- $required = ($param['w_required'] == "yes" ? true : false);
1126
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1127
- if ($param['w_hide_label'] == "yes") {
1128
- $param['w_field_label_pos1'] = "display:none;";
1129
- }
1130
- $rep = '<div type="type_password" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" class="' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1131
- if ($required) {
1132
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1133
- }
1134
- $message_confirm = addslashes(__("Password values don't match", "form_maker"));
1135
- $onchange = (isset($param['w_verification']) && $param['w_verification'] == "yes") ? ' onchange="wd_check_confirmation_pass(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')"' : "";
1136
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="password" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . $onchange . '></div></div>';
1137
- if (isset($param['w_verification']) && $param['w_verification'] == "yes") {
1138
- $rep .= '<div><div type="type_password_confirmation" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $param['w_verification_label'] . '</span>';
1139
- if ($required) {
1140
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1141
- }
1142
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="password" id="wdform_' . $id1 . '_1_element' . $form_id . '" name="wdform_' . $id1 . '_1_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . ' onchange="wd_check_confirmation_pass(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')"></div></div></div>';
1143
- }
1144
- if ($required) {
1145
- array_push($req_fields, $id1);
1146
- }
1147
- break;
1148
- }
1149
-
1150
- case 'type_textarea': {
1151
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size_w', 'w_size_h', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1152
- $temp = $params;
1153
- if (strpos($temp, 'w_hide_label') > -1) {
1154
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size_w', 'w_size_h', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1155
- }
1156
- foreach ($params_names as $params_name) {
1157
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1158
- $param[$params_name] = $temp[0];
1159
- $temp = $temp[1];
1160
- }
1161
- if ($temp) {
1162
- $temp = explode('*:*w_attr_name*:*', $temp);
1163
- $attrs = array_slice($temp, 0, count($temp) - 1);
1164
- foreach ($attrs as $attr) {
1165
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1166
- }
1167
- }
1168
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1169
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size_w'] + 10 : max($param['w_field_label_size'], $param['w_size_w']));
1170
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1171
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1172
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1173
- if ($param['w_hide_label'] == "yes") {
1174
- $param['w_field_label_pos1'] = "display:none;";
1175
- }
1176
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1177
- $required = ($param['w_required'] == "yes" ? true : false);
1178
- $rep = '<div type="type_textarea" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1179
- if ($required) {
1180
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1181
- }
1182
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size_w'] . 'px"><textarea class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" title="' . $param['w_title'] . '" style="width: 100%; height: ' . $param['w_size_h'] . 'px;" ' . $param['attributes'] . '>' . str_replace(array("\r\n", "\n\r", "\n", "\r"), "&#13;", $param['w_first_val']) . '</textarea></div></div>';
1183
- if ($required) {
1184
- array_push($req_fields, $id1);
1185
- }
1186
- break;
1187
- }
1188
-
1189
- case 'type_phone': {
1190
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_mini_labels', 'w_required', 'w_unique', 'w_class');
1191
- $temp = $params;
1192
- if (strpos($temp, 'w_hide_label') > -1) {
1193
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_mini_labels', 'w_required', 'w_unique', 'w_class');
1194
- }
1195
- foreach ($params_names as $params_name) {
1196
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1197
- $param[$params_name] = $temp[0];
1198
- $temp = $temp[1];
1199
- }
1200
- if ($temp) {
1201
- $temp = explode('*:*w_attr_name*:*', $temp);
1202
- $attrs = array_slice($temp, 0, count($temp) - 1);
1203
- foreach ($attrs as $attr) {
1204
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1205
- }
1206
- }
1207
- $w_first_val = explode('***', $param['w_first_val']);
1208
- $w_title = explode('***', $param['w_title']);
1209
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]);
1210
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size'] + 65) : max($param['w_field_label_size'], ($param['w_size'] + 65)));
1211
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1212
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1213
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1214
- if ($param['w_hide_label'] == "yes") {
1215
- $param['w_field_label_pos1'] = "display:none;";
1216
- }
1217
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1218
- $required = ($param['w_required'] == "yes" ? true : false);
1219
- $w_first_val = explode('***', $param['w_first_val']);
1220
- $w_title = explode('***', $param['w_title']);
1221
- $w_mini_labels = explode('***', $param['w_mini_labels']);
1222
- $rep = '<div type="type_phone" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label" >' . $label . '</span>';
1223
- if ($required) {
1224
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1225
- }
1226
- $rep .= '
1227
- </div>
1228
- <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_size'] + 65) . 'px;">
1229
- <div style="display: table-cell;">
1230
- <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width: 52px;" ' . $param['attributes'] . '></div>
1231
- <div><label class="mini_label">' . $w_mini_labels[0] . '</label></div>
1232
- </div>
1233
- <div style="display: table-cell;">
1234
- <div class="wdform_line" style="margin: 0px 4px 10px 4px; padding: 0px;">-</div>
1235
- </div>
1236
- <div style="display: table-cell; width:100%;">
1237
- <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;" ' . $param['attributes'] . '></div>
1238
- <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
1239
- </div>
1240
- </div>
1241
- </div>';
1242
- if ($required) {
1243
- array_push($req_fields, $id1);
1244
- }
1245
- break;
1246
- }
1247
-
1248
- case 'type_phone_new': {
1249
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_top_country', 'w_required', 'w_unique', 'w_class');
1250
- $temp = $params;
1251
- foreach ($params_names as $params_name) {
1252
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1253
- $param[$params_name] = $temp[0];
1254
- $temp = $temp[1];
1255
- }
1256
- if ($temp) {
1257
- $temp = explode('*:*w_attr_name*:*', $temp);
1258
- $attrs = array_slice($temp, 0, count($temp) - 1);
1259
- foreach ($attrs as $attr) {
1260
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1261
- }
1262
- }
1263
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1264
-
1265
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size'] + 10) : max($param['w_field_label_size'], ($param['w_size'])));
1266
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1267
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1268
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1269
- if ($param['w_hide_label'] == "yes") {
1270
- $param['w_field_label_pos1'] = "display:none;";
1271
- }
1272
-
1273
- $required = ($param['w_required'] == "yes" ? true : false);
1274
-
1275
- $rep = '<div type="type_phone_new" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label" >' . $label . '</span>';
1276
- if ($required) {
1277
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1278
- }
1279
- $rep .= '
1280
- </div>
1281
- <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;">
1282
- <input type="text" class="input_active" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" style="width: 100%;" placeholder="" ' . $param['attributes'] . '>
1283
- </div>
1284
- </div>';
1285
-
1286
- if ($required) {
1287
- array_push($req_fields, $id1);
1288
- }
1289
- $onload_js .= '
1290
-
1291
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").intlTelInput({
1292
- nationalMode: false,
1293
- preferredCountries: [ "' . $param["w_top_country"] . '" ],
1294
- customPlaceholder: "Phone",
1295
- });
1296
- ';
1297
- break;
1298
- }
1299
-
1300
- case 'type_name': {
1301
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
1302
- $temp = $params;
1303
- if (strpos($temp, 'w_name_fields') > -1) {
1304
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields');
1305
- }
1306
- if (strpos($temp, 'w_autofill') > -1) {
1307
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields', 'w_autofill');
1308
- }
1309
- if (strpos($temp, 'w_hide_label') > -1) {
1310
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields', 'w_autofill');
1311
- }
1312
- foreach ($params_names as $params_name) {
1313
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1314
- $param[$params_name] = $temp[0];
1315
- $temp = $temp[1];
1316
- }
1317
- if ($temp) {
1318
- $temp = explode('*:*w_attr_name*:*', $temp);
1319
- $attrs = array_slice($temp, 0, count($temp) - 1);
1320
- foreach ($attrs as $attr) {
1321
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1322
- }
1323
- }
1324
- $w_first_val = explode('***', $param['w_first_val']);
1325
- $w_title = explode('***', $param['w_title']);
1326
- $w_mini_labels = explode('***', $param['w_mini_labels']);
1327
- $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
1328
- $w_name_fields = explode('***', $param['w_name_fields']);
1329
- $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
1330
- $element_title = isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_title' . $form_id])) : NULL;
1331
- $element_middle = isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_middle' . $form_id])) : NULL;
1332
- $element_first = isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : NULL;
1333
- if (isset($element_title) || isset($element_middle)) {
1334
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_title' . $form_id])) : $w_first_val[2]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_middle' . $form_id])) : $w_first_val[3]);
1335
- }
1336
- else {
1337
- if (isset($element_first)) {
1338
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]);
1339
- }
1340
- }
1341
- $w_first_val = explode('***', $param['w_first_val']);
1342
- $required = ($param['w_required'] == "yes" ? true : false);
1343
- if ($param['w_autofill'] == 'yes' && $wp_username) {
1344
- $user_display_name = explode(' ', $wp_username);
1345
- $w_first_val[0] = $user_display_name[0];
1346
- $w_first_val[1] = isset($user_display_name[1]) ? $user_display_name[1] : $w_first_val[1];
1347
- }
1348
- if ($w_name_fields[0] == 'no' && $w_name_fields[1] == 'no') {
1349
- $w_name_format = '
1350
- <div style="display: table-cell; width:50%">
1351
- <div><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width: 100%;"' . $param['attributes'] . '></div>
1352
- <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
1353
- </div>
1354
- <div style="display:table-cell;"><div style="margin: 0px 8px; padding: 0px;"></div></div>
1355
- <div style="display: table-cell; width:50%">
1356
- <div><input type="text" class="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;" ' . $param['attributes'] . '></div>
1357
- <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
1358
- </div>
1359
- ';
1360
- $w_size = 2 * $param['w_size'];
1361
- }
1362
- else {
1363
- $first_last_size = $w_name_fields[0] == 'yes' && $w_name_fields[1] == 'no' ? 45 : 30;
1364
- $w_name_format = '
1365
- <div style="display: table-cell; width:' . $first_last_size . '%">
1366
- <div><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width:100%;"></div>
1367
- <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
1368
- </div>
1369
- <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1370
- <div style="display: table-cell; width:' . $first_last_size . '%">
1371
- <div><input type="text" class="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;"></div>
1372
- <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
1373
- </div>';
1374
- $w_size = 2 * $param['w_size'];
1375
- if ($w_name_fields[0] == 'yes') {
1376
- $w_name_format = '
1377
- <div style="display: table-cell;">
1378
- <div><input type="text" class="' . ($w_first_val[2] == $w_title[2] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_title' . $form_id . '" name="wdform_' . $id1 . '_element_title' . $form_id . '" value="' . $w_first_val[2] . '" title="' . $w_title[2] . '" style="width: 40px;"></div>
1379
- <div><label class="mini_label">' . $w_mini_labels[0] . '</label></div>
1380
- </div>
1381
- <div style="display:table-cell;"><div style="margin: 0px 1px; padding: 0px;"></div></div>' . $w_name_format;
1382
- $w_size += 80;
1383
- }
1384
- if ($w_name_fields[1] == 'yes') {
1385
- $w_name_format = $w_name_format . '
1386
- <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1387
- <div style="display: table-cell; width:30%">
1388
- <div><input type="text" class="' . ($w_first_val[3] == $w_title[3] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_middle' . $form_id . '" name="wdform_' . $id1 . '_element_middle' . $form_id . '" value="' . $w_first_val[3] . '" title="' . $w_title[3] . '" style="width: 100%;"></div>
1389
- <div><label class="mini_label">' . $w_mini_labels[3] . '</label></div>
1390
- </div>
1391
- ';
1392
- $w_size += $param['w_size'];
1393
- }
1394
- }
1395
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $w_size) : max($param['w_field_label_size'], $w_size));
1396
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1397
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1398
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1399
- if ($param['w_hide_label'] == "yes") {
1400
- $param['w_field_label_pos1'] = "display:none;";
1401
- }
1402
- $rep = '<div type="type_name" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1403
- if ($required) {
1404
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1405
- }
1406
- $rep .= '</div>
1407
- <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $w_size . 'px;">' . $w_name_format . '</div></div>';
1408
- if ($required) {
1409
- array_push($req_fields, $id1);
1410
- }
1411
- break;
1412
- }
1413
-
1414
- case 'type_address': {
1415
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
1416
- $temp = $params;
1417
- if (strpos($temp, 'w_hide_label') > -1) {
1418
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
1419
- }
1420
- foreach ($params_names as $params_name) {
1421
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1422
- $param[$params_name] = $temp[0];
1423
- $temp = $temp[1];
1424
- }
1425
- if ($temp) {
1426
- $temp = explode('*:*w_attr_name*:*', $temp);
1427
- $attrs = array_slice($temp, 0, count($temp) - 1);
1428
- foreach ($attrs as $attr) {
1429
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1430
- }
1431
- }
1432
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1433
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1434
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1435
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1436
- if ($param['w_hide_label'] == "yes") {
1437
- $param['w_field_label_pos1'] = "display:none;";
1438
- }
1439
- $required = ($param['w_required'] == "yes" ? true : false);
1440
- $w_mini_labels = explode('***', $param['w_mini_labels']);
1441
- $w_disabled_fields = explode('***', $param['w_disabled_fields']);
1442
- $rep = '<div type="type_address" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1443
- if ($required) {
1444
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1445
- }
1446
- $address_fields = '';
1447
- $g = 0;
1448
- if (isset($w_disabled_fields[0]) && $w_disabled_fields[0] == 'no') {
1449
- $g += 2;
1450
- $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_' . $id1 . '_street1' . $form_id . '" name="wdform_' . $id1 . '_street1' . $form_id . '" value="' . (isset($_POST['wdform_' . $id1 . '_street1' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_street1' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[0] . '</label></span>';
1451
- }
1452
- if (isset($w_disabled_fields[1]) && $w_disabled_fields[1] == 'no') {
1453
- $g += 2;
1454
- $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_' . $id1 . '_street2' . $form_id . '" name="wdform_' . ($id1 + 1) . '_street2' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 1) . '_street2' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 1) . '_street2' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[1] . '</label></span>';
1455
- }
1456
- if (isset($w_disabled_fields[2]) && $w_disabled_fields[2] == 'no') {
1457
- $g++;
1458
- $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_city' . $form_id . '" name="wdform_' . ($id1 + 2) . '_city' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 2) . '_city' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 2) . '_city' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[2] . '</label></span>';
1459
- }
1460
- if (isset($w_disabled_fields[3]) && $w_disabled_fields[3] == 'no') {
1461
- $g++;
1462
- $w_states = array("", "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District Of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
1463
- $w_state_options = '';
1464
- $post_state = isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "";
1465
- foreach ($w_states as $w_state) {
1466
- if ($w_state == $post_state) {
1467
- $selected = 'selected="selected"';
1468
- }
1469
- else {
1470
- $selected = '';
1471
- }
1472
- $w_state_options .= '<option value="' . $w_state . '" ' . $selected . '>' . $w_state . '</option>';
1473
- }
1474
- if (isset($w_disabled_fields[5]) && $w_disabled_fields[5] == 'yes' && isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes') {
1475
- $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><select type="text" id="wdform_' . $id1 . '_state' . $form_id . '" name="wdform_' . ($id1 + 3) . '_state' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '>' . $w_state_options . '</select><label class="mini_label" style="display: block;" id="' . $id1 . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
1476
- }
1477
- else {
1478
- $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_state' . $form_id . '" name="wdform_' . ($id1 + 3) . '_state' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[3] . '</label></span>';
1479
- }
1480
- }
1481
- if (isset($w_disabled_fields[4]) && $w_disabled_fields[4] == 'no') {
1482
- $g++;
1483
- $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_postal' . $form_id . '" name="wdform_' . ($id1 + 4) . '_postal' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 4) . '_postal' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 4) . '_postal' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[4] . '</label></span>';
1484
- }
1485
- $w_countries = array("", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe");
1486
- $w_options = '';
1487
- $post_country = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id])) : "";
1488
- foreach ($w_countries as $w_country) {
1489
- if ($w_country == $post_country) {
1490
- $selected = 'selected="selected"';
1491
- }
1492
- else {
1493
- $selected = '';
1494
- }
1495
- $w_options .= '<option value="' . $w_country . '" ' . $selected . '>' . $w_country . '</option>';
1496
- }
1497
- if (isset($w_disabled_fields[5]) && $w_disabled_fields[5] == 'no') {
1498
- $g++;
1499
- $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;display: inline-block;"><select type="text" id="wdform_' . $id1 . '_country' . $form_id . '" name="wdform_' . ($id1 + 5) . '_country' . $form_id . '" style="width:100%" ' . $param['attributes'] . '>' . $w_options . '</select><label class="mini_label">' . $w_mini_labels[5] . '</label></span>';
1500
- }
1501
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><div>
1502
- ' . $address_fields . '</div><div style="clear:both;"></div></div></div>';
1503
- if ($required) {
1504
- array_push($req_fields, $id1);
1505
- }
1506
- $post = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id])) : NULL;
1507
- if (isset($post)) {
1508
- $onload_js .= ' jQuery("#wdform_' . $id1 . '_country' . $form_id . '").val("' . (isset($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id])) : '') . '");';
1509
- }
1510
- if (isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes') {
1511
- $onload_js .= ' jQuery("#wdform_' . $id1 . '_country' . $form_id . '").change(function() {
1512
- if( jQuery(this).val()=="United States")
1513
- {
1514
- jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<select type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" style=\"width: 100%;\" ' . $param['attributes'] . '>' . addslashes($w_state_options) . '</select><label class=\"mini_label\" id=\"' . $id1 . '_mini_label_state\">' . $w_mini_labels[3] . '</label>");
1515
- jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("input:first, label:first").remove();
1516
- }
1517
- else
1518
- {
1519
- if(jQuery("#wdform_' . $id1 . '_state' . $form_id . '").prop("tagName")=="SELECT")
1520
- {
1521
- jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<input type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" value=\"' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "") . '\" style=\"width: 100%;\" ' . $param['attributes'] . '><label class=\"mini_label\">' . $w_mini_labels[3] . '</label>");
1522
- jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("select:first, label:first").remove();
1523
- }
1524
- }
1525
- });';
1526
- }
1527
- break;
1528
- }
1529
-
1530
- case 'type_submitter_mail': {
1531
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1532
- $temp = $params;
1533
- if (strpos($temp, 'w_autofill') > -1) {
1534
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class', 'w_autofill');
1535
- }
1536
- if (strpos($temp, 'w_hide_label') > -1) {
1537
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class', 'w_autofill');
1538
- }
1539
- if (strpos($temp, 'w_verification') > -1) {
1540
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class', 'w_verification', 'w_verification_label', 'w_verification_placeholder', 'w_autofill');
1541
- }
1542
- foreach ($params_names as $params_name) {
1543
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1544
- $param[$params_name] = $temp[0];
1545
- $temp = $temp[1];
1546
- }
1547
- if ($temp) {
1548
- $temp = explode('*:*w_attr_name*:*', $temp);
1549
- $attrs = array_slice($temp, 0, count($temp) - 1);
1550
- foreach ($attrs as $attr) {
1551
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1552
- }
1553
- }
1554
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1555
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1556
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1557
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1558
- if ($param['w_hide_label'] == "yes") {
1559
- $param['w_field_label_pos1'] = "display:none;";
1560
- }
1561
- $required = ($param['w_required'] == "yes" ? true : false);
1562
- $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
1563
- if ($param['w_autofill'] == 'yes' && $wp_useremail) {
1564
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $wp_useremail);
1565
- $input_active = "input_active";
1566
- }
1567
- else {
1568
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1569
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1570
- }
1571
- $rep = '<div type="type_submitter_mail" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1572
- if ($required) {
1573
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1574
- }
1575
- $message_confirm = addslashes(__("The email addresses don't match", "form_maker"));
1576
- $message_check_email = addslashes(__('This is not a valid email address.', 'form_maker'));
1577
- $onchange = (isset($param['w_verification']) && $param['w_verification'] == "yes") ? '; wd_check_confirmation_email(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')' : '';
1578
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" style="width: 100%;" ' . $param['attributes'] . ' onchange="wd_check_email(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_check_email . '\', \'' . $message_confirm . '\')' . $onchange . '"></div></div>';
1579
- if (isset($param['w_verification']) && $param['w_verification'] == "yes") {
1580
- $param['w_verification_placeholder'] = (isset($_POST['wdform_' . $id1 . '_1_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_1_element' . $form_id])) : $param['w_verification_placeholder']);
1581
- $rep .= '<div><div type="type_submitter_mail_confirmation" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $param['w_verification_label'] . '</span>';
1582
- if ($required) {
1583
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1584
- }
1585
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_1_element' . $form_id . '" name="wdform_' . $id1 . '_1_element' . $form_id . '" value="' . $param['w_verification_placeholder'] . '" title="' . $param['w_verification_placeholder'] . '" style="width: 100%;" ' . $param['attributes'] . 'onchange="wd_check_confirmation_email(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')"></div></div></div>';
1586
- }
1587
- if ($required) {
1588
- array_push($req_fields, $id1);
1589
- }
1590
- break;
1591
- }
1592
-
1593
- case 'type_checkbox': {
1594
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
1595
- $temp = $params;
1596
- if (strpos($temp, 'w_field_option_pos') > -1) {
1597
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1598
- }
1599
- if (strpos($temp, 'w_hide_label') > -1) {
1600
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1601
- }
1602
- foreach ($params_names as $params_name) {
1603
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1604
- $param[$params_name] = $temp[0];
1605
- $temp = $temp[1];
1606
- }
1607
- if ($temp) {
1608
- $temp = explode('*:*w_attr_name*:*', $temp);
1609
- $attrs = array_slice($temp, 0, count($temp) - 1);
1610
- foreach ($attrs as $attr) {
1611
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1612
- }
1613
- }
1614
- if (!isset($param['w_value_disabled'])) {
1615
- $param['w_value_disabled'] = 'no';
1616
- }
1617
- if (!isset($param['w_field_option_pos'])) {
1618
- $param['w_field_option_pos'] = 'left';
1619
- }
1620
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1621
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1622
- $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none !important;'" : "");
1623
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1624
- if ($param['w_hide_label'] == "yes") {
1625
- $param['w_field_label_pos1'] = "display:none;";
1626
- }
1627
- $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
1628
- $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "");
1629
- $required = ($param['w_required'] == "yes" ? true : false);
1630
- $param['w_choices'] = explode('***', $param['w_choices']);
1631
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1632
- if (isset($param['w_choices_value'])) {
1633
- $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1634
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1635
- }
1636
- $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1637
- $is_other = false;
1638
- if (isset($post_value)) {
1639
- if ($param['w_allow_other'] == "yes") {
1640
- $is_other = FALSE;
1641
- $other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html($_POST['wdform_' . $id1 . "_other_input" . $form_id]) : NULL;
1642
- if (isset($other_element)) {
1643
- $is_other = TRUE;
1644
- }
1645
- }
1646
- }
1647
- else {
1648
- $is_other = ($param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true');
1649
- }
1650
- $rep = '<div type="type_checkbox" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1651
- if ($required) {
1652
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1653
- }
1654
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
1655
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1656
- $total_queries = 0;
1657
- foreach ($param['w_choices'] as $key => $choice) {
1658
- $key1 = $key + $total_queries;
1659
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
1660
- $choices_labels = array();
1661
- $choices_values = array();
1662
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1663
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
1664
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1665
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
1666
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
1667
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
1668
- $table = $label_table_and_column[0];
1669
- $label_column = $label_table_and_column[1];
1670
- if ($label_column) {
1671
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1672
- }
1673
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
1674
- $value_column = $value_table_and_column[1];
1675
- if ($value_column) {
1676
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1677
- }
1678
- $columns_count_checkbox = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
1679
- if (array_filter($choices_labels) || array_filter($choices_values)) {
1680
- $total_queries = $total_queries + $columns_count_checkbox - 1;
1681
- if (!isset($post_value)) {
1682
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1683
- }
1684
- for ($k = 0; $k < $columns_count_checkbox; $k++) {
1685
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1686
- $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
1687
- if (($key1 + $k) % $param['w_rowcol'] == 0 && ($key1 + $k) > 0) {
1688
- $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1689
- }
1690
- if (isset($post_value)) {
1691
- $post_valuetemp = $_POST['wdform_' . $id1 . "_element" . $form_id . ($key1 + $k)];
1692
- $param['w_choices_checked'][$key] = (isset($post_valuetemp) ? 'checked="checked"' : '');
1693
- }
1694
- $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="checkbox-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="checkbox" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" value="' . htmlspecialchars($choice_value[0]) . '" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . ($key1 + $k) . '&quot;,&quot;' . $form_id . '&quot;)) show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);"' : '') . ' ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label[0] . '</label></div></div>';
1695
- }
1696
- }
1697
- }
1698
- else {
1699
- if ($key1 % $param['w_rowcol'] == 0 && $key1 > 0) {
1700
- $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1701
- }
1702
- if (!isset($post_value)) {
1703
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1704
- }
1705
- else {
1706
- $post_valuetemp = isset($_POST['wdform_' . $id1 . "_element" . $form_id . $key]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . $key])) : NULL;
1707
- $param['w_choices_checked'][$key] = (isset($post_valuetemp) ? 'checked="checked"' : '');
1708
- }
1709
- $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
1710
- $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="checkbox-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="checkbox" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" value="' . htmlspecialchars($choice_value) . '" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key1 . '&quot;,&quot;' . $form_id . '&quot;)) show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);"' : '') . ' ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div></div>';
1711
- $param['w_allow_other_num'] = $param['w_allow_other_num'] == $key ? $key1 : $param['w_allow_other_num'];
1712
- }
1713
- }
1714
- $rep .= '</div>';
1715
- $rep .= '</div></div>';
1716
- if ($required) {
1717
- array_push($req_fields, $id1);
1718
- }
1719
- if ($is_other) {
1720
- $onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");';
1721
- }
1722
- if ($param['w_randomize'] == 'yes') {
1723
- $onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();
1724
- ';
1725
- }
1726
- $onsubmit_js .= '
1727
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other' . $form_id . '\" value = \"' . $param['w_allow_other'] . '\" />").appendTo("#form' . $form_id . '");
1728
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\" value = \"' . $param['w_allow_other_num'] . '\" />").appendTo("#form' . $form_id . '");
1729
- ';
1730
- break;
1731
- }
1732
-
1733
- case 'type_radio': {
1734
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
1735
- $temp = $params;
1736
- if (strpos($temp, 'w_field_option_pos') > -1) {
1737
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1738
- }
1739
- if (strpos($temp, 'w_hide_label') > -1) {
1740
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1741
- }
1742
- foreach ($params_names as $params_name) {
1743
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1744
- $param[$params_name] = $temp[0];
1745
- $temp = $temp[1];
1746
- }
1747
- if ($temp) {
1748
- $temp = explode('*:*w_attr_name*:*', $temp);
1749
- $attrs = array_slice($temp, 0, count($temp) - 1);
1750
- foreach ($attrs as $attr) {
1751
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1752
- }
1753
- }
1754
- if (!isset($param['w_value_disabled'])) {
1755
- $param['w_value_disabled'] = 'no';
1756
- }
1757
- if (!isset($param['w_field_option_pos'])) {
1758
- $param['w_field_option_pos'] = 'left';
1759
- }
1760
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1761
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1762
- $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none !important;'" : "");
1763
- $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "");
1764
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1765
- if ($param['w_hide_label'] == "yes") {
1766
- $param['w_field_label_pos1'] = "display:none;";
1767
- }
1768
- $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
1769
- $required = ($param['w_required'] == "yes" ? true : false);
1770
- $param['w_choices'] = explode('***', $param['w_choices']);
1771
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1772
- if (isset($param['w_choices_value'])) {
1773
- $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1774
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1775
- }
1776
- $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1777
- $is_other = false;
1778
- if (isset($post_value)) {
1779
- if ($param['w_allow_other'] == "yes") {
1780
- $is_other = false;
1781
- $other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : null;
1782
- if (isset($other_element)) {
1783
- $is_other = true;
1784
- }
1785
- }
1786
- }
1787
- else {
1788
- $is_other = ($param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true');
1789
- }
1790
- $rep = '<div type="type_radio" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1791
- if ($required) {
1792
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1793
- }
1794
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
1795
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1796
- $total_queries = 0;
1797
- foreach ($param['w_choices'] as $key => $choice) {
1798
- $key1 = $key + $total_queries;
1799
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
1800
- $choices_labels = array();
1801
- $choices_values = array();
1802
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1803
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
1804
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1805
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
1806
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
1807
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
1808
- $table = $label_table_and_column[0];
1809
- $label_column = $label_table_and_column[1];
1810
- if ($label_column) {
1811
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1812
- }
1813
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
1814
- $value_column = $value_table_and_column[1];
1815
- if ($value_column) {
1816
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1817
- }
1818
- $columns_count_radio = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
1819
- if (array_filter($choices_labels) || array_filter($choices_values)) {
1820
- $total_queries = $total_queries + $columns_count_radio - 1;
1821
- if (!isset($post_value)) {
1822
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1823
- }
1824
- for ($k = 0; $k < $columns_count_radio; $k++) {
1825
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1826
- $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
1827
- if (($key1 + $k) % $param['w_rowcol'] == 0 && ($key1 + $k) > 0) {
1828
- $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1829
- }
1830
- if (isset($post_value)) {
1831
- $post_valuetemp = $_POST['wdform_' . $id1 . "_element" . $form_id];
1832
- $param['w_choices_checked'][$key] = (isset($post_valuetemp) ? 'checked="checked"' : '');
1833
- }
1834
- $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice_value[0]) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . ($key1 + $k) . '&quot;,&quot;' . $form_id . '&quot;); ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);' : '') . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label[0] . '</label></div></div>';
1835
- }
1836
- }
1837
- }
1838
- else {
1839
- if ($key1 % $param['w_rowcol'] == 0 && $key1 > 0) {
1840
- $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1841
- }
1842
- if (!isset($post_value)) {
1843
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1844
- }
1845
- else {
1846
- $param['w_choices_checked'][$key] = (htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : "") ? 'checked="checked"' : '');
1847
- }
1848
- $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
1849
- $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice_value) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key1 . '&quot;,&quot;' . $form_id . '&quot;); ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);' : '') . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div></div>';
1850
- $param['w_allow_other_num'] = $param['w_allow_other_num'] == $key ? $key1 : $param['w_allow_other_num'];
1851
- }
1852
- }
1853
- $rep .= '</div>';
1854
- $rep .= '</div></div>';
1855
- if ($required) {
1856
- array_push($req_fields, $id1);
1857
- }
1858
- if ($is_other) {
1859
- $onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");';
1860
- }
1861
- if ($param['w_randomize'] == 'yes') {
1862
- $onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();
1863
- ';
1864
- }
1865
- $onsubmit_js .= '
1866
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other' . $form_id . '\" value = \"' . $param['w_allow_other'] . '\" />").appendTo("#form' . $form_id . '");
1867
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\" value = \"' . $param['w_allow_other_num'] . '\" />").appendTo("#form' . $form_id . '");
1868
- ';
1869
- break;
1870
- }
1871
-
1872
- case 'type_own_select': {
1873
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_class');
1874
- $temp = $params;
1875
- if (strpos($temp, 'w_choices_value') > -1) {
1876
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1877
- }
1878
- if (strpos($temp, 'w_hide_label') > -1) {
1879
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1880
- }
1881
- foreach ($params_names as $params_name) {
1882
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1883
- $param[$params_name] = $temp[0];
1884
- $temp = $temp[1];
1885
- }
1886
- if ($temp) {
1887
- $temp = explode('*:*w_attr_name*:*', $temp);
1888
- $attrs = array_slice($temp, 0, count($temp) - 1);
1889
- foreach ($attrs as $attr) {
1890
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1891
- }
1892
- }
1893
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1894
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1895
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1896
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1897
- if ($param['w_hide_label'] == "yes") {
1898
- $param['w_field_label_pos1'] = "display:none;";
1899
- }
1900
- $required = ($param['w_required'] == "yes" ? true : false);
1901
- $param['w_choices'] = explode('***', $param['w_choices']);
1902
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1903
- $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
1904
- if (isset($param['w_choices_value'])) {
1905
- $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1906
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1907
- }
1908
- if (!isset($param['w_value_disabled'])) {
1909
- $param['w_value_disabled'] = 'no';
1910
- }
1911
- $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1912
- $rep = '<div type="type_own_select" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1913
- if ($required) {
1914
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1915
- }
1916
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_size']) . 'px; "><select id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%" ' . $param['attributes'] . '>';
1917
- foreach ($param['w_choices'] as $key => $choice) {
1918
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
1919
- $choices_labels = array();
1920
- $choices_values = array();
1921
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1922
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
1923
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1924
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
1925
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
1926
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
1927
- $table = $label_table_and_column[0];
1928
- $label_column = $label_table_and_column[1];
1929
- if ($label_column) {
1930
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1931
- }
1932
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
1933
- $value_column = $param['w_choices_disabled'][$key] == "true" ? '' : $value_table_and_column[1];
1934
- if ($value_column) {
1935
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1936
- }
1937
- $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
1938
- if (array_filter($choices_labels) || array_filter($choices_values)) {
1939
- for ($k = 0; $k < $columns_count; $k++) {
1940
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1941
- $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : ($param['w_choices_disabled'][$key] == "true" ? '' : $choice_label);
1942
- if (!isset($post_value)) {
1943
- $param['w_choices_checked'][$key] = (($param['w_choices_checked'][$key] == 'true' && $k == 0) ? 'selected="selected"' : '');
1944
- }
1945
- else {
1946
- $param['w_choices_checked'][$key] = ($choice_value == htmlspecialchars($_POST['wdform_' . $id1 . "_element" . $form_id]) ? 'selected="selected"' : '');
1947
- }
1948
- $rep .= '<option value="' . htmlspecialchars($choice_value[0]) . '" ' . $param['w_choices_checked'][$key] . '>' . $choice_label[0] . '</option>';
1949
- }
1950
- }
1951
- }
1952
- else {
1953
- if (!isset($post_value)) {
1954
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'selected="selected"' : '');
1955
- }
1956
- else {
1957
- $param['w_choices_checked'][$key] = (htmlspecialchars($choice) == htmlspecialchars($_POST['wdform_' . $id1 . "_element" . $form_id]) ? 'selected="selected"' : '');
1958
- }
1959
- $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
1960
- $rep .= '<option value="' . htmlspecialchars($choice_value) . '" ' . $param['w_choices_checked'][$key] . '>' . $choice . '</option>';
1961
- }
1962
- }
1963
- $rep .= '</select></div></div>';
1964
- if ($required) {
1965
- array_push($req_fields, $id1);
1966
- }
1967
- break;
1968
- }
1969
-
1970
- case 'type_country': {
1971
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_countries', 'w_required', 'w_class');
1972
- $temp = $params;
1973
- if (strpos($temp, 'w_hide_label') > -1) {
1974
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_countries', 'w_required', 'w_class');
1975
- }
1976
- foreach ($params_names as $params_name) {
1977
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1978
- $param[$params_name] = $temp[0];
1979
- $temp = $temp[1];
1980
- }
1981
- if ($temp) {
1982
- $temp = explode('*:*w_attr_name*:*', $temp);
1983
- $attrs = array_slice($temp, 0, count($temp) - 1);
1984
- foreach ($attrs as $attr) {
1985
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
1986
- }
1987
- }
1988
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1989
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1990
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1991
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1992
- if ($param['w_hide_label'] == "yes") {
1993
- $param['w_field_label_pos1'] = "display:none;";
1994
- }
1995
- $required = ($param['w_required'] == "yes" ? true : false);
1996
- $param['w_countries'] = explode('***', $param['w_countries']);
1997
- $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1998
- $selected = '';
1999
- $rep = '<div type="type_country" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2000
- if ($required) {
2001
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2002
- }
2003
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><select id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '>';
2004
- foreach ($param['w_countries'] as $key => $choice) {
2005
- if (isset($post_value)) {
2006
- $selected = (htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : "") ? 'selected="selected"' : '');
2007
- }
2008
- $choice_value = $choice;
2009
- $rep .= '<option value="' . $choice_value . '" ' . $selected . '>' . $choice . '</option>';
2010
- }
2011
- $rep .= '</select></div></div>';
2012
- if ($required) {
2013
- array_push($req_fields, $id1);
2014
- }
2015
- break;
2016
- }
2017
-
2018
- case 'type_time': {
2019
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_time_type', 'w_am_pm', 'w_sec', 'w_hh', 'w_mm', 'w_ss', 'w_mini_labels', 'w_required', 'w_class');
2020
- $temp = $params;
2021
- if (strpos($temp, 'w_hide_label') > -1) {
2022
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_time_type', 'w_am_pm', 'w_sec', 'w_hh', 'w_mm', 'w_ss', 'w_mini_labels', 'w_required', 'w_class');
2023
- }
2024
- foreach ($params_names as $params_name) {
2025
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2026
- $param[$params_name] = $temp[0];
2027
- $temp = $temp[1];
2028
- }
2029
- if ($temp) {
2030
- $temp = explode('*:*w_attr_name*:*', $temp);
2031
- $attrs = array_slice($temp, 0, count($temp) - 1);
2032
- foreach ($attrs as $attr) {
2033
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2034
- }
2035
- }
2036
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2037
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2038
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2039
- if ($param['w_hide_label'] == "yes") {
2040
- $param['w_field_label_pos1'] = "display:none;";
2041
- }
2042
- $required = ($param['w_required'] == "yes" ? true : false);
2043
- $w_mini_labels = explode('***', $param['w_mini_labels']);
2044
- $w_sec = '';
2045
- $w_sec_label = '';
2046
- if ($param['w_sec'] == '1') {
2047
- $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_ss" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_ss" . $form_id])) : $param['w_ss']) . '" class="time_box" id="wdform_' . $id1 . '_ss' . $form_id . '" name="wdform_' . $id1 . '_ss' . $form_id . '" onkeypress="return check_second(event, &quot;wdform_' . $id1 . '_ss' . $form_id . '&quot;)" ' . $param['attributes'] . '></div>';
2048
- $w_sec_label = '<div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[2] . '</label></div>';
2049
- }
2050
- if ($param['w_time_type'] == '12') {
2051
- if ((isset($_POST['wdform_' . $id1 . "_am_pm" . $form_id]) ? esc_html($_POST['wdform_' . $id1 . "_am_pm" . $form_id]) : $param['w_am_pm']) == 'am') {
2052
- $am_ = "selected=\"selected\"";
2053
- $pm_ = "";
2054
- }
2055
- else {
2056
- $am_ = "";
2057
- $pm_ = "selected=\"selected\"";
2058
- }
2059
- $w_time_type = '<div style="display: table-cell;"><select class="am_pm_select" name="wdform_' . $id1 . '_am_pm' . $form_id . '" id="wdform_' . $id1 . '_am_pm' . $form_id . '" ' . $param['attributes'] . '><option value="am" ' . $am_ . '>AM</option><option value="pm" ' . $pm_ . '>PM</option></select></div>';
2060
- $w_time_type_label = '<div ><label class="mini_label">' . $w_mini_labels[3] . '</label></div>';
2061
- }
2062
- else {
2063
- $w_time_type = '';
2064
- $w_time_type_label = '';
2065
- }
2066
- $rep = '<div type="type_time" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2067
- if ($required) {
2068
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2069
- }
2070
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_hh" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_hh" . $form_id])) : $param['w_hh']) . '" class="time_box" id="wdform_' . $id1 . '_hh' . $form_id . '" name="wdform_' . $id1 . '_hh' . $form_id . '" onkeypress="return check_hour(event, &quot;wdform_' . $id1 . '_hh' . $form_id . '&quot;, &quot;23&quot;)" ' . $param['attributes'] . '></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_mm" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_mm" . $form_id])) : $param['w_mm']) . '" class="time_box" id="wdform_' . $id1 . '_mm' . $form_id . '" name="wdform_' . $id1 . '_mm' . $form_id . '" onkeypress="return check_minute(event, &quot;wdform_' . $id1 . '_mm' . $form_id . '&quot;)" ' . $param['attributes'] . '></div>' . $w_sec . $w_time_type . '</div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[0] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[1] . '</label></div>' . $w_sec_label . $w_time_type_label . '</div></div></div></div>';
2071
- if ($required) {
2072
- array_push($req_fields, $id1);
2073
- }
2074
- break;
2075
- }
2076
-
2077
- case 'type_date': {
2078
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_date', 'w_required', 'w_class', 'w_format', 'w_but_val');
2079
- $temp = $params;
2080
- if (strpos($temp, 'w_disable_past_days') > -1) {
2081
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_date', 'w_required', 'w_class', 'w_format', 'w_but_val', 'w_disable_past_days');
2082
- }
2083
- foreach ($params_names as $params_name) {
2084
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2085
- $param[$params_name] = $temp[0];
2086
- $temp = $temp[1];
2087
- }
2088
- if ($temp) {
2089
- $temp = explode('*:*w_attr_name*:*', $temp);
2090
- $attrs = array_slice($temp, 0, count($temp) - 1);
2091
- foreach ($attrs as $attr) {
2092
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2093
- }
2094
- }
2095
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2096
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2097
- $required = ($param['w_required'] == "yes" ? true : false);
2098
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
2099
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
2100
- $param['w_date'] = (isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : $param['w_date']);
2101
- $rep = '<div type="type_date" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2102
- if ($required) {
2103
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2104
- }
2105
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><input type="text" value="' . $param['w_date'] . '" class="wdform-date" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" maxlength="10" ' . $param['attributes'] . '><input id="wdform_' . $id1 . '_button' . $form_id . '" class="wdform-calendar-button" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" onclick="return showCalendar(\'wdform_' . $id1 . '_element' . $form_id . '\' , \'' . $param['w_format'] . '\', ' . $disable_past_days . ')" ' . $param['attributes'] . ' ></div></div>';
2106
- if ($required) {
2107
- array_push($req_fields, $id1);
2108
- }
2109
- if ($disable_past_days == 'true') {
2110
- $check_js .= '
2111
- var currentDate = new Date();
2112
- if( Date.parse(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val() + " 23:59:59") < currentDate.getTime() ) {
2113
- alert("' . __('You cannot select former dates. Choose a date starting from the current one.', 'form_maker') . '");
2114
- return false;
2115
- }
2116
- ';
2117
- }
2118
- $date_format = str_replace('%', '', $param['w_format']);
2119
- $onsubmit_js .= '
2120
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_date_format' . $form_id . '\" value = \"' . $date_format . '\" />").appendTo("#form' . $form_id . '");';
2121
- break;
2122
- }
2123
-
2124
- case 'type_date_new': {
2125
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2126
- $temp = $params;
2127
- if (strpos($temp, 'w_hide_label') > -1) {
2128
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2129
- }
2130
- foreach ($params_names as $params_name) {
2131
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2132
- $param[$params_name] = $temp[0];
2133
- $temp = $temp[1];
2134
- }
2135
- if ($temp) {
2136
- $temp = explode('*:*w_attr_name*:*', $temp);
2137
- $attrs = array_slice($temp, 0, count($temp) - 1);
2138
- foreach ($attrs as $attr) {
2139
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2140
- }
2141
- }
2142
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2143
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2144
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2145
- if ($param['w_hide_label'] == "yes") {
2146
- $param['w_field_label_pos1'] = "display:none;";
2147
- }
2148
- $required = ($param['w_required'] == "yes" ? true : false);
2149
- $show_image = ($param['w_show_image'] == "yes" ? "inline-block" : "none");
2150
- $div_size = ($show_image == "inline-block" ? $param['w_size'] + 22 : $param['w_size']);
2151
- $input_size = ($show_image == "inline-block" ? "calc(100% - 22px)" : "100%");
2152
- $default_date = (isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : $param['w_default_date']);
2153
- $w_show_week_days = explode('***', $param['w_show_days']);
2154
- $w_hide_sunday = $w_show_week_days[0] == 'yes' ? '' : ' && day != 0';
2155
- $w_hide_monday = $w_show_week_days[1] == 'yes' ? '' : ' && day != 1';
2156
- $w_hide_tuesday = $w_show_week_days[2] == 'yes' ? '' : ' && day != 2';
2157
- $w_hide_wednesday = $w_show_week_days[3] == 'yes' ? '' : ' && day != 3';
2158
- $w_hide_thursday = $w_show_week_days[4] == 'yes' ? '' : ' && day != 4';
2159
- $w_hide_friday = $w_show_week_days[5] == 'yes' ? '' : ' && day != 5';
2160
- $w_hide_saturday = $w_show_week_days[6] == 'yes' ? '' : '&& day != 6';
2161
- $rep = '<div type="type_date_new" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2162
- if ($required) {
2163
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2164
- }
2165
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="width:' . $div_size . 'px; ' . $param['w_field_label_pos2'] . ' "><input type="text" id="wdform_' . $id1 . '_element' . $form_id . '" class="input_active" style="width:' . $input_size . '" name="wdform_' . $id1 . '_element' . $form_id . '" ' . $param['attributes'] . '><span id="fm-calendar-'.$id1.'" class="wdform-calendar-button" style="display:'.$show_image.' "></span><input type="hidden" format="' . $param['w_format'] . '" id="wdform_' . $id1 . '_button' . $form_id . '" value="' . $default_date . '"/></div></div>';
2166
- if ($required) {
2167
- array_push($req_fields, $id1);
2168
- }
2169
- $onload_js .= '
2170
- jQuery("#button_calendar_' . $id1 . '").click(function() {
2171
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("show");
2172
- });
2173
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker({
2174
- dateFormat: "mm/dd/yy",
2175
- minDate: "' . $param['w_min_date'] . '",
2176
- maxDate: "' . $param['w_max_date'] . '",
2177
- changeMonth: true,
2178
- changeYear: true,
2179
- showOtherMonths: true,
2180
- selectOtherMonths: true,
2181
- firstDay: "' . $param['w_start_day'] . '",
2182
-
2183
- beforeShowDay: function(date){
2184
- var invalid_dates = "' . $param["w_invalid_dates"] . '";
2185
- var invalid_dates_finish = [];
2186
- var invalid_dates_start = invalid_dates.split(",");
2187
- var invalid_date_range =[];
2188
-
2189
-
2190
- for(var i = 0; i < invalid_dates_start.length; i++ ){
2191
- invalid_dates_start[i] = invalid_dates_start[i].trim();
2192
- if(invalid_dates_start[i].length < 11 || invalid_dates_start[i].indexOf("-") == -1){
2193
- invalid_dates_finish.push(invalid_dates_start[i]);
2194
- }
2195
- else{
2196
- if(invalid_dates_start[i].indexOf("-") > 4)
2197
- invalid_date_range.push(invalid_dates_start[i].split("-"));
2198
- else{
2199
- var invalid_date_array = invalid_dates_start[i].split("-");
2200
- var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2];
2201
- var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5];
2202
- invalid_date_range.push([start_invalid_day, end_invalid_day]);
2203
- }
2204
- }
2205
- }
2206
-
2207
-
2208
- jQuery.each(invalid_date_range, function( index, value ) {
2209
- for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) {
2210
- invalid_dates_finish.push(jQuery.datepicker.formatDate("mm/dd/yy", d));
2211
- }
2212
- });
2213
-
2214
- var string_days = jQuery.datepicker.formatDate("mm/dd/yy", date);
2215
- var day = date.getDay();
2216
- return [ invalid_dates_finish.indexOf(string_days) == -1 ' . $w_hide_sunday . $w_hide_monday . $w_hide_tuesday . $w_hide_wednesday . $w_hide_thursday . $w_hide_friday . $w_hide_saturday . '];
2217
- }
2218
- });
2219
-
2220
-
2221
-
2222
- var default_date = "' . $default_date . '";
2223
- var format_date = "' . $param['w_format'] . '";
2224
-
2225
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("option", "dateFormat", format_date);
2226
-
2227
- if(default_date =="today")
2228
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", new Date());
2229
- else if(default_date.indexOf("d") == -1 && default_date.indexOf("m") == -1 && default_date.indexOf("y") == -1 && default_date.indexOf("w") == -1){
2230
- if(default_date !== "")
2231
- default_date = jQuery.datepicker.formatDate(format_date, new Date(default_date));
2232
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", default_date);
2233
- }
2234
- else
2235
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", default_date);
2236
-
2237
- ';
2238
- break;
2239
- }
2240
-
2241
- case 'type_date_range': {
2242
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date_start', 'w_default_date_end', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2243
- $temp = $params;
2244
- if (strpos($temp, 'w_hide_label') > -1) {
2245
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date_start', 'w_default_date_end', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2246
- }
2247
- foreach ($params_names as $params_name) {
2248
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2249
- $param[$params_name] = $temp[0];
2250
- $temp = $temp[1];
2251
- }
2252
- if ($temp) {
2253
- $temp = explode('*:*w_attr_name*:*', $temp);
2254
- $attrs = array_slice($temp, 0, count($temp) - 1);
2255
- foreach ($attrs as $attr) {
2256
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2257
- }
2258
- }
2259
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2260
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2261
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2262
- if ($param['w_hide_label'] == "yes") {
2263
- $param['w_field_label_pos1'] = "display:none;";
2264
- }
2265
- $required = ($param['w_required'] == "yes" ? true : false);
2266
- $show_image = ($param['w_show_image'] == "yes" ? "inline-block" : "none");
2267
- $input_size = $param['w_size'];
2268
- $param['w_size'] = ($show_image == "inline-block" ? $param['w_size'] * 2 + 44 : $param['w_size'] * 2 + 8);
2269
- $input_size = ($show_image == "inline-block" ? "calc(50% - 26px)" : "calc(50% - 4px)");
2270
- if ($param['w_default_date_start'] == 'today') {
2271
- $default_date_start = 'new Date()';
2272
- }
2273
- else {
2274
- $default_date_start = $param['w_default_date_start'];
2275
- }
2276
- if ($param['w_default_date_end'] == 'today') {
2277
- $default_date_end = 'new Date()';
2278
- }
2279
- else {
2280
- $default_date_end = $param['w_default_date_end'];
2281
- }
2282
- $default_date_start = (isset($_POST["wdform_" . $id1 . "_element" . $form_id . "0"]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . "0"])) : $default_date_start);
2283
- $default_date_end = (isset($_POST["wdform_" . $id1 . "_element" . $form_id . "1"]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . "1"])) : $default_date_end);
2284
- $w_show_week_days = explode('***', $param['w_show_days']);
2285
- $w_hide_sunday = $w_show_week_days[0] == 'yes' ? '' : ' && day != 0';
2286
- $w_hide_monday = $w_show_week_days[1] == 'yes' ? '' : ' && day != 1';
2287
- $w_hide_tuesday = $w_show_week_days[2] == 'yes' ? '' : ' && day != 2';
2288
- $w_hide_wednesday = $w_show_week_days[3] == 'yes' ? '' : ' && day != 3';
2289
- $w_hide_thursday = $w_show_week_days[4] == 'yes' ? '' : ' && day != 4';
2290
- $w_hide_friday = $w_show_week_days[5] == 'yes' ? '' : ' && day != 5';
2291
- $w_hide_saturday = $w_show_week_days[6] == 'yes' ? '' : '&& day != 6';
2292
- $rep = '<div type="type_date_range" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2293
- if ($required) {
2294
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2295
- }
2296
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="width:' . $param['w_size'] . 'px; ' . $param['w_field_label_pos2'] . ' "><input type="text" class="input_active" id="wdform_' . $id1 . '_element' . $form_id . '0" style="width:' . $input_size . '" name="wdform_' . $id1 . '_element' . $form_id . '0" ' . $param['attributes'] . ' onchange="change_value_range(\'wdform_' . $id1 . '_element' . $form_id . '1\', \'minDate\', this.value, \'' . $param['w_min_date'] . '\', \'' . $param['w_format'] . '\')"><img src="' . WD_FM_URL . '/images/date.png" style="display:' . $show_image . '; vertical-align:sub" id="button_calendar_' . $id1 . '0" /><span>-</span><input type="text" class="input_active" id="wdform_' . $id1 . '_element' . $form_id . '1" style="width:' . $input_size . '" name="wdform_' . $id1 . '_element' . $form_id . '1" ' . $param['attributes'] . ' onchange="change_value_range(\'wdform_' . $id1 . '_element' . $form_id . '0\', \'maxDate\', this.value, \'' . $param['w_max_date'] . '\', \'' . $param['w_format'] . '\')"><img src="' . WD_FM_URL . '/images/date.png" style="display:' . $show_image . '; vertical-align:sub" id="button_calendar_' . $id1 . '1" /><input type="hidden" format="' . $param['w_format'] . '" id="wdform_' . $id1 . '_button' . $form_id . '" default_date_start="' . $param['w_default_date_start'] . '" default_date_end="' . $param['w_default_date_end'] . '"/></div></div>';
2297
- if ($required) {
2298
- array_push($req_fields, $id1);
2299
- }
2300
- $onload_js .= '
2301
- jQuery("#button_calendar_' . $id1 . '0").click(function() {
2302
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("show");
2303
- });
2304
- jQuery("#button_calendar_' . $id1 . '1").click(function() {
2305
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("show");
2306
- });
2307
- jQuery("input[id^=\'wdform_' . $id1 . '_element' . $form_id . '\']").datepicker({
2308
- dateFormat: "mm/dd/yy",
2309
- minDate: "' . $param['w_min_date'] . '",
2310
- maxDate: "' . $param['w_max_date'] . '",
2311
- changeMonth: true,
2312
- changeYear: true,
2313
- showOtherMonths: true,
2314
- selectOtherMonths: true,
2315
- firstDay: "' . $param['w_start_day'] . '",
2316
-
2317
- beforeShowDay: function(date){
2318
- var invalid_dates = "' . $param["w_invalid_dates"] . '";
2319
- var invalid_dates_finish = [];
2320
- var invalid_dates_start = invalid_dates.split(",");
2321
- var invalid_date_range =[];
2322
-
2323
-
2324
- for(var i = 0; i < invalid_dates_start.length; i++ ){
2325
- invalid_dates_start[i] = invalid_dates_start[i].trim();
2326
- if(invalid_dates_start[i].length < 11 || invalid_dates_start[i].indexOf("-") == -1){
2327
- invalid_dates_finish.push(invalid_dates_start[i]);
2328
- }
2329
- else{
2330
- if(invalid_dates_start[i].indexOf("-") > 4)
2331
- invalid_date_range.push(invalid_dates_start[i].split("-"));
2332
- else{
2333
- var invalid_date_array = invalid_dates_start[i].split("-");
2334
- var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2];
2335
- var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5];
2336
- invalid_date_range.push([start_invalid_day, end_invalid_day]);
2337
- }
2338
- }
2339
- }
2340
-
2341
-
2342
- jQuery.each(invalid_date_range, function( index, value ) {
2343
- for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) {
2344
- invalid_dates_finish.push(jQuery.datepicker.formatDate("mm/dd/yy", d));
2345
- }
2346
- });
2347
-
2348
- var string_days = jQuery.datepicker.formatDate("mm/dd/yy", date);
2349
- var day = date.getDay();
2350
- return [ invalid_dates_finish.indexOf(string_days) == -1 ' . $w_hide_sunday . $w_hide_monday . $w_hide_tuesday . $w_hide_wednesday . $w_hide_thursday . $w_hide_friday . $w_hide_saturday . '];
2351
- }
2352
- });
2353
-
2354
-
2355
-
2356
- var default_date_start = "' . $param['w_default_date_start'] . '";
2357
- var format_date = "' . $param['w_format'] . '";
2358
-
2359
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("option", "dateFormat", format_date);
2360
-
2361
- if(default_date_start =="today"){
2362
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", new Date());
2363
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", new Date());
2364
- }
2365
- else if(default_date_start.indexOf("d") == -1 && default_date_start.indexOf("m") == -1 && default_date_start.indexOf("y") == -1 && default_date_start.indexOf("w") == -1){
2366
- if(default_date_start !== ""){
2367
- default_date_start = jQuery.datepicker.formatDate(format_date, new Date(default_date_start));
2368
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start);
2369
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", default_date_start);
2370
- }
2371
- else
2372
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start);
2373
- }
2374
- else{
2375
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start);
2376
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", default_date_start);
2377
- }
2378
-
2379
-
2380
- var default_date_end = "' . $param['w_default_date_end'] . '";
2381
- var format_date = "' . $param['w_format'] . '";
2382
-
2383
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "dateFormat", format_date);
2384
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "dateFormat", format_date);
2385
-
2386
- if(default_date_end =="today"){
2387
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", new Date());
2388
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", new Date());
2389
- }
2390
- else if(default_date_end.indexOf("d") == -1 && default_date_end.indexOf("m") == -1 && default_date_end.indexOf("y") == -1 && default_date_end.indexOf("w") == -1){
2391
- if(default_date_end !== ""){
2392
- default_date_end = jQuery.datepicker.formatDate(format_date, new Date(default_date_end));
2393
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end);
2394
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", default_date_end);
2395
- }
2396
- else
2397
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end);
2398
- }
2399
- else{
2400
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end);
2401
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", default_date_end);
2402
- }
2403
- ';
2404
- break;
2405
- }
2406
-
2407
- case 'type_date_fields': {
2408
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_day', 'w_month', 'w_year', 'w_day_type', 'w_month_type', 'w_year_type', 'w_day_label', 'w_month_label', 'w_year_label', 'w_day_size', 'w_month_size', 'w_year_size', 'w_required', 'w_class', 'w_from', 'w_to', 'w_divider');
2409
- $temp = $params;
2410
- if (strpos($temp, 'w_hide_label') > -1) {
2411
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_day', 'w_month', 'w_year', 'w_day_type', 'w_month_type', 'w_year_type', 'w_day_label', 'w_month_label', 'w_year_label', 'w_day_size', 'w_month_size', 'w_year_size', 'w_required', 'w_class', 'w_from', 'w_to', 'w_divider');
2412
- }
2413
- foreach ($params_names as $params_name) {
2414
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2415
- $param[$params_name] = $temp[0];
2416
- $temp = $temp[1];
2417
- }
2418
- if ($temp) {
2419
- $temp = explode('*:*w_attr_name*:*', $temp);
2420
- $attrs = array_slice($temp, 0, count($temp) - 1);
2421
- foreach ($attrs as $attr) {
2422
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2423
- }
2424
- }
2425
- $param['w_day'] = (isset($_POST['wdform_' . $id1 . "_day" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_day" . $form_id])) : $param['w_day']);
2426
- $param['w_month'] = (isset($_POST['wdform_' . $id1 . "_month" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_month" . $form_id])) : $param['w_month']);
2427
- $param['w_year'] = (isset($_POST['wdform_' . $id1 . "_year" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_year" . $form_id])) : $param['w_year']);
2428
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2429
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2430
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2431
- if ($param['w_hide_label'] == "yes") {
2432
- $param['w_field_label_pos1'] = "display:none;";
2433
- }
2434
- $required = ($param['w_required'] == "yes" ? true : false);
2435
- if ($param['w_day_type'] == "SELECT") {
2436
- $w_day_type = '<select id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option>';
2437
- for ($k = 1; $k <= 31; $k++) {
2438
- if ($k < 10) {
2439
- if ($param['w_day'] == '0' . $k) {
2440
- $selected = "selected=\"selected\"";
2441
- }
2442
- else {
2443
- $selected = "";
2444
- }
2445
- $w_day_type .= '<option value="0' . $k . '" ' . $selected . '>0' . $k . '</option>';
2446
- }
2447
- else {
2448
- if ($param['w_day'] == '' . $k) {
2449
- $selected = "selected=\"selected\"";
2450
- }
2451
- else {
2452
- $selected = "";
2453
- }
2454
- $w_day_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
2455
- }
2456
- }
2457
- $w_day_type .= '</select>';
2458
- }
2459
- else {
2460
- $w_day_type = '<input type="text" value="' . $param['w_day'] . '" id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
2461
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_day' . $form_id . '").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2462
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_day' . $form_id . '").keypress(function() {return check_day(event, this)});';
2463
- }
2464
- if ($param['w_month_type'] == "SELECT") {
2465
- $w_month_type = '<select id="wdform_' . $id1 . '_month' . $form_id . '" name="wdform_' . $id1 . '_month' . $form_id . '" style="width: ' . $param['w_month_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option><option value="01" ' . ($param['w_month'] == "01" ? "selected=\"selected\"" : "") . ' >' . (__("January", 'form_maker')) . '</option><option value="02" ' . ($param['w_month'] == "02" ? "selected=\"selected\"" : "") . '>' . (__("February", 'form_maker')) . '</option><option value="03" ' . ($param['w_month'] == "03" ? "selected=\"selected\"" : "") . '>' . (__("March", 'form_maker')) . '</option><option value="04" ' . ($param['w_month'] == "04" ? "selected=\"selected\"" : "") . ' >' . (__("April", 'form_maker')) . '</option><option value="05" ' . ($param['w_month'] == "05" ? "selected=\"selected\"" : "") . ' >' . (__("May", 'form_maker')) . '</option><option value="06" ' . ($param['w_month'] == "06" ? "selected=\"selected\"" : "") . ' >' . (__("June", 'form_maker')) . '</option><option value="07" ' . ($param['w_month'] == "07" ? "selected=\"selected\"" : "") . ' >' . (__("July", 'form_maker')) . '</option><option value="08" ' . ($param['w_month'] == "08" ? "selected=\"selected\"" : "") . ' >' . (__("August", 'form_maker')) . '</option><option value="09" ' . ($param['w_month'] == "09" ? "selected=\"selected\"" : "") . ' >' . (__("September", 'form_maker')) . '</option><option value="10" ' . ($param['w_month'] == "10" ? "selected=\"selected\"" : "") . ' >' . (__("October", 'form_maker')) . '</option><option value="11" ' . ($param['w_month'] == "11" ? "selected=\"selected\"" : "") . '>' . (__("November", 'form_maker')) . '</option><option value="12" ' . ($param['w_month'] == "12" ? "selected=\"selected\"" : "") . ' >' . (__("December", 'form_maker')) . '</option></select>';
2466
- }
2467
- else {
2468
- $w_month_type = '<input type="text" value="' . $param['w_month'] . '" id="wdform_' . $id1 . '_month' . $form_id . '" name="wdform_' . $id1 . '_month' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
2469
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_month' . $form_id . '").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2470
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_month' . $form_id . '").keypress(function() {return check_month(event, this)});';
2471
- }
2472
- $param['w_to'] = isset($param['w_to']) && $param['w_to'] != "NaN" ? $param['w_to'] : date("Y");
2473
- if ($param['w_year_type'] == "SELECT") {
2474
- $w_year_type = '<select id="wdform_' . $id1 . '_year' . $form_id . '" name="wdform_' . $id1 . '_year' . $form_id . '" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_year_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option>';
2475
- for ($k = $param['w_to']; $k >= $param['w_from']; $k--) {
2476
- if ($param['w_year'] == $k) {
2477
- $selected = "selected=\"selected\"";
2478
- }
2479
- else {
2480
- $selected = "";
2481
- }
2482
- $w_year_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
2483
- }
2484
- $w_year_type .= '</select>';
2485
- }
2486
- else {
2487
- $w_year_type = '<input type="text" value="' . $param['w_year'] . '" id="wdform_' . $id1 . '_year' . $form_id . '" name="wdform_' . $id1 . '_year' . $form_id . '" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
2488
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_year' . $form_id . '").keypress(function() {return check_year1(event, this)});';
2489
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_year' . $form_id . '").change(function() {change_year(this)});';
2490
- }
2491
- $rep = '<div type="type_date_fields" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2492
- if ($required) {
2493
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2494
- }
2495
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;">' . $w_day_type . '</div><div style="display: table-cell;"><span class="wdform_separator">' . $param['w_divider'] . '</span></div><div style="display: table-cell;">' . $w_month_type . '</div><div style="display: table-cell;"><span class="wdform_separator">' . $param['w_divider'] . '</span></div><div style="display: table-cell;">' . $w_year_type . '</div></div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">' . $param['w_day_label'] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label" >' . $param['w_month_label'] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $param['w_year_label'] . '</label></div></div></div></div></div>';
2496
- if ($required) {
2497
- array_push($req_fields, $id1);
2498
- }
2499
- break;
2500
- }
2501
-
2502
- case 'type_file_upload': {
2503
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_destination', 'w_extension', 'w_max_size', 'w_required', 'w_multiple', 'w_class');
2504
- $temp = $params;
2505
- if (strpos($temp, 'w_hide_label') > -1) {
2506
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_destination', 'w_extension', 'w_max_size', 'w_required', 'w_multiple', 'w_class');
2507
- }
2508
- foreach ($params_names as $params_name) {
2509
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2510
- $param[$params_name] = $temp[0];
2511
- if (isset($temp[1])) {
2512
- $temp = $temp[1];
2513
- }
2514
- else {
2515
- $temp = '';
2516
- }
2517
- }
2518
- if ($temp) {
2519
- $temp = explode('*:*w_attr_name*:*', $temp);
2520
- $attrs = array_slice($temp, 0, count($temp) - 1);
2521
- foreach ($attrs as $attr) {
2522
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2523
- }
2524
- }
2525
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2526
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2527
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2528
- if ($param['w_hide_label'] == "yes") {
2529
- $param['w_field_label_pos1'] = "display:none;";
2530
- }
2531
- $required = ($param['w_required'] == "yes" ? true : false);
2532
- $multiple = ($param['w_multiple'] == "yes" ? "multiple='multiple'" : "");
2533
- $rep = '<div type="type_file_upload" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2534
- if ($required) {
2535
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2536
- }
2537
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><label class="file-upload"><div class="file-picker"></div><input type="file" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_file' . $form_id . '[]" ' . $multiple . ' ' . $param['attributes'] . '></label></div></div>';
2538
- if ($required) {
2539
- array_push($req_fields, $id1);
2540
- }
2541
- $file_upload_check[$id1] = $param['w_extension'];
2542
- break;
2543
- }
2544
-
2545
- case 'type_captcha': {
2546
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_digit', 'w_class');
2547
- $temp = $params;
2548
- if (strpos($temp, 'w_hide_label') > -1) {
2549
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_digit', 'w_class');
2550
- }
2551
- foreach ($params_names as $params_name) {
2552
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2553
- $param[$params_name] = $temp[0];
2554
- $temp = $temp[1];
2555
- }
2556
- if ($temp) {
2557
- $temp = explode('*:*w_attr_name*:*', $temp);
2558
- $attrs = array_slice($temp, 0, count($temp) - 1);
2559
- foreach ($attrs as $attr) {
2560
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2561
- }
2562
- }
2563
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2564
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2565
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2566
- if ($param['w_hide_label'] == "yes") {
2567
- $param['w_field_label_pos1'] = "display:none;";
2568
- }
2569
- $rep = '<div type="type_captcha" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div style="display: table;"><div style="display: table-cell;vertical-align: middle;"><div valign="middle" style="display: table-cell; text-align: center;"><img type="captcha" digit="' . $param['w_digit'] . '" src=" ' . add_query_arg(array('action' => 'formmakerwdcaptcha', 'digit' => $param['w_digit'], 'i' => $form_id), admin_url('admin-ajax.php')) . '" id="wd_captcha' . $form_id . '" class="captcha_img" style="display:none" ' . $param['attributes'] . '></div><div valign="middle" style="display: table-cell;"><div class="captcha_refresh" id="_element_refresh' . $form_id . '" ' . $param['attributes'] . '></div></div></div><div style="display: table-cell;vertical-align: middle;"><div style="display: table-cell;"><input type="text" class="captcha_input" id="wd_captcha_input' . $form_id . '" name="captcha_input" style="width: ' . ($param['w_digit'] * 10 + 15) . 'px;" ' . $param['attributes'] . '></div></div></div></div></div>';
2570
- $onload_js .= 'jQuery("#wd_captcha' . $form_id . '").click(function() {captcha_refresh("wd_captcha","' . $form_id . '")});';
2571
- $onload_js .= 'jQuery("#_element_refresh' . $form_id . '").click(function() {captcha_refresh("wd_captcha","' . $form_id . '")});';
2572
- array_push($req_fields, $id1);
2573
- $onload_js .= 'captcha_refresh("wd_captcha", "' . $form_id . '");';
2574
- break;
2575
- }
2576
-
2577
- case 'type_arithmetic_captcha': {
2578
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_count', 'w_operations', 'w_class', 'w_input_size');
2579
- $temp = $params;
2580
- if (strpos($temp, 'w_hide_label') > -1) {
2581
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_count', 'w_operations', 'w_class', 'w_input_size');
2582
- }
2583
- foreach ($params_names as $params_name) {
2584
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2585
- $param[$params_name] = $temp[0];
2586
- $temp = $temp[1];
2587
- }
2588
- if ($temp) {
2589
- $temp = explode('*:*w_attr_name*:*', $temp);
2590
- $attrs = array_slice($temp, 0, count($temp) - 1);
2591
- foreach ($attrs as $attr) {
2592
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2593
- }
2594
- }
2595
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2596
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2597
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2598
- if ($param['w_hide_label'] == "yes") {
2599
- $param['w_field_label_pos1'] = "display:none;";
2600
- }
2601
- $param['w_count'] = $param['w_count'] ? $param['w_count'] : 1;
2602
- $param['w_operations'] = $param['w_operations'] ? $param['w_operations'] : '+, -, *, /';
2603
- $param['w_input_size'] = $param['w_input_size'] ? $param['w_input_size'] : 60;
2604
- $rep = '<div type="type_arithmetic_captcha" class="wdform-field"><div align="left" class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label" style="vertical-align: top;">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos2'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell; vertical-align: middle;"><img type="captcha" operations_count="' . $param['w_count'] . '" operations="' . $param['w_operations'] . '" src="' . add_query_arg(array('action' => 'formmakerwdmathcaptcha', 'operations_count' => $param['w_count'], 'operations' => urlencode($param['w_operations']), 'i' => $form_id), admin_url('admin-ajax.php')) . '" id="wd_arithmetic_captcha' . $form_id . '" class="arithmetic_captcha_img" ' . $param['attributes'] . '></div><div style="display: table-cell;"><input type="text" class="arithmetic_captcha_input" id="wd_arithmetic_captcha_input' . $form_id . '" name="arithmetic_captcha_input" onkeypress="return check_isnum(event)" style="width: ' . $param['w_input_size'] . 'px;" ' . $param['attributes'] . '/></div><div style="display: table-cell; vertical-align: middle;"><div class="captcha_refresh" id="_element_refresh' . $form_id . '" ' . $param['attributes'] . '></div></div></div></div></div></div>';
2605
- $onload_js .= 'jQuery("#wd_arithmetic_captcha' . $form_id . '").click(function() { captcha_refresh("wd_arithmetic_captcha","' . $form_id . '") });';
2606
- $onload_js .= 'jQuery("#_element_refresh' . $form_id . '").click(function() {captcha_refresh("wd_arithmetic_captcha","' . $form_id . '")});';
2607
- array_push($req_fields, $id1);
2608
- $onload_js .= 'captcha_refresh("wd_arithmetic_captcha", "' . $form_id . '");';
2609
- break;
2610
- }
2611
-
2612
- case 'type_recaptcha_old': {
2613
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_public', 'w_private', 'w_theme', 'w_class');
2614
- $temp = $params;
2615
- foreach ($params_names as $params_name) {
2616
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2617
- $param[$params_name] = $temp[0];
2618
- $temp = $temp[1];
2619
- }
2620
- if ($temp) {
2621
- $temp = explode('*:*w_attr_name*:*', $temp);
2622
- $attrs = array_slice($temp, 0, count($temp) - 1);
2623
- foreach ($attrs as $attr) {
2624
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2625
- }
2626
- }
2627
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2628
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2629
- $publickey = ($row->public_key ? $row->public_key : '0');
2630
- $error = null;
2631
- require_once(WD_FM_DIR . '/recaptchalib.php');
2632
- $secure_server = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? recaptcha_get_html($publickey, $error, true) : recaptcha_get_html($publickey, $error);
2633
- $rep = '<script>var RecaptchaOptions = {theme: "' . $param['w_theme'] . '"};</script><div type="type_recaptcha" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">
2634
- <div id="wd_recaptcha' . $form_id . '" ' . $param['attributes'] . '>' . $secure_server . '</div></div></div>';
2635
- break;
2636
- }
2637
-
2638
- case 'type_recaptcha': {
2639
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_public', 'w_private', 'w_class');
2640
- $temp = $params;
2641
- if (strpos($temp, 'w_hide_label') > -1) {
2642
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_public', 'w_private', 'w_class');
2643
- }
2644
- foreach ($params_names as $params_name) {
2645
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2646
- $param[$params_name] = $temp[0];
2647
- $temp = $temp[1];
2648
- }
2649
- if ($temp) {
2650
- $temp = explode('*:*w_attr_name*:*', $temp);
2651
- $attrs = array_slice($temp, 0, count($temp) - 1);
2652
- foreach ($attrs as $attr) {
2653
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2654
- }
2655
- }
2656
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2657
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2658
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2659
- if ($param['w_hide_label'] == "yes") {
2660
- $param['w_field_label_pos1'] = "display:none;";
2661
- }
2662
- $publickey = isset($fm_settings['public_key']) ? $fm_settings['public_key'] : '0';
2663
- $rep = ' <script src="https://www.google.com/recaptcha/api.js"></script><div type="type_recaptcha" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><div class="g-recaptcha" data-sitekey="' . $publickey . '"></div></div></div>';
2664
- break;
2665
- }
2666
-
2667
- case 'type_hidden': {
2668
- $params_names = array('w_name', 'w_value');
2669
- $temp = $params;
2670
- foreach ($params_names as $params_name) {
2671
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2672
- $param[$params_name] = $temp[0];
2673
- $temp = $temp[1];
2674
- }
2675
- if ($temp) {
2676
- $temp = explode('*:*w_attr_name*:*', $temp);
2677
- $attrs = array_slice($temp, 0, count($temp) - 1);
2678
- foreach ($attrs as $attr) {
2679
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2680
- }
2681
- }
2682
- $rep = '<div type="type_hidden" class="wdform-field"><div class="wdform-label-section" style="display: table-cell;"></div><div class="wdform-element-section" style="display: table-cell;"><input type="hidden" value="' . $param['w_value'] . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="' . $param['w_name'] . '" ' . $param['attributes'] . '></div></div>';
2683
- break;
2684
- }
2685
-
2686
- case 'type_mark_map': {
2687
- if ($GLOBALS['map_include'] === false) {
2688
- $fm_settings = get_option('fm_settings');
2689
- $map_key = isset($fm_settings['map_key']) ? $fm_settings['map_key'] : '';
2690
- wp_enqueue_script('gmap_form_api', 'https://maps.google.com/maps/api/js?v=3.exp&key=' . $map_key);
2691
- $GLOBALS['map_include'] = true;
2692
- }
2693
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_center_x', 'w_center_y', 'w_long', 'w_lat', 'w_zoom', 'w_width', 'w_height', 'w_info', 'w_class');
2694
- $temp = $params;
2695
- if (strpos($temp, 'w_hide_label') > -1) {
2696
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_center_x', 'w_center_y', 'w_long', 'w_lat', 'w_zoom', 'w_width', 'w_height', 'w_info', 'w_class');
2697
- }
2698
- foreach ($params_names as $params_name) {
2699
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2700
- $param[$params_name] = $temp[0];
2701
- $temp = $temp[1];
2702
- }
2703
- if ($temp) {
2704
- $temp = explode('*:*w_attr_name*:*', $temp);
2705
- $attrs = array_slice($temp, 0, count($temp) - 1);
2706
- foreach ($attrs as $attr) {
2707
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2708
- }
2709
- }
2710
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_width']) : max($param['w_field_label_size'], $param['w_width']));
2711
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2712
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2713
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2714
- if ($param['w_hide_label'] == "yes") {
2715
- $param['w_field_label_pos1'] = "display:none;";
2716
- }
2717
- $rep = '<div type="type_mark_map" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_width'] . 'px;"><input type="hidden" id="wdform_' . $id1 . '_long' . $form_id . '" name="wdform_' . $id1 . '_long' . $form_id . '" value="' . $param['w_long'] . '"><input type="hidden" id="wdform_' . $id1 . '_lat' . $form_id . '" name="wdform_' . $id1 . '_lat' . $form_id . '" value="' . $param['w_lat'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" long0="' . $param['w_long'] . '" lat0="' . $param['w_lat'] . '" zoom="' . $param['w_zoom'] . '" info0="' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info']) . '" center_x="' . $param['w_center_x'] . '" center_y="' . $param['w_center_y'] . '" style="width: 100%; height: ' . $param['w_height'] . 'px;" ' . $param['attributes'] . '></div></div></div> ';
2718
- $onload_js .= 'if_gmap_init("wdform_' . $id1 . '", ' . $form_id . ');';
2719
- $onload_js .= 'add_marker_on_map("wdform_' . $id1 . '", 0, "' . $param['w_long'] . '", "' . $param['w_lat'] . '", "' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info']) . '", ' . $form_id . ',true);';
2720
- break;
2721
- }
2722
-
2723
- case 'type_map': {
2724
- if ($GLOBALS['map_include'] === false) {
2725
- $fm_settings = get_option('fm_settings');
2726
- $map_key = isset($fm_settings['map_key']) ? $fm_settings['map_key'] : '';
2727
- wp_enqueue_script('gmap_form_api', 'https://maps.google.com/maps/api/js?v=3.exp&key=' . $map_key);
2728
- $GLOBALS['map_include'] = true;
2729
- }
2730
- $params_names = array('w_center_x', 'w_center_y', 'w_long', 'w_lat', 'w_zoom', 'w_width', 'w_height', 'w_info', 'w_class');
2731
- $temp = $params;
2732
- foreach ($params_names as $params_name) {
2733
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2734
- $param[$params_name] = $temp[0];
2735
- $temp = $temp[1];
2736
- }
2737
- if ($temp) {
2738
- $temp = explode('*:*w_attr_name*:*', $temp);
2739
- $attrs = array_slice($temp, 0, count($temp) - 1);
2740
- foreach ($attrs as $attr) {
2741
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2742
- }
2743
- }
2744
- $marker = '';
2745
- $param['w_long'] = explode('***', $param['w_long']);
2746
- $param['w_lat'] = explode('***', $param['w_lat']);
2747
- $param['w_info'] = explode('***', $param['w_info']);
2748
- foreach ($param['w_long'] as $key => $w_long) {
2749
- $marker .= 'long' . $key . '="' . $w_long . '" lat' . $key . '="' . $param['w_lat'][$key] . '" info' . $key . '="' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info'][$key]) . '"';
2750
- }
2751
- $rep = '<div type="type_map" class="wdform-field" style="width:' . ($param['w_width']) . 'px"><div class="wdform-label-section" style="display: table-cell;"><span id="wdform_' . $id1 . '_element_label' . $form_id . '" style="display: none;">' . $label . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="width: ' . $param['w_width'] . 'px;"><div id="wdform_' . $id1 . '_element' . $form_id . '" zoom="' . $param['w_zoom'] . '" center_x="' . $param['w_center_x'] . '" center_y="' . $param['w_center_y'] . '" style="width: 100%; height: ' . $param['w_height'] . 'px;" ' . $marker . ' ' . $param['attributes'] . '></div></div></div>';
2752
- $onload_js .= 'if_gmap_init("wdform_' . $id1 . '", ' . $form_id . ');';
2753
- foreach ($param['w_long'] as $key => $w_long) {
2754
- $onload_js .= 'add_marker_on_map("wdform_' . $id1 . '",' . $key . ', "' . $w_long . '", "' . $param['w_lat'][$key] . '", "' . str_replace(array("\r\n", "\n", "\r"), '<br />', $param['w_info'][$key]) . '", ' . $form_id . ',false);';
2755
- }
2756
- break;
2757
- }
2758
-
2759
- case 'type_paypal_price': {
2760
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_required', 'w_hide_cents', 'w_class', 'w_range_min', 'w_range_max');
2761
- $temp = $params;
2762
- foreach ($params_names as $params_name) {
2763
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2764
- $param[$params_name] = $temp[0];
2765
- $temp = $temp[1];
2766
- }
2767
- if ($temp) {
2768
- $temp = explode('*:*w_attr_name*:*', $temp);
2769
- $attrs = array_slice($temp, 0, count($temp) - 1);
2770
- foreach ($attrs as $attr) {
2771
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2772
- }
2773
- }
2774
- $w_first_val = explode('***', $param['w_first_val']);
2775
- $w_title = explode('***', $param['w_title']);
2776
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_dollars' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_dollars' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_cents' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_cents' . $form_id])) : $w_first_val[1]);
2777
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2778
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2779
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
2780
- $required = ($param['w_required'] == "yes" ? true : false);
2781
- $hide_cents = ($param['w_hide_cents'] == "yes" ? "none;" : "table-cell;");
2782
- $w_first_val = explode('***', $param['w_first_val']);
2783
- $w_title = explode('***', $param['w_title']);
2784
- $w_mini_labels = explode('***', $param['w_mini_labels']);
2785
- $rep = '<div type="type_paypal_price" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2786
- if ($required) {
2787
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2788
- }
2789
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><input type="hidden" value="' . $param['w_range_min'] . '" name="wdform_' . $id1 . '_range_min' . $form_id . '" id="wdform_' . $id1 . '_range_min' . $form_id . '"><input type="hidden" value="' . $param['w_range_max'] . '" name="wdform_' . $id1 . '_range_max' . $form_id . '" id="wdform_' . $id1 . '_range_max' . $form_id . '"><div id="wdform_' . $id1 . '_table_price" style="display: table;"><div id="wdform_' . $id1 . '_tr_price1" style="display: table-row;"><div id="wdform_' . $id1 . '_td_name_currency" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;' . $form_currency . '&nbsp;<!--repend--></span></div><div id="wdform_' . $id1 . '_td_name_dollars" style="display: table-cell;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_dollars' . $form_id . '" name="wdform_' . $id1 . '_element_dollars' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . '></div><div id="wdform_' . $id1 . '_td_name_divider" style="display: ' . $hide_cents . ';"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;.&nbsp;</span></div><div id="wdform_' . $id1 . '_td_name_cents" style="display: ' . $hide_cents . '"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_cents' . $form_id . '" name="wdform_' . $id1 . '_element_cents' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 30px;" ' . $param['attributes'] . '></div></div><div id="wdform_' . $id1 . '_tr_price2" style="display: table-row;"><div style="display: table-cell;"><label class="mini_label"></label></div><div align="left" style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[0] . '</label></div><div id="wdform_' . $id1 . '_td_name_label_divider" style="display: ' . $hide_cents . '"><label class="mini_label"></label></div><div align="left" id="wdform_' . $id1 . '_td_name_label_cents" style="display: ' . $hide_cents . '"><label class="mini_label">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
2790
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").blur(function() {add_0(this)});';
2791
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").keypress(function(event) {return check_isnum_interval(event,this,0,99)});';
2792
- if ($required) {
2793
- $check_js .= '
2794
- if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
2795
- {
2796
- if(jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()=="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()=="")
2797
- {
2798
- alert("' . addslashes($label . ' ' . __('field is required.', 'form_maker')) . '");
2799
- old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
2800
- x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
2801
- jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").focus();
2802
- return false;
2803
- }
2804
- }
2805
- ';
2806
- }
2807
- $check_js .= '
2808
- if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
2809
- {
2810
- dollars=0;
2811
- cents=0;
2812
-
2813
- if(jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()!="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val())
2814
- dollars =jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val();
2815
-
2816
- if(jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val()!="' . $w_title[1] . '" || jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val())
2817
- cents =jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val();
2818
-
2819
- var price=dollars+"."+cents;
2820
-
2821
- if(isNaN(price))
2822
- {
2823
- alert("Invalid value of number field");
2824
- old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
2825
- x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
2826
- jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").focus();
2827
- return false;
2828
- }
2829
-
2830
- var range_min=' . ($param['w_range_min'] ? $param['w_range_min'] : 0) . ';
2831
- var range_max=' . ($param['w_range_max'] ? $param['w_range_max'] : -1) . ';
2832
-
2833
-
2834
- if(' . ($required ? 'true' : 'false') . ' || jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").val()!="' . $w_title[0] . '" || jQuery("#wdform_' . $id1 . '_element_cents' . $form_id . '").val()!="' . $w_title[1] . '")
2835
- if((range_max!=-1 && parseFloat(price)>range_max) || parseFloat(price)<range_min)
2836
- {
2837
- alert("' . addslashes((__('The', 'form_maker')) . $label . (__('value must be between', 'form_maker')) . ($param['w_range_min'] ? $param['w_range_min'] : 0) . '-' . ($param['w_range_max'] ? $param['w_range_max'] : "any")) . '");
2838
-
2839
- old_bg=x.find(jQuery("div[wdid=' . $id1 . ']")).css("background-color");
2840
- x.find(jQuery("div[wdid=' . $id1 . ']")).effect( "shake", {}, 500 ).css("background-color","#FF8F8B").animate({backgroundColor: old_bg}, {duration: 500, queue: false });
2841
- jQuery("#wdform_' . $id1 . '_element_dollars' . $form_id . '").focus();
2842
- return false;
2843
- }
2844
- }
2845
- ';
2846
- break;
2847
- }
2848
-
2849
- case 'type_paypal_price_new': {
2850
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_size', 'w_required', 'w_class', 'w_range_min', 'w_range_max', 'w_readonly', 'w_currency');
2851
- $temp = $params;
2852
- if (strpos($temp, 'w_hide_label') > -1) {
2853
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_first_val', 'w_title', 'w_size', 'w_required', 'w_class', 'w_range_min', 'w_range_max', 'w_readonly', 'w_currency');
2854
- }
2855
- foreach ($params_names as $params_name) {
2856
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2857
- $param[$params_name] = $temp[0];
2858
- $temp = $temp[1];
2859
- }
2860
- if ($temp) {
2861
- $temp = explode('*:*w_attr_name*:*', $temp);
2862
- $attrs = array_slice($temp, 0, count($temp) - 1);
2863
- foreach ($attrs as $attr) {
2864
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2865
- }
2866
- }
2867
- $currency_symbol = ($param['w_currency'] == 'yes' ? '' : $form_currency);
2868
- $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
2869
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2870
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2871
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2872
- if ($param['w_hide_label'] == "yes") {
2873
- $param['w_field_label_pos1'] = "display:none;";
2874
- }
2875
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
2876
- $required = ($param['w_required'] == "yes" ? true : false);
2877
- $readonly = (isset($param['w_readonly']) && $param['w_readonly'] == "yes" ? "readonly='readonly'" : '');
2878
- $symbol_begin_paypal = isset($symbol_begin[$id1]) ? $symbol_begin[$id1] : '';
2879
- $symbol_end_paypal = isset($symbol_end[$id1]) ? $symbol_end[$id1] : '';
2880
- $display_begin = $symbol_begin_paypal || $param['w_currency'] == 'no' ? 'display:table-cell;' : 'display:none;';
2881
- $display_end = $symbol_end_paypal != '' ? 'display:table-cell;' : 'display:none;';
2882
- $rep = '<div type="type_paypal_price_new" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2883
- if ($required) {
2884
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2885
- }
2886
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><input type="hidden" value="' . $param['w_range_min'] . '" name="wdform_' . $id1 . '_range_min' . $form_id . '" id="wdform_' . $id1 . '_range_min' . $form_id . '"><input type="hidden" value="' . $param['w_range_max'] . '" name="wdform_' . $id1 . '_range_max' . $form_id . '" id="wdform_' . $id1 . '_range_max' . $form_id . '"><div id="wdform_' . $id1 . '_table_price" style="display: table;"><div id="wdform_' . $id1 . '_tr_price1" style="display: table-row;"><div style="' . $display_begin . '"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;' . $currency_symbol . '&nbsp;</span><span class="wdform_colon" style="vertical-align: middle;">' . $symbol_begin_paypal . '</span></div><div style="display: table-cell;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" ' . $readonly . ' onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . '></div><div style="' . $display_end . '"><span class="wdform_colon" style="vertical-align: middle;">' . $symbol_end_paypal . '</span></div> </div></div></div></div>';
2887
- if ($required) {
2888
- array_push($req_fields, $id1);
2889
- }
2890
- $check_paypal_price_min_max[$id1] = array($label, $param['w_title'], $required, $param['w_range_min'], $param['w_range_max']);
2891
- break;
2892
- }
2893
-
2894
- case 'type_paypal_select': {
2895
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_quantity', 'w_quantity_value', 'w_class', 'w_property', 'w_property_values');
2896
- $temp = $params;
2897
- if (strpos($temp, 'w_choices_params') > -1) {
2898
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_quantity', 'w_quantity_value', 'w_choices_params', 'w_class', 'w_property', 'w_property_values');
2899
- }
2900
- if (strpos($temp, 'w_hide_label') > -1) {
2901
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_quantity', 'w_quantity_value', 'w_choices_params', 'w_class', 'w_property', 'w_property_values');
2902
- }
2903
- foreach ($params_names as $params_name) {
2904
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2905
- $param[$params_name] = $temp[0];
2906
- $temp = $temp[1];
2907
- }
2908
- if ($temp) {
2909
- $temp = explode('*:*w_attr_name*:*', $temp);
2910
- $attrs = array_slice($temp, 0, count($temp) - 1);
2911
- foreach ($attrs as $attr) {
2912
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
2913
- }
2914
- }
2915
- $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
2916
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2917
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2918
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2919
- if ($param['w_hide_label'] == "yes") {
2920
- $param['w_field_label_pos1'] = "display:none;";
2921
- }
2922
- $required = ($param['w_required'] == "yes" ? true : false);
2923
- $param['w_choices'] = explode('***', $param['w_choices']);
2924
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2925
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2926
- $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
2927
- $param['w_property'] = explode('***', $param['w_property']);
2928
- $param['w_property_values'] = explode('***', $param['w_property_values']);
2929
- if (isset($param['w_choices_params'])) {
2930
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2931
- }
2932
- $post_value = isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : NULL;
2933
- $rep = '<div type="type_paypal_select" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2934
- if ($required) {
2935
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2936
- }
2937
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><select id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '>';
2938
- foreach ($param['w_choices'] as $key => $choice) {
2939
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
2940
- $choices_labels = array();
2941
- $choices_values = array();
2942
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2943
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
2944
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2945
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
2946
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
2947
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
2948
- $table = $label_table_and_column[0];
2949
- $label_column = $label_table_and_column[1];
2950
- if ($label_column) {
2951
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
2952
- }
2953
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
2954
- $value_column = $param['w_choices_disabled'][$key] == "true" ? '' : $value_table_and_column[1];
2955
- if ($value_column) {
2956
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
2957
- }
2958
- $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
2959
- for ($k = 0; $k < $columns_count; $k++) {
2960
- $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
2961
- $choice_value = isset($choices_values[$k]) ? (float)$choices_values[$k][0] : '';
2962
- if (isset($post_value)) {
2963
- if ($post_value == $choice_value && $choice_label == $_POST["wdform_" . $id1 . "_element_label" . $form_id]) {
2964
- $param['w_choices_checked'][$key] = 'selected="selected"';
2965
- }
2966
- else {
2967
- $param['w_choices_checked'][$key] = '';
2968
- }
2969
- }
2970
- else {
2971
- $param['w_choices_checked'][$key] = (($param['w_choices_checked'][$key] == 'true' && $k == 0) ? 'selected="selected"' : '');
2972
- }
2973
- $rep .= '<option value="' . $choice_value . '" ' . $param['w_choices_checked'][$key] . '>' . $choice_label[0] . '</option>';
2974
- }
2975
- }
2976
- else {
2977
- $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : $param['w_choices_price'][$key];
2978
- if (isset($post_value)) {
2979
- if ($post_value == $choice_value && $choice == $_POST["wdform_" . $id1 . "_element_label" . $form_id]) {
2980
- $param['w_choices_checked'][$key] = 'selected="selected"';
2981
- }
2982
- else {
2983
- $param['w_choices_checked'][$key] = '';
2984
- }
2985
- }
2986
- else {
2987
- if ($param['w_choices_checked'][$key] == 'true') {
2988
- $param['w_choices_checked'][$key] = 'selected="selected"';
2989
- }
2990
- else {
2991
- $param['w_choices_checked'][$key] = '';
2992
- }
2993
- }
2994
- $rep .= '<option value="' . $choice_value . '" ' . $param['w_choices_checked'][$key] . '>' . $choice . '</option>';
2995
- }
2996
- }
2997
- $rep .= '</select><div id="wdform_' . $id1 . '_div' . $form_id . '">';
2998
- if ($param['w_quantity'] == "yes") {
2999
- $rep .= '<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">' . (__("Quantity", 'form_maker')) . '</label><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_element_quantity" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element_quantity" . $form_id])) : $param['w_quantity_value']) . '" id="wdform_' . $id1 . '_element_quantity' . $form_id . '" name="wdform_' . $id1 . '_element_quantity' . $form_id . '" class="wdform-quantity"></div>';
3000
- }
3001
- if ($param['w_property'][0]) {
3002
- foreach ($param['w_property'] as $key => $property) {
3003
- $rep .= '
3004
- <div id="wdform_' . $id1 . '_property_' . $key . '" class="paypal-property">
3005
- <div style="width:150px; display:inline-block;">
3006
- <label class="mini_label" id="wdform_' . $id1 . '_property_label_' . $form_id . '' . $key . '" style="margin-right: 5px;">' . $property . '</label>
3007
- <select id="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" style="margin: 2px 0px;">';
3008
- $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
3009
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
3010
- foreach ($param['w_property_values'][$key] as $subkey => $property_value) {
3011
- $rep .= '<option id="wdform_' . $id1 . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '" ' . (isset($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key]) && esc_html(stripslashes($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key])) == $property_value ? 'selected="selected"' : "") . '>' . $property_value . '</option>';
3012
- }
3013
- $rep .= '</select></div></div>';
3014
- }
3015
- }
3016
- $rep .= '</div></div></div>';
3017
- if ($required) {
3018
- array_push($req_fields, $id1);
3019
- }
3020
- $onsubmit_js .= '
3021
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val(jQuery("#wdform_' . $id1 . '_element' . $form_id . ' option:selected").text()).appendTo("#form' . $form_id . '");
3022
- ';
3023
- $onsubmit_js .= '
3024
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\" />").val("' . (__("Quantity", 'form_maker')) . '").appendTo("#form' . $form_id . '");
3025
- ';
3026
- foreach ($param['w_property'] as $key => $property) {
3027
- $onsubmit_js .= '
3028
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\" />").val("' . $property . '").appendTo("#form' . $form_id . '");
3029
- ';
3030
- }
3031
- break;
3032
- }
3033
-
3034
- case 'type_paypal_checkbox': {
3035
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
3036
- $temp = $params;
3037
- if (strpos($temp, 'w_field_option_pos') > -1) {
3038
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
3039
- }
3040
- if (strpos($temp, 'w_hide_label') > -1) {
3041
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
3042
- }
3043
- foreach ($params_names as $params_name) {
3044
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3045
- $param[$params_name] = $temp[0];
3046
- $temp = $temp[1];
3047
- }
3048
- if ($temp) {
3049
- $temp = explode('*:*w_attr_name*:*', $temp);
3050
- $attrs = array_slice($temp, 0, count($temp) - 1);
3051
- foreach ($attrs as $attr) {
3052
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3053
- }
3054
- }
3055
- if (!isset($param['w_field_option_pos'])) {
3056
- $param['w_field_option_pos'] = 'left';
3057
- }
3058
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3059
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3060
- $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none
3061
- !important;'" : "");
3062
- $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "");
3063
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3064
- if ($param['w_hide_label'] == "yes") {
3065
- $param['w_field_label_pos1'] = "display:none;";
3066
- }
3067
- $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
3068
- $required = ($param['w_required'] == "yes" ? true : false);
3069
- $param['w_choices'] = explode('***', $param['w_choices']);
3070
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
3071
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
3072
- $param['w_property'] = explode('***', $param['w_property']);
3073
- $param['w_property_values'] = explode('***', $param['w_property_values']);
3074
- if (isset($param['w_choices_params'])) {
3075
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
3076
- }
3077
- foreach ($param['w_choices_checked'] as $key => $choices_checked) {
3078
- $param['w_choices_checked'][$key] = ($choices_checked == 'true' ? 'checked="checked"' : '');
3079
- }
3080
- $rep = '<div type="type_paypal_checkbox" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3081
- if ($required) {
3082
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3083
- }
3084
- $rep .= '</div><div class="wdform-element-section mini_label ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
3085
- $total_queries = 0;
3086
- foreach ($param['w_choices'] as $key => $choice) {
3087
- $key1 = $key + $total_queries;
3088
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
3089
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
3090
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
3091
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
3092
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
3093
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
3094
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
3095
- $table = $label_table_and_column[0];
3096
- $label_column = $label_table_and_column[1];
3097
- if ($label_column) {
3098
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3099
- }
3100
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
3101
- $value_column = $value_table_and_column[1];
3102
- if ($value_column) {
3103
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3104
- }
3105
- $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
3106
- if (array_filter($choices_labels) || array_filter($choices_values)) {
3107
- $total_queries = $total_queries + $columns_count - 1;
3108
- if (!isset($post_value)) {
3109
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
3110
- }
3111
- for ($k = 0; $k < $columns_count; $k++) {
3112
- $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
3113
- $choice_value = isset($choices_values) ? (float)$choices_values[$k][0] : '';
3114
- if (isset($post_value)) {
3115
- $param['w_choices_checked'][$key] = "";
3116
- $checkedvalue = $_POST['wdform_' . $id1 . "_element" . $form_id . ($key1 + $k)];
3117
- if (isset($checkedvalue)) {
3118
- $param['w_choices_checked'][$key] = 'checked="checked"';
3119
- }
3120
- }
3121
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><div class="checkbox-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" value="' . $choice_value . '" title="' . htmlspecialchars($choice_label[0]) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label[0] . '</label></div><input type="hidden" name="wdform_' . $id1 . '_element' . $form_id . ($key1 + $k) . '_label" value="' . htmlspecialchars($choice_label[0]) . '" /></div>';
3122
- }
3123
- }
3124
- }
3125
- else {
3126
- if (isset($post_value)) {
3127
- $param['w_choices_checked'][$key] = "";
3128
- $checkedvalue = isset($_POST['wdform_' . $id1 . "_element" . $form_id . $key1]);
3129
- if ($checkedvalue) {
3130
- $param['w_choices_checked'][$key] = 'checked="checked"';
3131
- }
3132
- }
3133
- else {
3134
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
3135
- }
3136
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><div class="checkbox-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" value="' . $param['w_choices_price'][$key] . '" title="' . htmlspecialchars($choice) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div><input type="hidden" name="wdform_' . $id1 . '_element' . $form_id . $key1 . '_label" value="' . htmlspecialchars($choice) . '" /></div>';
3137
- }
3138
- }
3139
- $rep .= '<div id="wdform_' . $id1 . '_div' . $form_id . '">';
3140
- if ($param['w_quantity'] == "yes") {
3141
- $rep .= '<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">' . (__("Quantity", 'form_maker')) . '</label><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_element_quantity" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element_quantity" . $form_id])) : $param['w_quantity_value']) . '" id="wdform_' . $id1 . '_element_quantity' . $form_id . '" name="wdform_' . $id1 . '_element_quantity' . $form_id . '" class="wdform-quantity"></div>';
3142
- }
3143
- if ($param['w_property'][0]) {
3144
- foreach ($param['w_property'] as $key => $property) {
3145
- $rep .= '
3146
- <div class="paypal-property">
3147
- <div style="display:inline-block;">
3148
- <label class="mini_label" id="wdform_' . $id1 . '_property_label_' . $form_id . '' . $key . '" style="margin-right: 5px;">' . $property . '</label>
3149
- <select id="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" style="margin: 2px 0px;">';
3150
- $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
3151
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
3152
- foreach ($param['w_property_values'][$key] as $subkey => $property_value) {
3153
- $rep .= '<option id="wdform_' . $id1 . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '" ' . (isset($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key]) && esc_html(stripslashes($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key])) == $property_value ? 'selected="selected"' : "") . '>' . $property_value . '</option>';
3154
- }
3155
- $rep .= '</select></div></div>';
3156
- }
3157
- }
3158
- $rep .= '</div></div></div>';
3159
- if ($required) {
3160
- array_push($req_fields, $id1);
3161
- }
3162
- $onsubmit_js .= '
3163
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val((x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).length != 0) ? jQuery("#"+x.find(jQuery("div[wdid=' . $id1 . '] input:checked")).attr("id").replace("element", "elementlabel_")) : "").appendTo("#form' . $form_id . '");
3164
- ';
3165
- $onsubmit_js .= '
3166
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\" />").val("' . (__("Quantity", 'form_maker')) . '").appendTo("#form' . $form_id . '");
3167
- ';
3168
- foreach ($param['w_property'] as $key => $property) {
3169
- $onsubmit_js .= '
3170
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\" />").val("' . $property . '").appendTo("#form' . $form_id . '");
3171
- ';
3172
- }
3173
- break;
3174
- }
3175
-
3176
- case 'type_paypal_radio': {
3177
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
3178
- $temp = $params;
3179
- if (strpos($temp, 'w_field_option_pos') > -1) {
3180
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
3181
- }
3182
- if (strpos($temp, 'w_hide_label') > -1) {
3183
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class', 'w_property', 'w_property_values', 'w_quantity', 'w_quantity_value');
3184
- }
3185
- foreach ($params_names as $params_name) {
3186
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3187
- $param[$params_name] = $temp[0];
3188
- $temp = $temp[1];
3189
- }
3190
- if ($temp) {
3191
- $temp = explode('*:*w_attr_name*:*', $temp);
3192
- $attrs = array_slice($temp, 0, count($temp) - 1);
3193
- foreach ($attrs as $attr) {
3194
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3195
- }
3196
- }
3197
- if (!isset($param['w_field_option_pos'])) {
3198
- $param['w_field_option_pos'] = 'left';
3199
- }
3200
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3201
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3202
- $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none
3203
- !important;'" : "");
3204
- $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin-right: 8px !important; display: inline-block !important;'" : "");
3205
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3206
- if ($param['w_hide_label'] == "yes") {
3207
- $param['w_field_label_pos1'] = "display:none;";
3208
- }
3209
- $required = ($param['w_required'] == "yes" ? true : false);
3210
- $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
3211
- $param['w_choices'] = explode('***', $param['w_choices']);
3212
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
3213
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
3214
- $param['w_property'] = explode('***', $param['w_property']);
3215
- $param['w_property_values'] = explode('***', $param['w_property_values']);
3216
- if (isset($param['w_choices_params'])) {
3217
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
3218
- }
3219
- foreach ($param['w_choices_checked'] as $key => $choices_checked) {
3220
- $param['w_choices_checked'][$key] = ($choices_checked == 'true' ? 'checked="checked"' : '');
3221
- }
3222
- $rep = '<div type="type_paypal_radio" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3223
- if ($required) {
3224
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3225
- }
3226
- $rep .= '</div><div class="wdform-element-section mini_label ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
3227
- $total_queries = 0;
3228
- foreach ($param['w_choices'] as $key => $choice) {
3229
- $key1 = $key + $total_queries;
3230
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
3231
- $choices_labels = array();
3232
- $choices_values = array();
3233
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
3234
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
3235
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
3236
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
3237
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
3238
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
3239
- $table = $label_table_and_column[0];
3240
- $label_column = $label_table_and_column[1];
3241
- if ($label_column) {
3242
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3243
- }
3244
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
3245
- $value_column = $value_table_and_column[1];
3246
- if ($value_column) {
3247
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3248
- }
3249
- $columns_count_radio = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
3250
- if (array_filter($choices_labels) || array_filter($choices_values)) {
3251
- $total_queries = $total_queries + $columns_count_radio - 1;
3252
- for ($k = 0; $k < $columns_count_radio; $k++) {
3253
- $choice_label = isset($choices_labels) ? $choices_labels[$k] : '';
3254
- $choice_value = isset($choices_values) ? (float)$choices_values[$k][0] : '';
3255
- if (isset($post_value)) {
3256
- $param['w_choices_checked'][$key] = (($post_value == $choice_value && htmlspecialchars($choice_label) == htmlspecialchars($_POST['wdform_' . $id1 . "_element_label" . $form_id])) ? 'checked="checked"' : '');
3257
- }
3258
- else {
3259
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
3260
- }
3261
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $choice_value . '" title="' . htmlspecialchars($choice_label[0]) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label[0] . '</label></div></div>';
3262
- }
3263
- }
3264
- }
3265
- else {
3266
- if (isset($post_value)) {
3267
- $param['w_choices_checked'][$key] = (($post_value == $param['w_choices_price'][$key] && htmlspecialchars($choice) == htmlspecialchars($_POST['wdform_' . $id1 . "_element_label" . $form_id])) ? 'checked="checked"' : '');
3268
- }
3269
- else {
3270
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
3271
- }
3272
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_choices_price'][$key] . '" title="' . htmlspecialchars($choice) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div></div>';
3273
- }
3274
- }
3275
- $rep .= '<div id="wdform_' . $id1 . '_div' . $form_id . '">';
3276
- if ($param['w_quantity'] == "yes") {
3277
- $rep .= '<div class="paypal-property"><label class="mini_label" style="margin: 0px 5px;">' . (__("Quantity", 'form_maker')) . '</label><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_element_quantity" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element_quantity" . $form_id])) : $param['w_quantity_value']) . '" id="wdform_' . $id1 . '_element_quantity' . $form_id . '" name="wdform_' . $id1 . '_element_quantity' . $form_id . '" class="wdform-quantity"></div>';
3278
- }
3279
- if ($param['w_property'][0]) {
3280
- foreach ($param['w_property'] as $key => $property) {
3281
- $rep .= '
3282
- <div class="paypal-property">
3283
- <div style="width:150px; display:inline-block;">
3284
- <label class="mini_label" id="wdform_' . $id1 . '_property_label_' . $form_id . '' . $key . '" style="margin-right: 5px;">' . $property . '</label>
3285
- <select id="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" name="wdform_' . $id1 . '_property' . $form_id . '' . $key . '" style="margin: 2px 0px;">';
3286
- $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
3287
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
3288
- foreach ($param['w_property_values'][$key] as $subkey => $property_value) {
3289
- $rep .= '<option id="wdform_' . $id1 . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '" ' . (isset($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key]) && esc_html(stripslashes($_POST['wdform_' . $id1 . '_property' . $form_id . '' . $key])) == $property_value ? 'selected="selected"' : "") . '>' . $property_value . '</option>';
3290
- }
3291
- $rep .= '</select></div></div>';
3292
- }
3293
- }
3294
- $rep .= '</div></div></div>';
3295
- if ($required) {
3296
- array_push($req_fields, $id1);
3297
- }
3298
- $onsubmit_js .= '
3299
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val(
3300
- jQuery("label[for=\'"+jQuery("input[name^=\'wdform_' . $id1 . '_element' . $form_id . '\']:checked").attr("id")+"\']").eq(0).text()
3301
- ).appendTo("#form' . $form_id . '");
3302
-
3303
- ';
3304
- $onsubmit_js .= '
3305
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_quantity_label' . $form_id . '\" />").val("' . (__("Quantity", 'form_maker')) . '").appendTo("#form' . $form_id . '");
3306
- ';
3307
- foreach ($param['w_property'] as $key => $property) {
3308
- $onsubmit_js .= '
3309
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_property_label' . $form_id . $key . '\" />").val("' . $property . '").appendTo("#form' . $form_id . '");
3310
- ';
3311
- }
3312
- break;
3313
- }
3314
-
3315
- case 'type_paypal_shipping': {
3316
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
3317
- $temp = $params;
3318
- if (strpos($temp, 'w_field_option_pos') > -1) {
3319
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class');
3320
- }
3321
- if (strpos($temp, 'w_hide_label') > -1) {
3322
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_price', 'w_choices_checked', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_choices_params', 'w_class');
3323
- }
3324
- foreach ($params_names as $params_name) {
3325
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3326
- $param[$params_name] = $temp[0];
3327
- $temp = $temp[1];
3328
- }
3329
- if ($temp) {
3330
- $temp = explode('*:*w_attr_name*:*', $temp);
3331
- $attrs = array_slice($temp, 0, count($temp) - 1);
3332
- foreach ($attrs as $attr) {
3333
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3334
- }
3335
- }
3336
- if (!isset($param['w_field_option_pos'])) {
3337
- $param['w_field_option_pos'] = 'left';
3338
- }
3339
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3340
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3341
- $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none
3342
- !important;'" : "");
3343
- $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "");
3344
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3345
- if ($param['w_hide_label'] == "yes") {
3346
- $param['w_field_label_pos1'] = "display:none;";
3347
- }
3348
- $required = ($param['w_required'] == "yes" ? true : false);
3349
- $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
3350
- $param['w_choices'] = explode('***', $param['w_choices']);
3351
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
3352
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
3353
- if (isset($param['w_choices_params'])) {
3354
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
3355
- }
3356
- foreach ($param['w_choices_checked'] as $key => $choices_checked) {
3357
- $param['w_choices_checked'][$key] = ($choices_checked == 'true' ? 'checked="checked"' : '');
3358
- }
3359
- $rep = '<div type="type_paypal_shipping" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3360
- if ($required) {
3361
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3362
- }
3363
- $rep .= '</div><div class="wdform-element-section mini_label ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
3364
- $total_queries = 0;
3365
- foreach ($param['w_choices'] as $key => $choice) {
3366
- $key1 = $key + $total_queries;
3367
- if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
3368
- $choices_labels = array();
3369
- $choices_values = array();
3370
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
3371
- $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
3372
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
3373
- $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
3374
- $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
3375
- $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
3376
- $table = $label_table_and_column[0];
3377
- $label_column = $label_table_and_column[1];
3378
- if ($label_column) {
3379
- $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
3380
- }
3381
- $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_price'][$key]));
3382
- $value_column = $value_table_and_column[1];
3383
- if ($value_column) {
3384
- $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
3385
- }
3386
- $columns_count_shipping = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
3387
- if (array_filter($choices_labels) || array_filter($choices_values)) {
3388
- $total_queries = $total_queries + $columns_count_shipping - 1;
3389
- for ($k = 0; $k < $columns_count_shipping; $k++) {
3390
- $choice_label = isset($choices_labels) ? $choices_labels[$k][0] : '';
3391
- $choice_value = isset($choices_values) ? (float)$choices_values[$k][0] : '';
3392
- if (isset($post_value)) {
3393
- $param['w_choices_checked'][$key] = (($post_value == $choice_value && htmlspecialchars($choice_label) == htmlspecialchars($_POST['wdform_' . $id1 . "_element_label" . $form_id])) ? 'checked="checked"' : '');
3394
- }
3395
- else {
3396
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
3397
- }
3398
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $choice_value . '" title="' . htmlspecialchars($choice_label[0]) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label . '</label></div></div>';
3399
- }
3400
- }
3401
- }
3402
- else {
3403
- if (isset($post_value)) {
3404
- $param['w_choices_checked'][$key] = (($post_value == $param['w_choices_price'][$key] && htmlspecialchars($choice) == htmlspecialchars($_POST['wdform_' . $id1 . "_element_label" . $form_id])) ? 'checked="checked"' : '');
3405
- }
3406
- else {
3407
- $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
3408
- }
3409
- $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_choices_price'][$key] . '" title="' . htmlspecialchars($choice) . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div></div>';
3410
- }
3411
- }
3412
- $rep .= '</div></div>';
3413
- if ($required) {
3414
- array_push($req_fields, $id1);
3415
- }
3416
- $onsubmit_js .= '
3417
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_element_label' . $form_id . '\" />").val(
3418
- jQuery("label[for=\'"+jQuery("input[name^=\'wdform_' . $id1 . '_element' . $form_id . '\']:checked").attr("id")+"\']").eq(0).text()
3419
- ).appendTo("#form' . $form_id . '");
3420
- ';
3421
- break;
3422
- }
3423
-
3424
- case 'type_submit_reset': {
3425
- $params_names = array('w_submit_title', 'w_reset_title', 'w_class', 'w_act');
3426
- $temp = $params;
3427
- foreach ($params_names as $params_name) {
3428
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3429
- $param[$params_name] = $temp[0];
3430
- $temp = $temp[1];
3431
- }
3432
- if ($temp) {
3433
- $temp = explode('*:*w_attr_name*:*', $temp);
3434
- $attrs = array_slice($temp, 0, count($temp) - 1);
3435
- foreach ($attrs as $attr) {
3436
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3437
- }
3438
- }
3439
- $param['w_act'] = ($param['w_act'] == "false" ? 'style="display: none;"' : "");
3440
- $rep = '<div type="type_submit_reset" class="wdform-field fm-subscribe-reset"><div class="wdform-label-section" style="display: table-cell;"></div><div class="wdform-element-section ' . $param['w_class'] . '" style="display: table-cell;"><button type="button" class="button-submit" onclick="check_required' . $form_id . '(\'submit\', \'' . $form_id . '\');" ' . $param['attributes'] . '>' . $param['w_submit_title'] . '</button><button type="button" class="button-reset" onclick="check_required' . $form_id . '(\'reset\', ' . $form_id . ');" ' . $param['w_act'] . ' ' . $param['attributes'] . '>' . $param['w_reset_title'] . '</button></div></div>';
3441
- break;
3442
- }
3443
-
3444
- case 'type_button': {
3445
- $params_names = array('w_title', 'w_func', 'w_class');
3446
- $temp = $params;
3447
- foreach ($params_names as $params_name) {
3448
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3449
- $param[$params_name] = $temp[0];
3450
- $temp = $temp[1];
3451
- }
3452
- if ($temp) {
3453
- $temp = explode('*:*w_attr_name*:*', $temp);
3454
- $attrs = array_slice($temp, 0, count($temp) - 1);
3455
- foreach ($attrs as $attr) {
3456
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3457
- }
3458
- }
3459
- $param['w_title'] = explode('***', $param['w_title']);
3460
- $param['w_func'] = explode('***', $param['w_func']);
3461
- $rep .= '<div type="type_button" class="wdform-field"><div class="wdform-label-section" style="display: table-cell;"><span style="display: none;">button_' . $id1 . '</span></div><div class="wdform-element-section ' . $param['w_class'] . '" style="display: table-cell;">';
3462
-
3463
- foreach ($param['w_title'] as $key => $title) {
3464
- $rep .= '<button type="button" name="wdform_' . $id1 . '_element' . $form_id . '' . $key . '" onclick="' . $param['w_func'][$key] . '" ' . $param['attributes'] . '>' . $title . '</button>';
3465
- }
3466
- $rep .= '</div></div>';
3467
- break;
3468
- }
3469
-
3470
- case 'type_star_rating': {
3471
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_label_col', 'w_star_amount', 'w_required', 'w_class');
3472
- $temp = $params;
3473
- if (strpos($temp, 'w_hide_label') > -1) {
3474
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_field_label_col', 'w_star_amount', 'w_required', 'w_class');
3475
- }
3476
- foreach ($params_names as $params_name) {
3477
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3478
- $param[$params_name] = $temp[0];
3479
- $temp = $temp[1];
3480
- }
3481
- if ($temp) {
3482
- $temp = explode('*:*w_attr_name*:*', $temp);
3483
- $attrs = array_slice($temp, 0, count($temp) - 1);
3484
- foreach ($attrs as $attr) {
3485
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3486
- }
3487
- }
3488
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3489
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3490
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3491
- if ($param['w_hide_label'] == "yes") {
3492
- $param['w_field_label_pos1'] = "display:none;";
3493
- }
3494
- $required = ($param['w_required'] == "yes" ? true : false);
3495
- $images = '';
3496
- for ($i = 0; $i < $param['w_star_amount']; $i++) {
3497
- $images .= '<img id="wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '" src="' . WD_FM_URL . '/images/star.png" >';
3498
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").mouseover(function() {change_src(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ', "' . $param['w_field_label_col'] . '");});';
3499
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").mouseout(function() {reset_src(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ');});';
3500
- $onload_js .= 'jQuery("#wdform_' . $id1 . '_star_' . $i . '_' . $form_id . '").click(function() {select_star_rating(' . $i . ',"wdform_' . $id1 . '", ' . $form_id . ',"' . $param['w_field_label_col'] . '", "' . $param['w_star_amount'] . '");});';
3501
- }
3502
- $rep = '<div type="type_star_rating" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3503
- if ($required) {
3504
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3505
- }
3506
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" ' . $param['attributes'] . '>' . $images . '</div><input type="hidden" value="" id="wdform_' . $id1 . '_selected_star_amount' . $form_id . '" name="wdform_' . $id1 . '_selected_star_amount' . $form_id . '"></div></div>';
3507
- if ($required) {
3508
- array_push($req_fields, $id1);
3509
- }
3510
- $post = isset($_POST['wdform_' . $id1 . '_selected_star_amount' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_selected_star_amount' . $form_id])) : NULL;
3511
- if (isset($post)) {
3512
- $onload_js .= ' select_star_rating(' . ($post - 1) . ',"wdform_' . $id1 . '", ' . $form_id . ',"' . $param['w_field_label_col'] . '", "' . $param['w_star_amount'] . '");';
3513
- }
3514
- $onsubmit_js .= '
3515
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_star_amount' . $form_id . '\" value = \"' . $param['w_star_amount'] . '\" />").appendTo("#form' . $form_id . '");
3516
- ';
3517
- break;
3518
- }
3519
-
3520
- case 'type_scale_rating': {
3521
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_mini_labels', 'w_scale_amount', 'w_required', 'w_class');
3522
- $temp = $params;
3523
- if (strpos($temp, 'w_hide_label') > -1) {
3524
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_mini_labels', 'w_scale_amount', 'w_required', 'w_class');
3525
- }
3526
- foreach ($params_names as $params_name) {
3527
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3528
- $param[$params_name] = $temp[0];
3529
- $temp = $temp[1];
3530
- }
3531
- if ($temp) {
3532
- $temp = explode('*:*w_attr_name*:*', $temp);
3533
- $attrs = array_slice($temp, 0, count($temp) - 1);
3534
- foreach ($attrs as $attr) {
3535
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3536
- }
3537
- }
3538
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3539
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3540
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3541
- if ($param['w_hide_label'] == "yes") {
3542
- $param['w_field_label_pos1'] = "display:none;";
3543
- }
3544
- $required = ($param['w_required'] == "yes" ? true : false);
3545
- $w_mini_labels = explode('***', $param['w_mini_labels']);
3546
- $numbers = '';
3547
- $radio_buttons = '';
3548
- $to_check = 0;
3549
- $post_value = isset($_POST['wdform_' . $id1 . '_scale_radio' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_scale_radio' . $form_id])) : NULL;
3550
- if (isset($post_value)) {
3551
- $to_check = $post_value;
3552
- }
3553
- for ($i = 1; $i <= $param['w_scale_amount']; $i++) {
3554
- $numbers .= '<div style="text-align: center; display: table-cell;"><span>' . $i . '</span></div>';
3555
- $radio_buttons .= '<div style="text-align: center; display: table-cell;"><div class="radio-div"><input id="wdform_' . $id1 . '_scale_radio' . $form_id . '_' . $i . '" name="wdform_' . $id1 . '_scale_radio' . $form_id . '" value="' . $i . '" type="radio" ' . ($to_check == $i ? 'checked="checked"' : '') . '><label for="wdform_' . $id1 . '_scale_radio' . $form_id . '_' . $i . '"><span></span></label></div></div>';
3556
- }
3557
- $rep = '<div type="type_scale_rating" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3558
- if ($required) {
3559
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3560
- }
3561
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" style="float: left;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[0] . '</label><div style="display: inline-table; vertical-align: middle;border-spacing: 7px;"><div style="display: table-row;">' . $numbers . '</div><div style="display: table-row;">' . $radio_buttons . '</div></div><label class="mini_label" >' . $w_mini_labels[1] . '</label></div></div></div>';
3562
- if ($required) {
3563
- array_push($req_fields, $id1);
3564
- }
3565
- $onsubmit_js .= '
3566
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_scale_amount' . $form_id . '\" value = \"' . $param['w_scale_amount'] . '\" />").appendTo("#form' . $form_id . '");
3567
- ';
3568
- break;
3569
- }
3570
-
3571
- case 'type_spinner': {
3572
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_width', 'w_field_min_value', 'w_field_max_value', 'w_field_step', 'w_field_value', 'w_required', 'w_class');
3573
- $temp = $params;
3574
- if (strpos($temp, 'w_hide_label') > -1) {
3575
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_field_width', 'w_field_min_value', 'w_field_max_value', 'w_field_step', 'w_field_value', 'w_required', 'w_class');
3576
- }
3577
- foreach ($params_names as $params_name) {
3578
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3579
- $param[$params_name] = $temp[0];
3580
- $temp = $temp[1];
3581
- }
3582
- if ($temp) {
3583
- $temp = explode('*:*w_attr_name*:*', $temp);
3584
- $attrs = array_slice($temp, 0, count($temp) - 1);
3585
- foreach ($attrs as $attr) {
3586
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3587
- }
3588
- }
3589
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3590
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3591
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3592
- if ($param['w_hide_label'] == "yes") {
3593
- $param['w_field_label_pos1'] = "display:none;";
3594
- }
3595
- $required = ($param['w_required'] == "yes" ? true : false);
3596
- $param['w_field_value'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_field_value']);
3597
- $rep = '<div type="type_spinner" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3598
- if ($required) {
3599
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3600
- }
3601
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><input type="text" value="' . ($param['w_field_value'] != 'null' ? $param['w_field_value'] : '') . '" name="wdform_' . $id1 . '_element' . $form_id . '" id="wdform_' . $id1 . '_element' . $form_id . '" style="width: ' . $param['w_field_width'] . 'px;" ' . $param['attributes'] . '></div></div>';
3602
- $onload_js .= '
3603
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '")[0].spin = null;
3604
- spinner = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner();
3605
- spinner.spinner( "value", "' . ($param['w_field_value'] != 'null' ? $param['w_field_value'] : '') . '");
3606
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ min: "' . $param['w_field_min_value'] . '"});
3607
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ max: "' . $param['w_field_max_value'] . '"});
3608
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: "' . $param['w_field_step'] . '"});
3609
- ';
3610
- if ($required) {
3611
- array_push($req_fields, $id1);
3612
- }
3613
- $spinner_check[$id1] = array($param['w_field_min_value'], $param['w_field_max_value']);
3614
- break;
3615
- }
3616
-
3617
- case 'type_slider': {
3618
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_width', 'w_field_min_value', 'w_field_max_value', 'w_field_value', 'w_required', 'w_class');
3619
- $temp = $params;
3620
- if (strpos($temp, 'w_hide_label') > -1) {
3621
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_field_width', 'w_field_min_value', 'w_field_max_value', 'w_field_value', 'w_required', 'w_class');
3622
- }
3623
- foreach ($params_names as $params_name) {
3624
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3625
- $param[$params_name] = $temp[0];
3626
- $temp = $temp[1];
3627
- }
3628
- if ($temp) {
3629
- $temp = explode('*:*w_attr_name*:*', $temp);
3630
- $attrs = array_slice($temp, 0, count($temp) - 1);
3631
- foreach ($attrs as $attr) {
3632
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3633
- }
3634
- }
3635
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3636
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3637
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3638
- if ($param['w_hide_label'] == "yes") {
3639
- $param['w_field_label_pos1'] = "display:none;";
3640
- }
3641
- $required = ($param['w_required'] == "yes" ? true : false);
3642
- $param['w_field_value'] = (isset($_POST['wdform_' . $id1 . '_slider_value' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_slider_value' . $form_id])) : $param['w_field_value']);
3643
- $rep = '<div type="type_slider" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3644
- if ($required) {
3645
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3646
- }
3647
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><input type="hidden" value="' . $param['w_field_value'] . '" id="wdform_' . $id1 . '_slider_value' . $form_id . '" name="wdform_' . $id1 . '_slider_value' . $form_id . '"><div name="' . $id1 . '_element' . $form_id . '" id="wdform_' . $id1 . '_element' . $form_id . '" style="width: ' . $param['w_field_width'] . 'px;" ' . $param['attributes'] . '"></div><div align="left" style="display: inline-block; width: 33.3%; text-align: left;"><span id="wdform_' . $id1 . '_element_min' . $form_id . '" class="label">' . $param['w_field_min_value'] . '</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: center;"><span id="wdform_' . $id1 . '_element_value' . $form_id . '" class="label">' . $param['w_field_value'] . '</span></div><div align="right" style="display: inline-block; width: 33.3%; text-align: right;"><span id="wdform_' . $id1 . '_element_max' . $form_id . '" class="label">' . $param['w_field_max_value'] . '</span></div></div></div>';
3648
- $onload_js .= '
3649
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '")[0].slide = null;
3650
- jQuery("#wdform_' . $id1 . '_element' . $form_id . '").slider({
3651
- range: "min",
3652
- value: eval(' . $param['w_field_value'] . '),
3653
- min: eval(' . $param['w_field_min_value'] . '),
3654
- max: eval(' . $param['w_field_max_value'] . '),
3655
- slide: function( event, ui ) {
3656
- jQuery("#wdform_' . $id1 . '_element_value' . $form_id . '").html("" + ui.value);
3657
- jQuery("#wdform_' . $id1 . '_slider_value' . $form_id . '").val("" + ui.value);
3658
- }
3659
- });
3660
- ';
3661
- if ($required) {
3662
- array_push($req_fields, $id1);
3663
- }
3664
- break;
3665
- }
3666
-
3667
- case 'type_range': {
3668
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_range_width', 'w_field_range_step', 'w_field_value1', 'w_field_value2', 'w_mini_labels', 'w_required', 'w_class');
3669
- $temp = $params;
3670
- if (strpos($temp, 'w_hide_label') > -1) {
3671
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_field_range_width', 'w_field_range_step', 'w_field_value1', 'w_field_value2', 'w_mini_labels', 'w_required', 'w_class');
3672
- }
3673
- foreach ($params_names as $params_name) {
3674
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3675
- $param[$params_name] = $temp[0];
3676
- $temp = $temp[1];
3677
- }
3678
- if ($temp) {
3679
- $temp = explode('*:*w_attr_name*:*', $temp);
3680
- $attrs = array_slice($temp, 0, count($temp) - 1);
3681
- foreach ($attrs as $attr) {
3682
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3683
- }
3684
- }
3685
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3686
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3687
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3688
- if ($param['w_hide_label'] == "yes") {
3689
- $param['w_field_label_pos1'] = "display:none;";
3690
- }
3691
- $required = ($param['w_required'] == "yes" ? true : false);
3692
- $param['w_field_value1'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id . '0']) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id . '0'])) : $param['w_field_value1']);
3693
- $param['w_field_value2'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id . '1']) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id . '1'])) : $param['w_field_value2']);
3694
- $w_mini_labels = explode('***', $param['w_mini_labels']);
3695
- $rep = '<div type="type_range" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3696
- if ($required) {
3697
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3698
- }
3699
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div style="display: table;"><div style="display: table-row;"><div valign="middle" align="left" style="display: table-cell;"><input type="text" value="' . ($param['w_field_value1'] != 'null' ? $param['w_field_value1'] : '') . '" name="wdform_' . $id1 . '_element' . $form_id . '0" id="wdform_' . $id1 . '_element' . $form_id . '0" style="width: ' . $param['w_field_range_width'] . 'px;" ' . $param['attributes'] . '></div><div valign="middle" align="left" style="display: table-cell; padding-left: 4px;"><input type="text" value="' . ($param['w_field_value2'] != 'null' ? $param['w_field_value2'] : '') . '" name="wdform_' . $id1 . '_element' . $form_id . '1" id="wdform_' . $id1 . '_element' . $form_id . '1" style="width: ' . $param['w_field_range_width'] . 'px;" ' . $param['attributes'] . '></div></div><div style="display: table-row;"><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_' . $id1 . '_mini_label_from">' . $w_mini_labels[0] . '</label></div><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="wdform_' . $id1 . '_mini_label_to">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
3700
- $onload_js .= '
3701
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0")[0].spin = null;
3702
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1")[0].spin = null;
3703
-
3704
- spinner0 = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '0").spinner();
3705
- spinner0.spinner( "value", "' . ($param['w_field_value1'] != 'null' ? $param['w_field_value1'] : '') . '");
3706
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: ' . $param['w_field_range_step'] . '});
3707
-
3708
- spinner1 = jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '1").spinner();
3709
- spinner1.spinner( "value", "' . ($param['w_field_value2'] != 'null' ? $param['w_field_value2'] : '') . '");
3710
- jQuery("#form' . $form_id . ' #wdform_' . $id1 . '_element' . $form_id . '").spinner({ step: ' . $param['w_field_range_step'] . '});
3711
- ';
3712
- if ($required) {
3713
- array_push($req_fields, $id1);
3714
- }
3715
- break;
3716
- }
3717
-
3718
- case 'type_grading': {
3719
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_items', 'w_total', 'w_required', 'w_class');
3720
- $temp = $params;
3721
- if (strpos($temp, 'w_hide_label') > -1) {
3722
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_items', 'w_total', 'w_required', 'w_class');
3723
- }
3724
- foreach ($params_names as $params_name) {
3725
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3726
- $param[$params_name] = $temp[0];
3727
- $temp = $temp[1];
3728
- }
3729
- if ($temp) {
3730
- $temp = explode('*:*w_attr_name*:*', $temp);
3731
- $attrs = array_slice($temp, 0, count($temp) - 1);
3732
- foreach ($attrs as $attr) {
3733
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3734
- }
3735
- }
3736
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3737
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3738
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3739
- if ($param['w_hide_label'] == "yes") {
3740
- $param['w_field_label_pos1'] = "display:none;";
3741
- }
3742
- $required = ($param['w_required'] == "yes" ? true : false);
3743
- $w_items = explode('***', $param['w_items']);
3744
- $w_items_labels = implode(':', $w_items);
3745
- $grading_items = '';
3746
- for ($i = 0; $i < count($w_items); $i++) {
3747
- $value = (isset($_POST['wdform_' . $id1 . '_element' . $form_id . '_' . $i]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id . '_' . $i])) : '');
3748
- $grading_items .= '<div class="wdform_grading"><input type="text" id="wdform_' . $id1 . '_element' . $form_id . '_' . $i . '" name="wdform_' . $id1 . '_element' . $form_id . '_' . $i . '" value="' . $value . '" ' . $param['attributes'] . '><label class="wdform-ch-rad-label" for="wdform_' . $id1 . '_element' . $form_id . '_' . $i . '">' . $w_items[$i] . '</label></div>';
3749
- }
3750
- $rep = '<div type="type_grading" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3751
- if ($required) {
3752
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3753
- }
3754
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><input type="hidden" value="' . $param['w_total'] . '" name="wdform_' . $id1 . '_grading_total' . $form_id . '" id="wdform_' . $id1 . '_grading_total' . $form_id . '"><div id="wdform_' . $id1 . '_element' . $form_id . '">' . $grading_items . '<div id="wdform_' . $id1 . '_element_total_div' . $form_id . '" class="grading_div">Total: <span id="wdform_' . $id1 . '_sum_element' . $form_id . '">0</span>/<span id="wdform_' . $id1 . '_total_element' . $form_id . '">' . $param['w_total'] . '</span><span id="wdform_' . $id1 . '_text_element' . $form_id . '"></span></div></div></div></div>';
3755
- $onload_js .= '
3756
- jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").change(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});';
3757
- $onload_js .= '
3758
- jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").keyup(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});';
3759
- $onload_js .= '
3760
- jQuery("#wdform_' . $id1 . '_element' . $form_id . ' input").keyup(function() {sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');});';
3761
- $onload_js .= '
3762
- sum_grading_values("wdform_' . $id1 . '",' . $form_id . ');';
3763
- if ($required) {
3764
- array_push($req_fields, $id1);
3765
- }
3766
- $check_js .= 'var isAllowdedSubmit = true;
3767
- if(x.find(jQuery("div[wdid=' . $id1 . ']")).length != 0 && x.find(jQuery("div[wdid=' . $id1 . ']")).css("display") != "none")
3768
- {
3769
- if(parseInt(jQuery("#wdform_' . $id1 . '_sum_element' . $form_id . '").html()) > ' . $param['w_total'] . ')
3770
- {
3771
- alert("' . addslashes(__("Your score should be less than", 'form_maker')) . ' ' . $param['w_total'] . '");
3772
- return false;
3773
- }
3774
- }
3775
- ';
3776
- $onsubmit_js .= '
3777
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_hidden_item' . $form_id . '\" value = \"' . $w_items_labels . ':' . $param['w_total'] . '\" />").appendTo("#form' . $form_id . '");
3778
- ';
3779
- break;
3780
- }
3781
-
3782
- case 'type_matrix': {
3783
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_input_type', 'w_rows', 'w_columns', 'w_required', 'w_class', 'w_textbox_size');
3784
- $temp = $params;
3785
- if (strpos($temp, 'w_hide_label') > -1) {
3786
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_field_input_type', 'w_rows', 'w_columns', 'w_required', 'w_class', 'w_textbox_size');
3787
- }
3788
- foreach ($params_names as $params_name) {
3789
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3790
- $param[$params_name] = $temp[0];
3791
- $temp = $temp[1];
3792
- }
3793
- if ($temp) {
3794
- $temp = explode('*:*w_attr_name*:*', $temp);
3795
- $attrs = array_slice($temp, 0, count($temp) - 1);
3796
- foreach ($attrs as $attr) {
3797
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3798
- }
3799
- }
3800
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3801
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3802
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3803
- if ($param['w_hide_label'] == "yes") {
3804
- $param['w_field_label_pos1'] = "display:none;";
3805
- }
3806
- $required = ($param['w_required'] == "yes" ? true : false);
3807
- $param['w_textbox_size'] = isset($param['w_textbox_size']) ? $param['w_textbox_size'] : '120';
3808
- $w_rows = explode('***', $param['w_rows']);
3809
- $w_columns = explode('***', $param['w_columns']);
3810
- $column_labels = '';
3811
- for ($i = 1; $i < count($w_columns); $i++) {
3812
- $column_labels .= '<div><label class="wdform-ch-rad-label">' . $w_columns[$i] . '</label></div>';
3813
- }
3814
- $rows_columns = '';
3815
- for ($i = 1; $i < count($w_rows); $i++) {
3816
- $rows_columns .= '<div class="wdform-matrix-row' . ($i % 2) . '" row="' . $i . '"><div class="wdform-matrix-column"><label class="wdform-ch-rad-label" >' . $w_rows[$i] . '</label></div>';
3817
- for ($k = 1; $k < count($w_columns); $k++) {
3818
- $rows_columns .= '<div class="wdform-matrix-cell">';
3819
- if ($param['w_field_input_type'] == 'radio') {
3820
- $to_check = 0;
3821
- $post_value = isset($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i])) : NULL;
3822
- if (isset($post_value)) {
3823
- $to_check = $post_value;
3824
- }
3825
- $rows_columns .= '<div class="radio-div"><input id="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" type="radio" name="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '" value="' . $i . '_' . $k . '" ' . ($to_check == $i . '_' . $k ? 'checked="checked"' : '') . '><label for="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '"><span></span></label></div>';
3826
- }
3827
- else {
3828
- if ($param['w_field_input_type'] == 'checkbox') {
3829
- $to_check = 0;
3830
- $post_value = isset($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k])) : NULL;
3831
- if (isset($post_value)) {
3832
- $to_check = $post_value;
3833
- }
3834
- $rows_columns .= '<div class="checkbox-div"><input id="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" type="checkbox" name="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" value="1" ' . ($to_check == "1" ? 'checked="checked"' : '') . '><label for="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '"><span></span></label></div>';
3835
- }
3836
- else {
3837
- if ($param['w_field_input_type'] == 'text') {
3838
- $rows_columns .= '<input id="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" type="text" name="wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k . '" value="' . (isset($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_input_element' . $form_id . '' . $i . '_' . $k])) : "") . '" style="width:' . $param['w_textbox_size'] . 'px">';
3839
- }
3840
- else {
3841
- if ($param['w_field_input_type'] == 'select') {
3842
- $rows_columns .= '<select id="wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k . '" name="wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k . '" ><option value="" ' . (isset($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) && esc_html($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) == "" ? "selected=\"selected\"" : "") . '> </option><option value="yes" ' . (isset($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) && esc_html($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) == "yes" ? "selected=\"selected\"" : "") . '>Yes</option><option value="no" ' . (isset($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) && esc_html($_POST['wdform_' . $id1 . '_select_yes_no' . $form_id . '' . $i . '_' . $k]) == "no" ? "selected=\"selected\"" : "") . '>No</option></select>';
3843
- }
3844
- }
3845
- }
3846
- }
3847
- $rows_columns .= '</div>';
3848
- }
3849
- $rows_columns .= '</div>';
3850
- }
3851
- $rep = '<div type="type_matrix" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3852
- if ($required) {
3853
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3854
- }
3855
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div id="wdform_' . $id1 . '_element' . $form_id . '" class="wdform-matrix-table" ' . $param['attributes'] . '><div style="display: table-row-group;"><div class="wdform-matrix-head"><div style="display: table-cell;"></div>' . $column_labels . '</div>' . $rows_columns . '</div></div></div></div>';
3856
- $onsubmit_js .= '
3857
- jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_input_type' . $form_id . '\" value = \"' . $param['w_field_input_type'] . '\" /><input type=\"hidden\" name=\"wdform_' . $id1 . '_hidden_row' . $form_id . '\" value = \"' . esc_html(addslashes($param['w_rows'])) . '\" /><input type=\"hidden\" name=\"wdform_' . $id1 . '_hidden_column' . $form_id . '\" value = \"' . esc_html(addslashes($param['w_columns'])) . '\" />").appendTo("#form' . $form_id . '");
3858
- ';
3859
- if ($required) {
3860
- array_push($req_fields, $id1);
3861
- }
3862
- break;
3863
- }
3864
-
3865
- case 'type_paypal_total': {
3866
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_class');
3867
- $temp = $params;
3868
- if (strpos($temp, 'w_size') > -1) {
3869
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_class', 'w_size');
3870
- }
3871
- if (strpos($temp, 'w_hide_label') > -1) {
3872
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_class', 'w_size');
3873
- }
3874
- foreach ($params_names as $params_name) {
3875
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3876
- $param[$params_name] = $temp[0];
3877
- $temp = $temp[1];
3878
- }
3879
- if ($temp) {
3880
- $temp = explode('*:*w_attr_name*:*', $temp);
3881
- $attrs = array_slice($temp, 0, count($temp) - 1);
3882
- foreach ($attrs as $attr) {
3883
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3884
- }
3885
- }
3886
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3887
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3888
- $param['w_size'] = isset($param['w_size']) ? $param['w_size'] : '300';
3889
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3890
- if ($param['w_hide_label'] == "yes") {
3891
- $param['w_field_label_pos1'] = "display:none;";
3892
- }
3893
- $rep = '<div type="type_paypal_total" class="wdform-field"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
3894
- $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . '"><div id="wdform_' . $id1 . 'paypal_total' . $form_id . '" class="wdform_paypal_total paypal_total' . $form_id . '" style="width:' . $param['w_size'] . 'px;"><input type="hidden" value="" name="wdform_' . $id1 . '_paypal_total' . $form_id . '" class="input_paypal_total' . $form_id . '"><div id="wdform_' . $id1 . 'div_total' . $form_id . '" class="div_total' . $form_id . '" style="margin-bottom: 10px;"></div><div id="wdform_' . $id1 . 'paypal_products' . $form_id . '" class="paypal_products' . $form_id . '" style="border-spacing: 2px;"><div style="border-spacing: 2px;"></div><div style="border-spacing: 2px;"></div></div><div id="wdform_' . $id1 . 'paypal_tax' . $form_id . '" class="paypal_tax' . $form_id . '" style="border-spacing: 2px; margin-top: 7px;"></div></div></div></div>';
3895
- $onload_js .= 'set_total_value(' . $form_id . ');';
3896
- break;
3897
- }
3898
-
3899
- case 'type_stripe': {
3900
- $params_names = array('w_field_size', 'w_field_label_size', 'w_field_label_pos', 'w_class');
3901
- $temp = $params;
3902
- foreach ($params_names as $params_name) {
3903
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3904
- $param[$params_name] = $temp[0];
3905
- $temp = $temp[1];
3906
- }
3907
- if ($temp) {
3908
- $temp = explode('*:*w_attr_name*:*', $temp);
3909
- $attrs = array_slice($temp, 0, count($temp) - 1);
3910
- foreach ($attrs as $attr) {
3911
- $param['attributes'] = $param['attributes'] . ' ' . $attr;
3912
- }
3913
- }
3914
- $addon_stripe = 'WD_FM_STRIPE';
3915
- if (defined($addon_stripe) && is_plugin_active(constant($addon_stripe))) {
3916
- require_once(WD_FM_STRIPE_DIR . '/controller.php');
3917
- $stripe_fields = WD_FM_STRIPE_controller::stripe_fields($form_id);
3918
- $stripe_enable = (int)WD_FM_STRIPE_controller::stripe_enable($form_id);
3919
- $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
3920
- $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
3921
- $rep = '<div type="type_stripe" class="wdform-field">';
3922
- $index_stripe = 0;
3923
- foreach ($stripe_fields as $class_name => $stripe_field) {
3924
- $elem_index = $index_stripe == 0 ? $id1 : $id1 . '_' . $index_stripe;
3925
- if ($stripe_field->value != 0) {
3926
- if ($stripe_field->type == 'select') {
3927
- $rep .= '<div wdid="wdfm_stripe_' . $index_stripe . '" class="wdform_row ui-sortable-handle">';
3928
- $rep .= '<div class="wdfm_stripe_elem wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;">' . '<span class="wdform-label">' . $stripe_field->label_name . '</span>';
3929
- $required = true;
3930
- if ($required) {
3931
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3932
- }
3933
- $rep .= '</div>'
3934
- . '<div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_field_size']) . 'px; ">'
3935
- . '<select class="' . $class_name . '" id="wdform_' . $elem_index . '_element' . $form_id . '" name="wdform_' . $elem_index . '_element' . $form_id . '" style="width: 100%" ' . $param['attributes'] . '>';
3936
- foreach ($stripe_field->value as $option) {
3937
- $rep .= '<option value="' . $option . '">' . $option . '</option>';
3938
- }
3939
- $rep .= '</select></div></div>';
3940
- }
3941
- else {
3942
- $rep .= '<div wdid="wdfm_stripe_' . $index_stripe . '" class="wdform_row ui-sortable-handle">';
3943
- $rep .= '<div class="wdfm_stripe_elem wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;">'
3944
- . '<span class="wdform-label">' . $stripe_field->label_name . '</span>';
3945
- $required = ($stripe_field->value == 2) ? true : false;
3946
- if ($required) {
3947
- $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
3948
- }
3949
- $rep .= '</div>'
3950
- . '<div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_field_size']) . 'px; ">'
3951
- . '<input type="text" class="' . $class_name . '" id="wdform_' . $elem_index . '_element' . $form_id . '" name="wdform_' . $elem_index . '_element' . $form_id . '" value="" style="width: 100%;" ' . $param['attributes'] . '></div></div>';
3952
- }
3953
- $index_stripe++;
3954
- }
3955
- }
3956
- $_GET['addon_task'] = 'frontend';
3957
- $_GET['form_id'] = $id;
3958
- do_action($addon_stripe . '_init');
3959
- $rep .= '</div>';
3960
- break;
3961
- }
3962
- }
3963
- break;
3964
- }
3965
- $form = str_replace('%' . $id1 . ' - ' . $labels[$id1s_key] . '%', $rep, $form);
3966
- $form = str_replace('%' . $id1 . ' -' . $labels[$id1s_key] . '%', $rep, $form);
3967
- }
3968
- }
3969
- $onsubmit_js .= '
3970
- var disabled_fields ="";
3971
- jQuery("div[wdid]").each(function() {
3972
- if(jQuery(this).css("display")=="none")
3973
- {
3974
- disabled_fields += jQuery(this).attr("wdid");
3975
- disabled_fields += ",";
3976
- }
3977
-
3978
- if(disabled_fields)
3979
- jQuery("<input type=\"hidden\" name=\"disabled_fields' . $form_id . '\" value =\""+disabled_fields+"\" />").appendTo("#form' . $form_id . '");
3980
-
3981
- });';
3982
- $rep1 = array('form_id_temp');
3983
- $rep2 = array($id);
3984
- $form = str_replace($rep1, $rep2, $form);
3985
- if (!$fm_hide_form_after_submit) {
3986
- $form_maker_front_end .= $form;
3987
- }
3988
- if (isset($form_theme['HPAlign']) && ($form_theme['HPAlign'] == 'right' || $form_theme['HPAlign'] == 'bottom')) {
3989
- if ($row->header_title || $row->header_description || $row->header_image_url) {
3990
- $form_maker_front_end .= '<div class="fm-header-bg"><div class="fm-header ' . $image_pos . '">';
3991
- if ($form_theme['HIPAlign'] == 'left' || $form_theme['HIPAlign'] == 'top') {
3992
- if ($row->header_image_url) {
3993
- $form_maker_front_end .= '<div class="fm-header-img ' . $hide_header_image_class . ' fm-animated ' . $header_image_animation . '"><img src="' . $row->header_image_url . '" ' . $image_width . ' ' . $image_height . '/></div>';
3994
- }
3995
- }
3996
-
3997
- if ($row->header_title || $row->header_description) {
3998
- $form_maker_front_end .= '<div class="fm-header-text">
3999
- <div class="fm-header-title">
4000
- ' . $row->header_title . '
4001
- </div>
4002
- <div class="fm-header-description">
4003
- ' . $row->header_description . '
4004
- </div>
4005
- </div>';
4006
- }
4007
-
4008
- if ($form_theme['HIPAlign'] == 'right' || $form_theme['HIPAlign'] == 'bottom') {
4009
- if ($row->header_image_url) {
4010
- $form_maker_front_end .= '<div class="fm-header-img"><img src="' . $row->header_image_url . '" ' . $image_width . ' ' . $image_height . '/></div>';
4011
- }
4012
- }
4013
- $form_maker_front_end .= '</div></div>';
4014
- }
4015
- }
4016
- $form_maker_front_end .= '<div class="wdform_preload"></div>';
4017
- $form_maker_front_end .= '</form>';
4018
- if (defined('WD_FM_CALCULATOR') && is_plugin_active(constant('WD_FM_CALCULATOR'))) { ?>
4019
- <script src="<?php echo WD_FM_CALCULATOR_URL . '/js/math.js'; ?>"></script>
4020
- <script src="<?php echo WD_FM_CALCULATOR_URL . '/js/frontend.js'; ?>"></script>
4021
- <?php } ?>
4022
- <script type="text/javascript">
4023
- plugin_url = "<?php echo WD_FM_URL; ?>";
4024
- WDF_GRADING_TEXT = '<?php echo addslashes(__("Your score should be less than", 'form_maker')); ?>';
4025
- FormCurrency_<?php echo $id; ?> = '<?php echo $form_currency ?>';
4026
- FormPaypalTax_<?php echo $id; ?> = '<?php echo $form_paypal_tax ?>';
4027
- FM_HeaderAnime<?php echo $id; ?> = '<?php echo $row->header_image_animation; ?>';
4028
-
4029
- var fmscrollHandler<?php echo $form_id; ?> = function () {
4030
- var scrollPercent<?php echo $form_id; ?> = 100 * jQuery(window).scrollTop() / (jQuery(document).height() - jQuery(window).height());
4031
- if (!jQuery("#fm-scrollbox<?php echo $form_id; ?>").hasClass("fm-minimized") && scrollPercent<?php echo $form_id; ?> >= <?php echo (int)$row_display->scrollbox_trigger_point; ?>) {
4032
- setTimeout(function () {
4033
- jQuery("#fm-scrollbox<?php echo $form_id; ?>").removeClass("fm-animated fadeOutDown").addClass("fm-animated fadeInUp");
4034
- jQuery("#fm-scrollbox<?php echo $form_id; ?>").css("visibility", "");
4035
- jQuery("#fm-scrollbox<?php echo $form_id; ?> .fm-header-img").addClass("fm-animated <?php echo $row->header_image_animation; ?>");
4036
- }, <?php echo (int)$row_display->scrollbox_loading_delay; ?> * 1000
4037
- )
4038
- ;
4039
- }
4040
- };
4041
-
4042
- var check_submit<?php echo $id; ?> = 0;
4043
- var check_before_submit<?php echo $id; ?> = {};
4044
- var required_fields<?php echo $id; ?> = <?php echo json_encode($req_fields) ?>;
4045
- var labels_and_ids<?php echo $id; ?> = <?php echo json_encode($labels_and_ids) ?>;
4046
- var check_regExp_all<?php echo $id; ?> = <?php echo json_encode($check_regExp_all) ?>;
4047
- var check_paypal_price_min_max<?php echo $id; ?> = <?php echo json_encode($check_paypal_price_min_max) ?>;
4048
- var file_upload_check<?php echo $id; ?> = <?php echo json_encode($file_upload_check) ?>;
4049
- var spinner_check<?php echo $id; ?> = <?php echo json_encode($spinner_check) ?>;
4050
-
4051
- function formOnload<?php echo $id; ?>() {
4052
- if (navigator.userAgent.toLowerCase().indexOf('msie') != -1 && parseInt(navigator.userAgent.toLowerCase().split('msie')[1]) === 8) {
4053
- jQuery("#form<?php echo $id; ?>").find(jQuery("input[type='radio']")).click(function () {
4054
- jQuery("input[type='radio']+label").removeClass('if-ie-div-label');
4055
- jQuery("input[type='radio']:checked+label").addClass('if-ie-div-label')
4056
- });
4057
- jQuery("#form<?php echo $id; ?>").find(jQuery("input[type='radio']:checked+label")).addClass('if-ie-div-label');
4058
- jQuery("#form<?php echo $id; ?>").find(jQuery("input[type='checkbox']")).click(function () {
4059
- jQuery("input[type='checkbox']+label").removeClass('if-ie-div-label');
4060
- jQuery("input[type='checkbox']:checked+label").addClass('if-ie-div-label')
4061
- });
4062
- jQuery("#form<?php echo $id; ?>").find(jQuery("input[type='checkbox']:checked+label")).addClass('if-ie-div-label');
4063
- }
4064
-
4065
- jQuery.each(check_regExp_all<?php echo $id; ?>, function (wdid, exp) {
4066
- var exp_array = {};
4067
- exp_array[wdid] = exp;
4068
- jQuery("div[wdid='" + wdid + "'] input").blur(function () {
4069
- wd_check_regExp(<?php echo $id; ?>, exp_array)
4070
- }).focus(function () {
4071
- jQuery("#form"+<?php echo $id; ?>+
4072
- " #wd_exp_" + wdid
4073
- ).
4074
- remove();
4075
- jQuery("#form"+<?php echo $id; ?>+
4076
- " div[wdid='" + wdid + "'] .wdform-label-section:first .error_label_exp"
4077
- ).
4078
- removeClass("error_label_exp")
4079
- });
4080
- });
4081
-
4082
- jQuery.each(check_paypal_price_min_max<?php echo $id; ?>, function (wdid, price_min_max_option) {
4083
- var price_min_max_array = {};
4084
- price_min_max_array[wdid] = price_min_max_option;
4085
- jQuery("div[wdid='" + wdid + "'] input").blur(function () {
4086
- wd_check_price_min_max(<?php echo $id; ?>, price_min_max_array)
4087
- }).focus(function () {
4088
- jQuery("#form"+<?php echo $id; ?>+
4089
- " #wd_price_" + wdid
4090
- ).
4091
- remove();
4092
- jQuery("#form"+<?php echo $id; ?>+
4093
- " div[wdid='" + wdid + "'] .wdform-label-section:first .error_label_price"
4094
- ).
4095
- removeClass("error_label_price")
4096
- });
4097
- });
4098
-
4099
- jQuery.each(spinner_check<?php echo $id; ?>, function (wdid, spinner_min_max) {
4100
- var spinner_min_max_array = {};
4101
- spinner_min_max_array[wdid] = spinner_min_max;
4102
- jQuery("div[wdid='" + wdid + "'] input").blur(function () {
4103
- wd_spinner_check(<?php echo $id; ?>, spinner_min_max_array)
4104
- }).focus(function () {
4105
- jQuery("#form"+<?php echo $id; ?>+
4106
- " #wd_price_" + wdid
4107
- ).
4108
- remove();
4109
- jQuery("#form"+<?php echo $id; ?>+
4110
- " div[wdid='" + wdid + "'] .wdform-label-section:first .error_label_price"
4111
- ).
4112
- removeClass("error_label_price")
4113
- });
4114
- });
4115
-
4116
- jQuery.each(file_upload_check<?php echo $id; ?>, function (wdid, upload_types) {
4117
- var upload_types_array = {};
4118
- upload_types_array[wdid] = upload_types;
4119
- jQuery("div[wdid='" + wdid + "'] input").change(function () {
4120
- wd_file_upload_check(<?php echo $id; ?>, upload_types_array)
4121
- });
4122
- });
4123
-
4124
- jQuery("div[type='type_text'] input, div[type='type_number'] input, div[type='type_phone'] input, div[type='type_name'] input, div[type='type_submitter_mail'] input, div[type='type_submitter_mail_confirmation'] input, div[type='type_paypal_price'] input, div[type='type_paypal_price_new'] input, div[type='type_textarea'] textarea").focus(function () {
4125
- delete_value(this)
4126
- }).blur(function () {
4127
- return_value(this)
4128
- });
4129
-
4130
- jQuery("div[type='type_number'] input, div[type='type_phone'] input, div[type='type_spinner'] input, div[type='type_range'] input, .wdform-quantity, div[type='type_paypal_price_new'] input").keypress(function (evt) {
4131
- return check_isnum(evt)
4132
- });
4133
-
4134
- jQuery("div[type='type_grading'] input").keypress(function (evt) {
4135
- return check_isnum_or_minus(evt)
4136
- });
4137
-
4138
- jQuery("div[type='type_paypal_checkbox'] input[type='checkbox'], div[type='type_paypal_radio'] input[type='radio'], div[type='type_paypal_shipping'] input[type='radio']").click(function () {
4139
- set_total_value(<?php echo $form_id; ?>)
4140
- });
4141
- jQuery("div[type='type_paypal_select'] select, div[type='type_paypal_price'] input, div[type='type_paypal_price_new'] input").change(function () {
4142
- set_total_value(<?php echo $form_id; ?>)
4143
- });
4144
- jQuery(".wdform-quantity").change(function () {
4145
- set_total_value(<?php echo $form_id; ?>)
4146
- });
4147
-
4148
- jQuery("div[type='type_address'] select").change(function () {
4149
- set_total_value(<?php echo $form_id; ?>)
4150
- });
4151
-
4152
- jQuery("div[type='type_time'] input").blur(function () {
4153
- add_0(this)
4154
- });
4155
-
4156
- jQuery('.wdform-element-section').each(function () {
4157
- if (!jQuery(this).parent()[0].style.width && parseInt(jQuery(this).width()) != 0) {
4158
-
4159
- if (jQuery(this).css('display') == "table-cell") {
4160
- if (jQuery(this).parent().attr('type') != "type_captcha")
4161
- jQuery(this).parent().css('width', parseInt(jQuery(this).width()) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width) + 15);
4162
- else
4163
- jQuery(this).parent().css('width', (parseInt(jQuery(this).parent().find(jQuery(".captcha_input"))[0].style.width) * 2 + 50) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width) + 15);
4164
- }
4165
- }
4166
- if (!jQuery(this).parent()[0].style.width && parseInt(jQuery(this).width()) != 0) {
4167
- if (jQuery(this).css('display') == "table-cell") {
4168
- if (jQuery(this).parent().attr('type') != "type_captcha") {
4169
- jQuery(this).parent().css('width', parseInt(jQuery(this).width()) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width) + 15);
4170
- }
4171
- else {
4172
- jQuery(this).parent().css('width', (parseInt(jQuery(this).parent().find(jQuery(".captcha_input"))[0].style.width) * 2 + 50) + parseInt(jQuery(this).parent().find(jQuery(".wdform-label-section"))[0].style.width) + 15);
4173
- }
4174
- }
4175
- }
4176
- if (parseInt(jQuery(this)[0].style.width.replace('px', '')) < parseInt(jQuery(this).css('min-width').replace('px', '')))
4177
- jQuery(this).css('min-width', parseInt(jQuery(this)[0].style.width.replace('px', '')) - 10);
4178
- });
4179
-
4180
- jQuery('.wdform-label').each(function () {
4181
- if (parseInt(jQuery(this).height()) >= 2 * parseInt(jQuery(this).css('line-height').replace('px', ''))) {
4182
- jQuery(this).parent().css('max-width', jQuery(this).parent().width());
4183
- jQuery(this).parent().css('width', '');
4184
- }
4185
- });
4186
-
4187
- (function (jQuery) {
4188
- jQuery.fn.shuffle = function () {
4189
- var allElems = this.get(),
4190
- getRandom = function (max) {
4191
- return Math.floor(Math.random() * max);
4192
- },
4193
- shuffled = jQuery.map(allElems, function () {
4194
- var random = getRandom(allElems.length),
4195
- randEl = jQuery(allElems[parseInt(random)]).clone(true)[0];
4196
- allElems.splice(random, 1);
4197
- return randEl;
4198
- });
4199
- this.each(function (i) {
4200
- jQuery(this).replaceWith(jQuery(shuffled[i]));
4201
- });
4202
- return jQuery(shuffled);
4203
- };
4204
- })(jQuery);
4205
-
4206
- <?php echo $onload_js; ?>
4207
- <?php
4208
- $addons = array('WD_FM_SAVE_PROG', 'WD_FM_CALCULATOR');
4209
- $addon_data = array();
4210
- foreach ($addons as $addon) {
4211
- if (defined($addon) && is_plugin_active(constant($addon))) {
4212
- $_GET['addon_view'] = 'frontend';
4213
- $_GET['form_id'] = $id;
4214
- do_action($addon . '_init');
4215
- }
4216
- }
4217
- ?>
4218
- <?php echo $condition_js; ?>
4219
-
4220
- if (window.before_load) {
4221
- before_load();
4222
- }
4223
- }
4224
-
4225
- jQuery(window).load(function () {
4226
- formOnload<?php echo $id ?>();
4227
- });
4228
-
4229
- form_view_count<?php echo $id ?>= 0;
4230
- jQuery(document).ready(function () {
4231
- for (i = 1; i <= 30; i++) {
4232
- if (document.getElementById('<?php echo $id ?>form_view' + i)) {
4233
- form_view_count<?php echo $id ?>++;
4234
- form_view_max<?php echo $id ?> = i;
4235
- }
4236
- }
4237
- if (form_view_count<?php echo $id ?> > 1) {
4238
- for (i = 1; i <= form_view_max<?php echo $id ?>; i++) {
4239
- if (document.getElementById('<?php echo $id ?>form_view' + i)) {
4240
- first_form_view<?php echo $id ?> = i;
4241
- break;
4242
- }
4243
- }
4244
- generate_page_nav(first_form_view<?php echo $id ?>, '<?php echo $id ?>', form_view_count<?php echo $id ?>, form_view_max<?php echo $id ?>);
4245
- }
4246
- });
4247
-
4248
- function check_required<?php echo $form_id ?>(but_type, form_id) {
4249
- if (but_type == 'reset') {
4250
- if (window.before_reset) {
4251
- before_reset();
4252
- }
4253
- jQuery.each(window['labels_and_ids' + form_id], function (index, elem) {
4254
- switch (elem) {
4255
- case "type_text":
4256
- case "type_textarea":
4257
- case "type_number":
4258
- case "type_spinner":
4259
- case 'type_own_select':
4260
- case 'type_country':
4261
- case 'type_date':
4262
- case 'type_date_new':
4263
- case 'type_hidden':
4264
- case 'type_phone_new':
4265
- case 'type_paypal_price_new':
4266
- jQuery("#wdform_" + index + "_element" + form_id).val('');
4267
- break;
4268
- case 'type_submitter_mail':
4269
- case 'type_password':
4270
- jQuery("#wdform_" + index + "_element" + form_id).val('');
4271
- if (jQuery("#wdform_" + index + "_1_element" + form_id)) {
4272
- jQuery("#wdform_" + index + "_1_element" + form_id).val('');
4273
-
4274
- if (jQuery("#confirm_" + index + "_" + form_id))
4275
- jQuery("#confirm_" + index + "_" + form_id).remove();
4276
-
4277
- if (elem == 'type_submitter_mail' && jQuery("#check_email_" + index + "_" + form_id))
4278
- jQuery("#check_email_" + index + "_" + form_id).remove();
4279
- }
4280
- break;
4281
- case 'type_date_range':
4282
- jQuery("#wdform_" + index + "_element" + form_id + "0").val('');
4283
- jQuery("#wdform_" + index + "_element" + form_id + "1").val('');
4284
- break;
4285
-
4286
- case 'type_send_copy':
4287
- jQuery("#wdform_" + index + "_element" + form_id).prop('checked', false);
4288
- break;
4289
- case 'type_phone':
4290
- jQuery("#wdform_" + index + "_element_first" + form_id + ", #wdform_" + index + "_element_last" + form_id).val('');
4291
- break;
4292
-
4293
- case 'type_name':
4294
- jQuery("#wdform_" + index + "_element_first" + form_id + ", #wdform_" + index + "_element_last" + form_id + ", #wdform_" + index + "_element_title" + form_id + ", #wdform_" + index + "_element_middle" + form_id).val('');
4295
- break;
4296
-
4297
- case 'type_address':
4298
- jQuery("#wdform_" + index + "_street1" + form_id + ", #wdform_" + index + "_street2" + form_id + ", #wdform_" + index + "_city" + form_id + ", #wdform_" + index + "_state" + form_id + ", #wdform_" + index + "_postal" + form_id + ", #wdform_" + index + "_country" + form_id).val('');
4299
- break;
4300
-
4301
- case 'type_checkbox':
4302
- jQuery("#form" + form_id + " div[wdid='" + index + "'] .checkbox-div input").prop('checked', false);
4303
- jQuery("#wdform_" + index + "_other_br" + form_id).remove();
4304
- jQuery("#wdform_" + index + "_other_input" + form_id).remove();
4305
- break;
4306
-
4307
- case 'type_radio':
4308
- jQuery("#form" + form_id + " div[wdid='" + index + "'] .radio-div input").prop('checked', false);
4309
- jQuery("#wdform_" + index + "_other_br" + form_id).remove();
4310
- jQuery("#wdform_" + index + "_other_input" + form_id).remove();
4311
- break;
4312
-
4313
- case 'type_time':
4314
- jQuery("#wdform_" + index + "_hh" + form_id + ", #wdform_" + index + "_mm" + form_id + ", #wdform_" + index + "_ss" + form_id + ", #wdform_" + index + "_am_pm" + form_id).val('');
4315
- break;
4316
-
4317
- case 'type_date_fields':
4318
- jQuery("#wdform_" + index + "_day" + form_id + ", #wdform_" + index + "_month" + form_id + ", #wdform_" + index + "_year" + form_id).val('');
4319
- break;
4320
-
4321
- case 'type_file_upload':
4322
- jQuery("#wdform_" + index + "_element" + form_id + "_save").remove();
4323
- break;
4324
-
4325
- case 'type_paypal_price':
4326
- jQuery("#wdform_" + index + "_element_dollars" + form_id + ", #wdform_" + index + "_element_cents" + form_id).val('');
4327
- break;
4328
-
4329
- case 'type_paypal_select':
4330
- jQuery("#wdform_" + index + "_element" + form_id + ", #wdform_" + index + "_element_quantity" + form_id + ", #form" + form_id + " div[wdid='" + index + "'] .paypal-property select").val('');
4331
- break;
4332
-
4333
- case 'type_paypal_radio':
4334
- jQuery("#wdform_" + index + "_element_quantity" + form_id + ",#form" + form_id + " div[wdid='" + index + "'] .paypal-property select").val('');
4335
- jQuery("#form" + form_id + " div[wdid='" + index + "'] .radio-div input").prop('checked', false);
4336
- break;
4337
-
4338
- case 'type_paypal_shipping':
4339
- jQuery("#form" + form_id + " div[wdid='" + index + "'] .radio-div input").prop('checked', false);
4340
- break;
4341
-
4342
- case 'type_paypal_checkbox':
4343
- jQuery("#wdform_" + index + "_element_quantity" + form_id + ",#form" + form_id + " div[wdid='" + index + "'] .paypal-property select").val('');
4344
- jQuery("#form" + form_id + " div[wdid='" + index + "'] .checkbox-div input").prop('checked', false);
4345
- break;
4346
-
4347
- case 'type_star_rating':
4348
- jQuery("#wdform_" + index + "_selected_star_amount" + form_id).val('');
4349
- jQuery("#wdform_" + index + "_element" + form_id + " img").attr('src', plugin_url + '/images/star.png');
4350
- break;
4351
-
4352
- case 'type_scale_rating':
4353
- jQuery("#form" + form_id + " div[wdid='" + index + "'] .radio-div input").prop('checked', false);
4354
- break;
4355
-
4356
- case 'type_slider':
4357
- jQuery("#wdform_" + index + "_element" + form_id).slider({
4358
- value: eval(0),
4359
- });
4360
- jQuery("#wdform_" + index + "_element_value" + form_id).html('0');
4361
- break;
4362
-
4363
- case 'type_range':
4364
- jQuery("#wdform_" + index + "_element" + form_id + "0, #wdform_" + index + "_element" + form_id + "1").val('');
4365
- break;
4366
-
4367
- case 'type_grading':
4368
- jQuery("#wdform_" + index + "_element" + form_id + " input").val('');
4369
- break;
4370
-
4371
- case 'type_matrix':
4372
- jQuery("#wdform_" + index + "_element" + form_id + " .radio-div input").prop('checked', false);
4373
- jQuery("#wdform_" + index + "_element" + form_id + " .checkbox-div input").prop('checked', false);
4374
- jQuery("#wdform_" + index + "_element" + form_id + " input[type='text']").val('');
4375
- jQuery("#wdform_" + index + "_element" + form_id + " select").val('');
4376
- break;
4377
-
4378
- case 'type_paypal_total':
4379
- jQuery("#wdform_" + index + "div_total" + form_id).html('$0');
4380
- jQuery("#wdform_" + index + "paypal_products" + form_id).empty();
4381
- break;
4382
- case 'type_captcha':
4383
- jQuery("#wd_captcha_input" + form_id).val('');
4384
- break;
4385
- case 'type_arithmetic_captcha':
4386
- jQuery("#wd_arithmetic_captcha_input" + form_id).val('');
4387
- break;
4388
- default:
4389
- break;
4390
- }
4391
- });
4392
- return;
4393
- }
4394
- if (but_type == 'clear') {
4395
- var clear_data = confirm("Are you sure to clear saved data?");
4396
- if (clear_data == true) {
4397
- jQuery.get('<?php echo add_query_arg(array('action' => 'FMSaveProg', 'addon_task' => 'clear_data'), admin_url('admin-ajax.php')); ?>&form_id =' + form_id).done(function () {
4398
- window.location = "<?php echo $current_url ?>";
4399
- });
4400
- }
4401
- return;
4402
- }
4403
- if (window.before_submit) {
4404
- if (before_submit())
4405
- return false;
4406
- }
4407
-
4408
- if (but_type != 'save') {
4409
- if (!wd_is_filled(form_id))
4410
- return false;
4411
-
4412
- if (!wd_check_regExp(form_id))
4413
- return false;
4414
-
4415
- if (!wd_check_price_min_max(form_id))
4416
- return false;
4417
-
4418
- if (!wd_spinner_check(form_id))
4419
- return false;
4420
-
4421
- if (!wd_file_upload_check(form_id))
4422
- return false;
4423
-
4424
- x = jQuery("#form" + form_id);
4425
- <?php echo $check_js; ?>
4426
- }
4427
-
4428
- var a = [];
4429
- if (typeof a[form_id] !== 'undefined' && a[form_id] == 1) {
4430
- return;
4431
- }
4432
- <?php $onsubmit_js .= 'jQuery("<input type=\"hidden\" name=\"save_or_submit"+form_id+"\" value = \""+but_type+"\" />").appendTo("#form"+form_id);';
4433
-
4434
- echo $onsubmit_js; ?>
4435
-
4436
- a[form_id] = 1;
4437
- <?php
4438
- $stripe_enable = ($stripe_enable && ($stripe_enable == 1 || $stripe_enable == 0)) ? $stripe_enable : 2;
4439
- ?>
4440
- var checkStripe = <?php echo $stripe_enable; ?>;
4441
- if (checkStripe == 1) {
4442
- var jq_mainForm = jQuery("form[id='form" + form_id + "']");
4443
- if (jq_mainForm.find(".wdfm_stripe_elem").first().parents(".wdform_row").is(":visible")) {
4444
- wdfm_call_stripe();
4445
- }
4446
- else {
4447
- document.getElementById("form" + form_id).submit();
4448
- }
4449
- }
4450
- else {
4451
- document.getElementById("form" + form_id).submit();
4452
- }
4453
- }
4454
-
4455
- function check<?php echo $form_id ?>(id, form_id) {
4456
- if (!wd_is_filled(form_id))
4457
- return false;
4458
-
4459
- if (!wd_check_regExp(form_id))
4460
- return false;
4461
-
4462
- if (!wd_check_price_min_max(form_id))
4463
- return false;
4464
-
4465
- if (!wd_spinner_check(form_id))
4466
- return false;
4467
-
4468
- if (!wd_file_upload_check(form_id))
4469
- return false;
4470
-
4471
- x = jQuery("#<?php echo $form_id ?>form_view" + id);
4472
- <?php echo $check_js; ?>
4473
- return true;
4474
- }
4475
- </script>
4476
- <?php
4477
- return $formType == 'embedded' ? WDW_FM_Library::fm_container($theme_id, $form_maker_front_end) : $form_maker_front_end;
4478
- }
4479
-
4480
- public function autoload_form() {
4481
- wp_print_scripts('jquery');
4482
-
4483
- $fm_form = '';
4484
- $fm_forms = array();
4485
- $onload_js = 'var currentDate = new Date();';
4486
-
4487
- $ip_address = $_SERVER['REMOTE_ADDR'];
4488
- $current_date = current_time( "n/j/Y" );
4489
- $forms = $this->model->all_forms();
4490
- foreach($forms as $key => $form) {
4491
- $display_on_this = false;
4492
- $error = 'success';
4493
- $message = false;
4494
- $id = (int)$form->id;
4495
-
4496
- if (isset($_SESSION['redirect_paypal' . $id]) && ($_SESSION['redirect_paypal' . $id] == 1)) {
4497
- $_SESSION['redirect_paypal' . $id] = 0;
4498
- }
4499
- elseif (isset($_SESSION['massage_after_submit' . $id]) && $_SESSION['massage_after_submit' . $id]!='') {
4500
- $massage_after_submit = $_SESSION['massage_after_submit'. $id];
4501
- if($massage_after_submit){
4502
- $message = true;
4503
- }
4504
- }
4505
-
4506
- $display_on = explode(',', $form->display_on);
4507
- $posts_include = explode(',', $form->posts_include);
4508
- $pages_include = explode(',', $form->pages_include);
4509
- $categories_display = explode(',', $form->display_on_categories);
4510
- $current_categories = explode(',', $form->current_categories);
4511
-
4512
- $posts_include = array_filter($posts_include);
4513
- $pages_include = array_filter($pages_include);
4514
-
4515
- if($display_on) {
4516
- wp_reset_query();
4517
- if(in_array('everything', $display_on)) {
4518
- if (is_singular()) {
4519
- if ((is_singular('page') && (!$pages_include || in_array(get_the_ID(), $pages_include))) || (!is_singular('page') && (!$posts_include || in_array( get_the_ID(), $posts_include) ))) {
4520
- $display_on_this = true;
4521
- }
4522
- } else {
4523
- $display_on_this = true;
4524
- }
4525
- }
4526
- else {
4527
- if (is_archive()) {
4528
- if (in_array('archive', $display_on)) {
4529
- $display_on_this = true;
4530
- }
4531
- } else {
4532
- $page_id = ( is_front_page() && !is_page() ) ? 'homepage' : get_the_ID();
4533
- $current_post_type = 'homepage' == $page_id ? 'home' : get_post_type( $page_id );
4534
-
4535
- if (is_singular() || 'home' == $current_post_type) {
4536
- if (in_array('home', $display_on) && is_front_page()) {
4537
- $display_on_this = true;
4538
- }
4539
- }
4540
-
4541
- $posts_and_pages = array();
4542
- foreach ($display_on as $dis) {
4543
- if (!in_array($dis, array('everything', 'home', 'archive', 'category'))) {
4544
- $posts_and_pages[] = $dis;
4545
- }
4546
- }
4547
-
4548
- if($posts_and_pages && is_singular( $posts_and_pages )) {
4549
- switch ( $current_post_type ) {
4550
- case 'page' :
4551
- case 'home' :
4552
- if (!$pages_include || in_array($page_id, $pages_include)) {
4553
- $display_on_this = true;
4554
- }
4555
- break;
4556
-
4557
- case 'post':
4558
- if (!$posts_include || in_array($page_id, $posts_include)) {
4559
- $display_on_this = true;
4560
- }
4561
- else {
4562
- $categories = get_the_terms($page_id, 'category');
4563
- $post_cats = array();
4564
- if ($categories) {
4565
- foreach ($categories as $category) {
4566
- $post_cats[] = $category->term_id;
4567
- }
4568
- }
4569
-
4570
- foreach ($post_cats as $single_cat) {
4571
- if (in_array($single_cat, $categories_display)) {
4572
- $display_on_this = true;
4573
- }
4574
- }
4575
-
4576
- if (false === $display_on_this && !in_array('auto_select_new', $categories_display)) {
4577
- foreach ($post_cats as $single_cat) {
4578
- if (!in_array($single_cat, $current_categories)) {
4579
- $display_on_this = true;
4580
- }
4581
- }
4582
- }
4583
- else {
4584
- $display_on_this = true;
4585
- }
4586
- }
4587
- break;
4588
-
4589
- default:
4590
- if (in_array($current_post_type, $display_on)) {
4591
- $display_on_this = true;
4592
- }
4593
- break;
4594
- }
4595
- }
4596
- }
4597
- }
4598
- }
4599
-
4600
- $show_for_admin = current_user_can('administrator') && $form->show_for_admin ? 'true' : 'false';
4601
- switch ($form->type) {
4602
- case 'topbar': {
4603
- $top_bottom = $form->topbar_position ? 'top' : 'bottom';
4604
- $fixed_relative = !$form->topbar_remain_top && $form->topbar_position ? 'absolute' : 'fixed';
4605
- $closing = $form->topbar_closing;
4606
- $hide_duration = $form->topbar_hide_duration;
4607
- $hide_mobile = wp_is_mobile() && $form->hide_mobile ? false : true;
4608
-
4609
- if($display_on_this && $hide_mobile) {
4610
- if (isset($_SESSION['fm_hide_form_after_submit' .$id]) && $_SESSION['fm_hide_form_after_submit' .$id] == 1) {
4611
- if($error == 'success'){
4612
- if($message){
4613
- $onload_js .= '
4614
- jQuery("#fm-form'.$id.'").css("display", "none");
4615
- jQuery("#fm-pages'.$id.'").css("display", "none");
4616
- jQuery("#fm-topbar'.$id.'").css("visibility", "");
4617
- fm_hide_form('.$id.', '.$hide_duration.');
4618
- ';
4619
- }
4620
- else{
4621
- $onload_js .= '
4622
- fm_hide_form('.$id.', '.$hide_duration.');';
4623
- }
4624
- }
4625
- } else {
4626
- $onload_js .= '
4627
- if('.$hide_duration.' == 0){
4628
- localStorage.removeItem("hide-"+'.$id.');
4629
- }
4630
-
4631
- var hide_topbar = localStorage.getItem("hide-"+'.$id.');
4632
- if(hide_topbar == null || currentDate.getTime() >= hide_topbar || '.$show_for_admin.'){
4633
- jQuery("#fm-topbar'.$id.'").css("visibility", "");
4634
- jQuery("#fm-topbar'.$id.' .fm-header-img").addClass("fm-animated '.($form->header_image_animation).'");
4635
- }';
4636
- }
4637
-
4638
- $fm_form .= '<div id="fm-topbar'.$id.'" class="fm-topbar" style="position: '.$fixed_relative.'; '.$top_bottom.': 0px; visibility:hidden;">'.$this->display($id, $form->type, $onload_js);
4639
- $fm_form .= '<div id="fm-action-buttons'.$id.'" class="fm-action-buttons">';
4640
- if($closing){
4641
- $fm_form .= '<span id="closing-form'.$id.'" class="closing-form fa fa-close" onclick="fm_hide_form('.$id.', '.$hide_duration.', function(){
4642
- jQuery(\'#fm-topbar'.$id.'\').css(\'display\', \'none\');
4643
- })"></span>';
4644
- }
4645
- $fm_form .= '</div>';
4646
- $fm_form .= '</div></div>';
4647
- /* one more closing div for cloasing buttons */
4648
- }
4649
- $fm_forms[$id] = WDW_FM_Library::fm_container($form->theme, $fm_form);
4650
- $fm_form = '';
4651
- break;
4652
- }
4653
- case 'scrollbox': {
4654
- $left_right = $form->scrollbox_position ? 'right' : 'left';
4655
- $loading_delay = (int)$form->scrollbox_loading_delay;
4656
- $trigger_point = (int)$form->scrollbox_trigger_point;
4657
- $closing = $form->scrollbox_closing;
4658
- $minimize = $form->scrollbox_minimize;
4659
- $minimize_text = $form->scrollbox_minimize_text;
4660
- $hide_duration = $form->scrollbox_hide_duration;
4661
- $auto_hide = $form->scrollbox_auto_hide;
4662
- $hide_mobile_class = wp_is_mobile() ? 'fm_mobile_full' : '';
4663
- $hide_mobile = wp_is_mobile() && $form->hide_mobile ? false : true;
4664
- $left_right_class = $form->scrollbox_position ? 'float-right' : 'float-left';
4665
-
4666
- if($display_on_this && $hide_mobile) {
4667
- if (isset($_SESSION['fm_hide_form_after_submit' .$id]) && $_SESSION['fm_hide_form_after_submit' .$id] == 1) {
4668
- if($error == 'success'){
4669
- if($message){
4670
- $onload_js .= '
4671
- jQuery("#fm-form'.$id.', #fm-pages'.$id.'").addClass("fm-hide");
4672
- fm_hide_form('.$id.', '.$hide_duration.');
4673
- jQuery("#fm-scrollbox'.$id.'").removeClass("fm-animated fadeOutDown").addClass("fm-animated fadeInUp");
4674
- jQuery("#fm-scrollbox'.$id.'").css("visibility", "");
4675
- jQuery("#minimize-form'.$id.'").css("visibility", "hidden");
4676
- ';
4677
- }
4678
- else{
4679
- $onload_js .= 'fm_hide_form('.$id.', '.$hide_duration.');';
4680
- }
4681
- }
4682
- }
4683
- else{
4684
- if (isset($_SESSION['error_occurred' .$id]) && $_SESSION['error_occurred' .$id] == 1) {
4685
- $_SESSION['error_occurred' . $id] = 0;
4686
- if($message){
4687
- $onload_js .= '
4688
- jQuery("#fm-scrollbox'.$id.'").removeClass("fm-animated fadeOutDown").addClass("fm-animated fadeInUp");
4689
- jQuery("#fm-scrollbox'.$id.'").removeClass("fm-animated fadeOutDown").addClass("fm-animated fadeInUp");
4690
- jQuery("#fm-scrollbox'.$id.'").css("visibility", "");
4691
- ';
4692
- }
4693
- }
4694
- else {
4695
- $onload_js .= '
4696
- if('.$hide_duration.' == 0){
4697
- localStorage.removeItem("hide-"+'.$id.');
4698
- }
4699
- var hide_scrollbox = localStorage.getItem("hide-"+'.$id.');';
4700
- if($trigger_point > 0){
4701
- $onload_js .= '
4702
- if(hide_scrollbox == null || currentDate.getTime() >= hide_scrollbox || '.$show_for_admin.'){
4703
- jQuery(window).scroll(fmscrollHandler'.$id.');
4704
- }';
4705
- }
4706
- else{
4707
- $onload_js .= '
4708
- if(hide_scrollbox == null || currentDate.getTime() >= hide_scrollbox || '.$show_for_admin.'){
4709
- fmscrollHandler'.$id.'();
4710
- }';
4711
- }
4712
- }
4713
- }
4714
-
4715
- if($minimize){
4716
- $fm_form .= '<div id="fm-minimize-text'.$id.'" class="fm-minimize-text '.$hide_mobile_class.'" onclick="fm_show_scrollbox('.$id.');" style="'.$left_right.': 0px; display:none;"><div>'.$minimize_text.'</div></div>';
4717
- }
4718
- $fm_form .= '<div id="fm-scrollbox'.$id.'" class="fm-scrollbox '.$hide_mobile_class.'" style="'.$left_right.': 0px; visibility:hidden;"><div class="fm-scrollbox-form '.$left_right_class.'">'.$this->display($id, 'scrollbox', $onload_js);
4719
- $fm_form .= '<div id="fm-action-buttons'.$id.'" class="fm-action-buttons">';
4720
- if($minimize){
4721
- $fm_form .= '<span id="minimize-form'.$id.'" class="minimize-form fa fa-minus" onclick="minimize_form('.$id.')"></span>';
4722
- }
4723
- if($closing){
4724
- $fm_form .= '<span id="closing-form'.$id.'" class="closing-form fa fa-close" onclick="fm_hide_form('.$id.', '.$hide_duration.', function(){ jQuery(\'#fm-scrollbox'.$id.'\').removeClass(\'fm-show\').addClass(\'fm-hide\'); });"></span>';
4725
- }
4726
- $fm_form .= '</div></div>';
4727
- $fm_form .= '</div></div>';
4728
- /* one more closing div for cloasing buttons */
4729
- }
4730
- $fm_forms[$id] = WDW_FM_Library::fm_container($form->theme, $fm_form);
4731
- $fm_form = '';
4732
- break;
4733
- }
4734
- case 'popover': {
4735
- $animate_effect = $form->popover_animate_effect;
4736
- $loading_delay = (int)$form->popover_loading_delay;
4737
- $frequency = $form->popover_frequency;
4738
- $hide_mobile = wp_is_mobile() && $form->hide_mobile ? false : true;
4739
- $hide_mobile_class = wp_is_mobile() ? 'fm_mobile_full' : '';
4740
-
4741
- if($display_on_this && $hide_mobile) {
4742
- if (isset($_SESSION['fm_hide_form_after_submit' .$id]) && $_SESSION['fm_hide_form_after_submit' .$id] == 1) {
4743
- if($error == 'success'){
4744
- if($message){
4745
- $onload_js .= '
4746
- jQuery("#fm-form'.$id.'").addClass("fm-hide");
4747
- jQuery("#fm-pages'.$id.'").addClass("fm-hide");
4748
- jQuery("#fm-popover-background'.$id.'").css("display", "block");
4749
- jQuery("#fm-popover'.$id.'").css("visibility", "");
4750
-
4751
- fm_hide_form('.$id.', '.$frequency.');
4752
- ';
4753
- }
4754
- else{
4755
- $onload_js .= '
4756
- jQuery("#fm-form'.$id.'").addClass("fm-hide");
4757
- jQuery("#fm-pages'.$id.'").addClass("fm-hide");
4758
- fm_hide_form('.$id.', '.$frequency.', function(){
4759
- jQuery("#fm-popover-background'.$id.'").css("display", "none");
4760
- jQuery("#fm-popover'.$id.'").css("display", "none");
4761
- });
4762
- ';
4763
- }
4764
- }
4765
- }
4766
- else{
4767
- if (isset($_SESSION['error_occurred' .$id]) && $_SESSION['error_occurred' .$id] == 1) {
4768
- $_SESSION['error_occurred' . $id] = 0;
4769
- if($message){
4770
- $onload_js .= '
4771
- jQuery("#fm-popover-background'.$id.'").css("display", "block");
4772
- jQuery("#fm-popover'.$id.'").css("visibility", "");
4773
- ';
4774
- }
4775
- }
4776
- else {
4777
- $onload_js .= '
4778
- if('.$frequency.' == 0){
4779
- localStorage.removeItem("hide-"+'.$id.');
4780
- }
4781
- var hide_popover = localStorage.getItem("hide-"+'.$id.');
4782
- if(hide_popover == null || currentDate.getTime() >= hide_popover || '.$show_for_admin.'){
4783
- setTimeout(function(){
4784
- jQuery("#fm-popover-background'.$id.'").css("display", "block");
4785
- jQuery("#fm-popover'.$id.'").css("visibility", "");
4786
- jQuery(".fm-popover-content").addClass("fm-animated '.($animate_effect).'");
4787
- jQuery("#fm-popover'.$id.' .fm-header-img").addClass("fm-animated '.($form->header_image_animation).'");
4788
- }, '.($loading_delay * 1000).');
4789
- }';
4790
- }
4791
- }
4792
-
4793
- $onload_js .= '
4794
- jQuery("#fm-popover-inner-background'.$id.'").on("click", function(){
4795
- fm_hide_form('.$id.', '.$frequency.', function(){
4796
- jQuery("#fm-popover-background'.$id.'").css("display", "none");
4797
- jQuery("#fm-popover'.$id.'").css("display", "none");
4798
- });
4799
- });
4800
- ';
4801
-
4802
- $fm_form .= '<div class="fm-popover-background" id="fm-popover-background'.$id.'" style="display:none;"></div><div id="fm-popover'.$id.'" class="fm-popover '.$hide_mobile_class.'" style="visibility:hidden;"><div class="fm-popover-container" id="fm-popover-container'.$id.'"><div class="fm-popover-inner-background" id="fm-popover-inner-background'.$id.'"></div><div class="fm-popover-content">'.$this->display($id, 'popover', $onload_js);
4803
- $fm_form .= '<div id="fm-action-buttons'.$id.'" class="fm-action-buttons">';
4804
- $fm_form .= '<span id="closing-form'.$id.'" class="closing-form fa fa-close" onclick="fm_hide_form('.$id.', '.$frequency.', function(){
4805
- jQuery(\'#fm-popover-background'.$id.'\').css(\'display\', \'none\');
4806
- jQuery(\'#fm-popover'.$id.'\').css(\'display\', \'none\');
4807
- });"></span>';
4808
- $fm_form .= '</div></div></div></div></div>';
4809
- /* one more closing div for cloasing buttons */
4810
- }
4811
- $fm_forms[$id] = WDW_FM_Library::fm_container($form->theme, $fm_form);
4812
- $fm_form = '';
4813
- break;
4814
- }
4815
- }
4816
- }
4817
- return implode($fm_forms);
4818
- }
4819
-
1
+ <?php
2
+
3
+ class FMViewForm_maker {
4
+ private $model;
5
+ public function __construct($model) {
6
+ $this->model = $model;
7
+ }
8
+
9
+ public function display($id, $formType = 'embedded', $onload_js = '') {
10
+ global $wpdb;
11
+ require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
12
+ $fm_settings = get_option('fm_settings');
13
+ $current_user = wp_get_current_user();
14
+ if ($current_user->ID != 0) {
15
+ $wp_userid = $current_user->ID;
16
+ $wp_username = $current_user->display_name;
17
+ $wp_useremail = $current_user->user_email;
18
+ }
19
+ else {
20
+ $wp_userid = '';
21
+ $wp_username = '';
22
+ $wp_useremail = '';
23
+ }
24
+ $current_url = htmlentities($_SERVER['REQUEST_URI']);
25
+ $pattern = '/\/\/(.+)(\r\n|\r|\n)/';
26
+ $result = $this->model->showform($id, $formType);
27
+ if (!$result) {
28
+ return;
29
+ }
30
+ $ok = $this->model->savedata($result[0], $id);
31
+ if (is_numeric($ok)) {
32
+ $this->model->remove($ok);
33
+ }
34
+ $row = $result[0];
35
+ $label_id = $result[2];
36
+ $label_type = $result[3];
37
+ $form_theme = $result[4];
38
+ if (isset($_GET['test_theme']) && (esc_html(stripslashes($_GET['test_theme'])) != '')) {
39
+ /* From preview.*/
40
+ $theme_id = esc_html(stripslashes($_GET['test_theme']));
41
+ }
42
+ else {
43
+ $theme_id = $row->theme;
44
+ }
45
+ $form_maker_front_end = '';
46
+ $row_display = $this->model->display_options($id);
47
+ $this->model->increment_views_count($id);
48
+ $article = $row->article_id;
49
+
50
+ $header_pos = isset($form_theme['HPAlign']) && ($form_theme['HPAlign'] == 'left' || $form_theme['HPAlign'] == 'right') ? (($row->header_title || $row->header_description || $row->header_image_url) ? 'header_left_right' : 'no_header') : '';
51
+ $pagination_align = $row->pagination == 'steps' && isset($form_theme['PSAPAlign']) ? 'fm-align-' . $form_theme['PSAPAlign'] : '';
52
+ $form_maker_front_end .= '<script type="text/javascript">' . preg_replace($pattern, ' ', $row->javascript) . '</script>';
53
+ $form_currency = '$';
54
+ $check_js = '';
55
+ // $onload_js = '';
56
+ $onsubmit_js = '';
57
+ $currency_code = array('USD', 'EUR', 'GBP', 'JPY', 'CAD', 'MXN', 'HKD', 'HUF', 'NOK', 'NZD', 'SGD', 'SEK', 'PLN', 'AUD', 'DKK', 'CHF', 'CZK', 'ILS', 'BRL', 'TWD', 'MYR', 'PHP', 'THB');
58
+ $currency_sign = array('$', '&#8364;', '&#163;', '&#165;', 'C$', 'Mex$', 'HK$', 'Ft', 'kr', 'NZ$', 'S$', 'kr', 'zl', 'A$', 'kr', 'CHF', 'Kc', '&#8362;', 'R$', 'NT$', 'RM', '&#8369;', '&#xe3f;');
59
+ if ($row->payment_currency) {
60
+ $form_currency = $currency_sign[array_search($row->payment_currency, $currency_code)];
61
+ }
62
+ $form_paypal_tax = $row->tax;
63
+ $form_maker_front_end .= '<div id="fm-pages' . $id . '" class="fm-pages wdform_page_navigation ' . $pagination_align . '" show_title="' . $row->show_title . '" show_numbers="' . $row->show_numbers . '" type="' . $row->pagination . '"></div>';
64
+ $form_maker_front_end .= '<form name="form' . $id . '" action="' . $current_url . '" method="post" id="form' . $id . '" class="fm-form form' . $id . ' ' . $header_pos . '" enctype="multipart/form-data" onsubmit="check_required' . $id . '(\'submit\', \'' . $id . '\'); return false;">
65
+ <input type="hidden" id="counter' . $id . '" value="' . $row->counter . '" name="counter' . $id . '" />
66
+ <input type="hidden" id="Itemid' . $id . '" value="" name="Itemid' . $id . '" />';
67
+ $image_pos = isset($form_theme['HIPAlign']) && ($form_theme['HIPAlign'] == 'left' || $form_theme['HIPAlign'] == 'right') ? 'image_left_right' : '';
68
+ $image_width = isset($form_theme['HIPWidth']) && $form_theme['HIPWidth'] ? 'width="' . $form_theme['HIPWidth'] . 'px"' : '';
69
+ $image_height = isset($form_theme['HIPHeight']) && $form_theme['HIPHeight'] ? 'height="' . $form_theme['HIPHeight'] . 'px"' : '';
70
+ $hide_header_image_class = wp_is_mobile() && $row->header_hide_image ? 'fm_hide_mobile' : '';
71
+ $header_image_animation = $formType == 'embedded' ? $row->header_image_animation : '';
72
+ if (!isset($form_theme['HPAlign']) || ($form_theme['HPAlign'] == 'left' || $form_theme['HPAlign'] == 'top')) {
73
+ if ($row->header_title || $row->header_description || $row->header_image_url) {
74
+ $form_maker_front_end .= '<div class="fm-header-bg"><div class="fm-header ' . $image_pos . '">';
75
+ if (!isset($form_theme['HIPAlign']) || $form_theme['HIPAlign'] == 'left' || $form_theme['HIPAlign'] == 'top') {
76
+ if ($row->header_image_url) {
77
+ $form_maker_front_end .= '<div class="fm-header-img ' . $hide_header_image_class . ' fm-animated ' . $header_image_animation . '"><img src="' . $row->header_image_url . '" ' . $image_width . ' ' . $image_height . '/></div>';
78
+ }
79
+ }
80
+ if ($row->header_title || $row->header_description) {
81
+ $form_maker_front_end .= '<div class="fm-header-text">
82
+ <div class="fm-header-title">
83
+ ' . $row->header_title . '
84
+ </div>
85
+ <div class="fm-header-description">
86
+ ' . $row->header_description . '
87
+ </div>
88
+ </div>';
89
+ }
90
+ if (isset($form_theme['HIPAlign']) && ($form_theme['HIPAlign'] == 'right' || $form_theme['HIPAlign'] == 'bottom')) {
91
+ if ($row->header_image_url) {
92
+ $form_maker_front_end .= '<div class="fm-header-img"><img src="' . $row->header_image_url . '" ' . $image_width . ' ' . $image_height . '/></div>';
93
+ }
94
+ }
95
+ $form_maker_front_end .= '</div></div>';
96
+ }
97
+ }
98
+
99
+ $fm_hide_form_after_submit = 0;
100
+ if (isset($_SESSION['form_submit_type' . $id])) {
101
+ $type_and_id = $_SESSION['form_submit_type' . $id];
102
+ $type_and_id = explode(',', $type_and_id);
103
+ $form_get_type = $type_and_id[0];
104
+ $form_get_id = isset($type_and_id[1]) ? $type_and_id[1] : '';
105
+ $_SESSION['form_submit_type' . $id] = 0;
106
+ if ($form_get_type == 3) {
107
+ $_SESSION['massage_after_submit' . $id] = "";
108
+ $after_submission_text = $this->model->get_after_submission_text($form_get_id);
109
+ $form_maker_front_end .= WDW_FM_Library::message(wpautop(html_entity_decode($after_submission_text)), 'warning', $id);
110
+ $fm_hide_form_after_submit = 1;
111
+ }
112
+ }
113
+ if (isset($_SESSION['redirect_paypal' . $id]) && ($_SESSION['redirect_paypal' . $id] == 1)) {
114
+ $_SESSION['redirect_paypal' . $id] = 0;
115
+ if (isset($_GET['succes'])) {
116
+ if ($_GET['succes'] == 0) {
117
+ $form_maker_front_end .= WDW_FM_Library::message(__('Error, email was not sent.', 'form_maker'), 'error', $id);
118
+ }
119
+ else {
120
+ $form_maker_front_end .= WDW_FM_Library::message(__('Your form was successfully submitted.', 'form_maker'), 'warning', $id);
121
+ }
122
+ }
123
+ }
124
+ elseif (isset($_SESSION['massage_after_submit' . $id]) && $_SESSION['massage_after_submit' . $id] != "") {
125
+ $message = $_SESSION['massage_after_submit' . $id];
126
+ $_SESSION['massage_after_submit' . $id] = "";
127
+ if ($_SESSION['error_or_no' . $id]) {
128
+ $error = 'error';
129
+ }
130
+ else {
131
+ $error = 'warning';
132
+ }
133
+ $form_maker_front_end .= WDW_FM_Library::message($message, $error, $id);
134
+ }
135
+ if (isset($_SESSION['massage_after_save' . $id]) && $_SESSION['massage_after_save' . $id] != "") {
136
+ $save_message = $_SESSION['massage_after_save' . $id];
137
+ $_SESSION['massage_after_save' . $id] = '';
138
+ if (isset($_SESSION['save_error' . $id]) && $_SESSION['save_error' . $id] == 2) {
139
+ echo $save_message;
140
+ }
141
+ else {
142
+ $save_error = $_SESSION['save_error' . $id] ? 'error' : 'warning';
143
+ $form_maker_front_end .= WDW_FM_Library::message($save_message, $save_error, $id);
144
+ }
145
+ }
146
+ if (isset($_SESSION['show_submit_text' . $id])) {
147
+ if ($_SESSION['show_submit_text' . $id] == 1) {
148
+ $_SESSION['show_submit_text' . $id] = 0;
149
+ $form_maker_front_end .= $row->submit_text;
150
+ }
151
+ }
152
+ if (isset($_SESSION['fm_hide_form_after_submit' . $id]) && $_SESSION['fm_hide_form_after_submit' . $id] == 1) {
153
+ $_SESSION['fm_hide_form_after_submit' . $id] = 0;
154
+ $fm_hide_form_after_submit = 1;
155
+ }
156
+
157
+ $stripe_enable = 0;
158
+ $is_type = array();
159
+ $id1s = array();
160
+ $types = array();
161
+ $labels = array();
162
+ $paramss = array();
163
+ $required_sym = $row->requiredmark;
164
+ $fields = explode('*:*new_field*:*', $row->form_fields);
165
+ $fields = array_slice($fields, 0, count($fields) - 1);
166
+ foreach ($fields as $field) {
167
+ $temp = explode('*:*id*:*', $field);
168
+ array_push($id1s, $temp[0]);
169
+ $temp = explode('*:*type*:*', $temp[1]);
170
+ array_push($types, $temp[0]);
171
+ $temp = explode('*:*w_field_label*:*', $temp[1]);
172
+ array_push($labels, $temp[0]);
173
+ array_push($paramss, $temp[1]);
174
+ }
175
+
176
+ $labels_and_ids = array_combine($id1s, $types);
177
+ $form_id = $id;
178
+ $symbol_begin = array();
179
+ $symbol_end = array();
180
+ if (defined('WD_FM_CALCULATOR') && is_plugin_active(constant('WD_FM_CALCULATOR'))) {
181
+ $row_calc = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'formmaker_calculator WHERE form_id=' . $form_id, ARRAY_A);
182
+ $symbol_end = json_decode($row_calc['symbol_end'], true);
183
+ $symbol_begin = json_decode($row_calc['symbol_begin'], true);
184
+ }
185
+ $show_hide = array();
186
+ $field_label = array();
187
+ $all_any = array();
188
+ $condition_params = array();
189
+ $type_and_id = array();
190
+ $condition_js = '';
191
+ if ($row->condition != "") {
192
+ $conditions = explode('*:*new_condition*:*', $row->condition);
193
+ $conditions = array_slice($conditions, 0, count($conditions) - 1);
194
+ $count_of_conditions = count($conditions);
195
+ foreach ($conditions as $condition) {
196
+ $temp = explode('*:*show_hide*:*', $condition);
197
+ array_push($show_hide, $temp[0]);
198
+ $temp = explode('*:*field_label*:*', $temp[1]);
199
+ array_push($field_label, $temp[0]);
200
+ $temp = explode('*:*all_any*:*', $temp[1]);
201
+ array_push($all_any, $temp[0]);
202
+ array_push($condition_params, $temp[1]);
203
+ }
204
+ foreach ($id1s as $id1s_key => $id1) {
205
+ $type_and_id[$id1] = $types[$id1s_key];
206
+ }
207
+ for ($k = 0; $k < $count_of_conditions; $k++) {
208
+ if ($show_hide[$k]) {
209
+ $display = 'removeAttr("style")';
210
+ $display_none = 'css("display", "none")';
211
+ }
212
+ else {
213
+ $display = 'css("display", "none")';
214
+ $display_none = 'removeAttr("style")';
215
+ }
216
+ if ($all_any[$k] == "and") {
217
+ $or_and = '&&';
218
+ }
219
+ else {
220
+ $or_and = '||';
221
+ }
222
+ if ($condition_params[$k]) {
223
+ $cond_params = explode('*:*next_condition*:*', $condition_params[$k]);
224
+ $cond_params = array_slice($cond_params, 0, count($cond_params) - 1);
225
+ for ($l = 0; $l < count($cond_params); $l++) {
226
+ $params_value = explode('***', $cond_params[$l]);
227
+ if (!isset($type_and_id[$params_value[0]])) {
228
+ unset($cond_params[$l]);
229
+ }
230
+ }
231
+ $cond_params = array_values($cond_params);
232
+ $if = '';
233
+ $keyup = '';
234
+ $change = '';
235
+ $click = '';
236
+ $blur = '';
237
+ for ($m = 0; $m < count($cond_params); $m++) {
238
+ $params_value = explode('***', wp_specialchars_decode($cond_params[$m], 'single'));
239
+ switch ($type_and_id[$params_value[0]]) {
240
+ case "type_text":
241
+ case "type_password":
242
+ case "type_textarea":
243
+ case "type_number":
244
+ case "type_submitter_mail":
245
+ case "type_spinner":
246
+ case "type_paypal_price_new":
247
+ case "type_date_new":
248
+ case "type_phone_new":
249
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
250
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
251
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
252
+ }
253
+ else {
254
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
255
+ $params_value[2] = "";
256
+ $params_value[1] = $params_value[1] . "=";
257
+ }
258
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
259
+ }
260
+ $keyup .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
261
+ if ($type_and_id[$params_value[0]] == "type_date_new") {
262
+ $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
263
+ }
264
+ if ($type_and_id[$params_value[0]] == "type_spinner") {
265
+ $click .= '#wdform_' . $params_value[0] . '_element' . $form_id . ' ~ a, ';
266
+ }
267
+ if ($type_and_id[$params_value[0]] == "type_phone_new") {
268
+ $blur = '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
269
+ }
270
+ break;
271
+ case "type_name":
272
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
273
+ $extended0 = '';
274
+ $extended1 = '';
275
+ $extended2 = '';
276
+ $extended3 = '';
277
+ $normal0 = '';
278
+ $normal1 = '';
279
+ $normal2 = '';
280
+ $normal3 = '';
281
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
282
+ $name_fields = explode(' ', $params_value[2]);
283
+ if ($name_fields[0] != '') {
284
+ $extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 ';
285
+ $normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[0] . '")' . $like_or_not . '-1 ';
286
+ }
287
+ if (isset($name_fields[1]) && $name_fields[1] != '') {
288
+ $extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 ';
289
+ $normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[1] . '")' . $like_or_not . '-1 ';
290
+ }
291
+ if (isset($name_fields[2]) && $name_fields[2] != '') {
292
+ $extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $name_fields[2] . '")' . $like_or_not . '-1 ';
293
+ $normal2 = '';
294
+ }
295
+ if (isset($name_fields[3]) && $name_fields[3] != '') {
296
+ $extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val().indexOf("' . $name_fields[3] . '")' . $like_or_not . '-1 ';
297
+ $normal3 = '';
298
+ }
299
+ if (isset($name_fields[3])) {
300
+ $extended = '';
301
+ $normal = '';
302
+ if ($extended0) {
303
+ $extended = $extended0;
304
+ if ($extended1) {
305
+ $extended .= ' && ' . $extended1;
306
+ if ($extended2) {
307
+ $extended .= ' && ' . $extended2;
308
+ }
309
+ if ($extended3) {
310
+ $extended .= ' && ' . $extended3;
311
+ }
312
+ }
313
+ else {
314
+ if ($extended2) {
315
+ $extended .= ' && ' . $extended2;
316
+ }
317
+ if ($extended3) {
318
+ $extended .= ' && ' . $extended3;
319
+ }
320
+ }
321
+ }
322
+ else {
323
+ if ($extended1) {
324
+ $extended = $extended1;
325
+ if ($extended2) {
326
+ $extended .= ' && ' . $extended2;
327
+ }
328
+ if ($extended3) {
329
+ $extended .= ' && ' . $extended3;
330
+ }
331
+ }
332
+ else {
333
+ if ($extended2) {
334
+ $extended = $extended2;
335
+ if ($extended3) {
336
+ $extended .= ' && ' . $extended3;
337
+ }
338
+ }
339
+ else {
340
+ if ($extended3) {
341
+ $extended = $extended3;
342
+ }
343
+ }
344
+ }
345
+ }
346
+ if ($normal0) {
347
+ $normal = $normal0;
348
+ if ($normal1) {
349
+ $normal .= ' && ' . $normal1;
350
+ }
351
+ }
352
+ else {
353
+ if ($normal1) {
354
+ $normal = $normal1;
355
+ }
356
+ }
357
+ }
358
+ else {
359
+ if (isset($name_fields[2])) {
360
+ $extended = "";
361
+ $normal = "";
362
+ if ($extended0) {
363
+ $extended = $extended0;
364
+ if ($extended1) {
365
+ $extended .= ' && ' . $extended1;
366
+ }
367
+ if ($extended2) {
368
+ $extended .= ' && ' . $extended2;
369
+ }
370
+ }
371
+ else {
372
+ if ($extended1) {
373
+ $extended = $extended1;
374
+ if ($extended2) {
375
+ $extended .= ' && ' . $extended2;
376
+ }
377
+ }
378
+ else {
379
+ if ($extended2) {
380
+ $extended = $extended2;
381
+ }
382
+ }
383
+ }
384
+ if ($normal0) {
385
+ $normal = $normal0;
386
+ if ($normal1) {
387
+ $normal .= ' && ' . $normal1;
388
+ }
389
+ }
390
+ else {
391
+ if ($normal1) {
392
+ $normal = $normal1;
393
+ }
394
+ }
395
+ }
396
+ else {
397
+ if (isset($name_fields[1])) {
398
+ $extended = '';
399
+ $normal = '';
400
+ if ($extended0) {
401
+ if ($extended1) {
402
+ $extended = $extended0 . ' && ' . $extended1;
403
+ }
404
+ else {
405
+ $extended = $extended0;
406
+ }
407
+ }
408
+ else {
409
+ if ($extended1) {
410
+ $extended = $extended1;
411
+ }
412
+ }
413
+ if ($normal0) {
414
+ if ($normal1) {
415
+ $normal = $normal0 . ' && ' . $normal1;
416
+ }
417
+ else {
418
+ $normal = $normal0;
419
+ }
420
+ }
421
+ else {
422
+ if ($normal1) {
423
+ $normal = $normal1;
424
+ }
425
+ }
426
+ }
427
+ else {
428
+ $extended = $extended0;
429
+ $normal = $normal0;
430
+ }
431
+ }
432
+ }
433
+ if ($extended != "" && $normal != "") {
434
+ $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') ';
435
+ }
436
+ else {
437
+ $if .= ' true';
438
+ }
439
+ }
440
+ else {
441
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
442
+ $name_and_or = $params_value[1] == "=" ? "&&" : "||";
443
+ $name_empty_or_not = $params_value[1] . "=";
444
+ $extended = ' (jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $name_empty_or_not . '"") ';
445
+ $normal = ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $name_empty_or_not . '"" ' . $name_and_or . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $name_empty_or_not . '"") ';
446
+ $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') ';
447
+ }
448
+ else {
449
+ $extended0 = '';
450
+ $extended1 = '';
451
+ $extended2 = '';
452
+ $extended3 = '';
453
+ $normal0 = '';
454
+ $normal1 = '';
455
+ $normal2 = '';
456
+ $normal3 = '';
457
+ $name_fields = explode(' ', $params_value[2]);
458
+ if ($name_fields[0] != '') {
459
+ $extended0 = 'jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"';
460
+ $normal0 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[0] . '"';
461
+ }
462
+ if (isset($name_fields[1]) && $name_fields[1] != '') {
463
+ $extended1 = 'jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"';
464
+ $normal1 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[1] . '"';
465
+ }
466
+ if (isset($name_fields[2]) && $name_fields[2] != '') {
467
+ $extended2 = 'jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[2] . '"';
468
+ $normal2 = '';
469
+ }
470
+ if (isset($name_fields[3]) && $name_fields[3] != '') {
471
+ $extended3 = 'jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").val()' . $params_value[1] . '"' . $name_fields[3] . '"';
472
+ $normal3 = '';
473
+ }
474
+ if (isset($name_fields[3])) {
475
+ $extended = '';
476
+ $normal = '';
477
+ if ($extended0) {
478
+ $extended = $extended0;
479
+ if ($extended1) {
480
+ $extended .= ' && ' . $extended1;
481
+ if ($extended2) {
482
+ $extended .= ' && ' . $extended2;
483
+ }
484
+ if ($extended3) {
485
+ $extended .= ' && ' . $extended3;
486
+ }
487
+ }
488
+ else {
489
+ if ($extended2) {
490
+ $extended .= ' && ' . $extended2;
491
+ }
492
+ if ($extended3) {
493
+ $extended .= ' && ' . $extended3;
494
+ }
495
+ }
496
+ }
497
+ else {
498
+ if ($extended1) {
499
+ $extended = $extended1;
500
+ if ($extended2) {
501
+ $extended .= ' && ' . $extended2;
502
+ }
503
+ if ($extended3) {
504
+ $extended .= ' && ' . $extended3;
505
+ }
506
+ }
507
+ else {
508
+ if ($extended2) {
509
+ $extended = $extended2;
510
+ if ($extended3) {
511
+ $extended .= ' && ' . $extended3;
512
+ }
513
+ }
514
+ else {
515
+ if ($extended3) {
516
+ $extended = $extended3;
517
+ }
518
+ }
519
+ }
520
+ }
521
+ if ($normal0) {
522
+ $normal = $normal0;
523
+ if ($normal1) {
524
+ $normal .= ' && ' . $normal1;
525
+ }
526
+ }
527
+ else {
528
+ if ($normal1) {
529
+ $normal = $normal1;
530
+ }
531
+ }
532
+ }
533
+ else {
534
+ if (isset($name_fields[2])) {
535
+ $extended = "";
536
+ $normal = "";
537
+ if ($extended0) {
538
+ $extended = $extended0;
539
+ if ($extended1) {
540
+ $extended .= ' && ' . $extended1;
541
+ }
542
+ if ($extended2) {
543
+ $extended .= ' && ' . $extended2;
544
+ }
545
+ }
546
+ else {
547
+ if ($extended1) {
548
+ $extended = $extended1;
549
+ if ($extended2) {
550
+ $extended .= ' && ' . $extended2;
551
+ }
552
+ }
553
+ else {
554
+ if ($extended2) {
555
+ $extended = $extended2;
556
+ }
557
+ }
558
+ }
559
+ if ($normal0) {
560
+ $normal = $normal0;
561
+ if ($normal1) {
562
+ $normal .= ' && ' . $normal1;
563
+ }
564
+ }
565
+ else {
566
+ if ($normal1) {
567
+ $normal = $normal1;
568
+ }
569
+ }
570
+ }
571
+ else {
572
+ if (isset($name_fields[1])) {
573
+ $extended = '';
574
+ $normal = '';
575
+ if ($extended0) {
576
+ if ($extended1) {
577
+ $extended = $extended0 . ' && ' . $extended1;
578
+ }
579
+ else {
580
+ $extended = $extended0;
581
+ }
582
+ }
583
+ else {
584
+ if ($extended1) {
585
+ $extended = $extended1;
586
+ }
587
+ }
588
+ if ($normal0) {
589
+ if ($normal1) {
590
+ $normal = $normal0 . ' && ' . $normal1;
591
+ }
592
+ else {
593
+ $normal = $normal0;
594
+ }
595
+ }
596
+ else {
597
+ if ($normal1) {
598
+ $normal = $normal1;
599
+ }
600
+ }
601
+ }
602
+ else {
603
+ $extended = $extended0;
604
+ $normal = $normal0;
605
+ }
606
+ }
607
+ }
608
+ if ($extended != "" && $normal != "") {
609
+ $if .= ' ((jQuery("#wdform_' . $params_value[0] . '_element_title' . $form_id . '").length != 0 || jQuery("#wdform_' . $params_value[0] . '_element_middle' . $form_id . '").length != 0) ? ' . $extended . ' : ' . $normal . ') ';
610
+ }
611
+ else {
612
+ $if .= ' true';
613
+ }
614
+ }
615
+ }
616
+ $keyup .= '#wdform_' . $params_value[0] . '_element_title' . $form_id . ', #wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', #wdform_' . $params_value[0] . '_element_middle' . $form_id . ', ';
617
+ break;
618
+ case "type_phone":
619
+ if ($params_value[1] == "==" || $params_value[1] == "!=") {
620
+ $phone_fields = explode(' ', $params_value[2]);
621
+ if (isset($phone_fields[1])) {
622
+ if ($phone_fields[0] != '' && $phone_fields[1] != '') {
623
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[0] . '" && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
624
+ }
625
+ else {
626
+ if ($phone_fields[0] == '') {
627
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
628
+ }
629
+ else {
630
+ if ($phone_fields[1] == '') {
631
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $phone_fields[1] . '") ';
632
+ }
633
+ }
634
+ }
635
+ }
636
+ else {
637
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
638
+ }
639
+ }
640
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
641
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
642
+ $phone_fields = explode(' ', $params_value[2]);
643
+ if (isset($phone_fields[1])) {
644
+ if ($phone_fields[0] != '' && $phone_fields[1] != '') {
645
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1 && jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1)';
646
+ }
647
+ else {
648
+ if ($phone_fields[0] == '') {
649
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val().indexOf("' . $phone_fields[1] . '")' . $like_or_not . '-1) ';
650
+ }
651
+ else {
652
+ if ($phone_fields[1] == '') {
653
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) ';
654
+ }
655
+ }
656
+ }
657
+ }
658
+ else {
659
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val().indexOf("' . $phone_fields[0] . '")' . $like_or_not . '-1) ';
660
+ }
661
+ }
662
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
663
+ $params_value[2] = "";
664
+ $and_or_phone = ($params_value[1] == "=" ? "&&" : "||");
665
+ $params_value[1] = $params_value[1] . "=";
666
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_element_first' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_phone . ' jQuery("#wdform_' . $params_value[0] . '_element_last' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '") ';
667
+ }
668
+ $keyup .= '#wdform_' . $params_value[0] . '_element_first' . $form_id . ', #wdform_' . $params_value[0] . '_element_last' . $form_id . ', ';
669
+ break;
670
+ case "type_paypal_price":
671
+ if ($params_value[1] == "==" || $params_value[1] == "!=") {
672
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : parseFloat(jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val())' . $params_value[1] . 'parseFloat("' . str_replace('.0', '.', $params_value[2]) . '"))';
673
+ }
674
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
675
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
676
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()+"."+jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()).indexOf("' . str_replace('.0', '.', $params_value[2]) . '")' . $like_or_not . '-1) ';
677
+ }
678
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
679
+ $params_value[2] = "";
680
+ $and_or_price = ($params_value[1] == "=" ? "&&" : "||");
681
+ $params_value[1] = $params_value[1] . "=";
682
+ $if .= ' (jQuery("#wdform_' . $params_value[0] . '_td_name_cents").attr("style")=="display: none;" ? jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" : (jQuery("#wdform_' . $params_value[0] . '_element_dollars' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or_price . ' jQuery("#wdform_' . $params_value[0] . '_element_cents' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"))';
683
+ }
684
+ $keyup .= '#wdform_' . $params_value[0] . '_element_dollars' . $form_id . ', #wdform_' . $params_value[0] . '_element_cents' . $form_id . ', ';
685
+ break;
686
+ case "type_own_select":
687
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
688
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
689
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
690
+ }
691
+ else {
692
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
693
+ $params_value[2] = "";
694
+ $params_value[1] = $params_value[1] . "=";
695
+ }
696
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
697
+ }
698
+ $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
699
+ break;
700
+ case "type_paypal_select":
701
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
702
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
703
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
704
+ }
705
+ else {
706
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
707
+ $params_value[2] = "";
708
+ $params_value[1] = $params_value[1] . "=";
709
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '"';
710
+ }
711
+ else {
712
+ if (strpos($params_value[2], '*:*value*:*') > -1) {
713
+ $and_or = $params_value[1] == "==" ? '&&' : '||';
714
+ $choise_and_value = explode("*:*value*:*", $params_value[2]);
715
+ $params_value[2] = $choise_and_value[1];
716
+ $params_label = $choise_and_value[0];
717
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or . ' jQuery("div[wdid=' . $params_value[0] . '] select option:selected").text()' . $params_value[1] . '"' . $params_label . '" ';
718
+ }
719
+ else {
720
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
721
+ }
722
+ }
723
+ }
724
+ $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
725
+ break;
726
+ case "type_address":
727
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
728
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
729
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
730
+ }
731
+ else {
732
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
733
+ $params_value[2] = "";
734
+ $params_value[1] = $params_value[1] . "=";
735
+ }
736
+ $if .= ' jQuery("#wdform_' . $params_value[0] . '_country' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
737
+ }
738
+ $change .= '#wdform_' . $params_value[0] . '_country' . $form_id . ', ';
739
+ break;
740
+ case "type_country":
741
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
742
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
743
+ $if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 ';
744
+ }
745
+ else {
746
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
747
+ $params_value[2] = "";
748
+ $params_value[1] = $params_value[1] . "=";
749
+ }
750
+ $if .= ' wdformjQuery("#wdform_' . $params_value[0] . '_element' . $form_id . '").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
751
+ }
752
+ $change .= '#wdform_' . $params_value[0] . '_element' . $form_id . ', ';
753
+ break;
754
+ case "type_radio":
755
+ case "type_paypal_radio":
756
+ case "type_paypal_shipping":
757
+ if ($params_value[1] == "==" || $params_value[1] == "!=") {
758
+ if (strpos($params_value[2], '*:*value*:*') > -1) {
759
+ $and_or = $params_value[1] == "==" ? '&&' : '||';
760
+ $choise_and_value = explode("*:*value*:*", $params_value[2]);
761
+ $params_value[2] = $choise_and_value[1];
762
+ $params_label = $choise_and_value[0];
763
+ $if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" ' . $and_or . ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("title")' . $params_value[1] . '"' . $params_label . '" ';
764
+ }
765
+ else {
766
+ $if .= ' jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()' . $params_value[1] . '"' . $params_value[2] . '" ';
767
+ }
768
+ $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
769
+ }
770
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
771
+ $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
772
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
773
+ $if .= ' (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val() ? (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").attr("other") ? false : (jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val().indexOf("' . $params_value[2] . '")' . $like_or_not . '-1 )) : false) ';
774
+ }
775
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
776
+ $ckecked_or_no = ($params_value[1] == "=" ? "!" : "");
777
+ $if .= ' ' . $ckecked_or_no . 'jQuery("input[name^=\'wdform_' . $params_value[0] . '_element' . $form_id . '\']:checked").val()';
778
+ $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'radio\'], ';
779
+ }
780
+ break;
781
+ case "type_checkbox":
782
+ case "type_paypal_checkbox":
783
+ if ($params_value[1] == "==" || $params_value[1] == "!=") {
784
+ if ($params_value[2]) {
785
+ $choises = explode('@@@', $params_value[2]);
786
+ $choises = array_slice($choises, 0, count($choises) - 1);
787
+ if ($params_value[1] == "!=") {
788
+ $is = "!";
789
+ }
790
+ else {
791
+ $is = "";
792
+ }
793
+ foreach ($choises as $key1 => $choise) {
794
+ if ($type_and_id[$params_value[0]] == "type_paypal_checkbox") {
795
+ $choise_and_value = explode("*:*value*:*", $choise);
796
+ $if .= ' ' . $is . '(jQuery("#form' . $form_id . ' div[wdid=' . $params_value[0] . '] input[value=\"' . $choise_and_value[1] . '\"]").is(":checked") && jQuery("div[wdid=' . $params_value[0] . '] input[title=\"' . $choise_and_value[0] . '\"]"))';
797
+ }
798
+ else {
799
+ $if .= ' ' . $is . 'jQuery("#form' . $form_id . ' div[wdid=' . $params_value[0] . '] input[value=\"' . $choise . '\"]").is(":checked") ';
800
+ }
801
+ if ($key1 != count($choises) - 1) {
802
+ $if .= '&&';
803
+ }
804
+ }
805
+ $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
806
+ }
807
+ else {
808
+ if ($or_and == '&&') {
809
+ $if .= ' true';
810
+ }
811
+ else {
812
+ $if .= ' false';
813
+ }
814
+ }
815
+ }
816
+ if ($params_value[1] == "%" || $params_value[1] == "!%") {
817
+ $like_or_not = ($params_value[1] == "%" ? ">" : "==");
818
+ if ($params_value[2]) {
819
+ $choises = explode('@@@', $params_value[2]);
820
+ $choises = array_slice($choises, 0, count($choises) - 1);
821
+ if ($type_and_id[$params_value[0]] == "type_paypal_checkbox") {
822
+ foreach ($choises as $key1 => $choise) {
823
+ $choise_and_value = explode("*:*value*:*", $choise);
824
+ $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").serialize().indexOf("' . $choise_and_value[1] . '")' . $like_or_not . '-1 ';
825
+ if ($key1 != count($choises) - 1) {
826
+ $if .= '&&';
827
+ }
828
+ }
829
+ }
830
+ else {
831
+ foreach ($choises as $key1 => $choise) {
832
+ $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").serialize().indexOf("' . str_replace(" ", "+", $choise) . '")' . $like_or_not . '-1 ';
833
+ if ($key1 != count($choises) - 1) {
834
+ $if .= '&&';
835
+ }
836
+ }
837
+ }
838
+ $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
839
+ }
840
+ else {
841
+ if ($or_and == '&&') {
842
+ $if .= ' true';
843
+ }
844
+ else {
845
+ $if .= ' false';
846
+ }
847
+ }
848
+ }
849
+ if ($params_value[1] == "=" || $params_value[1] == "!") {
850
+ $ckecked_or_no = ($params_value[1] == "=" ? "==" : ">");
851
+ $if .= ' jQuery("div[wdid=' . $params_value[0] . '] input[type=\"checkbox\"]:checked").length' . $ckecked_or_no . '0 ';
852
+ $click .= 'div[wdid=' . $params_value[0] . '] input[type=\'checkbox\'], ';
853
+ }
854
+ break;
855
+ }
856
+ if ($m != count($cond_params) - 1) {
857
+ $params_value_next = explode('***', $cond_params[$m + 1]);
858
+ if (isset($type_and_id[$params_value_next[0]])) {
859
+ $if .= $or_and;
860
+ }
861
+ }
862
+ }
863
+ if ($if) {
864
+ $condition_js .= '
865
+ if(' . $if . ')
866
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
867
+ else
868
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . ';';
869
+ }
870
+ if ($keyup) {
871
+ $condition_js .= '
872
+ jQuery("' . substr($keyup, 0, -2) . '").keyup(function() {
873
+ if(' . $if . ')
874
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
875
+ else
876
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
877
+ }
878
+ if ($change) {
879
+ $condition_js .= '
880
+ jQuery("' . substr($change, 0, -2) . '").change(function() {
881
+ if(' . $if . ')
882
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
883
+ else
884
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
885
+ }
886
+ if ($blur) {
887
+ $condition_js .= '
888
+ jQuery("' . substr($blur, 0, -2) . '").blur(function() {
889
+ if(' . $if . ')
890
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
891
+ else
892
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
893
+ }
894
+ if ($click) {
895
+ $condition_js .= '
896
+ jQuery("' . substr($click, 0, -2) . '").click(function() {
897
+ if(' . $if . ')
898
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display . ';
899
+ else
900
+ jQuery("#form' . $form_id . ' div[wdid=' . $field_label[$k] . ']").' . $display_none . '; });';
901
+ }
902
+ }
903
+ }
904
+ }
905
+
906
+ if ($row->autogen_layout == 0) {
907
+ $form = $row->custom_front;
908
+ }
909
+ else {
910
+ $form = $row->form_front;
911
+ }
912
+
913
+ $req_fields = array();
914
+ $check_regExp_all = array();
915
+ $check_paypal_price_min_max = array();
916
+ $file_upload_check = array();
917
+ $spinner_check = array();
918
+
919
+ $GLOBALS['map_include'] = false;
920
+
921
+ foreach ($id1s as $id1s_key => $id1) {
922
+ $label = $labels[$id1s_key];
923
+ $type = $types[$id1s_key];
924
+ $params = $paramss[$id1s_key];
925
+ if (strpos($form, '%' . $id1 . ' - ' . $label . '%') || strpos($form, '%' . $id1 . ' -' . $label . '%')) {
926
+ $rep = '';
927
+ $required = false;
928
+ $param = array();
929
+ $param['attributes'] = '';
930
+ $is_type[$type] = true;
931
+ switch ($type) {
932
+ case 'type_section_break': {
933
+ $params_names = array('w_editor');
934
+ $temp = $params;
935
+ foreach ($params_names as $params_name) {
936
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
937
+ $param[$params_name] = $temp[0];
938
+ $temp = $temp[1];
939
+ }
940
+ $rep = '<div type="type_section_break" class="wdform-field-section-break"><div class="wdform_section_break">' . html_entity_decode($param['w_editor']) . '</div></div>';
941
+ break;
942
+ }
943
+ case 'type_editor': {
944
+ $params_names = array('w_editor');
945
+ $temp = $params;
946
+ foreach ($params_names as $params_name) {
947
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
948
+ $param[$params_name] = $temp[0];
949
+ $temp = $temp[1];
950
+ }
951
+ $rep = '<div type="type_editor" class="wdform-field">' . html_entity_decode($param['w_editor']) . '</div>';
952
+ break;
953
+ }
954
+ case 'type_send_copy': {
955
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required');
956
+ $temp = $params;
957
+ if (strpos($temp, 'w_hide_label') > -1) {
958
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_first_val', 'w_required');
959
+ }
960
+ foreach ($params_names as $params_name) {
961
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
962
+ $param[$params_name] = $temp[0];
963
+ $temp = $temp[1];
964
+ }
965
+ if ($temp) {
966
+ $temp = explode('*:*w_attr_name*:*', $temp);
967
+ $attrs = array_slice($temp, 0, count($temp) - 1);
968
+ foreach ($attrs as $attr) {
969
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
970
+ }
971
+ }
972
+ $input_active = ($param['w_first_val'] == 'true' ? "checked='checked'" : "");
973
+ $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
974
+ if (isset($post_value)) {
975
+ $post_temp = isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : "";
976
+ $input_active = (isset($post_temp) ? "checked='checked'" : "");
977
+ }
978
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
979
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
980
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
981
+ if ($param['w_hide_label'] == "yes") {
982
+ $param['w_field_label_pos1'] = "display:none;";
983
+ }
984
+ $required = ($param['w_required'] == "yes" ? true : false);
985
+ $rep = '<div type="type_send_copy" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label"><label for="wdform_' . $id1 . '_element' . $form_id . '">' . $label . '</label></span>';
986
+ if ($required) {
987
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
988
+ }
989
+ $rep .= '</div>
990
+ <div class="wdform-element-section" style="' . $param['w_field_label_pos2'] . '" >
991
+ <div class="checkbox-div" style="left:3px">
992
+ <input type="checkbox" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" ' . $input_active . ' ' . $param['attributes'] . '/>
993
+ <label for="wdform_' . $id1 . '_element' . $form_id . '"><span></span></label>
994
+ </div>
995
+ </div></div>';
996
+ $onsubmit_js .= '
997
+ if(!jQuery("#wdform_' . $id1 . '_element' . $form_id . '").is(":checked"))
998
+ jQuery("<input type=\"hidden\" name=\"wdform_send_copy_' . $form_id . '\" value = \"1\" />").appendTo("#form' . $form_id . '");';
999
+ if ($required) {
1000
+ array_push($req_fields, $id1);
1001
+ }
1002
+ break;
1003
+ }
1004
+
1005
+ case 'type_text': {
1006
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique');
1007
+ $temp = $params;
1008
+ if (strpos($temp, 'w_regExp_status') > -1) {
1009
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique');
1010
+ }
1011
+ if (strpos($temp, 'w_readonly') > -1) {
1012
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique', 'w_readonly');
1013
+ }
1014
+ if (strpos($temp, 'w_hide_label') > -1) {
1015
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_regExp_status', 'w_regExp_value', 'w_regExp_common', 'w_regExp_arg', 'w_regExp_alert', 'w_unique', 'w_readonly');
1016
+ }
1017
+ foreach ($params_names as $params_name) {
1018
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1019
+ $param[$params_name] = $temp[0];
1020
+ $temp = $temp[1];
1021
+ }
1022
+ if ($temp) {
1023
+ $temp = explode('*:*w_attr_name*:*', $temp);
1024
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1025
+ foreach ($attrs as $attr) {
1026
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1027
+ }
1028
+ }
1029
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1030
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 50 : max($param['w_field_label_size'], $param['w_size']));
1031
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1032
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1033
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1034
+ if ($param['w_hide_label'] == "yes") {
1035
+ $param['w_field_label_pos1'] = "display:none;";
1036
+ }
1037
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1038
+ $required = ($param['w_required'] == "yes" ? true : false);
1039
+ $param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no");
1040
+ $readonly = (isset($param['w_readonly']) && $param['w_readonly'] == "yes" ? "readonly='readonly'" : '');
1041
+ $symbol_begin_text = isset($symbol_begin[$id1]) ? $symbol_begin[$id1] : '';
1042
+ $symbol_end_text = isset($symbol_end[$id1]) ? $symbol_end[$id1] : '';
1043
+ $display_begin = $symbol_begin ? 'display:table-cell' : 'display:none;';
1044
+ $display_end = $symbol_end != '' ? 'display:table-cell' : 'display:none;';
1045
+ $input_width = $symbol_begin_text || $symbol_end_text ? '' : 'width:100%';
1046
+ $check_regExp = '';
1047
+ $rep = '<div type="type_text" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1048
+ if ($required) {
1049
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1050
+ }
1051
+ $rep .= '</div><div class="wdform-element-section" style="' . $param['w_field_label_pos2'] . '; width:' . $param['w_size'] . 'px;">
1052
+ <div style="display:table; width: 100%;">
1053
+ <div style="display:table-row;">
1054
+ <div style="' . $display_begin . ';"><span style="vertical-align:middle;">' . $symbol_begin_text . '</span></div>
1055
+ <div style="display:table-cell;">
1056
+ <input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" ' . $readonly . ' ' . $param['attributes'] . ' style="' . $input_width . '"></div><div style="' . $display_end . ';"><span style="vertical-align:middle;">' . $symbol_end_text . '</span></div>
1057
+ </div>
1058
+ </div>
1059
+ </div></div>';
1060
+ if ($required) {
1061
+ array_push($req_fields, $id1);
1062
+ }
1063
+ if ($param['w_regExp_status'] == 'yes') {
1064
+ $check_regExp_all[$id1] = array($param["w_regExp_value"], $param["w_regExp_arg"], $param["w_regExp_alert"]);
1065
+ }
1066
+ break;
1067
+ }
1068
+
1069
+ case 'type_number': {
1070
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1071
+ $temp = $params;
1072
+ foreach ($params_names as $params_name) {
1073
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1074
+ $param[$params_name] = $temp[0];
1075
+ $temp = $temp[1];
1076
+ }
1077
+ if ($temp) {
1078
+ $temp = explode('*:*w_attr_name*:*', $temp);
1079
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1080
+ foreach ($attrs as $attr) {
1081
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1082
+ }
1083
+ }
1084
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1085
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']));
1086
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1087
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1088
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1089
+ $required = ($param['w_required'] == "yes" ? true : false);
1090
+ $rep = '<div type="type_number" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" class="' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1091
+ if ($required) {
1092
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1093
+ }
1094
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" style="width: 100%;" ' . $param['attributes'] . '></div></div>';
1095
+ if ($required) {
1096
+ array_push($req_fields, $id1);
1097
+ }
1098
+ break;
1099
+ }
1100
+
1101
+ case 'type_password': {
1102
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_required', 'w_unique', 'w_class');
1103
+ $temp = $params;
1104
+ if (strpos($temp, 'w_hide_label') > -1) {
1105
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_required', 'w_unique', 'w_class');
1106
+ }
1107
+ if (strpos($temp, 'w_verification') > -1) {
1108
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_required', 'w_unique', 'w_class', 'w_verification', 'w_verification_label');
1109
+ }
1110
+ foreach ($params_names as $params_name) {
1111
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1112
+ $param[$params_name] = $temp[0];
1113
+ $temp = $temp[1];
1114
+ }
1115
+ if ($temp) {
1116
+ $temp = explode('*:*w_attr_name*:*', $temp);
1117
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1118
+ foreach ($attrs as $attr) {
1119
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1120
+ }
1121
+ }
1122
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size'] + 10 : max($param['w_field_label_size'], $param['w_size']));
1123
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1124
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1125
+ $required = ($param['w_required'] == "yes" ? true : false);
1126
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1127
+ if ($param['w_hide_label'] == "yes") {
1128
+ $param['w_field_label_pos1'] = "display:none;";
1129
+ }
1130
+ $rep = '<div type="type_password" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" class="' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1131
+ if ($required) {
1132
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1133
+ }
1134
+ $message_confirm = addslashes(__("Password values don't match", "form_maker"));
1135
+ $onchange = (isset($param['w_verification']) && $param['w_verification'] == "yes") ? ' onchange="wd_check_confirmation_pass(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')"' : "";
1136
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="password" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . $onchange . '></div></div>';
1137
+ if (isset($param['w_verification']) && $param['w_verification'] == "yes") {
1138
+ $rep .= '<div><div type="type_password_confirmation" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $param['w_verification_label'] . '</span>';
1139
+ if ($required) {
1140
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1141
+ }
1142
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="password" id="wdform_' . $id1 . '_1_element' . $form_id . '" name="wdform_' . $id1 . '_1_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . ' onchange="wd_check_confirmation_pass(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')"></div></div></div>';
1143
+ }
1144
+ if ($required) {
1145
+ array_push($req_fields, $id1);
1146
+ }
1147
+ break;
1148
+ }
1149
+
1150
+ case 'type_textarea': {
1151
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size_w', 'w_size_h', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1152
+ $temp = $params;
1153
+ if (strpos($temp, 'w_hide_label') > -1) {
1154
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size_w', 'w_size_h', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1155
+ }
1156
+ foreach ($params_names as $params_name) {
1157
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1158
+ $param[$params_name] = $temp[0];
1159
+ $temp = $temp[1];
1160
+ }
1161
+ if ($temp) {
1162
+ $temp = explode('*:*w_attr_name*:*', $temp);
1163
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1164
+ foreach ($attrs as $attr) {
1165
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1166
+ }
1167
+ }
1168
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1169
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? $param['w_field_label_size'] + $param['w_size_w'] + 10 : max($param['w_field_label_size'], $param['w_size_w']));
1170
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1171
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1172
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1173
+ if ($param['w_hide_label'] == "yes") {
1174
+ $param['w_field_label_pos1'] = "display:none;";
1175
+ }
1176
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1177
+ $required = ($param['w_required'] == "yes" ? true : false);
1178
+ $rep = '<div type="type_textarea" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1179
+ if ($required) {
1180
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1181
+ }
1182
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size_w'] . 'px"><textarea class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" title="' . $param['w_title'] . '" style="width: 100%; height: ' . $param['w_size_h'] . 'px;" ' . $param['attributes'] . '>' . str_replace(array("\r\n", "\n\r", "\n", "\r"), "&#13;", $param['w_first_val']) . '</textarea></div></div>';
1183
+ if ($required) {
1184
+ array_push($req_fields, $id1);
1185
+ }
1186
+ break;
1187
+ }
1188
+
1189
+ case 'type_phone': {
1190
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_mini_labels', 'w_required', 'w_unique', 'w_class');
1191
+ $temp = $params;
1192
+ if (strpos($temp, 'w_hide_label') > -1) {
1193
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_mini_labels', 'w_required', 'w_unique', 'w_class');
1194
+ }
1195
+ foreach ($params_names as $params_name) {
1196
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1197
+ $param[$params_name] = $temp[0];
1198
+ $temp = $temp[1];
1199
+ }
1200
+ if ($temp) {
1201
+ $temp = explode('*:*w_attr_name*:*', $temp);
1202
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1203
+ foreach ($attrs as $attr) {
1204
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1205
+ }
1206
+ }
1207
+ $w_first_val = explode('***', $param['w_first_val']);
1208
+ $w_title = explode('***', $param['w_title']);
1209
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]);
1210
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size'] + 65) : max($param['w_field_label_size'], ($param['w_size'] + 65)));
1211
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1212
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1213
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1214
+ if ($param['w_hide_label'] == "yes") {
1215
+ $param['w_field_label_pos1'] = "display:none;";
1216
+ }
1217
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1218
+ $required = ($param['w_required'] == "yes" ? true : false);
1219
+ $w_first_val = explode('***', $param['w_first_val']);
1220
+ $w_title = explode('***', $param['w_title']);
1221
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
1222
+ $rep = '<div type="type_phone" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label" >' . $label . '</span>';
1223
+ if ($required) {
1224
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1225
+ }
1226
+ $rep .= '
1227
+ </div>
1228
+ <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_size'] + 65) . 'px;">
1229
+ <div style="display: table-cell;">
1230
+ <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width: 52px;" ' . $param['attributes'] . '></div>
1231
+ <div><label class="mini_label">' . $w_mini_labels[0] . '</label></div>
1232
+ </div>
1233
+ <div style="display: table-cell;">
1234
+ <div class="wdform_line" style="margin: 0px 4px 10px 4px; padding: 0px;">-</div>
1235
+ </div>
1236
+ <div style="display: table-cell; width:100%;">
1237
+ <div><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;" ' . $param['attributes'] . '></div>
1238
+ <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
1239
+ </div>
1240
+ </div>
1241
+ </div>';
1242
+ if ($required) {
1243
+ array_push($req_fields, $id1);
1244
+ }
1245
+ break;
1246
+ }
1247
+
1248
+ case 'type_phone_new': {
1249
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_top_country', 'w_required', 'w_unique', 'w_class');
1250
+ $temp = $params;
1251
+ foreach ($params_names as $params_name) {
1252
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1253
+ $param[$params_name] = $temp[0];
1254
+ $temp = $temp[1];
1255
+ }
1256
+ if ($temp) {
1257
+ $temp = explode('*:*w_attr_name*:*', $temp);
1258
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1259
+ foreach ($attrs as $attr) {
1260
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1261
+ }
1262
+ }
1263
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1264
+
1265
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size'] + 10) : max($param['w_field_label_size'], ($param['w_size'])));
1266
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1267
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1268
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1269
+ if ($param['w_hide_label'] == "yes") {
1270
+ $param['w_field_label_pos1'] = "display:none;";
1271
+ }
1272
+
1273
+ $required = ($param['w_required'] == "yes" ? true : false);
1274
+
1275
+ $rep = '<div type="type_phone_new" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label" >' . $label . '</span>';
1276
+ if ($required) {
1277
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1278
+ }
1279
+ $rep .= '
1280
+ </div>
1281
+ <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;">
1282
+ <input type="text" class="input_active" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" style="width: 100%;" placeholder="" ' . $param['attributes'] . '>
1283
+ </div>
1284
+ </div>';
1285
+
1286
+ if ($required) {
1287
+ array_push($req_fields, $id1);
1288
+ }
1289
+ $onload_js .= '
1290
+
1291
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").intlTelInput({
1292
+ nationalMode: false,
1293
+ preferredCountries: [ "' . $param["w_top_country"] . '" ],
1294
+ customPlaceholder: "Phone",
1295
+ });
1296
+ ';
1297
+ break;
1298
+ }
1299
+
1300
+ case 'type_name': {
1301
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
1302
+ $temp = $params;
1303
+ if (strpos($temp, 'w_name_fields') > -1) {
1304
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields');
1305
+ }
1306
+ if (strpos($temp, 'w_autofill') > -1) {
1307
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields', 'w_autofill');
1308
+ }
1309
+ if (strpos($temp, 'w_hide_label') > -1) {
1310
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class', 'w_name_fields', 'w_autofill');
1311
+ }
1312
+ foreach ($params_names as $params_name) {
1313
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1314
+ $param[$params_name] = $temp[0];
1315
+ $temp = $temp[1];
1316
+ }
1317
+ if ($temp) {
1318
+ $temp = explode('*:*w_attr_name*:*', $temp);
1319
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1320
+ foreach ($attrs as $attr) {
1321
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1322
+ }
1323
+ }
1324
+ $w_first_val = explode('***', $param['w_first_val']);
1325
+ $w_title = explode('***', $param['w_title']);
1326
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
1327
+ $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
1328
+ $w_name_fields = explode('***', $param['w_name_fields']);
1329
+ $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
1330
+ $element_title = isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_title' . $form_id])) : NULL;
1331
+ $element_middle = isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_middle' . $form_id])) : NULL;
1332
+ $element_first = isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : NULL;
1333
+ if (isset($element_title) || isset($element_middle)) {
1334
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_title' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_title' . $form_id])) : $w_first_val[2]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_middle' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_middle' . $form_id])) : $w_first_val[3]);
1335
+ }
1336
+ else {
1337
+ if (isset($element_first)) {
1338
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element_first' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_first' . $form_id])) : $w_first_val[0]) . '***' . (isset($_POST['wdform_' . $id1 . '_element_last' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element_last' . $form_id])) : $w_first_val[1]);
1339
+ }
1340
+ }
1341
+ $w_first_val = explode('***', $param['w_first_val']);
1342
+ $required = ($param['w_required'] == "yes" ? true : false);
1343
+ if ($param['w_autofill'] == 'yes' && $wp_username) {
1344
+ $user_display_name = explode(' ', $wp_username);
1345
+ $w_first_val[0] = $user_display_name[0];
1346
+ $w_first_val[1] = isset($user_display_name[1]) ? $user_display_name[1] : $w_first_val[1];
1347
+ }
1348
+ if ($w_name_fields[0] == 'no' && $w_name_fields[1] == 'no') {
1349
+ $w_name_format = '
1350
+ <div style="display: table-cell; width:50%">
1351
+ <div><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width: 100%;"' . $param['attributes'] . '></div>
1352
+ <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
1353
+ </div>
1354
+ <div style="display:table-cell;"><div style="margin: 0px 8px; padding: 0px;"></div></div>
1355
+ <div style="display: table-cell; width:50%">
1356
+ <div><input type="text" class="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;" ' . $param['attributes'] . '></div>
1357
+ <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
1358
+ </div>
1359
+ ';
1360
+ $w_size = 2 * $param['w_size'];
1361
+ }
1362
+ else {
1363
+ $first_last_size = $w_name_fields[0] == 'yes' && $w_name_fields[1] == 'no' ? 45 : 30;
1364
+ $w_name_format = '
1365
+ <div style="display: table-cell; width:' . $first_last_size . '%">
1366
+ <div><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_first' . $form_id . '" name="wdform_' . $id1 . '_element_first' . $form_id . '" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" style="width:100%;"></div>
1367
+ <div><label class="mini_label">' . $w_mini_labels[1] . '</label></div>
1368
+ </div>
1369
+ <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1370
+ <div style="display: table-cell; width:' . $first_last_size . '%">
1371
+ <div><input type="text" class="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_last' . $form_id . '" name="wdform_' . $id1 . '_element_last' . $form_id . '" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" style="width: 100%;"></div>
1372
+ <div><label class="mini_label">' . $w_mini_labels[2] . '</label></div>
1373
+ </div>';
1374
+ $w_size = 2 * $param['w_size'];
1375
+ if ($w_name_fields[0] == 'yes') {
1376
+ $w_name_format = '
1377
+ <div style="display: table-cell;">
1378
+ <div><input type="text" class="' . ($w_first_val[2] == $w_title[2] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_title' . $form_id . '" name="wdform_' . $id1 . '_element_title' . $form_id . '" value="' . $w_first_val[2] . '" title="' . $w_title[2] . '" style="width: 40px;"></div>
1379
+ <div><label class="mini_label">' . $w_mini_labels[0] . '</label></div>
1380
+ </div>
1381
+ <div style="display:table-cell;"><div style="margin: 0px 1px; padding: 0px;"></div></div>' . $w_name_format;
1382
+ $w_size += 80;
1383
+ }
1384
+ if ($w_name_fields[1] == 'yes') {
1385
+ $w_name_format = $w_name_format . '
1386
+ <div style="display:table-cell;"><div style="margin: 0px 4px; padding: 0px;"></div></div>
1387
+ <div style="display: table-cell; width:30%">
1388
+ <div><input type="text" class="' . ($w_first_val[3] == $w_title[3] ? "input_deactive" : "input_active") . '" id="wdform_' . $id1 . '_element_middle' . $form_id . '" name="wdform_' . $id1 . '_element_middle' . $form_id . '" value="' . $w_first_val[3] . '" title="' . $w_title[3] . '" style="width: 100%;"></div>
1389
+ <div><label class="mini_label">' . $w_mini_labels[3] . '</label></div>
1390
+ </div>
1391
+ ';
1392
+ $w_size += $param['w_size'];
1393
+ }
1394
+ }
1395
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $w_size) : max($param['w_field_label_size'], $w_size));
1396
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1397
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1398
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1399
+ if ($param['w_hide_label'] == "yes") {
1400
+ $param['w_field_label_pos1'] = "display:none;";
1401
+ }
1402
+ $rep = '<div type="type_name" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1403
+ if ($required) {
1404
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1405
+ }
1406
+ $rep .= '</div>
1407
+ <div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $w_size . 'px;">' . $w_name_format . '</div></div>';
1408
+ if ($required) {
1409
+ array_push($req_fields, $id1);
1410
+ }
1411
+ break;
1412
+ }
1413
+
1414
+ case 'type_address': {
1415
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
1416
+ $temp = $params;
1417
+ if (strpos($temp, 'w_hide_label') > -1) {
1418
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
1419
+ }
1420
+ foreach ($params_names as $params_name) {
1421
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1422
+ $param[$params_name] = $temp[0];
1423
+ $temp = $temp[1];
1424
+ }
1425
+ if ($temp) {
1426
+ $temp = explode('*:*w_attr_name*:*', $temp);
1427
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1428
+ foreach ($attrs as $attr) {
1429
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1430
+ }
1431
+ }
1432
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1433
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1434
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1435
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1436
+ if ($param['w_hide_label'] == "yes") {
1437
+ $param['w_field_label_pos1'] = "display:none;";
1438
+ }
1439
+ $required = ($param['w_required'] == "yes" ? true : false);
1440
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
1441
+ $w_disabled_fields = explode('***', $param['w_disabled_fields']);
1442
+ $rep = '<div type="type_address" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1443
+ if ($required) {
1444
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1445
+ }
1446
+ $address_fields = '';
1447
+ $g = 0;
1448
+ if (isset($w_disabled_fields[0]) && $w_disabled_fields[0] == 'no') {
1449
+ $g += 2;
1450
+ $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_' . $id1 . '_street1' . $form_id . '" name="wdform_' . $id1 . '_street1' . $form_id . '" value="' . (isset($_POST['wdform_' . $id1 . '_street1' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_street1' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[0] . '</label></span>';
1451
+ }
1452
+ if (isset($w_disabled_fields[1]) && $w_disabled_fields[1] == 'no') {
1453
+ $g += 2;
1454
+ $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="wdform_' . $id1 . '_street2' . $form_id . '" name="wdform_' . ($id1 + 1) . '_street2' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 1) . '_street2' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 1) . '_street2' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[1] . '</label></span>';
1455
+ }
1456
+ if (isset($w_disabled_fields[2]) && $w_disabled_fields[2] == 'no') {
1457
+ $g++;
1458
+ $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_city' . $form_id . '" name="wdform_' . ($id1 + 2) . '_city' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 2) . '_city' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 2) . '_city' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label" >' . $w_mini_labels[2] . '</label></span>';
1459
+ }
1460
+ if (isset($w_disabled_fields[3]) && $w_disabled_fields[3] == 'no') {
1461
+ $g++;
1462
+ $w_states = array("", "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District Of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
1463
+ $w_state_options = '';
1464
+ $post_state = isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "";
1465
+ foreach ($w_states as $w_state) {
1466
+ if ($w_state == $post_state) {
1467
+ $selected = 'selected="selected"';
1468
+ }
1469
+ else {
1470
+ $selected = '';
1471
+ }
1472
+ $w_state_options .= '<option value="' . $w_state . '" ' . $selected . '>' . $w_state . '</option>';
1473
+ }
1474
+ if (isset($w_disabled_fields[5]) && $w_disabled_fields[5] == 'yes' && isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes') {
1475
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><select type="text" id="wdform_' . $id1 . '_state' . $form_id . '" name="wdform_' . ($id1 + 3) . '_state' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '>' . $w_state_options . '</select><label class="mini_label" style="display: block;" id="' . $id1 . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
1476
+ }
1477
+ else {
1478
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_state' . $form_id . '" name="wdform_' . ($id1 + 3) . '_state' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[3] . '</label></span>';
1479
+ }
1480
+ }
1481
+ if (isset($w_disabled_fields[4]) && $w_disabled_fields[4] == 'no') {
1482
+ $g++;
1483
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="wdform_' . $id1 . '_postal' . $form_id . '" name="wdform_' . ($id1 + 4) . '_postal' . $form_id . '" value="' . (isset($_POST['wdform_' . ($id1 + 4) . '_postal' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 4) . '_postal' . $form_id])) : "") . '" style="width: 100%;" ' . $param['attributes'] . '><label class="mini_label">' . $w_mini_labels[4] . '</label></span>';
1484
+ }
1485
+ $w_countries = array("", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe");
1486
+ $w_options = '';
1487
+ $post_country = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id])) : "";
1488
+ foreach ($w_countries as $w_country) {
1489
+ if ($w_country == $post_country) {
1490
+ $selected = 'selected="selected"';
1491
+ }
1492
+ else {
1493
+ $selected = '';
1494
+ }
1495
+ $w_options .= '<option value="' . $w_country . '" ' . $selected . '>' . $w_country . '</option>';
1496
+ }
1497
+ if (isset($w_disabled_fields[5]) && $w_disabled_fields[5] == 'no') {
1498
+ $g++;
1499
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;display: inline-block;"><select type="text" id="wdform_' . $id1 . '_country' . $form_id . '" name="wdform_' . ($id1 + 5) . '_country' . $form_id . '" style="width:100%" ' . $param['attributes'] . '>' . $w_options . '</select><label class="mini_label">' . $w_mini_labels[5] . '</label></span>';
1500
+ }
1501
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><div>
1502
+ ' . $address_fields . '</div><div style="clear:both;"></div></div></div>';
1503
+ if ($required) {
1504
+ array_push($req_fields, $id1);
1505
+ }
1506
+ $post = isset($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . '_country' . $form_id])) : NULL;
1507
+ if (isset($post)) {
1508
+ $onload_js .= ' jQuery("#wdform_' . $id1 . '_country' . $form_id . '").val("' . (isset($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 5) . "_country" . $form_id])) : '') . '");';
1509
+ }
1510
+ if (isset($w_disabled_fields[6]) && $w_disabled_fields[6] == 'yes') {
1511
+ $onload_js .= ' jQuery("#wdform_' . $id1 . '_country' . $form_id . '").change(function() {
1512
+ if( jQuery(this).val()=="United States")
1513
+ {
1514
+ jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<select type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" style=\"width: 100%;\" ' . $param['attributes'] . '>' . addslashes($w_state_options) . '</select><label class=\"mini_label\" id=\"' . $id1 . '_mini_label_state\">' . $w_mini_labels[3] . '</label>");
1515
+ jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("input:first, label:first").remove();
1516
+ }
1517
+ else
1518
+ {
1519
+ if(jQuery("#wdform_' . $id1 . '_state' . $form_id . '").prop("tagName")=="SELECT")
1520
+ {
1521
+ jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().append("<input type=\"text\" id=\"wdform_' . $id1 . '_state' . $form_id . '\" name=\"wdform_' . ($id1 + 3) . '_state' . $form_id . '\" value=\"' . (isset($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . ($id1 + 3) . '_state' . $form_id])) : "") . '\" style=\"width: 100%;\" ' . $param['attributes'] . '><label class=\"mini_label\">' . $w_mini_labels[3] . '</label>");
1522
+ jQuery("#wdform_' . $id1 . '_state' . $form_id . '").parent().children("select:first, label:first").remove();
1523
+ }
1524
+ }
1525
+ });';
1526
+ }
1527
+ break;
1528
+ }
1529
+
1530
+ case 'type_submitter_mail': {
1531
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
1532
+ $temp = $params;
1533
+ if (strpos($temp, 'w_autofill') > -1) {
1534
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class', 'w_autofill');
1535
+ }
1536
+ if (strpos($temp, 'w_hide_label') > -1) {
1537
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class', 'w_autofill');
1538
+ }
1539
+ if (strpos($temp, 'w_verification') > -1) {
1540
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class', 'w_verification', 'w_verification_label', 'w_verification_placeholder', 'w_autofill');
1541
+ }
1542
+ foreach ($params_names as $params_name) {
1543
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1544
+ $param[$params_name] = $temp[0];
1545
+ $temp = $temp[1];
1546
+ }
1547
+ if ($temp) {
1548
+ $temp = explode('*:*w_attr_name*:*', $temp);
1549
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1550
+ foreach ($attrs as $attr) {
1551
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1552
+ }
1553
+ }
1554
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1555
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1556
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1557
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1558
+ if ($param['w_hide_label'] == "yes") {
1559
+ $param['w_field_label_pos1'] = "display:none;";
1560
+ }
1561
+ $required = ($param['w_required'] == "yes" ? true : false);
1562
+ $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
1563
+ if ($param['w_autofill'] == 'yes' && $wp_useremail) {
1564
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $wp_useremail);
1565
+ $input_active = "input_active";
1566
+ }
1567
+ else {
1568
+ $param['w_first_val'] = (isset($_POST['wdform_' . $id1 . '_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_element' . $form_id])) : $param['w_first_val']);
1569
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
1570
+ }
1571
+ $rep = '<div type="type_submitter_mail" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1572
+ if ($required) {
1573
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1574
+ }
1575
+ $message_confirm = addslashes(__("The email addresses don't match", "form_maker"));
1576
+ $message_check_email = addslashes(__('This is not a valid email address.', 'form_maker'));
1577
+ $onchange = (isset($param['w_verification']) && $param['w_verification'] == "yes") ? '; wd_check_confirmation_email(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')' : '';
1578
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" style="width: 100%;" ' . $param['attributes'] . ' onchange="wd_check_email(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_check_email . '\', \'' . $message_confirm . '\')' . $onchange . '"></div></div>';
1579
+ if (isset($param['w_verification']) && $param['w_verification'] == "yes") {
1580
+ $param['w_verification_placeholder'] = (isset($_POST['wdform_' . $id1 . '_1_element' . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . '_1_element' . $form_id])) : $param['w_verification_placeholder']);
1581
+ $rep .= '<div><div type="type_submitter_mail_confirmation" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $param['w_verification_label'] . '</span>';
1582
+ if ($required) {
1583
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1584
+ }
1585
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><input type="text" class="' . $input_active . '" id="wdform_' . $id1 . '_1_element' . $form_id . '" name="wdform_' . $id1 . '_1_element' . $form_id . '" value="' . $param['w_verification_placeholder'] . '" title="' . $param['w_verification_placeholder'] . '" style="width: 100%;" ' . $param['attributes'] . 'onchange="wd_check_confirmation_email(\'' . $id1 . '\', \'' . $form_id . '\', \'' . $message_confirm . '\')"></div></div></div>';
1586
+ }
1587
+ if ($required) {
1588
+ array_push($req_fields, $id1);
1589
+ }
1590
+ break;
1591
+ }
1592
+
1593
+ case 'type_checkbox': {
1594
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
1595
+ $temp = $params;
1596
+ if (strpos($temp, 'w_field_option_pos') > -1) {
1597
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1598
+ }
1599
+ if (strpos($temp, 'w_hide_label') > -1) {
1600
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1601
+ }
1602
+ foreach ($params_names as $params_name) {
1603
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1604
+ $param[$params_name] = $temp[0];
1605
+ $temp = $temp[1];
1606
+ }
1607
+ if ($temp) {
1608
+ $temp = explode('*:*w_attr_name*:*', $temp);
1609
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1610
+ foreach ($attrs as $attr) {
1611
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1612
+ }
1613
+ }
1614
+ if (!isset($param['w_value_disabled'])) {
1615
+ $param['w_value_disabled'] = 'no';
1616
+ }
1617
+ if (!isset($param['w_field_option_pos'])) {
1618
+ $param['w_field_option_pos'] = 'left';
1619
+ }
1620
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1621
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1622
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none !important;'" : "");
1623
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1624
+ if ($param['w_hide_label'] == "yes") {
1625
+ $param['w_field_label_pos1'] = "display:none;";
1626
+ }
1627
+ $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
1628
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "");
1629
+ $required = ($param['w_required'] == "yes" ? true : false);
1630
+ $param['w_choices'] = explode('***', $param['w_choices']);
1631
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1632
+ if (isset($param['w_choices_value'])) {
1633
+ $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1634
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1635
+ }
1636
+ $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1637
+ $is_other = false;
1638
+ if (isset($post_value)) {
1639
+ if ($param['w_allow_other'] == "yes") {
1640
+ $is_other = FALSE;
1641
+ $other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html($_POST['wdform_' . $id1 . "_other_input" . $form_id]) : NULL;
1642
+ if (isset($other_element)) {
1643
+ $is_other = TRUE;
1644
+ }
1645
+ }
1646
+ }
1647
+ else {
1648
+ $is_other = ($param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true');
1649
+ }
1650
+ $rep = '<div type="type_checkbox" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1651
+ if ($required) {
1652
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1653
+ }
1654
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
1655
+ $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1656
+ $total_queries = 0;
1657
+ foreach ($param['w_choices'] as $key => $choice) {
1658
+ $key1 = $key + $total_queries;
1659
+ if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
1660
+ $choices_labels = array();
1661
+ $choices_values = array();
1662
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1663
+ $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
1664
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1665
+ $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
1666
+ $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
1667
+ $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
1668
+ $table = $label_table_and_column[0];
1669
+ $label_column = $label_table_and_column[1];
1670
+ if ($label_column) {
1671
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1672
+ }
1673
+ $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
1674
+ $value_column = $value_table_and_column[1];
1675
+ if ($value_column) {
1676
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1677
+ }
1678
+ $columns_count_checkbox = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
1679
+ if (array_filter($choices_labels) || array_filter($choices_values)) {
1680
+ $total_queries = $total_queries + $columns_count_checkbox - 1;
1681
+ if (!isset($post_value)) {
1682
+ $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1683
+ }
1684
+ for ($k = 0; $k < $columns_count_checkbox; $k++) {
1685
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1686
+ $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
1687
+ if (($key1 + $k) % $param['w_rowcol'] == 0 && ($key1 + $k) > 0) {
1688
+ $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1689
+ }
1690
+ if (isset($post_value)) {
1691
+ $post_valuetemp = $_POST['wdform_' . $id1 . "_element" . $form_id . ($key1 + $k)];
1692
+ $param['w_choices_checked'][$key] = (isset($post_valuetemp) ? 'checked="checked"' : '');
1693
+ }
1694
+ $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="checkbox-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="checkbox" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" value="' . htmlspecialchars($choice_value[0]) . '" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . ($key1 + $k) . '&quot;,&quot;' . $form_id . '&quot;)) show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);"' : '') . ' ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label[0] . '</label></div></div>';
1695
+ }
1696
+ }
1697
+ }
1698
+ else {
1699
+ if ($key1 % $param['w_rowcol'] == 0 && $key1 > 0) {
1700
+ $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1701
+ }
1702
+ if (!isset($post_value)) {
1703
+ $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1704
+ }
1705
+ else {
1706
+ $post_valuetemp = isset($_POST['wdform_' . $id1 . "_element" . $form_id . $key]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . $key])) : NULL;
1707
+ $param['w_choices_checked'][$key] = (isset($post_valuetemp) ? 'checked="checked"' : '');
1708
+ }
1709
+ $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
1710
+ $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="checkbox-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="checkbox" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" value="' . htmlspecialchars($choice_value) . '" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'onclick="if(set_checked(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key1 . '&quot;,&quot;' . $form_id . '&quot;)) show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);"' : '') . ' ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div></div>';
1711
+ $param['w_allow_other_num'] = $param['w_allow_other_num'] == $key ? $key1 : $param['w_allow_other_num'];
1712
+ }
1713
+ }
1714
+ $rep .= '</div>';
1715
+ $rep .= '</div></div>';
1716
+ if ($required) {
1717
+ array_push($req_fields, $id1);
1718
+ }
1719
+ if ($is_other) {
1720
+ $onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");';
1721
+ }
1722
+ if ($param['w_randomize'] == 'yes') {
1723
+ $onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();
1724
+ ';
1725
+ }
1726
+ $onsubmit_js .= '
1727
+ jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other' . $form_id . '\" value = \"' . $param['w_allow_other'] . '\" />").appendTo("#form' . $form_id . '");
1728
+ jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\" value = \"' . $param['w_allow_other_num'] . '\" />").appendTo("#form' . $form_id . '");
1729
+ ';
1730
+ break;
1731
+ }
1732
+
1733
+ case 'type_radio': {
1734
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_class');
1735
+ $temp = $params;
1736
+ if (strpos($temp, 'w_field_option_pos') > -1) {
1737
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1738
+ }
1739
+ if (strpos($temp, 'w_hide_label') > -1) {
1740
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_field_option_pos', 'w_hide_label', 'w_flow', 'w_choices', 'w_choices_checked', 'w_rowcol', 'w_required', 'w_randomize', 'w_allow_other', 'w_allow_other_num', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1741
+ }
1742
+ foreach ($params_names as $params_name) {
1743
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1744
+ $param[$params_name] = $temp[0];
1745
+ $temp = $temp[1];
1746
+ }
1747
+ if ($temp) {
1748
+ $temp = explode('*:*w_attr_name*:*', $temp);
1749
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1750
+ foreach ($attrs as $attr) {
1751
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1752
+ }
1753
+ }
1754
+ if (!isset($param['w_value_disabled'])) {
1755
+ $param['w_value_disabled'] = 'no';
1756
+ }
1757
+ if (!isset($param['w_field_option_pos'])) {
1758
+ $param['w_field_option_pos'] = 'left';
1759
+ }
1760
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1761
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1762
+ $param['w_field_option_pos1'] = ($param['w_field_option_pos'] == "right" ? "style='float: none !important;'" : "");
1763
+ $param['w_field_option_pos2'] = ($param['w_field_option_pos'] == "right" ? "style='float: left !important; margin:3px 8px 0 0 !important; display: inline-block !important;'" : "");
1764
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1765
+ if ($param['w_hide_label'] == "yes") {
1766
+ $param['w_field_label_pos1'] = "display:none;";
1767
+ }
1768
+ $class_right = $param['w_field_option_pos'] == 'left' ? 'fm-right' : '';
1769
+ $required = ($param['w_required'] == "yes" ? true : false);
1770
+ $param['w_choices'] = explode('***', $param['w_choices']);
1771
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1772
+ if (isset($param['w_choices_value'])) {
1773
+ $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1774
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1775
+ }
1776
+ $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1777
+ $is_other = false;
1778
+ if (isset($post_value)) {
1779
+ if ($param['w_allow_other'] == "yes") {
1780
+ $is_other = false;
1781
+ $other_element = isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : null;
1782
+ if (isset($other_element)) {
1783
+ $is_other = true;
1784
+ }
1785
+ }
1786
+ }
1787
+ else {
1788
+ $is_other = ($param['w_allow_other'] == "yes" && $param['w_choices_checked'][$param['w_allow_other_num']] == 'true');
1789
+ }
1790
+ $rep = '<div type="type_radio" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1791
+ if ($required) {
1792
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1793
+ }
1794
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';">';
1795
+ $rep .= '<div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1796
+ $total_queries = 0;
1797
+ foreach ($param['w_choices'] as $key => $choice) {
1798
+ $key1 = $key + $total_queries;
1799
+ if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
1800
+ $choices_labels = array();
1801
+ $choices_values = array();
1802
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1803
+ $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
1804
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1805
+ $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
1806
+ $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
1807
+ $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
1808
+ $table = $label_table_and_column[0];
1809
+ $label_column = $label_table_and_column[1];
1810
+ if ($label_column) {
1811
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1812
+ }
1813
+ $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
1814
+ $value_column = $value_table_and_column[1];
1815
+ if ($value_column) {
1816
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1817
+ }
1818
+ $columns_count_radio = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
1819
+ if (array_filter($choices_labels) || array_filter($choices_values)) {
1820
+ $total_queries = $total_queries + $columns_count_radio - 1;
1821
+ if (!isset($post_value)) {
1822
+ $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1823
+ }
1824
+ for ($k = 0; $k < $columns_count_radio; $k++) {
1825
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1826
+ $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : $choice_label;
1827
+ if (($key1 + $k) % $param['w_rowcol'] == 0 && ($key1 + $k) > 0) {
1828
+ $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1829
+ }
1830
+ if (isset($post_value)) {
1831
+ $post_valuetemp = $_POST['wdform_' . $id1 . "_element" . $form_id];
1832
+ $param['w_choices_checked'][$key] = (isset($post_valuetemp) ? 'checked="checked"' : '');
1833
+ }
1834
+ $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice_value[0]) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . ($key1 + $k) . '&quot;,&quot;' . $form_id . '&quot;); ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);' : '') . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . ($key1 + $k) . '"><span></span>' . $choice_label[0] . '</label></div></div>';
1835
+ }
1836
+ }
1837
+ }
1838
+ else {
1839
+ if ($key1 % $param['w_rowcol'] == 0 && $key1 > 0) {
1840
+ $rep .= '</div><div style="display: ' . ($param['w_flow'] == 'hor' ? 'inline-block' : 'table-row') . '; vertical-align:top">';
1841
+ }
1842
+ if (!isset($post_value)) {
1843
+ $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'checked="checked"' : '');
1844
+ }
1845
+ else {
1846
+ $param['w_choices_checked'][$key] = (htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : "") ? 'checked="checked"' : '');
1847
+ }
1848
+ $choice_value = isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice;
1849
+ $rep .= '<div style="display: ' . ($param['w_flow'] != 'hor' ? 'table-cell' : 'table-row') . ';"><div class="radio-div forlabs ' . $class_right . '" ' . $param['w_field_option_pos2'] . '><input type="radio" ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'other="1"' : '') . ' id="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '" name="wdform_' . $id1 . '_element' . $form_id . '" value="' . htmlspecialchars($choice_value) . '" onclick="set_default(&quot;wdform_' . $id1 . '&quot;,&quot;' . $key1 . '&quot;,&quot;' . $form_id . '&quot;); ' . (($param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $key) ? 'show_other_input(&quot;wdform_' . $id1 . '&quot;,&quot;' . $form_id . '&quot;);' : '') . '" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . '><label for="wdform_' . $id1 . '_element' . $form_id . '' . $key1 . '"><span></span>' . $choice . '</label></div></div>';
1850
+ $param['w_allow_other_num'] = $param['w_allow_other_num'] == $key ? $key1 : $param['w_allow_other_num'];
1851
+ }
1852
+ }
1853
+ $rep .= '</div>';
1854
+ $rep .= '</div></div>';
1855
+ if ($required) {
1856
+ array_push($req_fields, $id1);
1857
+ }
1858
+ if ($is_other) {
1859
+ $onload_js .= 'show_other_input("wdform_' . $id1 . '","' . $form_id . '"); jQuery("#wdform_' . $id1 . '_other_input' . $form_id . '").val("' . (isset($_POST['wdform_' . $id1 . "_other_input" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_other_input" . $form_id])) : '') . '");';
1860
+ }
1861
+ if ($param['w_randomize'] == 'yes') {
1862
+ $onload_js .= 'jQuery("#form' . $form_id . ' div[wdid=' . $id1 . '] .wdform-element-section> div").shuffle();
1863
+ ';
1864
+ }
1865
+ $onsubmit_js .= '
1866
+ jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other' . $form_id . '\" value = \"' . $param['w_allow_other'] . '\" />").appendTo("#form' . $form_id . '");
1867
+ jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_allow_other_num' . $form_id . '\" value = \"' . $param['w_allow_other_num'] . '\" />").appendTo("#form' . $form_id . '");
1868
+ ';
1869
+ break;
1870
+ }
1871
+
1872
+ case 'type_own_select': {
1873
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_class');
1874
+ $temp = $params;
1875
+ if (strpos($temp, 'w_choices_value') > -1) {
1876
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1877
+ }
1878
+ if (strpos($temp, 'w_hide_label') > -1) {
1879
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_choices', 'w_choices_checked', 'w_choices_disabled', 'w_required', 'w_value_disabled', 'w_choices_value', 'w_choices_params', 'w_class');
1880
+ }
1881
+ foreach ($params_names as $params_name) {
1882
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1883
+ $param[$params_name] = $temp[0];
1884
+ $temp = $temp[1];
1885
+ }
1886
+ if ($temp) {
1887
+ $temp = explode('*:*w_attr_name*:*', $temp);
1888
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1889
+ foreach ($attrs as $attr) {
1890
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1891
+ }
1892
+ }
1893
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1894
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1895
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1896
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1897
+ if ($param['w_hide_label'] == "yes") {
1898
+ $param['w_field_label_pos1'] = "display:none;";
1899
+ }
1900
+ $required = ($param['w_required'] == "yes" ? true : false);
1901
+ $param['w_choices'] = explode('***', $param['w_choices']);
1902
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1903
+ $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
1904
+ if (isset($param['w_choices_value'])) {
1905
+ $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1906
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1907
+ }
1908
+ if (!isset($param['w_value_disabled'])) {
1909
+ $param['w_value_disabled'] = 'no';
1910
+ }
1911
+ $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1912
+ $rep = '<div type="type_own_select" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
1913
+ if ($required) {
1914
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
1915
+ }
1916
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . ($param['w_size']) . 'px; "><select id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%" ' . $param['attributes'] . '>';
1917
+ foreach ($param['w_choices'] as $key => $choice) {
1918
+ if (isset($param['w_choices_params']) && $param['w_choices_params'][$key]) {
1919
+ $choices_labels = array();
1920
+ $choices_values = array();
1921
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1922
+ $where = (str_replace(array('[', ']'), '', $w_choices_params[0]) ? ' WHERE ' . str_replace(array('[', ']'), '', $w_choices_params[0]) : '');
1923
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1924
+ $order_by = str_replace(array('[', ']'), '', $w_choices_params[0]);
1925
+ $db_info = str_replace(array('[', ']'), '', $w_choices_params[1]);
1926
+ $label_table_and_column = explode(':', str_replace(array('[', ']'), '', $choice));
1927
+ $table = $label_table_and_column[0];
1928
+ $label_column = $label_table_and_column[1];
1929
+ if ($label_column) {
1930
+ $choices_labels = $this->model->select_data_from_db_for_labels($db_info, $label_column, $table, $where, $order_by);
1931
+ }
1932
+ $value_table_and_column = explode(':', str_replace(array('[', ']'), '', $param['w_choices_value'][$key]));
1933
+ $value_column = $param['w_choices_disabled'][$key] == "true" ? '' : $value_table_and_column[1];
1934
+ if ($value_column) {
1935
+ $choices_values = $this->model->select_data_from_db_for_values($db_info, $value_column, $table, $where, $order_by);
1936
+ }
1937
+ $columns_count = count($choices_labels) > 0 ? count($choices_labels) : count($choices_values);
1938
+ if (array_filter($choices_labels) || array_filter($choices_values)) {
1939
+ for ($k = 0; $k < $columns_count; $k++) {
1940
+ $choice_label = isset($choices_labels[$k]) ? $choices_labels[$k] : '';
1941
+ $choice_value = isset($choices_values[$k]) ? $choices_values[$k] : ($param['w_choices_disabled'][$key] == "true" ? '' : $choice_label);
1942
+ if (!isset($post_value)) {
1943
+ $param['w_choices_checked'][$key] = (($param['w_choices_checked'][$key] == 'true' && $k == 0) ? 'selected="selected"' : '');
1944
+ }
1945
+ else {
1946
+ $param['w_choices_checked'][$key] = ($choice_value == htmlspecialchars($_POST['wdform_' . $id1 . "_element" . $form_id]) ? 'selected="selected"' : '');
1947
+ }
1948
+ $rep .= '<option value="' . htmlspecialchars($choice_value[0]) . '" ' . $param['w_choices_checked'][$key] . '>' . $choice_label[0] . '</option>';
1949
+ }
1950
+ }
1951
+ }
1952
+ else {
1953
+ if (!isset($post_value)) {
1954
+ $param['w_choices_checked'][$key] = ($param['w_choices_checked'][$key] == 'true' ? 'selected="selected"' : '');
1955
+ }
1956
+ else {
1957
+ $param['w_choices_checked'][$key] = (htmlspecialchars($choice) == htmlspecialchars($_POST['wdform_' . $id1 . "_element" . $form_id]) ? 'selected="selected"' : '');
1958
+ }
1959
+ $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
1960
+ $rep .= '<option value="' . htmlspecialchars($choice_value) . '" ' . $param['w_choices_checked'][$key] . '>' . $choice . '</option>';
1961
+ }
1962
+ }
1963
+ $rep .= '</select></div></div>';
1964
+ if ($required) {
1965
+ array_push($req_fields, $id1);
1966
+ }
1967
+ break;
1968
+ }
1969
+
1970
+ case 'type_country': {
1971
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_countries', 'w_required', 'w_class');
1972
+ $temp = $params;
1973
+ if (strpos($temp, 'w_hide_label') > -1) {
1974
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_countries', 'w_required', 'w_class');
1975
+ }
1976
+ foreach ($params_names as $params_name) {
1977
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1978
+ $param[$params_name] = $temp[0];
1979
+ $temp = $temp[1];
1980
+ }
1981
+ if ($temp) {
1982
+ $temp = explode('*:*w_attr_name*:*', $temp);
1983
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1984
+ foreach ($attrs as $attr) {
1985
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
1986
+ }
1987
+ }
1988
+ $wdformfieldsize = ($param['w_field_label_pos'] == "left" ? ($param['w_field_label_size'] + $param['w_size']) : max($param['w_field_label_size'], $param['w_size']));
1989
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
1990
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
1991
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1992
+ if ($param['w_hide_label'] == "yes") {
1993
+ $param['w_field_label_pos1'] = "display:none;";
1994
+ }
1995
+ $required = ($param['w_required'] == "yes" ? true : false);
1996
+ $param['w_countries'] = explode('***', $param['w_countries']);
1997
+ $post_value = isset($_POST["counter" . $form_id]) ? esc_html($_POST["counter" . $form_id]) : NULL;
1998
+ $selected = '';
1999
+ $rep = '<div type="type_country" class="wdform-field" style="width:' . $wdformfieldsize . 'px"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2000
+ if ($required) {
2001
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2002
+ }
2003
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ' width: ' . $param['w_size'] . 'px;"><select id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" style="width: 100%;" ' . $param['attributes'] . '>';
2004
+ foreach ($param['w_countries'] as $key => $choice) {
2005
+ if (isset($post_value)) {
2006
+ $selected = (htmlspecialchars($choice) == htmlspecialchars(isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : "") ? 'selected="selected"' : '');
2007
+ }
2008
+ $choice_value = $choice;
2009
+ $rep .= '<option value="' . $choice_value . '" ' . $selected . '>' . $choice . '</option>';
2010
+ }
2011
+ $rep .= '</select></div></div>';
2012
+ if ($required) {
2013
+ array_push($req_fields, $id1);
2014
+ }
2015
+ break;
2016
+ }
2017
+
2018
+ case 'type_time': {
2019
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_time_type', 'w_am_pm', 'w_sec', 'w_hh', 'w_mm', 'w_ss', 'w_mini_labels', 'w_required', 'w_class');
2020
+ $temp = $params;
2021
+ if (strpos($temp, 'w_hide_label') > -1) {
2022
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_time_type', 'w_am_pm', 'w_sec', 'w_hh', 'w_mm', 'w_ss', 'w_mini_labels', 'w_required', 'w_class');
2023
+ }
2024
+ foreach ($params_names as $params_name) {
2025
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2026
+ $param[$params_name] = $temp[0];
2027
+ $temp = $temp[1];
2028
+ }
2029
+ if ($temp) {
2030
+ $temp = explode('*:*w_attr_name*:*', $temp);
2031
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2032
+ foreach ($attrs as $attr) {
2033
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
2034
+ }
2035
+ }
2036
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2037
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2038
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2039
+ if ($param['w_hide_label'] == "yes") {
2040
+ $param['w_field_label_pos1'] = "display:none;";
2041
+ }
2042
+ $required = ($param['w_required'] == "yes" ? true : false);
2043
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
2044
+ $w_sec = '';
2045
+ $w_sec_label = '';
2046
+ if ($param['w_sec'] == '1') {
2047
+ $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_ss" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_ss" . $form_id])) : $param['w_ss']) . '" class="time_box" id="wdform_' . $id1 . '_ss' . $form_id . '" name="wdform_' . $id1 . '_ss' . $form_id . '" onkeypress="return check_second(event, &quot;wdform_' . $id1 . '_ss' . $form_id . '&quot;)" ' . $param['attributes'] . '></div>';
2048
+ $w_sec_label = '<div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[2] . '</label></div>';
2049
+ }
2050
+ if ($param['w_time_type'] == '12') {
2051
+ if ((isset($_POST['wdform_' . $id1 . "_am_pm" . $form_id]) ? esc_html($_POST['wdform_' . $id1 . "_am_pm" . $form_id]) : $param['w_am_pm']) == 'am') {
2052
+ $am_ = "selected=\"selected\"";
2053
+ $pm_ = "";
2054
+ }
2055
+ else {
2056
+ $am_ = "";
2057
+ $pm_ = "selected=\"selected\"";
2058
+ }
2059
+ $w_time_type = '<div style="display: table-cell;"><select class="am_pm_select" name="wdform_' . $id1 . '_am_pm' . $form_id . '" id="wdform_' . $id1 . '_am_pm' . $form_id . '" ' . $param['attributes'] . '><option value="am" ' . $am_ . '>AM</option><option value="pm" ' . $pm_ . '>PM</option></select></div>';
2060
+ $w_time_type_label = '<div ><label class="mini_label">' . $w_mini_labels[3] . '</label></div>';
2061
+ }
2062
+ else {
2063
+ $w_time_type = '';
2064
+ $w_time_type_label = '';
2065
+ }
2066
+ $rep = '<div type="type_time" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2067
+ if ($required) {
2068
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2069
+ }
2070
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_hh" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_hh" . $form_id])) : $param['w_hh']) . '" class="time_box" id="wdform_' . $id1 . '_hh' . $form_id . '" name="wdform_' . $id1 . '_hh' . $form_id . '" onkeypress="return check_hour(event, &quot;wdform_' . $id1 . '_hh' . $form_id . '&quot;, &quot;23&quot;)" ' . $param['attributes'] . '></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div style="display: table-cell;"><input type="text" value="' . (isset($_POST['wdform_' . $id1 . "_mm" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_mm" . $form_id])) : $param['w_mm']) . '" class="time_box" id="wdform_' . $id1 . '_mm' . $form_id . '" name="wdform_' . $id1 . '_mm' . $form_id . '" onkeypress="return check_minute(event, &quot;wdform_' . $id1 . '_mm' . $form_id . '&quot;)" ' . $param['attributes'] . '></div>' . $w_sec . $w_time_type . '</div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[0] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $w_mini_labels[1] . '</label></div>' . $w_sec_label . $w_time_type_label . '</div></div></div></div>';
2071
+ if ($required) {
2072
+ array_push($req_fields, $id1);
2073
+ }
2074
+ break;
2075
+ }
2076
+
2077
+ case 'type_date': {
2078
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_date', 'w_required', 'w_class', 'w_format', 'w_but_val');
2079
+ $temp = $params;
2080
+ if (strpos($temp, 'w_disable_past_days') > -1) {
2081
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_date', 'w_required', 'w_class', 'w_format', 'w_but_val', 'w_disable_past_days');
2082
+ }
2083
+ foreach ($params_names as $params_name) {
2084
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2085
+ $param[$params_name] = $temp[0];
2086
+ $temp = $temp[1];
2087
+ }
2088
+ if ($temp) {
2089
+ $temp = explode('*:*w_attr_name*:*', $temp);
2090
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2091
+ foreach ($attrs as $attr) {
2092
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
2093
+ }
2094
+ }
2095
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2096
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2097
+ $required = ($param['w_required'] == "yes" ? true : false);
2098
+ $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
2099
+ $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
2100
+ $param['w_date'] = (isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : $param['w_date']);
2101
+ $rep = '<div type="type_date" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2102
+ if ($required) {
2103
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2104
+ }
2105
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><input type="text" value="' . $param['w_date'] . '" class="wdform-date" id="wdform_' . $id1 . '_element' . $form_id . '" name="wdform_' . $id1 . '_element' . $form_id . '" maxlength="10" ' . $param['attributes'] . '><input id="wdform_' . $id1 . '_button' . $form_id . '" class="wdform-calendar-button" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" onclick="return showCalendar(\'wdform_' . $id1 . '_element' . $form_id . '\' , \'' . $param['w_format'] . '\', ' . $disable_past_days . ')" ' . $param['attributes'] . ' ></div></div>';
2106
+ if ($required) {
2107
+ array_push($req_fields, $id1);
2108
+ }
2109
+ if ($disable_past_days == 'true') {
2110
+ $check_js .= '
2111
+ var currentDate = new Date();
2112
+ if( Date.parse(jQuery("#wdform_' . $id1 . '_element' . $form_id . '").val() + " 23:59:59") < currentDate.getTime() ) {
2113
+ alert("' . __('You cannot select former dates. Choose a date starting from the current one.', 'form_maker') . '");
2114
+ return false;
2115
+ }
2116
+ ';
2117
+ }
2118
+ $date_format = str_replace('%', '', $param['w_format']);
2119
+ $onsubmit_js .= '
2120
+ jQuery("<input type=\"hidden\" name=\"wdform_' . $id1 . '_date_format' . $form_id . '\" value = \"' . $date_format . '\" />").appendTo("#form' . $form_id . '");';
2121
+ break;
2122
+ }
2123
+
2124
+ case 'type_date_new': {
2125
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2126
+ $temp = $params;
2127
+ if (strpos($temp, 'w_hide_label') > -1) {
2128
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2129
+ }
2130
+ foreach ($params_names as $params_name) {
2131
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2132
+ $param[$params_name] = $temp[0];
2133
+ $temp = $temp[1];
2134
+ }
2135
+ if ($temp) {
2136
+ $temp = explode('*:*w_attr_name*:*', $temp);
2137
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2138
+ foreach ($attrs as $attr) {
2139
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
2140
+ }
2141
+ }
2142
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2143
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2144
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2145
+ if ($param['w_hide_label'] == "yes") {
2146
+ $param['w_field_label_pos1'] = "display:none;";
2147
+ }
2148
+ $required = ($param['w_required'] == "yes" ? true : false);
2149
+ $show_image = ($param['w_show_image'] == "yes" ? "inline-block" : "none");
2150
+ $div_size = ($show_image == "inline-block" ? $param['w_size'] + 22 : $param['w_size']);
2151
+ $input_size = ($show_image == "inline-block" ? "calc(100% - 22px)" : "100%");
2152
+ $default_date = (isset($_POST['wdform_' . $id1 . "_element" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id])) : $param['w_default_date']);
2153
+ $w_show_week_days = explode('***', $param['w_show_days']);
2154
+ $w_hide_sunday = $w_show_week_days[0] == 'yes' ? '' : ' && day != 0';
2155
+ $w_hide_monday = $w_show_week_days[1] == 'yes' ? '' : ' && day != 1';
2156
+ $w_hide_tuesday = $w_show_week_days[2] == 'yes' ? '' : ' && day != 2';
2157
+ $w_hide_wednesday = $w_show_week_days[3] == 'yes' ? '' : ' && day != 3';
2158
+ $w_hide_thursday = $w_show_week_days[4] == 'yes' ? '' : ' && day != 4';
2159
+ $w_hide_friday = $w_show_week_days[5] == 'yes' ? '' : ' && day != 5';
2160
+ $w_hide_saturday = $w_show_week_days[6] == 'yes' ? '' : '&& day != 6';
2161
+ $rep = '<div type="type_date_new" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2162
+ if ($required) {
2163
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2164
+ }
2165
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="width:' . $div_size . 'px; ' . $param['w_field_label_pos2'] . ' "><input type="text" id="wdform_' . $id1 . '_element' . $form_id . '" class="input_active" style="width:' . $input_size . '" name="wdform_' . $id1 . '_element' . $form_id . '" ' . $param['attributes'] . '><span id="fm-calendar-'.$id1.'" class="wdform-calendar-button" style="display:'.$show_image.' "></span><input type="hidden" format="' . $param['w_format'] . '" id="wdform_' . $id1 . '_button' . $form_id . '" value="' . $default_date . '"/></div></div>';
2166
+ if ($required) {
2167
+ array_push($req_fields, $id1);
2168
+ }
2169
+ $onload_js .= '
2170
+ jQuery("#button_calendar_' . $id1 . '").click(function() {
2171
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("show");
2172
+ });
2173
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker({
2174
+ dateFormat: "mm/dd/yy",
2175
+ minDate: "' . $param['w_min_date'] . '",
2176
+ maxDate: "' . $param['w_max_date'] . '",
2177
+ changeMonth: true,
2178
+ changeYear: true,
2179
+ showOtherMonths: true,
2180
+ selectOtherMonths: true,
2181
+ firstDay: "' . $param['w_start_day'] . '",
2182
+
2183
+ beforeShowDay: function(date){
2184
+ var invalid_dates = "' . $param["w_invalid_dates"] . '";
2185
+ var invalid_dates_finish = [];
2186
+ var invalid_dates_start = invalid_dates.split(",");
2187
+ var invalid_date_range =[];
2188
+
2189
+
2190
+ for(var i = 0; i < invalid_dates_start.length; i++ ){
2191
+ invalid_dates_start[i] = invalid_dates_start[i].trim();
2192
+ if(invalid_dates_start[i].length < 11 || invalid_dates_start[i].indexOf("-") == -1){
2193
+ invalid_dates_finish.push(invalid_dates_start[i]);
2194
+ }
2195
+ else{
2196
+ if(invalid_dates_start[i].indexOf("-") > 4)
2197
+ invalid_date_range.push(invalid_dates_start[i].split("-"));
2198
+ else{
2199
+ var invalid_date_array = invalid_dates_start[i].split("-");
2200
+ var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2];
2201
+ var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5];
2202
+ invalid_date_range.push([start_invalid_day, end_invalid_day]);
2203
+ }
2204
+ }
2205
+ }
2206
+
2207
+
2208
+ jQuery.each(invalid_date_range, function( index, value ) {
2209
+ for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) {
2210
+ invalid_dates_finish.push(jQuery.datepicker.formatDate("mm/dd/yy", d));
2211
+ }
2212
+ });
2213
+
2214
+ var string_days = jQuery.datepicker.formatDate("mm/dd/yy", date);
2215
+ var day = date.getDay();
2216
+ return [ invalid_dates_finish.indexOf(string_days) == -1 ' . $w_hide_sunday . $w_hide_monday . $w_hide_tuesday . $w_hide_wednesday . $w_hide_thursday . $w_hide_friday . $w_hide_saturday . '];
2217
+ }
2218
+ });
2219
+
2220
+
2221
+
2222
+ var default_date = "' . $default_date . '";
2223
+ var format_date = "' . $param['w_format'] . '";
2224
+
2225
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("option", "dateFormat", format_date);
2226
+
2227
+ if(default_date =="today")
2228
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", new Date());
2229
+ else if(default_date.indexOf("d") == -1 && default_date.indexOf("m") == -1 && default_date.indexOf("y") == -1 && default_date.indexOf("w") == -1){
2230
+ if(default_date !== "")
2231
+ default_date = jQuery.datepicker.formatDate(format_date, new Date(default_date));
2232
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", default_date);
2233
+ }
2234
+ else
2235
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("setDate", default_date);
2236
+
2237
+ ';
2238
+ break;
2239
+ }
2240
+
2241
+ case 'type_date_range': {
2242
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date_start', 'w_default_date_end', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2243
+ $temp = $params;
2244
+ if (strpos($temp, 'w_hide_label') > -1) {
2245
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_date', 'w_required', 'w_show_image', 'w_class', 'w_format', 'w_start_day', 'w_default_date_start', 'w_default_date_end', 'w_min_date', 'w_max_date', 'w_invalid_dates', 'w_show_days', 'w_hide_time', 'w_but_val', 'w_disable_past_days');
2246
+ }
2247
+ foreach ($params_names as $params_name) {
2248
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2249
+ $param[$params_name] = $temp[0];
2250
+ $temp = $temp[1];
2251
+ }
2252
+ if ($temp) {
2253
+ $temp = explode('*:*w_attr_name*:*', $temp);
2254
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2255
+ foreach ($attrs as $attr) {
2256
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
2257
+ }
2258
+ }
2259
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2260
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2261
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2262
+ if ($param['w_hide_label'] == "yes") {
2263
+ $param['w_field_label_pos1'] = "display:none;";
2264
+ }
2265
+ $required = ($param['w_required'] == "yes" ? true : false);
2266
+ $show_image = ($param['w_show_image'] == "yes" ? "inline-block" : "none");
2267
+ $input_size = $param['w_size'];
2268
+ $param['w_size'] = ($show_image == "inline-block" ? $param['w_size'] * 2 + 44 : $param['w_size'] * 2 + 8);
2269
+ $input_size = ($show_image == "inline-block" ? "calc(50% - 26px)" : "calc(50% - 4px)");
2270
+ if ($param['w_default_date_start'] == 'today') {
2271
+ $default_date_start = 'new Date()';
2272
+ }
2273
+ else {
2274
+ $default_date_start = $param['w_default_date_start'];
2275
+ }
2276
+ if ($param['w_default_date_end'] == 'today') {
2277
+ $default_date_end = 'new Date()';
2278
+ }
2279
+ else {
2280
+ $default_date_end = $param['w_default_date_end'];
2281
+ }
2282
+ $default_date_start = (isset($_POST["wdform_" . $id1 . "_element" . $form_id . "0"]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . "0"])) : $default_date_start);
2283
+ $default_date_end = (isset($_POST["wdform_" . $id1 . "_element" . $form_id . "1"]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_element" . $form_id . "1"])) : $default_date_end);
2284
+ $w_show_week_days = explode('***', $param['w_show_days']);
2285
+ $w_hide_sunday = $w_show_week_days[0] == 'yes' ? '' : ' && day != 0';
2286
+ $w_hide_monday = $w_show_week_days[1] == 'yes' ? '' : ' && day != 1';
2287
+ $w_hide_tuesday = $w_show_week_days[2] == 'yes' ? '' : ' && day != 2';
2288
+ $w_hide_wednesday = $w_show_week_days[3] == 'yes' ? '' : ' && day != 3';
2289
+ $w_hide_thursday = $w_show_week_days[4] == 'yes' ? '' : ' && day != 4';
2290
+ $w_hide_friday = $w_show_week_days[5] == 'yes' ? '' : ' && day != 5';
2291
+ $w_hide_saturday = $w_show_week_days[6] == 'yes' ? '' : '&& day != 6';
2292
+ $rep = '<div type="type_date_range" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . ' width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2293
+ if ($required) {
2294
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2295
+ }
2296
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="width:' . $param['w_size'] . 'px; ' . $param['w_field_label_pos2'] . ' "><input type="text" class="input_active" id="wdform_' . $id1 . '_element' . $form_id . '0" style="width:' . $input_size . '" name="wdform_' . $id1 . '_element' . $form_id . '0" ' . $param['attributes'] . ' onchange="change_value_range(\'wdform_' . $id1 . '_element' . $form_id . '1\', \'minDate\', this.value, \'' . $param['w_min_date'] . '\', \'' . $param['w_format'] . '\')"><img src="' . WD_FM_URL . '/images/date.png" style="display:' . $show_image . '; vertical-align:sub" id="button_calendar_' . $id1 . '0" /><span>-</span><input type="text" class="input_active" id="wdform_' . $id1 . '_element' . $form_id . '1" style="width:' . $input_size . '" name="wdform_' . $id1 . '_element' . $form_id . '1" ' . $param['attributes'] . ' onchange="change_value_range(\'wdform_' . $id1 . '_element' . $form_id . '0\', \'maxDate\', this.value, \'' . $param['w_max_date'] . '\', \'' . $param['w_format'] . '\')"><img src="' . WD_FM_URL . '/images/date.png" style="display:' . $show_image . '; vertical-align:sub" id="button_calendar_' . $id1 . '1" /><input type="hidden" format="' . $param['w_format'] . '" id="wdform_' . $id1 . '_button' . $form_id . '" default_date_start="' . $param['w_default_date_start'] . '" default_date_end="' . $param['w_default_date_end'] . '"/></div></div>';
2297
+ if ($required) {
2298
+ array_push($req_fields, $id1);
2299
+ }
2300
+ $onload_js .= '
2301
+ jQuery("#button_calendar_' . $id1 . '0").click(function() {
2302
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("show");
2303
+ });
2304
+ jQuery("#button_calendar_' . $id1 . '1").click(function() {
2305
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("show");
2306
+ });
2307
+ jQuery("input[id^=\'wdform_' . $id1 . '_element' . $form_id . '\']").datepicker({
2308
+ dateFormat: "mm/dd/yy",
2309
+ minDate: "' . $param['w_min_date'] . '",
2310
+ maxDate: "' . $param['w_max_date'] . '",
2311
+ changeMonth: true,
2312
+ changeYear: true,
2313
+ showOtherMonths: true,
2314
+ selectOtherMonths: true,
2315
+ firstDay: "' . $param['w_start_day'] . '",
2316
+
2317
+ beforeShowDay: function(date){
2318
+ var invalid_dates = "' . $param["w_invalid_dates"] . '";
2319
+ var invalid_dates_finish = [];
2320
+ var invalid_dates_start = invalid_dates.split(",");
2321
+ var invalid_date_range =[];
2322
+
2323
+
2324
+ for(var i = 0; i < invalid_dates_start.length; i++ ){
2325
+ invalid_dates_start[i] = invalid_dates_start[i].trim();
2326
+ if(invalid_dates_start[i].length < 11 || invalid_dates_start[i].indexOf("-") == -1){
2327
+ invalid_dates_finish.push(invalid_dates_start[i]);
2328
+ }
2329
+ else{
2330
+ if(invalid_dates_start[i].indexOf("-") > 4)
2331
+ invalid_date_range.push(invalid_dates_start[i].split("-"));
2332
+ else{
2333
+ var invalid_date_array = invalid_dates_start[i].split("-");
2334
+ var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2];
2335
+ var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5];
2336
+ invalid_date_range.push([start_invalid_day, end_invalid_day]);
2337
+ }
2338
+ }
2339
+ }
2340
+
2341
+
2342
+ jQuery.each(invalid_date_range, function( index, value ) {
2343
+ for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) {
2344
+ invalid_dates_finish.push(jQuery.datepicker.formatDate("mm/dd/yy", d));
2345
+ }
2346
+ });
2347
+
2348
+ var string_days = jQuery.datepicker.formatDate("mm/dd/yy", date);
2349
+ var day = date.getDay();
2350
+ return [ invalid_dates_finish.indexOf(string_days) == -1 ' . $w_hide_sunday . $w_hide_monday . $w_hide_tuesday . $w_hide_wednesday . $w_hide_thursday . $w_hide_friday . $w_hide_saturday . '];
2351
+ }
2352
+ });
2353
+
2354
+
2355
+
2356
+ var default_date_start = "' . $param['w_default_date_start'] . '";
2357
+ var format_date = "' . $param['w_format'] . '";
2358
+
2359
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '").datepicker("option", "dateFormat", format_date);
2360
+
2361
+ if(default_date_start =="today"){
2362
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", new Date());
2363
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", new Date());
2364
+ }
2365
+ else if(default_date_start.indexOf("d") == -1 && default_date_start.indexOf("m") == -1 && default_date_start.indexOf("y") == -1 && default_date_start.indexOf("w") == -1){
2366
+ if(default_date_start !== ""){
2367
+ default_date_start = jQuery.datepicker.formatDate(format_date, new Date(default_date_start));
2368
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start);
2369
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", default_date_start);
2370
+ }
2371
+ else
2372
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start);
2373
+ }
2374
+ else{
2375
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("setDate", default_date_start);
2376
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "minDate", default_date_start);
2377
+ }
2378
+
2379
+
2380
+ var default_date_end = "' . $param['w_default_date_end'] . '";
2381
+ var format_date = "' . $param['w_format'] . '";
2382
+
2383
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "dateFormat", format_date);
2384
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("option", "dateFormat", format_date);
2385
+
2386
+ if(default_date_end =="today"){
2387
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", new Date());
2388
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", new Date());
2389
+ }
2390
+ else if(default_date_end.indexOf("d") == -1 && default_date_end.indexOf("m") == -1 && default_date_end.indexOf("y") == -1 && default_date_end.indexOf("w") == -1){
2391
+ if(default_date_end !== ""){
2392
+ default_date_end = jQuery.datepicker.formatDate(format_date, new Date(default_date_end));
2393
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end);
2394
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", default_date_end);
2395
+ }
2396
+ else
2397
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end);
2398
+ }
2399
+ else{
2400
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '1").datepicker("setDate", default_date_end);
2401
+ jQuery("#wdform_' . $id1 . '_element' . $form_id . '0").datepicker("option", "maxDate", default_date_end);
2402
+ }
2403
+ ';
2404
+ break;
2405
+ }
2406
+
2407
+ case 'type_date_fields': {
2408
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_day', 'w_month', 'w_year', 'w_day_type', 'w_month_type', 'w_year_type', 'w_day_label', 'w_month_label', 'w_year_label', 'w_day_size', 'w_month_size', 'w_year_size', 'w_required', 'w_class', 'w_from', 'w_to', 'w_divider');
2409
+ $temp = $params;
2410
+ if (strpos($temp, 'w_hide_label') > -1) {
2411
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_day', 'w_month', 'w_year', 'w_day_type', 'w_month_type', 'w_year_type', 'w_day_label', 'w_month_label', 'w_year_label', 'w_day_size', 'w_month_size', 'w_year_size', 'w_required', 'w_class', 'w_from', 'w_to', 'w_divider');
2412
+ }
2413
+ foreach ($params_names as $params_name) {
2414
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2415
+ $param[$params_name] = $temp[0];
2416
+ $temp = $temp[1];
2417
+ }
2418
+ if ($temp) {
2419
+ $temp = explode('*:*w_attr_name*:*', $temp);
2420
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2421
+ foreach ($attrs as $attr) {
2422
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
2423
+ }
2424
+ }
2425
+ $param['w_day'] = (isset($_POST['wdform_' . $id1 . "_day" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_day" . $form_id])) : $param['w_day']);
2426
+ $param['w_month'] = (isset($_POST['wdform_' . $id1 . "_month" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_month" . $form_id])) : $param['w_month']);
2427
+ $param['w_year'] = (isset($_POST['wdform_' . $id1 . "_year" . $form_id]) ? esc_html(stripslashes($_POST['wdform_' . $id1 . "_year" . $form_id])) : $param['w_year']);
2428
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2429
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2430
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2431
+ if ($param['w_hide_label'] == "yes") {
2432
+ $param['w_field_label_pos1'] = "display:none;";
2433
+ }
2434
+ $required = ($param['w_required'] == "yes" ? true : false);
2435
+ if ($param['w_day_type'] == "SELECT") {
2436
+ $w_day_type = '<select id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option>';
2437
+ for ($k = 1; $k <= 31; $k++) {
2438
+ if ($k < 10) {
2439
+ if ($param['w_day'] == '0' . $k) {
2440
+ $selected = "selected=\"selected\"";
2441
+ }
2442
+ else {
2443
+ $selected = "";
2444
+ }
2445
+ $w_day_type .= '<option value="0' . $k . '" ' . $selected . '>0' . $k . '</option>';
2446
+ }
2447
+ else {
2448
+ if ($param['w_day'] == '' . $k) {
2449
+ $selected = "selected=\"selected\"";
2450
+ }
2451
+ else {
2452
+ $selected = "";
2453
+ }
2454
+ $w_day_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
2455
+ }
2456
+ }
2457
+ $w_day_type .= '</select>';
2458
+ }
2459
+ else {
2460
+ $w_day_type = '<input type="text" value="' . $param['w_day'] . '" id="wdform_' . $id1 . '_day' . $form_id . '" name="wdform_' . $id1 . '_day' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
2461
+ $onload_js .= 'jQuery("#wdform_' . $id1 . '_day' . $form_id . '").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2462
+ $onload_js .= 'jQuery("#wdform_' . $id1 . '_day' . $form_id . '").keypress(function() {return check_day(event, this)});';
2463
+ }
2464
+ if ($param['w_month_type'] == "SELECT") {
2465
+ $w_month_type = '<select id="wdform_' . $id1 . '_month' . $form_id . '" name="wdform_' . $id1 . '_month' . $form_id . '" style="width: ' . $param['w_month_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option><option value="01" ' . ($param['w_month'] == "01" ? "selected=\"selected\"" : "") . ' >' . (__("January", 'form_maker')) . '</option><option value="02" ' . ($param['w_month'] == "02" ? "selected=\"selected\"" : "") . '>' . (__("February", 'form_maker')) . '</option><option value="03" ' . ($param['w_month'] == "03" ? "selected=\"selected\"" : "") . '>' . (__("March", 'form_maker')) . '</option><option value="04" ' . ($param['w_month'] == "04" ? "selected=\"selected\"" : "") . ' >' . (__("April", 'form_maker')) . '</option><option value="05" ' . ($param['w_month'] == "05" ? "selected=\"selected\"" : "") . ' >' . (__("May", 'form_maker')) . '</option><option value="06" ' . ($param['w_month'] == "06" ? "selected=\"selected\"" : "") . ' >' . (__("June", 'form_maker')) . '</option><option value="07" ' . ($param['w_month'] == "07" ? "selected=\"selected\"" : "") . ' >' . (__("July", 'form_maker')) . '</option><option value="08" ' . ($param['w_month'] == "08" ? "selected=\"selected\"" : "") . ' >' . (__("August", 'form_maker')) . '</option><option value="09" ' . ($param['w_month'] == "09" ? "selected=\"selected\"" : "") . ' >' . (__("September", 'form_maker')) . '</option><option value="10" ' . ($param['w_month'] == "10" ? "selected=\"selected\"" : "") . ' >' . (__("October", 'form_maker')) . '</option><option value="11" ' . ($param['w_month'] == "11" ? "selected=\"selected\"" : "") . '>' . (__("November", 'form_maker')) . '</option><option value="12" ' . ($param['w_month'] == "12" ? "selected=\"selected\"" : "") . ' >' . (__("December", 'form_maker')) . '</option></select>';
2466
+ }
2467
+ else {
2468
+ $w_month_type = '<input type="text" value="' . $param['w_month'] . '" id="wdform_' . $id1 . '_month' . $form_id . '" name="wdform_' . $id1 . '_month' . $form_id . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
2469
+ $onload_js .= 'jQuery("#wdform_' . $id1 . '_month' . $form_id . '").blur(function() {if (jQuery(this).val()=="0") jQuery(this).val(""); else add_0(this)});';
2470
+ $onload_js .= 'jQuery("#wdform_' . $id1 . '_month' . $form_id . '").keypress(function() {return check_month(event, this)});';
2471
+ }
2472
+ $param['w_to'] = isset($param['w_to']) && $param['w_to'] != "NaN" ? $param['w_to'] : date("Y");
2473
+ if ($param['w_year_type'] == "SELECT") {
2474
+ $w_year_type = '<select id="wdform_' . $id1 . '_year' . $form_id . '" name="wdform_' . $id1 . '_year' . $form_id . '" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_year_size'] . 'px;" ' . $param['attributes'] . '><option value=""></option>';
2475
+ for ($k = $param['w_to']; $k >= $param['w_from']; $k--) {
2476
+ if ($param['w_year'] == $k) {
2477
+ $selected = "selected=\"selected\"";
2478
+ }
2479
+ else {
2480
+ $selected = "";
2481
+ }
2482
+ $w_year_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
2483
+ }
2484
+ $w_year_type .= '</select>';
2485
+ }
2486
+ else {
2487
+ $w_year_type = '<input type="text" value="' . $param['w_year'] . '" id="wdform_' . $id1 . '_year' . $form_id . '" name="wdform_' . $id1 . '_year' . $form_id . '" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . '>';
2488
+ $onload_js .= 'jQuery("#wdform_' . $id1 . '_year' . $form_id . '").keypress(function() {return check_year1(event, this)});';
2489
+ $onload_js .= 'jQuery("#wdform_' . $id1 . '_year' . $form_id . '").change(function() {change_year(this)});';
2490
+ }
2491
+ $rep = '<div type="type_date_fields" class="wdform-field"><div class="wdform-label-section" style="' . $param['w_field_label_pos1'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span class="wdform-label">' . $label . '</span>';
2492
+ if ($required) {
2493
+ $rep .= '<span class="wdform-required">' . $required_sym . '</span>';
2494
+ }
2495
+ $rep .= '</div><div class="wdform-element-section ' . $param['w_class'] . '" style="' . $param['w_field_label_pos2'] . ';"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;">' . $w_day_type . '</div><div style="display: table-cell;"><span class="wdform_separator">' . $param['w_divider'] . '</span></div><div style="display: table-cell;">' . $w_month_type . '</div><div style="display: table-cell;"><span class="wdform_separator">' . $param['w_divider'] . '</span></div><div style="display: table-cell;">' . $w_year_type . '</div></div><div style="display: table-row;"><div style="display: table-cell;"><label class="mini_label">' . $param['w_day_label'] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label" >' . $param['w_month_label'] . '</label></div><div style="display: table-cell;"></div><div style="display: table-cell;"><label class="mini_label">' . $param['w_year_label'] . '</label></div></div></div></div></div>';
2496
+ if ($required) {
2497
+ array_push($req_fields, $id1);
2498
+ }
2499
+ break;
2500
+ }
2501
+
2502
+ case 'type_file_upload': {
2503
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_destination', 'w_extension', 'w_max_size', 'w_required', 'w_multiple', 'w_class');
2504
+ $temp = $params;
2505
+ if (strpos($temp, 'w_hide_label') > -1) {
2506
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_destination', 'w_extension', 'w_max_size', 'w_required', 'w_multiple', 'w_class');
2507
+ }
2508
+ foreach ($params_names as $params_name) {
2509
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2510
+ $param[$params_name] = $temp[0];
2511
+ if (isset($temp[1])) {
2512
+ $temp = $temp[1];
2513
+ }
2514
+ else {
2515
+ $temp = '';
2516
+ }
2517
+ }
2518
+ if ($temp) {
2519
+ $temp = explode('*:*w_attr_name*:*', $temp);
2520
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2521
+ foreach ($attrs as $attr) {
2522
+ $param['attributes'] = $param['attributes'] . ' ' . $attr;
2523
+ }
2524
+ }
2525
+ $param['w_field_label_pos1'] = ($param['w_field_label_pos'] == "left" ? "float: left;" : "");
2526
+ $param['w_field_label_pos2'] = ($param['w_field_label_pos'] == "left" ? "" : "display:block;");
2527
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2528
+ if ($param['w_hide_label'] == "yes") {
2529
+ $param['w_field_label_pos1'] = "display:none;";
2530
+ }
2531
+ $required = ($param