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

Version Description

  • Changed: Improved user interface of forms, submissions and options.
  • Changed: Separated field types into Basic, User Info, Layout, Advanced and Payment sections.
  • Changed: Simplified the structure of Form Options tabs.
  • Added: Drag and Drop builder button.
Download this release

Release Info

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

Code changes from version 1.11.11 to 1.12.0

Files changed (76) hide show
  1. .gitignore +4 -0
  2. admin/controllers/Blocked_ips_fm.php +270 -0
  3. admin/controllers/Checkpaypal.php +178 -0
  4. admin/controllers/FMControllerBlocked_ips_fm.php +0 -148
  5. admin/controllers/FMControllerFormMakerPreview.php +0 -43
  6. admin/controllers/FMControllerFormMakerSQLMapping.php +0 -112
  7. admin/controllers/FMControllerFormMakerSubmits.php +0 -43
  8. admin/controllers/FMControllerFormmakerwdcaptcha.php +0 -43
  9. admin/controllers/FMControllerFormmakerwdmathcaptcha.php +0 -43
  10. admin/controllers/FMControllerFormmakerwindow.php +0 -43
  11. admin/controllers/FMControllerFromeditcountryinpopup.php +0 -43
  12. admin/controllers/FMControllerFromipinfoinpopup.php +0 -43
  13. admin/controllers/FMControllerFrommapeditinpopup.php +0 -43
  14. admin/controllers/FMControllerGenerete_csv.php +0 -43
  15. admin/controllers/FMControllerGenerete_xml.php +0 -43
  16. admin/controllers/FMControllerGoptions_fm.php +0 -44
  17. admin/controllers/FMControllerLicensing_fm.php +0 -49
  18. admin/controllers/FMControllerManage_fm.php +0 -1196
  19. admin/controllers/FMControllerSelect_data_from_db.php +0 -70
  20. admin/controllers/FMControllerShow_matrix.php +0 -43
  21. admin/controllers/FMControllerSubmissions_fm.php +0 -291
  22. admin/controllers/FMControllerThemes_fm.php +0 -219
  23. admin/controllers/FMControllerUninstall_fm.php +0 -66
  24. admin/controllers/FMControllerWidget.php +0 -61
  25. admin/controllers/FMShortocde.php +43 -0
  26. admin/controllers/FormMakerEditCountryinPopup.php +31 -0
  27. admin/controllers/FormMakerIpinfoinPopup.php +58 -0
  28. admin/controllers/FormMakerMapEditinPopup.php +35 -0
  29. admin/controllers/FormMakerPreview.php +47 -0
  30. admin/controllers/FormMakerSQLMapping.php +167 -0
  31. admin/controllers/FormMakerSubmits.php +44 -0
  32. admin/controllers/Formmakerwdcaptcha.php +29 -0
  33. admin/controllers/Formmakerwdmathcaptcha.php +30 -0
  34. admin/controllers/Generete_csv.php +71 -0
  35. admin/controllers/Generete_xml.php +61 -0
  36. admin/controllers/Licensing_fm.php +26 -0
  37. admin/controllers/Manage_fm.php +1386 -0
  38. admin/controllers/Options_fm.php +43 -0
  39. admin/controllers/Paypal_info.php +38 -0
  40. admin/controllers/Product_option.php +36 -0
  41. admin/controllers/Select_data_from_db.php +93 -0
  42. admin/controllers/Show_matrix.php +27 -0
  43. admin/controllers/Submissions_fm.php +562 -0
  44. admin/controllers/Themes_fm.php +3044 -0
  45. admin/controllers/Uninstall_fm.php +65 -0
  46. admin/controllers/Widget.php +45 -0
  47. admin/models/Blocked_ips_fm.php +113 -0
  48. admin/models/FMCheckpaypal.php +105 -0
  49. admin/models/FMModelBlocked_ips_fm.php +0 -75
  50. admin/models/FMModelFormMakerPreview.php +0 -36
  51. admin/models/FMModelFormMakerSQLMapping.php +0 -121
  52. admin/models/FMModelFormMakerSubmits.php +0 -43
  53. admin/models/FMModelFormmakerwdcaptcha.php +0 -31
  54. admin/models/FMModelFormmakerwdmathcaptcha.php +0 -31
  55. admin/models/FMModelFormmakerwindow.php +0 -36
  56. admin/models/FMModelFromeditcountryinpopup.php +0 -31
  57. admin/models/FMModelFromipinfoinpopup.php +0 -31
  58. admin/models/FMModelFrommapeditinpopup.php +0 -31
  59. admin/models/FMModelGenerete_csv.php +0 -300
  60. admin/models/FMModelGenerete_xml.php +0 -301
  61. admin/models/FMModelGoptions_fm.php +0 -4
  62. admin/models/FMModelLicensing_fm.php +0 -30
  63. admin/models/FMModelManage_fm.php +0 -2887
  64. admin/models/FMModelSelect_data_from_db.php +0 -111
  65. admin/models/FMModelShow_matrix.php +0 -31
  66. admin/models/FMModelSubmissions_fm.php +0 -744
  67. admin/models/FMModelWidget.php +0 -38
  68. admin/models/FMPaypalInfo.php +20 -0
  69. admin/models/FMPreview.php +20 -0
  70. admin/models/FMSelectDataFromDb.php +134 -0
  71. admin/models/FMShortocde.php +18 -0
  72. admin/models/FMSqlMapping.php +119 -0
  73. admin/models/FormMakerSubmits.php +20 -0
  74. admin/models/Manage_fm.php +3759 -0
  75. admin/models/Options_fm.php +27 -0
  76. admin/models/Submissions_fm.php +578 -0
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ .idea
2
+ css/frontend/*
3
+ js/frontend/*
4
+ !.gitignore
admin/controllers/Blocked_ips_fm.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerBlocked_ips_fm
5
+ */
6
+ class FMControllerBlocked_ips_fm {
7
+ private $model;
8
+ private $view;
9
+ private $bulk_action_name = '';
10
+ private $items_per_page = 20;
11
+ private $actions = array();
12
+
13
+ public function __construct() {
14
+ require_once WDFM()->plugin_dir . "/admin/models/Blocked_ips_fm.php";
15
+ require_once WDFM()->plugin_dir . "/admin/views/Blocked_ips_fm.php";
16
+ $this->model = new FMModelBlocked_ips_fm();
17
+ $this->view = new FMViewBlocked_ips_fm();
18
+
19
+ $this->page = WDW_FM_Library::get('page');
20
+
21
+ $this->bulk_action_name = 'bulk_action';
22
+
23
+ $this->actions = array(
24
+ 'delete' => array(
25
+ 'title' => __('Delete', WDFM()->prefix),
26
+ $this->bulk_action_name => __('deleted', WDFM()->prefix),
27
+ ),
28
+ );
29
+ }
30
+
31
+ public function execute() {
32
+ $task = WDW_FM_Library::get('task');
33
+ $id = (int) WDW_FM_Library::get('current_id', 0);
34
+
35
+ if ( method_exists($this, $task) ) {
36
+ check_admin_referer(WDFM()->nonce, WDFM()->nonce);
37
+ $block_action = $this->bulk_action_name;
38
+ $action = WDW_FM_Library::get( $block_action, -1 );
39
+ if ( $action != -1 ) {
40
+ $this->$block_action($action);
41
+ }
42
+ else {
43
+ $this->$task($id);
44
+ }
45
+ }
46
+ else {
47
+ $this->display();
48
+ }
49
+ }
50
+
51
+ public function display() {
52
+ $params = array();
53
+ $params['order'] = WDW_FM_Library::get('order', 'desc');
54
+ $params['orderby'] = WDW_FM_Library::get('orderby', 'id');
55
+ // To prevent SQL injections.
56
+ if ( !in_array($params['orderby'], array( 'id', 'ip' )) ) {
57
+ $params['orderby'] = 'id';
58
+ }
59
+ $params['order'] = $params['order'] == 'desc' ? 'desc' : 'asc';
60
+
61
+ $params['items_per_page'] = $this->items_per_page;
62
+
63
+ $params['rows_data'] = $this->model->get_rows_data($params);
64
+
65
+ $params['total'] = $this->model->total();
66
+
67
+ $params['actions'] = $this->actions;
68
+ $params['page'] = $this->page;
69
+
70
+ $this->view->display($params);
71
+ }
72
+
73
+ /**
74
+ * Bulk actions.
75
+ *
76
+ * @param $task
77
+ */
78
+ public function bulk_action($task) {
79
+ $message = 0;
80
+ $successfully_updated = 0;
81
+ $check = WDW_FM_Library::get('check', '');
82
+ if ( $check ) {
83
+ foreach ( $check as $id => $item ) {
84
+ if ( method_exists($this, $task) ) {
85
+ $message = $this->$task($id, TRUE);
86
+ if ( $message != 2 ) {
87
+ // Increase successfully updated items count, if action doesn't failed.
88
+ $successfully_updated++;
89
+ }
90
+ }
91
+ }
92
+ if ( $successfully_updated ) {
93
+ $block_action = $this->bulk_action_name;
94
+ $message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $successfully_updated, WDFM()->prefix), $successfully_updated, $this->actions[$task][$block_action]);
95
+ }
96
+ }
97
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
98
+ 'page' => $this->page,
99
+ 'task' => 'display',
100
+ ($message === 2 ? 'message' : 'msg') => $message,
101
+ ), admin_url('admin.php')));
102
+ }
103
+
104
+ public function insert_blocked_ip() {
105
+
106
+ $page = WDW_FM_Library::get('page');
107
+
108
+ $ip = WDW_FM_Library::get('ip','');
109
+
110
+ $insert = $this->model->insert_fm_blocked(array('ip' => $ip,), array('%s',));
111
+ if( !$insert ){
112
+ $message = 2;
113
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
114
+ 'page' => $page,
115
+ 'task' => 'display',
116
+ 'message' => $message,
117
+ ), admin_url('admin.php')));
118
+ }
119
+ }
120
+
121
+ public function delete_blocked_ip( $id ) {
122
+ $page = WDW_FM_Library::get('page');
123
+ // check id for db
124
+ if(isset($id) && $id != "") {
125
+ $id = intval($id);
126
+ $delete = $this->model->delete_data($id);
127
+
128
+ if( !$delete ){
129
+ $message = 2;
130
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
131
+ 'page' => $page,
132
+ 'task' => 'display',
133
+ 'message' => $message,
134
+ ), admin_url('admin.php')));
135
+ }
136
+
137
+ }
138
+ else { // return message Failed
139
+ $message = 2;
140
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
141
+ 'page' => $page,
142
+ 'task' => 'display',
143
+ 'message' => $message,
144
+ ), admin_url('admin.php')));
145
+ }
146
+
147
+ $total = $this->model->total(); // get total count of blocked IPs
148
+ if( ($total % $this->items_per_page) == 0 ) {
149
+
150
+ echo '<div id="total_for_paging">'.$total/$this->items_per_page.'</div>'; // send to JS page number
151
+ }
152
+
153
+
154
+ }
155
+
156
+ public function update_blocked_ip( $id ) {
157
+ $page = WDW_FM_Library::get('page');
158
+
159
+ // check id for db
160
+ if(isset($id) && $id != "") {
161
+ $id = intval($id);
162
+ $ip = WDW_FM_Library::get('ip', '');
163
+ $update = $this->model->update_fm_blocked(array('ip' => $ip,), array('id' => $id));
164
+
165
+ if( !$update ){
166
+ $message = 2;
167
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
168
+ 'page' => $page,
169
+ 'task' => 'display',
170
+ 'message' => $message,
171
+ ), admin_url('admin.php')));
172
+ }
173
+
174
+ }
175
+ else { // return message Failed
176
+ $message = 2;
177
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
178
+ 'page' => $page,
179
+ 'task' => 'display',
180
+ 'message' => $message,
181
+ ), admin_url('admin.php')));
182
+ }
183
+
184
+ }
185
+
186
+ public function delete( $id, $bulk = FALSE ) {
187
+ if ( $this->model->delete_data($id) ) {
188
+ $message = 3;
189
+ }
190
+ else {
191
+ $message = 2;
192
+ }
193
+
194
+ if ( $bulk ) {
195
+ return $message;
196
+ }
197
+ else {
198
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
199
+ 'page' => $this->page,
200
+ 'task' => 'display',
201
+ 'message' => $message,
202
+ ), admin_url('admin.php')));
203
+ }
204
+ }
205
+
206
+ public function save() {
207
+ $message = $this->save_db();
208
+ $page = WDW_FM_Library::get('page');
209
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
210
+ 'page' => $page,
211
+ 'task' => 'display',
212
+ 'message' => $message,
213
+ ), admin_url('admin.php')));
214
+ }
215
+
216
+ public function save_db() {
217
+ $id = (isset($_POST['current_id']) ? (int) $_POST['current_id'] : 0);
218
+ $ip = (isset($_POST['ip']) ? esc_html(stripslashes($_POST['ip'])) : '');
219
+ if ( $id != 0 ) {
220
+ $save = $this->model->update_fm_blocked(array(
221
+ 'ip' => $ip,
222
+ ), array( 'id' => $id ));
223
+ }
224
+ else {
225
+ $save = $this->model->insert_fm_blocked(array(
226
+ 'ip' => $ip,
227
+ ), array(
228
+ '%s',
229
+ ));
230
+ }
231
+ if ( $save !== FALSE ) {
232
+ $message = 1;
233
+ }
234
+ else {
235
+ $message = 2;
236
+ }
237
+ return $message;
238
+ }
239
+
240
+ public function save_all() {
241
+ $flag = FALSE;
242
+ $ips_id_col = $this->model->get_col_data();
243
+ foreach ( $ips_id_col as $ip_id ) {
244
+ if ( isset($_POST['ip' . $ip_id]) ) {
245
+ $ip = esc_html(stripslashes($_POST['ip' . $ip_id]));
246
+ if ( $ip == '' ) {
247
+ $this->model->delete_data($ip_id);
248
+ }
249
+ else {
250
+ $flag = TRUE;
251
+ $this->model->update_fm_blocked(array(
252
+ 'ip' => $ip,
253
+ ), array( 'id' => $ip_id ));
254
+ }
255
+ }
256
+ }
257
+ if ( $flag ) {
258
+ $message = 1;
259
+ }
260
+ else {
261
+ $message = 0;
262
+ }
263
+ $page = WDW_FM_Library::get('page');
264
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
265
+ 'page' => $page,
266
+ 'task' => 'display',
267
+ 'message' => $message,
268
+ ), admin_url('admin.php')));
269
+ }
270
+ }
admin/controllers/Checkpaypal.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerCheckpaypal
5
+ */
6
+ class FMControllerCheckpaypal {
7
+ /**
8
+ * @var $model
9
+ */
10
+ private $model;
11
+ /**
12
+ * @var $view
13
+ */
14
+ private $view;
15
+
16
+ /**
17
+ * FMControllerCheckpaypal constructor.
18
+ */
19
+ public function __construct() {
20
+ // Load FMModelCheckpaypal class.
21
+ require_once WDFM()->plugin_dir . "/admin/models/checkpaypal.php";
22
+ $this->model = new FMModelCheckpaypal();
23
+ // Load FMViewCheckpaypal class.
24
+ require_once WDFM()->plugin_dir . "/admin/view/checkpaypal.php";
25
+ $this->view = new FMViewCheckpaypal();
26
+ }
27
+
28
+ /**
29
+ * Execute.
30
+ */
31
+ public function execute() {
32
+ $this->display();
33
+ }
34
+
35
+ /**
36
+ * Display.
37
+ */
38
+ public function display() {
39
+ // Get form by id.
40
+ $form_id = WDW_FM_Library::get('form_id', 0);
41
+ $form = $this->model->get_form_by_id($form_id);
42
+ // Get form session by group id.
43
+ $group_id = WDW_FM_Library::get('group_id', 0);
44
+ $form_session = $this->model->get_form_session_by_group_id($group_id);
45
+ // Connect to paypal.
46
+ $post_fields = '';
47
+ if ( isset($_POST) && !empty($_POST) ) {
48
+ foreach ( $_POST as $key => $value ) {
49
+ $post_fields .= $key . '=' . urlencode($value) . '&';
50
+ }
51
+ }
52
+ $post_fields .= 'cmd=_notify-validate';
53
+ $checkout_mode = !empty($form->checkout_mode) ? $form->checkout_mode : 0;
54
+ $paypal_params = array( 'checkout_mode' => $checkout_mode, 'post_fields' => $post_fields );
55
+ $response = $this->model->connect_to_paypal($paypal_params);
56
+ $tax = WDW_FM_Library::get('tax', 0);
57
+ $total = WDW_FM_Library::get('mc_gross', 0);
58
+ $shipping = WDW_FM_Library::get('mc_shipping', 0);
59
+ $payment_status = WDW_FM_Library::get('payment_status', 0);
60
+ // Update payment status for formmaker_submits table.
61
+ $this->model->update_submission_status($payment_status, $group_id);
62
+ $form_currency = '$';
63
+ $currency_code = array(
64
+ 'USD',
65
+ 'EUR',
66
+ 'GBP',
67
+ 'JPY',
68
+ 'CAD',
69
+ 'MXN',
70
+ 'HKD',
71
+ 'HUF',
72
+ 'NOK',
73
+ 'NZD',
74
+ 'SGD',
75
+ 'SEK',
76
+ 'PLN',
77
+ 'AUD',
78
+ 'DKK',
79
+ 'CHF',
80
+ 'CZK',
81
+ 'ILS',
82
+ 'BRL',
83
+ 'TWD',
84
+ 'MYR',
85
+ 'PHP',
86
+ 'THB',
87
+ );
88
+ $currency_sign = array(
89
+ '$',
90
+ '&#8364;',
91
+ '&#163;',
92
+ '&#165;',
93
+ 'C$',
94
+ 'Mex$',
95
+ 'HK$',
96
+ 'Ft',
97
+ 'kr',
98
+ 'NZ$',
99
+ 'S$',
100
+ 'kr',
101
+ 'zl',
102
+ 'A$',
103
+ 'kr',
104
+ 'CHF',
105
+ 'Kc',
106
+ '&#8362;',
107
+ 'R$',
108
+ 'NT$',
109
+ 'RM',
110
+ '&#8369;',
111
+ '&#xe3f;',
112
+ );
113
+ // Checking payment currency and set new value fo currency.
114
+ $payment_currency = !empty($form->payment_currency) ? $form->payment_currency : $form_currency;
115
+ if ( !empty($payment_currency) ) {
116
+ $form_currency = $currency_sign[array_search($payment_currency, $currency_code)];
117
+ }
118
+ $currency = $payment_currency . $form_currency;
119
+ $email = WDW_FM_Library::get('payer_email', '');
120
+ $first_name = WDW_FM_Library::get('first_name', '');
121
+ $last_name = WDW_FM_Library::get('last_name', '');
122
+ $full_name = (!empty($first_name) ? $first_name : '') . (!empty($last_name) ? ' ' . $last_name : '');
123
+ $phone_a = WDW_FM_Library::get('night_phone_a', '');
124
+ $phone_b = WDW_FM_Library::get('night_phone_b', '');
125
+ $phone_c = WDW_FM_Library::get('night_phone_c', '');
126
+ $phone = (!empty($phone_a) ? $phone_a : '') . (!empty($phone_b) ? ' - ' . $phone_b : '') . (!empty($phone_c) ? ' - ' . $phone_c : '');
127
+ $address = '';
128
+ $address .= !empty(WDW_FM_Library::get('address_country', '')) ? "Country: " . WDW_FM_Library::get('address_country', '') : '';
129
+ $address .= !empty(WDW_FM_Library::get('address_state', '')) ? "<br>State: " . WDW_FM_Library::get('address_state', '') : '';
130
+ $address .= !empty(WDW_FM_Library::get('address_city', '')) ? "<br>City: " . WDW_FM_Library::get('address_city', '') : '';
131
+ $address .= !empty(WDW_FM_Library::get('address_street', '')) ? "<br>Street: " . WDW_FM_Library::get('address_street', '') : '';
132
+ $address .= !empty(WDW_FM_Library::get('address_zip', '')) ? "<br>Zip Code: " . WDW_FM_Library::get('address_zip', '') : '';
133
+ $address .= !empty(WDW_FM_Library::get('address_status', '')) ? "<br>Address Status: " . WDW_FM_Library::get('address_status', '') : '';
134
+ $address .= !empty(WDW_FM_Library::get('address_name', '')) ? "<br>Name: " . WDW_FM_Library::get('address_name', '') : '';
135
+ $paypal_info = "";
136
+ $paypal_info .= !empty(WDW_FM_Library::get('payer_status', '')) ? "<br>Payer Status - " . WDW_FM_Library::get('payer_status', '') : '';
137
+ $paypal_info .= !empty(WDW_FM_Library::get('payer_email', '')) ? "<br>Payer Email - " . WDW_FM_Library::get('payer_email', '') : '';
138
+ $paypal_info .= !empty(WDW_FM_Library::get('txn_id', '')) ? "<br>Transaction - " . WDW_FM_Library::get('txn_id', '') : '';
139
+ $paypal_info .= !empty(WDW_FM_Library::get('payment_type', '')) ? "<br>Payment Type - " . WDW_FM_Library::get('payment_type', '') : '';
140
+ $paypal_info .= !empty(WDW_FM_Library::get('residence_country', '')) ? "<br>Residence Country - " . WDW_FM_Library::get('residence_country', '') : '';
141
+ $post = array(
142
+ 'form_id' => $form_id,
143
+ 'group_id' => $group_id,
144
+ 'full_name' => $full_name,
145
+ 'email' => $email,
146
+ 'phone' => $phone,
147
+ 'address' => $address,
148
+ 'status' => $payment_status,
149
+ 'ipn' => $response,
150
+ 'currency' => $currency,
151
+ 'paypal_info' => $paypal_info,
152
+ 'tax' => $tax,
153
+ 'total' => $total,
154
+ 'shipping' => $shipping,
155
+ 'ord_last_modified' => date('Y-m-d H:i:s'),
156
+ );
157
+ if ( !$form_session ) {
158
+ $this->model->add_formmaker_sessions($post);
159
+ }
160
+ else {
161
+ $this->model->update_formmaker_sessions_by_group_id($group_id, $post);
162
+ }
163
+ // Get form session by group id.
164
+ $form_session = $this->model->get_form_session_by_group_id($group_id);
165
+ // Send mail to payer
166
+ if ( $form->mail && !empty($form_session) ) {
167
+ $to = $form->mail;
168
+ $subject = "Payment information";
169
+ // Get template for payment information.
170
+ $template_params = array( 'form_session' => $form_session, 'post' => $post );
171
+ $message = $this->view->payment_information_template($template_params);
172
+ add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
173
+ wp_mail($to, $subject, $message);
174
+ }
175
+
176
+ return 0;
177
+ }
178
+ }
admin/controllers/FMControllerBlocked_ips_fm.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
-
3
- class FMControllerBlocked_ips_fm {
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 execute() {
22
- $task = WDW_FM_Library::get('task');
23
- $id = (int)WDW_FM_Library::get('current_id', 0);
24
- $message = WDW_FM_Library::get('message');
25
- echo WDW_FM_Library::message_id($message);
26
- if (method_exists($this, $task)) {
27
- check_admin_referer('nonce_fm', 'nonce_fm');
28
- $this->$task($id);
29
- }
30
- else {
31
- $this->display();
32
- }
33
- }
34
-
35
- public function display() {
36
- require_once WD_FM_DIR . "/admin/models/FMModelBlocked_ips_fm.php";
37
- $model = new FMModelBlocked_ips_fm();
38
-
39
- require_once WD_FM_DIR . "/admin/views/FMViewBlocked_ips_fm.php";
40
- $view = new FMViewBlocked_ips_fm($model);
41
- $view->display();
42
- }
43
-
44
- public function save() {
45
- $message = $this->save_db();
46
- // $this->display();
47
- $page = WDW_FM_Library::get('page');
48
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
49
- }
50
-
51
- public function save_db() {
52
- global $wpdb;
53
- $id = (isset($_POST['current_id']) ? (int) $_POST['current_id'] : 0);
54
- $ip = (isset($_POST['ip']) ? esc_html(stripslashes($_POST['ip'])) : '');
55
- if ($id != 0) {
56
- $save = $wpdb->update($wpdb->prefix . 'formmaker_blocked', array(
57
- 'ip' => $ip,
58
- ), array('id' => $id));
59
- }
60
- else {
61
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_blocked', array(
62
- 'ip' => $ip,
63
- ), array(
64
- '%s',
65
- ));
66
- }
67
- if ($save !== FALSE) {
68
- $message = 1;
69
- }
70
- else {
71
- $message = 2;
72
- }
73
- }
74
-
75
- public function save_all() {
76
- global $wpdb;
77
- $flag = FALSE;
78
- $ips_id_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_blocked');
79
- foreach ($ips_id_col as $ip_id) {
80
- if (isset($_POST['ip' . $ip_id])) {
81
- $ip = esc_html(stripslashes($_POST['ip' . $ip_id]));
82
- if ($ip == '') {
83
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $ip_id));
84
- }
85
- else {
86
- $flag = TRUE;
87
- $wpdb->update($wpdb->prefix . 'formmaker_blocked', array(
88
- 'ip' => $ip,
89
- ), array('id' => $ip_id));
90
- }
91
- }
92
- }
93
- if ($flag) {
94
- $message = 1;
95
- }
96
- else {
97
- $message = 0;
98
- }
99
- // $this->display();
100
- $page = WDW_FM_Library::get('page');
101
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
102
- }
103
-
104
- public function delete($id) {
105
- global $wpdb;
106
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $id);
107
- if ($wpdb->query($query)) {
108
- $message = 3;
109
- }
110
- else {
111
- $message = 2;
112
- }
113
- // $this->display();
114
- $page = WDW_FM_Library::get('page');
115
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
116
- }
117
-
118
- public function delete_all() {
119
- global $wpdb;
120
- $flag = FALSE;
121
- $ips_id_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_blocked');
122
- foreach ($ips_id_col as $ip_id) {
123
- if (isset($_POST['check_' . $ip_id])) {
124
- $flag = TRUE;
125
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $ip_id));
126
- }
127
- }
128
- if ($flag) {
129
- $message = 5;
130
- }
131
- else {
132
- $message = 2;
133
- }
134
- // $this->display();
135
- $page = WDW_FM_Library::get('page');
136
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
137
- }
138
-
139
- ////////////////////////////////////////////////////////////////////////////////////////
140
- // Getters & Setters //
141
- ////////////////////////////////////////////////////////////////////////////////////////
142
- ////////////////////////////////////////////////////////////////////////////////////////
143
- // Private Methods //
144
- ////////////////////////////////////////////////////////////////////////////////////////
145
- ////////////////////////////////////////////////////////////////////////////////////////
146
- // Listeners //
147
- ////////////////////////////////////////////////////////////////////////////////////////
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFormMakerPreview.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFormMakerPreview {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFormMakerPreview.php";
27
- $model = new FMModelFormMakerPreview();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFormMakerPreview.php";
30
- $view = new FMViewFormMakerPreview($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFormMakerSQLMapping.php DELETED
@@ -1,112 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFormMakerSQLMapping {
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 execute() {
22
- $task = ((isset($_GET['task'])) ? esc_html($_GET['task']) : 0);
23
- $id = ((isset($_GET['id'])) ? (int) $_GET['id'] : 0);
24
- $form_id = ((isset($_GET['form_id'])) ? (int) $_GET['form_id'] : 0);
25
- if ($task && method_exists($this, $task)) {
26
- $this->$task($form_id);
27
- }
28
- else {
29
- if ($id) {
30
- $this->edit_query($id, $form_id);
31
- }
32
- else {
33
- $this->add_query($form_id);
34
- }
35
- }
36
- }
37
-
38
- public function add_query($form_id) {
39
- require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
40
- $model = new FMModelFormMakerSQLMapping();
41
-
42
- require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
43
- $view = new FMViewFormMakerSQLMapping($model);
44
- $view->add_query($form_id);
45
- }
46
-
47
- public function edit_query($id, $form_id) {
48
- require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
49
- $model = new FMModelFormMakerSQLMapping();
50
-
51
- require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
52
- $view = new FMViewFormMakerSQLMapping($model);
53
- $view->edit_query($id, $form_id);
54
- }
55
-
56
- public function db_tables($form_id) {
57
- require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
58
- $model = new FMModelFormMakerSQLMapping();
59
-
60
- require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
61
- $view = new FMViewFormMakerSQLMapping($model);
62
- $view->db_tables($form_id);
63
- }
64
-
65
- public function db_table_struct($form_id) {
66
- require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSQLMapping.php";
67
- $model = new FMModelFormMakerSQLMapping();
68
-
69
- require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSQLMapping.php";
70
- $view = new FMViewFormMakerSQLMapping($model);
71
- $view->db_table_struct($form_id);
72
- }
73
-
74
- public function save_query() {
75
- global $wpdb;
76
- $form_id = ((isset($_GET['form_id'])) ? (int) $_GET['form_id'] : 0);
77
- $query = ((isset($_POST['query'])) ? stripslashes(wp_specialchars_decode($_POST['query'])) : "");
78
- $details = ((isset($_POST['details'])) ? esc_html($_POST['details']) : "");
79
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_query', array(
80
- 'form_id' => $form_id,
81
- 'query' => $query,
82
- 'details' => $details,
83
- ), array(
84
- '%d',
85
- '%s',
86
- '%s',
87
- ));
88
- }
89
-
90
- public function update_query() {
91
- global $wpdb;
92
- $id = ((isset($_GET['id'])) ? (int) $_GET['id'] : 0);
93
- $form_id = ((isset($_GET['form_id'])) ? (int) $_GET['form_id'] : 0);
94
- $query = ((isset($_POST['query'])) ? stripslashes(wp_specialchars_decode($_POST['query'])) : "");
95
- $details = ((isset($_POST['details'])) ? esc_html($_POST['details']) : "");
96
- $save = $wpdb->update($wpdb->prefix . 'formmaker_query', array(
97
- 'form_id' => $form_id,
98
- 'query' => $query,
99
- 'details' => $details,
100
- ), array('id' => $id));
101
- }
102
-
103
- ////////////////////////////////////////////////////////////////////////////////////////
104
- // Getters & Setters //
105
- ////////////////////////////////////////////////////////////////////////////////////////
106
- ////////////////////////////////////////////////////////////////////////////////////////
107
- // Private Methods //
108
- ////////////////////////////////////////////////////////////////////////////////////////
109
- ////////////////////////////////////////////////////////////////////////////////////////
110
- // Listeners //
111
- ////////////////////////////////////////////////////////////////////////////////////////
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFormMakerSubmits.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFormMakerSubmits {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFormMakerSubmits.php";
27
- $model = new FMModelFormMakerSubmits();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFormMakerSubmits.php";
30
- $view = new FMViewFormMakerSubmits($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFormmakerwdcaptcha.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFormmakerwdcaptcha {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFormmakerwdcaptcha.php";
27
- $model = new FMModelFormmakerwdcaptcha();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFormmakerwdcaptcha.php";
30
- $view = new FMViewFormmakerwdcaptcha($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFormmakerwdmathcaptcha.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFormmakerwdmathcaptcha {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFormmakerwdmathcaptcha.php";
27
- $model = new FMModelFormmakerwdmathcaptcha();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFormmakerwdmathcaptcha.php";
30
- $view = new FMViewFormmakerwdmathcaptcha($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFormmakerwindow.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFormmakerwindow {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFormmakerwindow.php";
27
- $model = new FMModelFormmakerwindow();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFormmakerwindow.php";
30
- $view = new FMViewFormmakerwindow($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFromeditcountryinpopup.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFromeditcountryinpopup {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFromeditcountryinpopup.php";
27
- $model = new FMModelFromeditcountryinpopup();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFromeditcountryinpopup.php";
30
- $view = new FMViewFromeditcountryinpopup($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFromipinfoinpopup.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFromipinfoinpopup {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFromipinfoinpopup.php";
27
- $model = new FMModelFromipinfoinpopup();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFromipinfoinpopup.php";
30
- $view = new FMViewFromipinfoinpopup($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerFrommapeditinpopup.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerFrommapeditinpopup {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelFrommapeditinpopup.php";
27
- $model = new FMModelFrommapeditinpopup();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewFrommapeditinpopup.php";
30
- $view = new FMViewFrommapeditinpopup($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerGenerete_csv.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerGenerete_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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelGenerete_csv.php";
27
- $model = new FMModelGenerete_csv();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewGenerete_csv.php";
30
- $view = new FMViewGenerete_csv($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerGenerete_xml.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerGenerete_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
- public function execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelGenerete_xml.php";
27
- $model = new FMModelGenerete_xml();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewGenerete_xml.php";
30
- $view = new FMViewGenerete_xml($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerGoptions_fm.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
-
3
- class FMControllerGoptions_fm {
4
- public function execute() {
5
- $task = WDW_FM_Library::get('task');
6
- $id = (int)WDW_FM_Library::get('current_id', 0);
7
- $message = WDW_FM_Library::get('message');
8
- echo WDW_FM_Library::message_id($message);
9
- if (method_exists($this, $task)) {
10
- check_admin_referer('nonce_fm', 'nonce_fm');
11
- $this->$task($id);
12
- }
13
- else {
14
- $this->display();
15
- }
16
- }
17
-
18
- public function display() {
19
- require_once WD_FM_DIR . "/admin/models/FMModelGoptions_fm.php";
20
- $model = new FMModelGoptions_fm();
21
-
22
- require_once WD_FM_DIR . "/admin/views/FMViewGoptions_fm.php";
23
- $view = new FMViewGoptions_fm($model);
24
- $view->display();
25
- }
26
-
27
- public function save() {
28
- $message = $this->save_db();
29
- $page = WDW_FM_Library::get('page');
30
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
31
- }
32
-
33
- public function save_db() {
34
- $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
35
- $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
36
- $csv_delimiter = (isset($_POST['csv_delimiter']) && $_POST['csv_delimiter'] != '' ? esc_html(stripslashes($_POST['csv_delimiter'])) : ',');
37
- $fm_shortcode = (isset($_POST['fm_shortcode']) ? "old" : '');
38
- $fm_advanced_layout = (isset($_POST['fm_advanced_layout']) ? '1' : '');
39
-
40
- $map_key = (isset($_POST['map_key']) ? esc_html(stripslashes($_POST['map_key'])) : '');
41
- update_option('fm_settings', array('public_key' => $public_key, 'private_key' => $private_key, 'csv_delimiter' => $csv_delimiter, 'map_key' => $map_key, 'fm_shortcode' => $fm_shortcode, 'fm_advanced_layout' => $fm_advanced_layout,));
42
- }
43
-
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerLicensing_fm.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- class FMControllerLicensing_fm {
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 execute() {
22
- $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
23
- if (method_exists($this, $task)) {
24
- $this->$task($id);
25
- }
26
- else {
27
- $this->display();
28
- }
29
- }
30
-
31
- public function display() {
32
- require_once WD_FM_DIR . "/admin/models/FMModelLicensing_fm.php";
33
- $model = new FMModelLicensing_fm();
34
-
35
- require_once WD_FM_DIR . "/admin/views/FMViewLicensing_fm.php";
36
- $view = new FMViewLicensing_fm($model);
37
- $view->display();
38
- }
39
-
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Getters & Setters //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- ////////////////////////////////////////////////////////////////////////////////////////
44
- // Private Methods //
45
- ////////////////////////////////////////////////////////////////////////////////////////
46
- ////////////////////////////////////////////////////////////////////////////////////////
47
- // Listeners //
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerManage_fm.php DELETED
@@ -1,1196 +0,0 @@
1
- <?php
2
-
3
- class FMControllerManage_fm {
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 execute() {
22
- $task = WDW_FM_Library::get('task');
23
- $id = (int)WDW_FM_Library::get('current_id', 0);
24
- $message = WDW_FM_Library::get('message');
25
- echo WDW_FM_Library::message_id($message);
26
- if (method_exists($this, $task)) {
27
- check_admin_referer('nonce_fm', 'nonce_fm');
28
- $this->$task($id);
29
- }
30
- else {
31
- $this->display();
32
- }
33
- }
34
-
35
- public function undo() {
36
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
37
- $model = new FMModelManage_fm();
38
-
39
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
40
-
41
- global $wpdb;
42
- $backup_id = (int)WDW_FM_Library::get('backup_id');
43
- $id = (int)WDW_FM_Library::get('id');
44
-
45
- $query = "SELECT backup_id FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id < $backup_id AND id = $id ORDER BY backup_id DESC LIMIT 0 , 1 ";
46
- $backup_id = $wpdb->get_var($query);
47
-
48
- $view = new FMViewManage_fm($model);
49
- $view->edit($backup_id);
50
- }
51
-
52
- public function redo() {
53
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
54
- $model = new FMModelManage_fm();
55
-
56
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
57
- global $wpdb;
58
- $backup_id = (int)WDW_FM_Library::get('backup_id');
59
- $id = (int)WDW_FM_Library::get('id');
60
-
61
- $query = "SELECT backup_id FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id > $backup_id AND id = $id ORDER BY backup_id ASC LIMIT 0 , 1 ";
62
- $backup_id = $wpdb->get_var($query);
63
-
64
- $view = new FMViewManage_fm($model);
65
- $view->edit($backup_id);
66
- }
67
-
68
- public function display() {
69
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
70
- $model = new FMModelManage_fm();
71
-
72
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
73
- $view = new FMViewManage_fm($model);
74
- $view->display();
75
- }
76
-
77
- public function add() {
78
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
79
- $model = new FMModelManage_fm();
80
-
81
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
82
- $view = new FMViewManage_fm($model);
83
- $view->edit(0);
84
- }
85
-
86
- public function edit() {
87
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
88
- $model = new FMModelManage_fm();
89
-
90
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
91
- $view = new FMViewManage_fm($model);
92
- $id = (int)WDW_FM_Library::get('current_id', 0);
93
-
94
- global $wpdb;
95
- $query = "SELECT backup_id FROM ".$wpdb->prefix."formmaker_backup WHERE cur=1 and id=".$id;
96
- $backup_id = $wpdb->get_var($query);
97
-
98
- if(!$backup_id) {
99
- $query = "SELECT max(backup_id) FROM ".$wpdb->prefix."formmaker_backup";
100
- $backup_id = $wpdb->get_var($query);
101
- if($backup_id)
102
- $backup_id++;
103
- else
104
- $backup_id=1;
105
- $query = "INSERT INTO ".$wpdb->prefix."formmaker_backup SELECT ".$backup_id." AS backup_id, 1 AS cur, formmakerbkup.id, formmakerbkup.title, formmakerbkup.type, formmakerbkup.mail, formmakerbkup.form_front, formmakerbkup.theme, formmakerbkup.javascript, formmakerbkup.submit_text, formmakerbkup.url, formmakerbkup.submit_text_type, formmakerbkup.script_mail, formmakerbkup.script_mail_user, formmakerbkup.counter, formmakerbkup.published, formmakerbkup.label_order, formmakerbkup.label_order_current, formmakerbkup.article_id, formmakerbkup.pagination, formmakerbkup.show_title, formmakerbkup.show_numbers, formmakerbkup.public_key, formmakerbkup.private_key, formmakerbkup.recaptcha_theme, formmakerbkup.paypal_mode, formmakerbkup.checkout_mode, formmakerbkup.paypal_email, formmakerbkup.payment_currency, formmakerbkup.tax, formmakerbkup.form_fields, formmakerbkup.savedb, formmakerbkup.sendemail, formmakerbkup.requiredmark, formmakerbkup.from_mail, formmakerbkup.from_name, formmakerbkup.reply_to, formmakerbkup.send_to, formmakerbkup.autogen_layout, formmakerbkup.custom_front, formmakerbkup.mail_from_user, formmakerbkup.mail_from_name_user, formmakerbkup.reply_to_user, formmakerbkup.condition, formmakerbkup.mail_cc, formmakerbkup.mail_cc_user, formmakerbkup.mail_bcc, formmakerbkup.mail_bcc_user, formmakerbkup.mail_subject, formmakerbkup.mail_subject_user, formmakerbkup.mail_mode, formmakerbkup.mail_mode_user, formmakerbkup.mail_attachment, formmakerbkup.mail_attachment_user, formmakerbkup.user_id_wd, formmakerbkup.sortable, formmakerbkup.frontend_submit_fields, formmakerbkup.frontend_submit_stat_fields, formmakerbkup.mail_emptyfields, formmakerbkup.mail_verify, formmakerbkup.mail_verify_expiretime, formmakerbkup.mail_verification_post_id, formmakerbkup.save_uploads, formmakerbkup.header_title, formmakerbkup.header_description, formmakerbkup.header_image_url, formmakerbkup.header_image_animation, formmakerbkup.header_hide_image FROM ".$wpdb->prefix."formmaker as formmakerbkup WHERE id=".$id;
106
- $wpdb->query($query);
107
- }
108
- $view->edit($backup_id);
109
- }
110
-
111
- public function form_layout() {
112
- if (!isset($_GET['task'])) {
113
- $this->save_db();
114
- }
115
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
116
- $model = new FMModelManage_fm();
117
-
118
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
119
- $view = new FMViewManage_fm($model);
120
- global $wpdb;
121
- $id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
122
- $view->form_layout($id);
123
- }
124
-
125
- public function save_layout() {
126
- $message = $this->save_db_layout();
127
- $page = WDW_FM_Library::get('page');
128
- $current_id = (int)WDW_FM_Library::get('current_id', 0);
129
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
130
- }
131
-
132
- public function apply_layout() {
133
- $message = $this->save_db_layout();
134
- $page = WDW_FM_Library::get('page');
135
- $current_id = (int)WDW_FM_Library::get('current_id', 0);
136
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'form_layout', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
137
- }
138
-
139
- public function save_db_layout() {
140
- global $wpdb;
141
- $id = (int)WDW_FM_Library::get('current_id', 0);
142
- $custom_front = (isset($_POST['custom_front']) ? stripslashes($_POST['custom_front']) : '');
143
- $autogen_layout = (isset($_POST['autogen_layout']) ? 1 : 0);
144
- $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
145
- 'custom_front' => $custom_front,
146
- 'autogen_layout' => $autogen_layout
147
- ), array('id' => $id));
148
- if ($save !== FALSE) {
149
- return 1;
150
- }
151
- else {
152
- return 2;
153
- }
154
- }
155
-
156
- public function form_options() {
157
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
158
- $model = new FMModelManage_fm();
159
-
160
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
161
- $view = new FMViewManage_fm($model);
162
-
163
- global $wpdb;
164
- $id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
165
- $view->form_options($id);
166
- }
167
-
168
- public function display_options() {
169
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
170
- $model = new FMModelManage_fm();
171
-
172
- require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
173
- $view = new FMViewManage_fm($model);
174
-
175
- global $wpdb;
176
- $id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
177
- $view->display_options($id);
178
- }
179
-
180
- public function save_options() {
181
- $message = $this->save_db_options();
182
- // $this->edit();
183
- $page = WDW_FM_Library::get('page');
184
- $current_id = (int)WDW_FM_Library::get('current_id', 0);
185
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
186
- }
187
-
188
- public function save_display_options() {
189
- $message = $this->save_dis_options();
190
- $page = WDW_FM_Library::get('page');
191
- $current_id = (int)WDW_FM_Library::get('current_id', 0);
192
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
193
- }
194
-
195
- public function view_options() {
196
- if (!isset($_GET['task'])) {
197
- $this->save_db();
198
- }
199
- global $wpdb;
200
- $page = WDW_FM_Library::get('page');
201
- $current_id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
202
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'form_options', 'current_id' => $current_id), admin_url('admin.php')));
203
- }
204
-
205
- public function view_display_options() {
206
- if (!isset($_GET['task'])) {
207
- $this->save_db();
208
- }
209
- global $wpdb;
210
- $page = WDW_FM_Library::get('page');
211
- $current_id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
212
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display_options', 'current_id' => $current_id), admin_url('admin.php')));
213
- }
214
-
215
- public function apply_options() {
216
- $message = $this->save_db_options();
217
- $page = WDW_FM_Library::get('page');
218
- $current_id = (int)WDW_FM_Library::get('current_id', 0);
219
- $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
220
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'form_options', 'current_id' => $current_id, 'message' => $message, 'fieldset_id' => $fieldset_id), admin_url('admin.php')));
221
- }
222
-
223
- public function apply_display_options() {
224
- $message = $this->save_dis_options();
225
- $page = WDW_FM_Library::get('page');
226
- $current_id = (int)WDW_FM_Library::get('current_id', 0);
227
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display_options', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
228
- }
229
-
230
- public function remove_query() {
231
- global $wpdb;
232
- $cid = ((isset($_POST['cid']) && $_POST['cid'] != '') ? $_POST['cid'] : NULL);
233
- if (count($cid)) {
234
- array_walk($cid, create_function('&$value', '$value = (int)$value;'));
235
- $cids = implode(',', $cid);
236
- $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_query WHERE id IN ( ' . $cids . ' )';
237
- if ($wpdb->query($query)) {
238
- echo WDW_FM_Library::message('Items Succesfully Deleted.', 'updated');
239
- }
240
- else {
241
- echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
242
- }
243
- }
244
- else {
245
- echo WDW_FM_Library::message('You must select at least one item.', 'error');
246
- }
247
- $this->apply_options();
248
- }
249
-
250
- public function cancel_options() {
251
- $this->edit();
252
- }
253
-
254
- public function save_db_options() {
255
- $javascript = "// Occurs before the form is loaded
256
- function before_load() {
257
-
258
- }
259
- // Occurs just before submitting the form
260
- function before_submit() {
261
- // IMPORTANT! If you want to interrupt (stop) the submitting of the form, this function should return true. You don't need to return any value if you don't want to stop the submission.
262
- }
263
- // Occurs just before resetting the form
264
- function before_reset() {
265
-
266
- }";
267
- global $wpdb;
268
- // $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
269
- $id = (int)WDW_FM_Library::get('current_id', 0);
270
- $published = (isset($_POST['published']) ? esc_html(stripslashes($_POST['published'])) : 1);
271
- $savedb = (isset($_POST['savedb']) ? esc_html(stripslashes($_POST['savedb'])) : 1);
272
- $theme = (int)(isset($_POST['theme']) ? esc_html(stripslashes($_POST['theme'])) : $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'"));
273
- $requiredmark = (isset($_POST['requiredmark']) ? esc_html(stripslashes($_POST['requiredmark'])) : '*');
274
- $sendemail = (isset($_POST['sendemail']) ? esc_html(stripslashes($_POST['sendemail'])) : 1);
275
- $save_uploads = (isset($_POST['save_uploads']) ? esc_html(stripslashes($_POST['save_uploads'])) : 1);
276
- $mail = (isset($_POST['mail']) ? esc_html(stripslashes($_POST['mail'])) : '');
277
- if (isset($_POST['mailToAdd']) && esc_html(stripslashes($_POST['mailToAdd'])) != '') {
278
- $mail .= esc_html(stripslashes($_POST['mailToAdd'])) . ',';
279
- }
280
- $from_mail = (isset($_POST['from_mail']) ? esc_html(stripslashes($_POST['from_mail'])) : '');
281
- $from_name = (isset($_POST['from_name']) ? esc_html(stripslashes($_POST['from_name'])) : '');
282
- $reply_to = (isset($_POST['reply_to']) ? esc_html(stripslashes($_POST['reply_to'])) : '');
283
- if ($from_mail == "other") {
284
- $from_mail = (isset($_POST['mail_from_other']) ? esc_html(stripslashes($_POST['mail_from_other'])) : '');
285
- }
286
- if ($reply_to == "other") {
287
- $reply_to = (isset($_POST['reply_to_other']) ? esc_html(stripslashes($_POST['reply_to_other'])) : '');
288
- }
289
- $script_mail = (isset($_POST['script_mail']) ? stripslashes($_POST['script_mail']) : '%all%');
290
- $mail_from_user = (isset($_POST['mail_from_user']) ? esc_html(stripslashes($_POST['mail_from_user'])) : '');
291
- $mail_from_name_user = (isset($_POST['mail_from_name_user']) ? esc_html(stripslashes($_POST['mail_from_name_user'])) : '');
292
- $reply_to_user = (isset($_POST['reply_to_user']) ? esc_html(stripslashes($_POST['reply_to_user'])) : '');
293
- $condition = (isset($_POST['condition']) ? esc_html(stripslashes($_POST['condition'])) : '');
294
- $mail_cc = (isset($_POST['mail_cc']) ? esc_html(stripslashes($_POST['mail_cc'])) : '');
295
- $mail_cc_user = (isset($_POST['mail_cc_user']) ? esc_html(stripslashes($_POST['mail_cc_user'])) : '');
296
- $mail_bcc = (isset($_POST['mail_bcc']) ? esc_html(stripslashes($_POST['mail_bcc'])) : '');
297
- $mail_bcc_user = (isset($_POST['mail_bcc_user']) ? esc_html(stripslashes($_POST['mail_bcc_user'])) : '');
298
- $mail_subject = (isset($_POST['mail_subject']) ? esc_html(stripslashes($_POST['mail_subject'])) : '');
299
- $mail_subject_user = (isset($_POST['mail_subject_user']) ? esc_html(stripslashes($_POST['mail_subject_user'])) : '');
300
- $mail_mode = (isset($_POST['mail_mode']) ? esc_html(stripslashes($_POST['mail_mode'])) : 1);
301
- $mail_mode_user = (isset($_POST['mail_mode_user']) ? esc_html(stripslashes($_POST['mail_mode_user'])) : 1);
302
- $mail_attachment = (isset($_POST['mail_attachment']) ? esc_html(stripslashes($_POST['mail_attachment'])) : 1);
303
- $mail_attachment_user = (isset($_POST['mail_attachment_user']) ? esc_html(stripslashes($_POST['mail_attachment_user'])) : 1);
304
- $script_mail_user = (isset($_POST['script_mail_user']) ? stripslashes($_POST['script_mail_user']) : '%all%');
305
- $submit_text = (isset($_POST['submit_text']) ? stripslashes($_POST['submit_text']) : '');
306
- $url = (isset($_POST['url']) ? esc_html(stripslashes($_POST['url'])) : '');
307
- $tax = (isset($_POST['tax']) ? esc_html(stripslashes($_POST['tax'])) : 0);
308
- $payment_currency = (isset($_POST['payment_currency']) ? stripslashes($_POST['payment_currency']) : '');
309
- $paypal_email = (isset($_POST['paypal_email']) ? esc_html(stripslashes($_POST['paypal_email'])) : '');
310
- $checkout_mode = (isset($_POST['checkout_mode']) ? esc_html(stripslashes($_POST['checkout_mode'])) : 'testmode');
311
- $paypal_mode = (isset($_POST['paypal_mode']) ? esc_html(stripslashes($_POST['paypal_mode'])) : 0);
312
- $javascript = (isset($_POST['javascript']) ? stripslashes($_POST['javascript']) : $javascript);
313
- $user_id_wd = (isset($_POST['user_id_wd']) ? stripslashes($_POST['user_id_wd']) : 'administrator,');
314
- $frontend_submit_fields = (isset($_POST['frontend_submit_fields']) ? stripslashes($_POST['frontend_submit_fields']) : '');
315
- $frontend_submit_stat_fields = (isset($_POST['frontend_submit_stat_fields']) ? stripslashes($_POST['frontend_submit_stat_fields']) : '');
316
- $mail_emptyfields = (isset($_POST['mail_emptyfields']) ? esc_html(stripslashes($_POST['mail_emptyfields'])) : 0);
317
- $mail_verify = (isset($_POST['mail_verify']) ? esc_html(stripslashes($_POST['mail_verify'])) : 0);
318
- $mail_verify_expiretime = (isset($_POST['mail_verify_expiretime']) ? esc_html(stripslashes($_POST['mail_verify_expiretime'])) : '');
319
- $send_to = '';
320
- for ($i = 0; $i < 20; $i++) {
321
- if (isset($_POST['send_to' . $i])) {
322
- $send_to .= '*' . esc_html(stripslashes($_POST['send_to' . $i])) . '*';
323
- }
324
- }
325
- if (isset($_POST['submit_text_type'])) {
326
- $submit_text_type = esc_html(stripslashes($_POST['submit_text_type']));
327
- if ($submit_text_type == 5) {
328
- $article_id = (isset($_POST['page_name']) ? esc_html(stripslashes($_POST['page_name'])) : 0);
329
- }
330
- else {
331
- $article_id = (isset($_POST['post_name']) ? esc_html(stripslashes($_POST['post_name'])) : 0);
332
- }
333
- }
334
- else {
335
- $submit_text_type = 1;
336
- $article_id = 0;
337
- }
338
-
339
- $mail_verification_post_id = (int)$wpdb->get_var('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!=0');
340
- if($mail_verify) {
341
- $email_verification_post = array(
342
- 'post_title' => 'Email Verification',
343
- 'post_content' => '[email_verification]',
344
- 'post_status' => 'publish',
345
- 'post_author' => 1,
346
- 'post_type' => 'fmemailverification',
347
- );
348
-
349
- if(!$mail_verification_post_id || get_post( $mail_verification_post_id )===NULL)
350
- $mail_verification_post_id = wp_insert_post( $email_verification_post );
351
- }
352
- $paypal_mode = $paypal_mode == 'paypal' ? 1 : 0;
353
- $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
354
- 'published' => $published,
355
- 'savedb' => $savedb,
356
- 'theme' => $theme,
357
- 'requiredmark' => $requiredmark,
358
- 'sendemail' => $sendemail,
359
- 'save_uploads' => $save_uploads,
360
- 'mail' => $mail,
361
- 'from_mail' => $from_mail,
362
- 'from_name' => $from_name,
363
- 'reply_to' => $reply_to,
364
- 'script_mail' => $script_mail,
365
- 'mail_from_user' => $mail_from_user,
366
- 'mail_from_name_user' => $mail_from_name_user,
367
- 'reply_to_user' => $reply_to_user,
368
- 'condition' => $condition,
369
- 'mail_cc' => $mail_cc,
370
- 'mail_cc_user' => $mail_cc_user,
371
- 'mail_bcc' => $mail_bcc,
372
- 'mail_bcc_user' => $mail_bcc_user,
373
- 'mail_subject' => $mail_subject,
374
- 'mail_subject_user' => $mail_subject_user,
375
- 'mail_mode' => $mail_mode,
376
- 'mail_mode_user' => $mail_mode_user,
377
- 'mail_attachment' => $mail_attachment,
378
- 'mail_attachment_user' => $mail_attachment_user,
379
- 'script_mail_user' => $script_mail_user,
380
- 'submit_text' => $submit_text,
381
- 'url' => $url,
382
- 'submit_text_type' => $submit_text_type,
383
- 'article_id' => $article_id,
384
- 'tax' => $tax,
385
- 'payment_currency' => $payment_currency,
386
- 'paypal_email' => $paypal_email,
387
- 'checkout_mode' => $checkout_mode,
388
- 'paypal_mode' => $paypal_mode,
389
- 'javascript' => $javascript,
390
- 'user_id_wd' => $user_id_wd,
391
- 'send_to' => $send_to,
392
- 'frontend_submit_fields' => $frontend_submit_fields,
393
- 'frontend_submit_stat_fields' => $frontend_submit_stat_fields,
394
- 'mail_emptyfields' => $mail_emptyfields,
395
- 'mail_verify' => $mail_verify,
396
- 'mail_verify_expiretime' => $mail_verify_expiretime,
397
- 'mail_verification_post_id' => $mail_verification_post_id,
398
- ), array('id' => $id));
399
- if ($save !== FALSE) {
400
- $save_theme_in_backup = $wpdb->update($wpdb->prefix . 'formmaker_backup', array(
401
- 'theme' => $theme
402
- ), array('id' => $id));
403
- return 8;
404
- }
405
- else {
406
- return 2;
407
- }
408
- }
409
-
410
- public function save_dis_options() {
411
- global $wpdb;
412
- $id = (int)WDW_FM_Library::get('current_id', 0);
413
- $scrollbox_loading_delay = (isset($_POST['scrollbox_loading_delay']) ? esc_html(stripslashes($_POST['scrollbox_loading_delay'])) : 0);
414
- $popover_animate_effect = (isset($_POST['popover_animate_effect']) ? esc_html(stripslashes($_POST['popover_animate_effect'])) : '');
415
- $popover_loading_delay = (isset($_POST['popover_loading_delay']) ? esc_html(stripslashes($_POST['popover_loading_delay'])) : 0);
416
- $popover_frequency = (isset($_POST['popover_frequency']) ? esc_html(stripslashes($_POST['popover_frequency'])) : 0);
417
- $topbar_position = (isset($_POST['topbar_position']) ? esc_html(stripslashes($_POST['topbar_position'])) : 1);
418
- $topbar_remain_top = (isset($_POST['topbar_remain_top']) ? esc_html(stripslashes($_POST['topbar_remain_top'])) : 1);
419
- $topbar_closing = (isset($_POST['topbar_closing']) ? esc_html(stripslashes($_POST['topbar_closing'])) : 1);
420
- $topbar_hide_duration = (isset($_POST['topbar_hide_duration']) ? esc_html(stripslashes($_POST['topbar_hide_duration'])) : 0);
421
- $scrollbox_position = (isset($_POST['scrollbox_position']) ? esc_html(stripslashes($_POST['scrollbox_position'])) : 1);
422
- $scrollbox_trigger_point = (isset($_POST['scrollbox_trigger_point']) ? esc_html(stripslashes($_POST['scrollbox_trigger_point'])) : 20);
423
- $scrollbox_hide_duration = (isset($_POST['scrollbox_hide_duration']) ? esc_html(stripslashes($_POST['scrollbox_hide_duration'])) : 0);
424
- $scrollbox_auto_hide = (isset($_POST['scrollbox_auto_hide']) ? esc_html(stripslashes($_POST['scrollbox_auto_hide'])) :1);
425
- $hide_mobile = (isset($_POST['hide_mobile']) ? esc_html(stripslashes($_POST['hide_mobile'])) : 0);
426
- $scrollbox_closing = (isset($_POST['scrollbox_closing']) ? esc_html(stripslashes($_POST['scrollbox_closing'])) : 1);
427
- $scrollbox_minimize = (isset($_POST['scrollbox_minimize']) ? esc_html(stripslashes($_POST['scrollbox_minimize'])) : 1);
428
- $scrollbox_minimize_text = (isset($_POST['scrollbox_minimize_text']) ? esc_html(stripslashes($_POST['scrollbox_minimize_text'])) : '');
429
-
430
- $type = (isset($_POST['form_type']) ? esc_html(stripslashes($_POST['form_type'])) : 'embadded');
431
- $display_on = (isset($_POST['display_on']) ? esc_html(implode(',', $_POST['display_on'])) : '');
432
- $posts_include = (isset($_POST['posts_include']) ? esc_html(stripslashes($_POST['posts_include'])) : '');
433
- $pages_include = (isset($_POST['pages_include']) ? esc_html(stripslashes($_POST['pages_include'])) : '');
434
- $display_on_categories = (isset($_POST['display_on_categories']) ? esc_html(implode(',', $_POST['display_on_categories'])) : '');
435
- $current_categories = (isset($_POST['current_categories']) ? esc_html(stripslashes($_POST['current_categories'])) : '');
436
- $show_for_admin = (isset($_POST['show_for_admin']) ? esc_html(stripslashes($_POST['show_for_admin'])) : 0);
437
-
438
- $save = $wpdb->replace($wpdb->prefix . 'formmaker_display_options', array(
439
- 'form_id' => $id,
440
- 'type' => $type,
441
- 'scrollbox_loading_delay' => $scrollbox_loading_delay,
442
- 'popover_animate_effect' => $popover_animate_effect,
443
- 'popover_loading_delay' => $popover_loading_delay,
444
- 'popover_frequency' => $popover_frequency,
445
- 'topbar_position' => $topbar_position,
446
- 'topbar_remain_top' => $topbar_remain_top,
447
- 'topbar_closing' => $topbar_closing,
448
- 'topbar_hide_duration' => $topbar_hide_duration,
449
- 'scrollbox_position' => $scrollbox_position,
450
- 'scrollbox_trigger_point' => $scrollbox_trigger_point,
451
- 'scrollbox_hide_duration' => $scrollbox_hide_duration,
452
- 'scrollbox_auto_hide' => $scrollbox_auto_hide,
453
- 'hide_mobile' => $hide_mobile,
454
- 'scrollbox_closing' => $scrollbox_closing,
455
- 'scrollbox_minimize' => $scrollbox_minimize,
456
- 'scrollbox_minimize_text' => $scrollbox_minimize_text,
457
- 'display_on' => $display_on,
458
- 'posts_include' => $posts_include,
459
- 'pages_include' => $pages_include,
460
- 'display_on_categories' => $display_on_categories,
461
- 'current_categories' => $current_categories,
462
- 'show_for_admin' => $show_for_admin,
463
- ));
464
-
465
- if ($save !== FALSE) {
466
- $save_in_backup = $wpdb->update($wpdb->prefix . 'formmaker_backup', array(
467
- 'type' => $type
468
- ), array('id' => $id));
469
-
470
- $save_in_form = $wpdb->update($wpdb->prefix . 'formmaker', array(
471
- 'type' => $type
472
- ), array('id' => $id));
473
- return 8;
474
- }
475
- else {
476
- return 2;
477
- }
478
- }
479
-
480
- public function save_as_copy() {
481
- $message = $this->save_db_as_copy();
482
- $page = WDW_FM_Library::get('page');
483
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
484
- }
485
-
486
- public function save() {
487
- $message = $this->save_db();
488
- $page = WDW_FM_Library::get('page');
489
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
490
- }
491
-
492
- public function apply() {
493
- $message = $this->save_db();
494
- global $wpdb;
495
- $id = (int) $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
496
- $current_id = (int)WDW_FM_Library::get('current_id', $id);
497
- $page = WDW_FM_Library::get('page');
498
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
499
- }
500
-
501
- public function save_db() {
502
- global $wpdb;
503
- $javascript = "// Occurs before the form is loaded
504
- function before_load() {
505
- }
506
- // Occurs just before submitting the form
507
- function before_submit() {
508
- // IMPORTANT! If you want to interrupt (stop) the submitting of the form, this function should return true. You don't need to return any value if you don't want to stop the submission.
509
- }
510
- // Occurs just before resetting the form
511
- function before_reset() {
512
- }";
513
- $id = (int)WDW_FM_Library::get('current_id', 0);
514
- $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
515
- $theme = (isset($_POST['theme']) ? esc_html(stripslashes($_POST['theme'])) : $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'"));
516
- $form_front = (isset($_POST['form_front']) ? stripslashes($_POST['form_front']) : '');
517
- $sortable = (isset($_POST['sortable']) ? stripslashes($_POST['sortable']) : 1);
518
- $counter = (isset($_POST['counter']) ? esc_html(stripslashes($_POST['counter'])) : 0);
519
- $label_order = (isset($_POST['label_order']) ? esc_html(stripslashes($_POST['label_order'])) : '');
520
- $pagination = (isset($_POST['pagination']) ? esc_html(stripslashes($_POST['pagination'])) : '');
521
- $show_title = (isset($_POST['show_title']) ? esc_html(stripslashes($_POST['show_title'])) : '');
522
- $show_numbers = (isset($_POST['show_numbers']) ? esc_html(stripslashes($_POST['show_numbers'])) : '');
523
- $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
524
- $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
525
- $recaptcha_theme = (isset($_POST['recaptcha_theme']) ? esc_html(stripslashes($_POST['recaptcha_theme'])) : '');
526
- $label_order_current = (isset($_POST['label_order_current']) ? esc_html(stripslashes($_POST['label_order_current'])) : '');
527
- $form_fields = (isset($_POST['form_fields']) ? stripslashes($_POST['form_fields']) : '');
528
-
529
- $header_title = (isset($_POST['header_title']) ? esc_html(stripslashes($_POST['header_title'])) : '');
530
- $header_description = (isset($_POST['header_description']) ? htmlspecialchars_decode(esc_html(stripslashes($_POST['header_description']))) : '');
531
- $header_image_url = (isset($_POST['header_image_url']) ? esc_html(stripslashes($_POST['header_image_url'])) : '');
532
- $header_image_animation = (isset($_POST['header_image_animation']) ? esc_html(stripslashes($_POST['header_image_animation'])) : '');
533
- $header_hide_image = (isset($_POST['header_hide_image']) ? esc_html(stripslashes($_POST['header_hide_image'])) : 0);
534
- $type = (isset($_POST['form_type']) ? esc_html(stripslashes($_POST['form_type'])) : 'embedded');
535
- $scrollbox_minimize_text = $header_title ? $header_title : 'The form is minimized.';
536
-
537
- if ($id != 0) {
538
- $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
539
- 'title' => $title,
540
- 'theme' => $theme,
541
- 'form_front' => $form_front,
542
- 'sortable' => $sortable,
543
- 'counter' => $counter,
544
- 'label_order' => $label_order,
545
- 'label_order_current' => $label_order_current,
546
- 'pagination' => $pagination,
547
- 'show_title' => $show_title,
548
- 'show_numbers' => $show_numbers,
549
- 'public_key' => $public_key,
550
- 'private_key' => $private_key,
551
- 'recaptcha_theme' => $recaptcha_theme,
552
- 'form_fields' => $form_fields,
553
- 'header_title' => $header_title,
554
- 'header_description' => $header_description,
555
- 'header_image_url' => $header_image_url,
556
- 'header_image_animation' => $header_image_animation,
557
- 'header_hide_image' => $header_hide_image,
558
- ), array('id' => $id));
559
- }
560
- else {
561
- $save = $wpdb->insert($wpdb->prefix . 'formmaker', array(
562
- 'title' => $title,
563
- 'type' => $type,
564
- 'mail' => '',
565
- 'form_front' => $form_front,
566
- 'theme' => $theme,
567
- 'counter' => $counter,
568
- 'label_order' => $label_order,
569
- 'pagination' => $pagination,
570
- 'show_title' => $show_title,
571
- 'show_numbers' => $show_numbers,
572
- 'public_key' => $public_key,
573
- 'private_key' => $private_key,
574
- 'recaptcha_theme' => $recaptcha_theme,
575
- 'javascript' => $javascript,
576
- 'submit_text' => '',
577
- 'url' => '',
578
- 'article_id' => 0,
579
- 'submit_text_type' => 1,
580
- 'script_mail' => '%all%',
581
- 'script_mail_user' => '%all%',
582
- 'label_order_current' => $label_order_current,
583
- 'tax' => 0,
584
- 'payment_currency' => '',
585
- 'paypal_email' => '',
586
- 'checkout_mode' => 'testmode',
587
- 'paypal_mode' => 0,
588
- 'published' => 1,
589
- 'form_fields' => $form_fields,
590
- 'savedb' => 1,
591
- 'sendemail' => 1,
592
- 'requiredmark' => '*',
593
- 'from_mail' => '',
594
- 'from_name' => '',
595
- 'reply_to' => '',
596
- 'send_to' => '',
597
- 'autogen_layout' => 1,
598
- 'custom_front' => '',
599
- 'mail_from_user' => '',
600
- 'mail_from_name_user' => '',
601
- 'reply_to_user' => '',
602
- 'condition' => '',
603
- 'mail_cc' => '',
604
- 'mail_cc_user' => '',
605
- 'mail_bcc' => '',
606
- 'mail_bcc_user' => '',
607
- 'mail_subject' => '',
608
- 'mail_subject_user' => '',
609
- 'mail_mode' => 1,
610
- 'mail_mode_user' => 1,
611
- 'mail_attachment' => 1,
612
- 'mail_attachment_user' => 1,
613
- 'sortable' => $sortable,
614
- 'user_id_wd' => 'administrator,',
615
- 'frontend_submit_fields' => '',
616
- 'frontend_submit_stat_fields' => '',
617
- 'save_uploads' => 1,
618
-
619
- 'header_title' => $header_title,
620
- 'header_description' => $header_description,
621
- 'header_image_url' => $header_image_url,
622
- 'header_image_animation' => $header_image_animation,
623
- 'header_hide_image' => $header_hide_image,
624
- ));
625
- $id = (int)$wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
626
- // $_POST['current_id'] = $id;
627
- $save_display_options = $wpdb->insert($wpdb->prefix . 'formmaker_display_options', array(
628
- 'form_id' => $id,
629
- 'type' => $type,
630
- 'scrollbox_loading_delay' => 0,
631
- 'popover_animate_effect' => '',
632
- 'popover_loading_delay' => 0,
633
- 'popover_frequency' => 0,
634
- 'topbar_position' => 1,
635
- 'topbar_remain_top' => 1,
636
- 'topbar_closing' => 1,
637
- 'topbar_hide_duration' => 0,
638
- 'scrollbox_position' => 1,
639
- 'scrollbox_trigger_point' => 20,
640
- 'scrollbox_hide_duration' => 0,
641
- 'scrollbox_auto_hide' => 1,
642
- 'hide_mobile' => 0,
643
- 'scrollbox_closing' => 1,
644
- 'scrollbox_minimize' => 1,
645
- 'scrollbox_minimize_text' => $scrollbox_minimize_text,
646
- 'display_on' => 'home,post,page',
647
- 'posts_include' => '',
648
- 'pages_include' => '',
649
- 'display_on_categories' => '',
650
- 'current_categories' => '',
651
- 'show_for_admin' => 0,
652
- ), array(
653
- '%d',
654
- '%s',
655
- '%d',
656
- '%s',
657
- '%d',
658
- '%d',
659
- '%d',
660
- '%d',
661
- '%d',
662
- '%d',
663
- '%d',
664
- '%d',
665
- '%d',
666
- '%d',
667
- '%d',
668
- '%d',
669
- '%d',
670
- '%s',
671
- '%s',
672
- '%s',
673
- '%s',
674
- '%s',
675
- '%s',
676
- '%d',
677
- ));
678
- $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
679
- 'form_id' => $id,
680
- 'views' => 0
681
- ), array(
682
- '%d',
683
- '%d'
684
- ));
685
- }
686
-
687
- $backup_id = (isset($_POST['backup_id']) ? (int)esc_html(stripslashes($_POST['backup_id'])) : '');
688
-
689
- if($backup_id)
690
- {
691
- $query = "SELECT backup_id FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id > ".$backup_id." AND id = ".$id." ORDER BY backup_id ASC LIMIT 0 , 1 ";
692
-
693
- if($wpdb->get_var($query))
694
- {
695
- $query = "DELETE FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id > ".$backup_id." AND id = ".$id;
696
- $wpdb->query($query);
697
- }
698
-
699
- $row = $wpdb->get_row($wpdb->prepare("SELECT form_fields, form_front FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id = '%d'", $backup_id));
700
-
701
- if($row->form_fields==$form_fields and $row->form_front==$form_front)
702
- {
703
- $save = $wpdb->update($wpdb->prefix . 'formmaker_backup', array(
704
- 'cur' => 1,
705
- 'title' => $title,
706
- 'theme' => $theme,
707
- 'form_front' => $form_front,
708
- 'sortable' => $sortable,
709
- 'counter' => $counter,
710
- 'label_order' => $label_order,
711
- 'label_order_current' => $label_order_current,
712
- 'pagination' => $pagination,
713
- 'show_title' => $show_title,
714
- 'show_numbers' => $show_numbers,
715
- 'public_key' => $public_key,
716
- 'private_key' => $private_key,
717
- 'recaptcha_theme' => $recaptcha_theme,
718
- 'form_fields' => $form_fields,
719
- 'header_title' => $header_title,
720
- 'header_description' => $header_description,
721
- 'header_image_url' => $header_image_url,
722
- 'header_image_animation' => $header_image_animation,
723
- 'header_hide_image' => $header_hide_image,
724
- ), array('backup_id' => $backup_id));
725
-
726
-
727
- if ($save !== FALSE) {
728
- return 1;
729
- }
730
- else {
731
- return 2;
732
- }
733
- }
734
- }
735
-
736
- $wpdb->query("UPDATE ".$wpdb->prefix."formmaker_backup SET cur=0 WHERE id=".$id );
737
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_backup', array(
738
- 'cur' => 1,
739
- 'id' => $id,
740
- 'title' => $title,
741
- 'mail' => '',
742
- 'form_front' => $form_front,
743
- 'theme' => $theme,
744
- 'counter' => $counter,
745
- 'label_order' => $label_order,
746
- 'pagination' => $pagination,
747
- 'show_title' => $show_title,
748
- 'show_numbers' => $show_numbers,
749
- 'public_key' => $public_key,
750
- 'private_key' => $private_key,
751
- 'recaptcha_theme' => $recaptcha_theme,
752
- 'javascript' => $javascript,
753
- 'submit_text' => '',
754
- 'url' => '',
755
- 'article_id' => 0,
756
- 'submit_text_type' => 1,
757
- 'script_mail' => '%all%',
758
- 'script_mail_user' => '%all%',
759
- 'label_order_current' => $label_order_current,
760
- 'tax' => 0,
761
- 'payment_currency' => '',
762
- 'paypal_email' => '',
763
- 'checkout_mode' => 'testmode',
764
- 'paypal_mode' => 0,
765
- 'published' => 1,
766
- 'form_fields' => $form_fields,
767
- 'savedb' => 1,
768
- 'sendemail' => 1,
769
- 'requiredmark' => '*',
770
- 'from_mail' => '',
771
- 'from_name' => '',
772
- 'reply_to' => '',
773
- 'send_to' => '',
774
- 'autogen_layout' => 1,
775
- 'custom_front' => '',
776
- 'mail_from_user' => '',
777
- 'mail_from_name_user' => '',
778
- 'reply_to_user' => '',
779
- 'condition' => '',
780
- 'mail_cc' => '',
781
- 'mail_cc_user' => '',
782
- 'mail_bcc' => '',
783
- 'mail_bcc_user' => '',
784
- 'mail_subject' => '',
785
- 'mail_subject_user' => '',
786
- 'mail_mode' => 1,
787
- 'mail_mode_user' => 1,
788
- 'mail_attachment' => 1,
789
- 'mail_attachment_user' => 1,
790
- 'sortable' => $sortable,
791
- 'user_id_wd' => 'administrator,',
792
- 'frontend_submit_fields' => '',
793
- 'frontend_submit_stat_fields' => '',
794
- 'header_title' => $header_title,
795
- 'header_description' => $header_description,
796
- 'header_image_url' => $header_image_url,
797
- 'header_image_animation' => $header_image_animation,
798
- 'header_hide_image' => $header_hide_image,
799
- ), array(
800
- '%d',
801
- '%d',
802
- '%s',
803
- '%s',
804
- '%s',
805
- '%d',
806
- '%d',
807
- '%s',
808
- '%s',
809
- '%s',
810
- '%s',
811
- '%s',
812
- '%s',
813
- '%s',
814
- '%s',
815
- '%s',
816
- '%s',
817
- '%d',
818
- '%d',
819
- '%s',
820
- '%s',
821
- '%s',
822
- '%s',
823
- '%s',
824
- '%s',
825
- '%s',
826
- '%d',
827
- '%d',
828
- '%s',
829
- '%d',
830
- '%d',
831
- '%s',
832
- '%s',
833
- '%s',
834
- '%s',
835
- '%s',
836
- '%d',
837
- '%s',
838
- '%s',
839
- '%s',
840
- '%s',
841
- '%s',
842
- '%s',
843
- '%s',
844
- '%s',
845
- '%s',
846
- '%s',
847
- '%s',
848
- '%d',
849
- '%d',
850
- '%d',
851
- '%d',
852
- '%d',
853
- '%s',
854
- '%s',
855
- '%s',
856
- '%s',
857
- '%s',
858
- '%s',
859
- '%s',
860
- '%d',
861
- )) ;
862
-
863
- $query = "SELECT count(backup_id) FROM ".$wpdb->prefix."formmaker_backup WHERE id = ".$id;
864
- $wpdb->get_var($query);
865
- if($wpdb->get_var($query)>10)
866
- {
867
- $query = "DELETE FROM ".$wpdb->prefix."formmaker_backup WHERE id = ".$id." ORDER BY backup_id ASC LIMIT 1 ";
868
- $wpdb->query($query);
869
- }
870
-
871
- if ($save !== FALSE) {
872
- return 1;
873
- }
874
- else {
875
- return 2;
876
- }
877
- }
878
-
879
- public function save_db_as_copy() {
880
- global $wpdb;
881
- $id = (int)WDW_FM_Library::get('current_id', 0);
882
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
883
- require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
884
- $model = new FMModelManage_fm();
885
- $row_display = $model->get_display_options($id);
886
- $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
887
- $theme = (isset($_POST['theme']) ? esc_html(stripslashes($_POST['theme'])) : 0);
888
- $form_front = (isset($_POST['form_front']) ? stripslashes($_POST['form_front']) : '');
889
- $sortable = (isset($_POST['sortable']) ? stripslashes($_POST['sortable']) : 1);
890
- $counter = (isset($_POST['counter']) ? esc_html(stripslashes($_POST['counter'])) : 0);
891
- $label_order = (isset($_POST['label_order']) ? esc_html(stripslashes($_POST['label_order'])) : '');
892
- $label_order_current = (isset($_POST['label_order_current']) ? esc_html(stripslashes($_POST['label_order_current'])) : '');
893
- $pagination = (isset($_POST['pagination']) ? esc_html(stripslashes($_POST['pagination'])) : '');
894
- $show_title = (isset($_POST['show_title']) ? esc_html(stripslashes($_POST['show_title'])) : '');
895
- $show_numbers = (isset($_POST['show_numbers']) ? esc_html(stripslashes($_POST['show_numbers'])) : '');
896
- $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
897
- $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
898
- $recaptcha_theme = (isset($_POST['recaptcha_theme']) ? esc_html(stripslashes($_POST['recaptcha_theme'])) : '');
899
- $form_fields = (isset($_POST['form_fields']) ? stripslashes($_POST['form_fields']) : '');
900
-
901
- $save = $wpdb->insert($wpdb->prefix . 'formmaker', array(
902
- 'title' => $title,
903
- 'type' => $row->type,
904
- 'mail' => $row->mail,
905
- 'form_front' => $form_front,
906
- 'theme' => $theme,
907
- 'counter' => $counter,
908
- 'label_order' => $label_order,
909
- 'pagination' => $pagination,
910
- 'show_title' => $show_title,
911
- 'show_numbers' => $show_numbers,
912
- 'public_key' => $public_key,
913
- 'private_key' => $private_key,
914
- 'recaptcha_theme' => $recaptcha_theme,
915
- 'javascript' => $row->javascript,
916
- 'submit_text' => $row->submit_text,
917
- 'url' => $row->url,
918
- 'article_id' => $row->article_id,
919
- 'submit_text_type' => $row->submit_text_type,
920
- 'script_mail' => $row->script_mail,
921
- 'script_mail_user' => $row->script_mail_user,
922
- 'label_order_current' => $label_order_current,
923
- 'tax' => $row->tax,
924
- 'payment_currency' => $row->payment_currency,
925
- 'paypal_email' => $row->paypal_email,
926
- 'checkout_mode' => $row->checkout_mode,
927
- 'paypal_mode' => $row->paypal_mode,
928
- 'published' => $row->published,
929
- 'form_fields' => $form_fields,
930
- 'savedb' => $row->savedb,
931
- 'sendemail' => $row->sendemail,
932
- 'requiredmark' => $row->requiredmark,
933
- 'from_mail' => $row->from_mail,
934
- 'from_name' => $row->from_name,
935
- 'reply_to' => $row->reply_to,
936
- 'send_to' => $row->send_to,
937
- 'autogen_layout' => $row->autogen_layout,
938
- 'custom_front' => $row->custom_front,
939
- 'mail_from_user' => $row->mail_from_user,
940
- 'mail_from_name_user' => $row->mail_from_name_user,
941
- 'reply_to_user' => $row->reply_to_user,
942
- 'condition' => $row->condition,
943
- 'mail_cc' => $row->mail_cc,
944
- 'mail_cc_user' => $row->mail_cc_user,
945
- 'mail_bcc' => $row->mail_bcc,
946
- 'mail_bcc_user' => $row->mail_bcc_user,
947
- 'mail_subject' => $row->mail_subject,
948
- 'mail_subject_user' => $row->mail_subject_user,
949
- 'mail_mode' => $row->mail_mode,
950
- 'mail_mode_user' => $row->mail_mode_user,
951
- 'mail_attachment' => $row->mail_attachment,
952
- 'mail_attachment_user' => $row->mail_attachment_user,
953
- 'sortable' => $sortable,
954
- 'user_id_wd' => $row->user_id_wd,
955
- 'frontend_submit_fields' => $row->frontend_submit_fields,
956
- 'frontend_submit_stat_fields' => $row->frontend_submit_stat_fields,
957
- 'save_uploads' => $row->save_uploads,
958
-
959
- 'header_title' => $row->header_title,
960
- 'header_description' => $row->header_description,
961
- 'header_image_url' => $row->header_image_url,
962
- 'header_image_animation' => $row->header_image_animation,
963
- 'header_hide_image' => $row->header_hide_image,
964
- ));
965
- $new_id = (int)$wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
966
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_display_options', array(
967
- 'form_id' => $new_id,
968
- 'type' => $row_display->type,
969
- 'scrollbox_loading_delay' => $row_display->scrollbox_loading_delay,
970
- 'popover_animate_effect' => $row_display->popover_animate_effect,
971
- 'popover_loading_delay' => $row_display->popover_loading_delay,
972
- 'popover_frequency' => $row_display->popover_frequency,
973
- 'topbar_position' => $row_display->topbar_position,
974
- 'topbar_remain_top' => $row_display->topbar_remain_top,
975
- 'topbar_closing' => $row_display->topbar_closing,
976
- 'topbar_hide_duration' => $row_display->topbar_hide_duration,
977
- 'scrollbox_position' => $row_display->scrollbox_position,
978
- 'scrollbox_trigger_point' => $row_display->scrollbox_trigger_point,
979
- 'scrollbox_hide_duration' => $row_display->scrollbox_hide_duration,
980
- 'scrollbox_auto_hide' => $row_display->scrollbox_auto_hide,
981
- 'hide_mobile' => $row_display->hide_mobile,
982
- 'scrollbox_closing' => $row_display->scrollbox_closing,
983
- 'scrollbox_minimize' => $row_display->scrollbox_minimize,
984
- 'scrollbox_minimize_text' => $row_display->scrollbox_minimize_text,
985
- 'display_on' => $row_display->display_on,
986
- 'posts_include' => $row_display->posts_include,
987
- 'pages_include' => $row_display->pages_include,
988
- 'display_on_categories' => $row_display->display_on_categories,
989
- 'current_categories' => $row_display->current_categories,
990
- 'show_for_admin' => $row_display->show_for_admin,
991
- ), array(
992
- '%d',
993
- '%s',
994
- '%d',
995
- '%s',
996
- '%d',
997
- '%d',
998
- '%d',
999
- '%d',
1000
- '%d',
1001
- '%d',
1002
- '%d',
1003
- '%d',
1004
- '%d',
1005
- '%d',
1006
- '%d',
1007
- '%d',
1008
- '%d',
1009
- '%s',
1010
- '%s',
1011
- '%s',
1012
- '%s',
1013
- '%s',
1014
- '%s',
1015
- '%d'
1016
- ));
1017
- $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
1018
- 'form_id' => $new_id,
1019
- 'views' => 0
1020
- ), array(
1021
- '%d',
1022
- '%d'
1023
- ));
1024
- if ($save !== FALSE) {
1025
- $addons = array('WD_FM_EMAIL_COND' => 'Conditional Emails', 'WD_FM_PDF' => 'PDF Integration', 'WD_FM_SAVE_PROG' => 'Save Form Progress', 'WD_FM_CALCULATOR' => 'Calculator');
1026
- $addons_array = array();
1027
- foreach($addons as $addon => $addon_name) {
1028
- if (defined($addon) && is_plugin_active(constant($addon))) {
1029
- $_GET['addon_task'] = 'save_as_copy';
1030
- $_GET['form_id'] = $id;
1031
- $_GET['form_id_new'] = $new_id;
1032
- do_action($addon.'_init');
1033
- }
1034
- }
1035
- return 1;
1036
- }
1037
- else {
1038
- return 2;
1039
- }
1040
- }
1041
-
1042
- public function delete($id) {
1043
- global $wpdb;
1044
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id);
1045
- if ($wpdb->query($query)) {
1046
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $id));
1047
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="%d"', $id));
1048
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE form_id="%d"', $id));
1049
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_backup WHERE id="%d"', $id));
1050
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_display_options WHERE form_id="%d"', $id));
1051
- $addons = array('WD_FM_EMAIL_COND' => 'Conditional Emails', 'WD_FM_PDF' => 'PDF Integration', 'WD_FM_SAVE_PROG' => 'Save Form Progress', 'WD_FM_CALCULATOR' => 'Calculator');
1052
- $addons_array = array();
1053
- foreach($addons as $addon => $addon_name) {
1054
- if (defined($addon) && is_plugin_active(constant($addon))) {
1055
- $_GET['addon_task'] = 'delete';
1056
- $_GET['form_id'] = $id;
1057
- do_action($addon.'_init');
1058
- }
1059
- }
1060
- $message = 3;
1061
- }
1062
- else {
1063
- $message = 2;
1064
- }
1065
- $page = WDW_FM_Library::get('page');
1066
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
1067
- }
1068
-
1069
- public function delete_all() {
1070
- global $wpdb;
1071
- $flag = FALSE;
1072
- $isDefault = FALSE;
1073
- $form_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker');
1074
- foreach ($form_ids_col as $form_id) {
1075
- if (isset($_POST['check_' . $form_id])) {
1076
- $flag = TRUE;
1077
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $form_id));
1078
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $form_id));
1079
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="%d"', $form_id));
1080
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE form_id="%d"', $form_id));
1081
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_backup WHERE id="%d"', $form_id));
1082
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_display_options WHERE form_id="%d"', $form_id));
1083
- }
1084
- }
1085
- if ($flag) {
1086
- $message = 5;
1087
- }
1088
- else {
1089
- $message = 6;
1090
- }
1091
- $page = WDW_FM_Library::get('page');
1092
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
1093
- }
1094
-
1095
- public function fm_live_search() {
1096
- $search_string = ! empty( $_POST['pp_live_search'] ) ? sanitize_text_field( $_POST['pp_live_search'] ) : '';
1097
- $post_type = ! empty( $_POST['pp_post_type'] ) ? sanitize_text_field( $_POST['pp_post_type'] ) : 'any';
1098
- $full_content = ! empty( $_POST['pp_full_content'] ) ? sanitize_text_field( $_POST['pp_full_content'] ) : 'true';
1099
-
1100
- $args['s'] = $search_string;
1101
-
1102
- $results = $this->fm_posts_query( $args, $post_type );
1103
- /* if ('true' === $full_content) { */
1104
- $output = '<ul class="pp_search_results">';
1105
- /* } else {
1106
- $output = '';
1107
- } */
1108
-
1109
- if (empty($results)) {
1110
- /* if ( 'true' === $full_content ) { */
1111
- $output .= sprintf(
1112
- '<li class="pp_no_res">%1$s</li>',
1113
- esc_html__( 'No results found', 'fm-text' )
1114
- );
1115
- /* } */
1116
- } else {
1117
- foreach( $results as $single_post ) {
1118
- $output .= sprintf(
1119
- '<li data-post_id="%2$s">[%3$s] - %1$s</li>',
1120
- esc_html( $single_post['title'] ),
1121
- esc_attr( $single_post['id'] ),
1122
- esc_html( $single_post['post_type'] )
1123
- );
1124
- }
1125
- }
1126
-
1127
- /* if ( 'true' === $full_content ) { */
1128
- $output .= '</ul>';
1129
- /* } */
1130
-
1131
- die( $output );
1132
- }
1133
-
1134
- public function fm_posts_query( $args = array(), $include_post_type = '' ) {
1135
- if ( 'only_pages' === $include_post_type ) {
1136
- $pt_names = array( 'page' );
1137
- } elseif ( 'any' === $include_post_type || 'only_posts' === $include_post_type ) {
1138
- $default_post_types = array( 'post', 'page' );
1139
- $custom_post_types = get_post_types( array(
1140
- 'public' => true,
1141
- '_builtin' => false,
1142
- ) );
1143
-
1144
- $post_types = array_merge($default_post_types, $custom_post_types);
1145
- $pt_names = array_values($post_types);
1146
-
1147
- if ( 'only_posts' === $include_post_type ) {
1148
- unset($pt_names[1]);
1149
- }
1150
- } else {
1151
- $pt_names = $include_post_type;
1152
- }
1153
-
1154
- $query = array(
1155
- 'post_type' => $pt_names,
1156
- 'suppress_filters' => true,
1157
- 'update_post_term_cache' => false,
1158
- 'update_post_meta_cache' => false,
1159
- 'post_status' => 'publish',
1160
- 'posts_per_page' => -1,
1161
- );
1162
-
1163
- if ( isset( $args['s'] ) ) {
1164
- $query['s'] = $args['s'];
1165
- }
1166
-
1167
- $get_posts = new WP_Query;
1168
- $posts = $get_posts->query( $query );
1169
- if ( ! $get_posts->post_count ) {
1170
- return false;
1171
- }
1172
-
1173
- $results = array();
1174
- foreach ($posts as $post) {
1175
- $results[] = array(
1176
- 'id' => (int) $post->ID,
1177
- 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
1178
- 'post_type' => $post->post_type,
1179
- );
1180
- }
1181
-
1182
- wp_reset_postdata();
1183
-
1184
- return $results;
1185
- }
1186
-
1187
- ////////////////////////////////////////////////////////////////////////////////////////
1188
- // Getters & Setters //
1189
- ////////////////////////////////////////////////////////////////////////////////////////
1190
- ////////////////////////////////////////////////////////////////////////////////////////
1191
- // Private Methods //
1192
- ////////////////////////////////////////////////////////////////////////////////////////
1193
- ////////////////////////////////////////////////////////////////////////////////////////
1194
- // Listeners //
1195
- ////////////////////////////////////////////////////////////////////////////////////////
1196
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerSelect_data_from_db.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- class FMControllerSelect_data_from_db {
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 execute() {
22
- $task = ((isset($_GET['task'])) ? esc_html($_GET['task']) : 0);
23
- $id = ((isset($_GET['id'])) ? (int)esc_html($_GET['id']) : 0);
24
- $form_id = ((isset($_GET['form_id'])) ? (int)esc_html($_GET['form_id']) : 0);
25
- $field_id = ((isset($_GET['field_id'])) ? esc_html($_GET['field_id']) : 0);
26
- $field_type = ((isset($_GET['field_type'])) ? esc_html($_GET['field_type']) : 0);
27
- $value_disabled = ((isset($_GET['value_disabled'])) ? esc_html($_GET['value_disabled']) : 0);
28
- if ($task && method_exists($this, $task)) {
29
- $this->$task($form_id,$field_type="");
30
- }
31
- else
32
- $this->display($id, $field_id, $field_type, $value_disabled,$form_id);
33
- }
34
-
35
- public function display($id, $field_id, $field_type, $value_disabled,$form_id) {
36
- require_once WD_FM_DIR . "/admin/models/FMModelSelect_data_from_db.php";
37
- $model = new FMModelSelect_data_from_db();
38
-
39
- require_once WD_FM_DIR . "/admin/views/FMViewSelect_data_from_db.php";
40
- $view = new FMViewSelect_data_from_db($model);
41
- $view->display($id, $field_id, $field_type, $value_disabled,$form_id);
42
- }
43
-
44
- public function db_tables($form_id,$field_type) {
45
- require_once WD_FM_DIR . "/admin/models/FMModelSelect_data_from_db.php";
46
- $model = new FMModelSelect_data_from_db();
47
-
48
- require_once WD_FM_DIR . "/admin/views/FMViewSelect_data_from_db.php";
49
- $view = new FMViewSelect_data_from_db($model);
50
- $view->db_tables((int)$form_id, $field_type);
51
- }
52
- public function db_table_struct_select($form_id,$field_type) {
53
- require_once WD_FM_DIR . "/admin/models/FMModelSelect_data_from_db.php";
54
- $model = new FMModelSelect_data_from_db();
55
-
56
- require_once WD_FM_DIR . "/admin/views/FMViewSelect_data_from_db.php";
57
- $view = new FMViewSelect_data_from_db($model);
58
- $view->db_table_struct_select((int)$form_id,$field_type);
59
- }
60
-
61
- ////////////////////////////////////////////////////////////////////////////////////////
62
- // Getters & Setters //
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- ////////////////////////////////////////////////////////////////////////////////////////
65
- // Private Methods //
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- ////////////////////////////////////////////////////////////////////////////////////////
68
- // Listeners //
69
- ////////////////////////////////////////////////////////////////////////////////////////
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerShow_matrix.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMControllerShow_matrix {
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 execute() {
22
- $this->display();
23
- }
24
-
25
- public function display() {
26
- require_once WD_FM_DIR . "/admin/models/FMModelShow_matrix.php";
27
- $model = new FMModelShow_matrix();
28
-
29
- require_once WD_FM_DIR . "/admin/views/FMViewShow_matrix.php";
30
- $view = new FMViewShow_matrix($model);
31
- $view->display();
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerSubmissions_fm.php DELETED
@@ -1,291 +0,0 @@
1
- <?php
2
-
3
- class FMControllerSubmissions_fm {
4
- public function execute() {
5
- $task = ((isset($_POST['task'])) ? esc_html($_POST['task']) : '');
6
- $id = ((isset($_POST['current_id'])) ? (int)esc_html($_POST['current_id']) : 0);
7
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
8
-
9
- if (method_exists($this, $task)) {
10
- if ($task != 'show_stats') {
11
- check_admin_referer('nonce_fm', 'nonce_fm');
12
- }
13
- else {
14
- check_ajax_referer('nonce_fm_ajax', 'nonce_fm_ajax');
15
- }
16
- $this->$task($id);
17
- }
18
- else {
19
- $this->display($form_id);
20
- }
21
- }
22
-
23
- public function display($form_id) {
24
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
25
- require_once WD_FM_DIR . "/admin/models/FMModelSubmissions_fm.php";
26
- $model = new FMModelSubmissions_fm();
27
-
28
- require_once WD_FM_DIR . "/admin/views/FMViewSubmissions_fm.php";
29
- $view = new FMViewSubmissions_fm($model);
30
- $view->display($form_id);
31
- }
32
-
33
- public function show_stats() {
34
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
35
- require_once WD_FM_DIR . "/admin/models/FMModelSubmissions_fm.php";
36
- $model = new FMModelSubmissions_fm();
37
-
38
- require_once WD_FM_DIR . "/admin/views/FMViewSubmissions_fm.php";
39
- $view = new FMViewSubmissions_fm($model);
40
- $view->show_stats($form_id);
41
- }
42
-
43
- public function edit() {
44
- global $wpdb;
45
- require_once WD_FM_DIR . "/admin/models/FMModelSubmissions_fm.php";
46
- $model = new FMModelSubmissions_fm();
47
-
48
- require_once WD_FM_DIR . "/admin/views/FMViewSubmissions_fm.php";
49
- $view = new FMViewSubmissions_fm($model);
50
- $id = ((isset($_POST['current_id']) && esc_html($_POST['current_id']) != '') ? (int)$_POST['current_id'] : 0);
51
-
52
- $form_id = (int)$wpdb->get_var("SELECT form_id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "'");
53
- $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
54
-
55
- $view->edit($id);
56
- }
57
-
58
- public function save() {
59
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
60
- $this->save_db();
61
- $this->display($form_id);
62
- }
63
-
64
- public function apply() {
65
- $this->save_db();
66
- $this->edit();
67
- }
68
-
69
- public function save_db() {
70
- global $wpdb;
71
- $id = (isset($_POST['current_id']) ? (int)esc_html(stripslashes($_POST['current_id'])) : 0);
72
- $date = esc_html($_POST['date']);
73
- $ip = esc_html($_POST['ip']);
74
- $form_id = (int)$wpdb->get_var("SELECT form_id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "'");
75
- $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
76
- $label_id = array();
77
- $label_order_original = array();
78
- $label_type = array();
79
-
80
- if (strpos($form->label_order, 'type_paypal_')) {
81
- $form->label_order = $form->label_order . "0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
82
- }
83
- $label_all = explode('#****#', $form->label_order);
84
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
85
- foreach ($label_all as $key => $label_each) {
86
- $label_id_each = explode('#**id**#', $label_each);
87
- array_push($label_id, $label_id_each[0]);
88
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
89
- array_push($label_order_original, $label_oder_each[0]);
90
- array_push($label_type, $label_oder_each[1]);
91
- }
92
-
93
- foreach ($label_id as $key => $label_id_1) {
94
- if (isset($_POST["submission_" . $label_id_1])) {
95
- $element_value = (isset($_POST["submission_" . $label_id_1]) ? esc_html(stripslashes($_POST["submission_" . $label_id_1])) : " ");
96
- $query = "SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "' AND element_label='" . $label_id_1 . "'";
97
- $result = $wpdb->get_var($query);
98
- if ($label_type[$key] == 'type_file_upload') {
99
- if ($element_value) {
100
- $element_value = $element_value . "*@@url@@*";
101
- }
102
- }
103
- if ($result) {
104
- $save = $wpdb->update($wpdb->prefix . "formmaker_submits", array(
105
- 'element_value' => stripslashes($element_value),
106
- ), array(
107
- 'group_id' => $id,
108
- 'element_label' => $label_id_1
109
- ), array(
110
- '%s',
111
- ), array(
112
- '%d',
113
- '%s'
114
- ));
115
- }
116
- else {
117
- $save = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
118
- 'form_id' => $form_id,
119
- 'element_label' => $label_id_1,
120
- 'element_value' => stripslashes($element_value),
121
- 'group_id' => $id,
122
- 'date' => $date,
123
- 'ip' => $ip
124
- ), array(
125
- '%d',
126
- '%s',
127
- '%s',
128
- '%d',
129
- '%s',
130
- '%s'
131
- )
132
- );
133
- }
134
- }
135
- else {
136
- if (isset($_POST["submission_" . $label_id_1 . '_0'])) {
137
- $element_value = '';
138
- for ($z = 0; $z < 21; $z++) {
139
- $element_value_ch = isset($_POST["submission_" . $label_id_1 . '_' . $z]) ? $_POST["submission_" . $label_id_1 . '_' . $z] : null;
140
- if (isset($element_value_ch)) {
141
- $element_value = $element_value . $element_value_ch . '***br***';
142
- }
143
- else {
144
- break;
145
- }
146
- }
147
- $query = "SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "' AND element_label='" . $label_id_1 . "'";
148
- $result = $wpdb->get_var($query);
149
- if ($result) {
150
- $save = $wpdb->update($wpdb->prefix . "formmaker_submits", array(
151
- 'element_value' => stripslashes($element_value),
152
- ), array(
153
- 'group_id' => $id,
154
- 'element_label' => $label_id_1
155
- ), array(
156
- '%s',
157
- ), array(
158
- '%d',
159
- '%s'
160
- ));
161
- }
162
- else {
163
- $save = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
164
- 'form_id' => $form_id,
165
- 'element_label' => $label_id_1,
166
- 'element_value' => stripslashes($element_value),
167
- 'group_id' => $id,
168
- 'date' => $date,
169
- 'ip' => $ip
170
- ), array(
171
- '%d',
172
- '%s',
173
- '%s',
174
- '%d',
175
- '%s',
176
- '%s'
177
- )
178
- );
179
- }
180
- }
181
- }
182
- }
183
- if ($save !== FALSE) {
184
- echo WDW_FM_Library::message('Submission Succesfully Saved.', 'updated');
185
- }
186
- else {
187
- echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
188
- }
189
- }
190
-
191
- public function delete($id) {
192
- global $wpdb;
193
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
194
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id="%d"', $id);
195
- if ($wpdb->query($query)) {
196
- echo WDW_FM_Library::message('Item Succesfully Deleted.', 'updated');
197
- }
198
- else {
199
- echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
200
- }
201
-
202
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE form_id="%d" AND group_id="%d"', $form_id, $id);
203
- $wpdb->query($query);
204
-
205
- $this->display($form_id);
206
- }
207
-
208
- public function delete_all() {
209
- global $wpdb;
210
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? esc_html($_POST['form_id']) : 0);
211
- $cid = ((isset($_POST['post']) && $_POST['post'] != '') ? $_POST['post'] : NULL);
212
- if (count($cid)) {
213
- array_walk($cid, create_function('&$value', '$value = (int)$value;'));
214
- $cids = implode(',', $cid);
215
- $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( ' . $cids . ' )';
216
-
217
- if ($wpdb->query($query)) {
218
- echo WDW_FM_Library::message('Items Succesfully Deleted.', 'updated');
219
- }
220
- else {
221
- echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
222
- }
223
-
224
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE form_id="%d" AND group_id IN ( "%s" )', $form_id, $cids);
225
- $wpdb->query($query);
226
- }
227
- else {
228
- echo WDW_FM_Library::message('You must select at least one item.', 'error');
229
- }
230
- $this->display($form_id);
231
- }
232
-
233
- public function block_ip() {
234
- global $wpdb;
235
- $flag = FALSE;
236
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
237
- $cid = ((isset($_POST['post']) && $_POST['post'] != '') ? $_POST['post'] : NULL);
238
- if (count($cid)) {
239
- array_walk($cid, create_function('&$value', '$value = (int)$value;'));
240
- $cids = implode(',', $cid);
241
- $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( ' . $cids . ' )';
242
- $rows = $wpdb->get_results($query);
243
- foreach ($rows as $row) {
244
- $ips = $wpdb->get_var($wpdb->prepare('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $row->ip));
245
- $flag = TRUE;
246
- if (!$ips) {
247
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_blocked', array(
248
- 'ip' => $row->ip,
249
- ), array(
250
- '%s',
251
- ));
252
- }
253
- }
254
- }
255
- if ($flag) {
256
- echo WDW_FM_Library::message('IPs Succesfully Blocked.', 'updated');
257
- }
258
- else {
259
- echo WDW_FM_Library::message('You must select at least one item.', 'error');
260
- }
261
- $this->display($form_id);
262
- }
263
-
264
- public function unblock_ip() {
265
- global $wpdb;
266
- $flag = FALSE;
267
- $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
268
- $cid = ((isset($_POST['post']) && $_POST['post'] != '') ? $_POST['post'] : NULL);
269
- if (count($cid)) {
270
- array_walk($cid, create_function('&$value', '$value = (int)$value;'));
271
- $cids = implode(',', $cid);
272
- $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( ' . $cids . ' )';
273
- $rows = $wpdb->get_results($query);
274
- foreach ($rows as $row) {
275
- $flag = TRUE;
276
- $ips = $wpdb->get_var($wpdb->prepare('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $row->ip));
277
- if ($ips) {
278
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ips));
279
- }
280
- }
281
- }
282
- if ($flag) {
283
- echo WDW_FM_Library::message('IPs Succesfully Unblocked.', 'updated');
284
- }
285
- else {
286
- echo WDW_FM_Library::message('You must select at least one item.', 'error');
287
- }
288
- $this->display($form_id);
289
- }
290
-
291
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerThemes_fm.php DELETED
@@ -1,219 +0,0 @@
1
- <?php
2
-
3
- class FMControllerThemes_fm {
4
-
5
- public function execute() {
6
- $task = WDW_FM_Library::get('task');
7
- $id = (int)WDW_FM_Library::get('current_id', 0);
8
- $message = WDW_FM_Library::get('message');
9
- echo WDW_FM_Library::message_id($message);
10
- if (method_exists($this, $task)) {
11
- check_admin_referer('nonce_fm', 'nonce_fm');
12
- $this->$task($id);
13
- }
14
- else {
15
- $this->display();
16
- }
17
- }
18
-
19
- public function display() {
20
- require_once WD_FM_DIR . "/admin/models/FMModelThemes_fm.php";
21
- $model = new FMModelThemes_fm();
22
-
23
- require_once WD_FM_DIR . "/admin/views/FMViewThemes_fm.php";
24
- $view = new FMViewThemes_fm($model);
25
- $view->display();
26
- }
27
-
28
- public function add() {
29
- require_once WD_FM_DIR . "/admin/models/FMModelThemes_fm.php";
30
- $model = new FMModelThemes_fm();
31
-
32
- require_once WD_FM_DIR . "/admin/views/FMViewThemes_fm.php";
33
- $view = new FMViewThemes_fm($model);
34
- $view->edit(0, FALSE);
35
- }
36
-
37
- public function edit() {
38
- require_once WD_FM_DIR . "/admin/models/FMModelThemes_fm.php";
39
- $model = new FMModelThemes_fm();
40
-
41
- require_once WD_FM_DIR . "/admin/views/FMViewThemes_fm.php";
42
- $view = new FMViewThemes_fm($model);
43
- $id = (int)WDW_FM_Library::get('current_id', 0);
44
- $view->edit($id, FALSE);
45
- }
46
-
47
- public function save() {
48
- $message = $this->save_db();
49
- $page = WDW_FM_Library::get('page');
50
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
51
- }
52
-
53
- public function apply() {
54
- $message = $this->save_db();
55
- global $wpdb;
56
- $id = (int) $wpdb->get_var('SELECT MAX(`id`) FROM ' . $wpdb->prefix . 'formmaker_themes');
57
- $current_id = (int)WDW_FM_Library::get('current_id', $id);
58
- $page = WDW_FM_Library::get('page');
59
- $active_tab = WDW_FM_Library::get('active_tab');
60
- $pagination = WDW_FM_Library::get('pagination-type');
61
- $form_type = WDW_FM_Library::get('form_type');
62
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message, 'active_tab' => $active_tab, 'pagination' => $pagination, 'form_type' => $form_type), admin_url('admin.php')));
63
- }
64
-
65
- public function copy_themes() {
66
- global $wpdb;
67
- $theme_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes');
68
- foreach ($theme_ids_col as $theme_id) {
69
- if (isset($_POST['check_' . $theme_id])) {
70
- $theme = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes where id=' . $theme_id);
71
- $title = $theme->title;
72
- $params = $theme->css;
73
- $version = $theme->version;
74
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_themes',
75
- array(
76
- 'title' => $title,
77
- 'css' => $params,
78
- 'version' => $version,
79
- 'default' => 0
80
- ));
81
- }
82
- }
83
-
84
- if ($save !== FALSE) {
85
- $message = 1;
86
- }
87
- else {
88
- $message = 2;
89
- }
90
-
91
- $page = WDW_FM_Library::get('page');
92
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
93
- }
94
-
95
- public function save_as_copy() {
96
- $message = $this->save_db_as_copy();
97
- $page = WDW_FM_Library::get('page');
98
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
99
- }
100
-
101
- public function save_db() {
102
- global $wpdb;
103
- $id = (int) WDW_FM_Library::get('current_id', 0);
104
- $title = (isset($_POST['title']) ? esc_html(stripslashes( $_POST['title'])) : '');
105
- $version = 2;
106
- $params = (isset($_POST['params']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['params'])) : '');
107
- $default = (isset($_POST['default']) ? esc_html(stripslashes( $_POST['default'])) : 0);
108
- if ($id != 0) {
109
- $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array(
110
- 'title' => $title,
111
- 'css' => $params,
112
- 'default' => $default,
113
- ), array('id' => $id));
114
- $version = $wpdb->get_var($wpdb->prepare("SELECT version FROM " . $wpdb->prefix . "formmaker_themes WHERE id=%d", $id));
115
- }
116
- else {
117
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_themes', array(
118
- 'title' => $title,
119
- 'css' => $params,
120
- 'default' => $default,
121
- 'version' => $version,
122
- ));
123
- $id = $wpdb->insert_id;
124
- }
125
- if ($save !== FALSE) {
126
- require_once WD_FM_DIR . "/frontend/models/FMModelForm_maker.php";
127
- $model_frontend = new FMModelForm_maker();
128
- $form_theme = json_decode(html_entity_decode($params), true);
129
- $model_frontend->create_css($id, $form_theme, $version == 1, true);
130
- return 1;
131
- }
132
- else {
133
- return 2;
134
- }
135
- }
136
-
137
- public function save_db_as_copy() {
138
- global $wpdb;
139
- $id = (int) WDW_FM_Library::get('current_id', 0);
140
- $title = isset($_POST['title']) ? esc_html(stripslashes( $_POST['title'])) : '';
141
- $params = isset($_POST['params']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['params'])) : '';
142
- $version = $wpdb->get_var($wpdb->prepare("SELECT version FROM " . $wpdb->prefix . "formmaker_themes WHERE id=%d", $id));
143
- $save = $wpdb->insert($wpdb->prefix . 'formmaker_themes',
144
- array(
145
- 'title' => $title,
146
- 'css' => $params,
147
- 'version' => $version,
148
- 'default' => 0
149
- ));
150
-
151
- if ($save !== FALSE) {
152
- return 1;
153
- }
154
- else {
155
- return 2;
156
- }
157
- }
158
-
159
- public function delete($id) {
160
- global $wpdb;
161
- $isDefault = $wpdb->get_var($wpdb->prepare('SELECT `default` FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id));
162
- if ($isDefault) {
163
- $message = 4;
164
- }
165
- else {
166
- $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id);
167
- if ($wpdb->query($query)) {
168
- $message = 3;
169
- }
170
- else {
171
- $message = 2;
172
- }
173
- }
174
- $page = WDW_FM_Library::get('page');
175
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
176
- }
177
-
178
- public function delete_all() {
179
- global $wpdb;
180
- $flag = FALSE;
181
- $isDefault = FALSE;
182
- $theme_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes');
183
- foreach ($theme_ids_col as $theme_id) {
184
- if (isset($_POST['check_' . $theme_id])) {
185
- $isDefault = $wpdb->get_var($wpdb->prepare('SELECT `default` FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
186
- if ($isDefault) {
187
- $message = 4;
188
- }
189
- else {
190
- $flag = TRUE;
191
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
192
- }
193
- }
194
- }
195
- if ($flag) {
196
- $message = 5;
197
- }
198
- else {
199
- $message = 6;
200
- }
201
- $page = WDW_FM_Library::get('page');
202
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
203
- }
204
-
205
- public function setdefault($id) {
206
- global $wpdb;
207
- $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 0), array('default' => 1));
208
- $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 1), array('id' => $id));
209
- if ($save !== FALSE) {
210
- $message = 7;
211
- }
212
- else {
213
- $message = 2;
214
- }
215
- $page = WDW_FM_Library::get('page');
216
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
217
- }
218
-
219
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerUninstall_fm.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
-
3
- class FMControllerUninstall_fm {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- global $fm_options;
18
- if (!class_exists("DoradoWebConfig")) {
19
- include_once(WD_FM_DIR . "/wd/config.php");
20
- }
21
- $config = new DoradoWebConfig();
22
- $config->set_options($fm_options);
23
- $deactivate_reasons = new DoradoWebDeactivate($config);
24
- $deactivate_reasons->submit_and_deactivate();
25
- }
26
- ////////////////////////////////////////////////////////////////////////////////////////
27
- // Public Methods //
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- public function execute() {
30
- $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
31
- if (method_exists($this, $task)) {
32
- check_admin_referer('nonce_fm', 'nonce_fm');
33
- $this->$task();
34
- }
35
- else {
36
- $this->display();
37
- }
38
- }
39
-
40
- public function display() {
41
- require_once WD_FM_DIR . "/admin/models/FMModelUninstall_fm.php";
42
- $model = new FMModelUninstall_fm();
43
-
44
- require_once WD_FM_DIR . "/admin/views/FMViewUninstall_fm.php";
45
- $view = new FMViewUninstall_fm($model);
46
- $view->display();
47
- }
48
-
49
- public function uninstall() {
50
- require_once WD_FM_DIR . "/admin/models/FMModelUninstall_fm.php";
51
- $model = new FMModelUninstall_fm();
52
-
53
- require_once WD_FM_DIR . "/admin/views/FMViewUninstall_fm.php";
54
- $view = new FMViewUninstall_fm($model);
55
- $view->uninstall();
56
- }
57
- ////////////////////////////////////////////////////////////////////////////////////////
58
- // Getters & Setters //
59
- ////////////////////////////////////////////////////////////////////////////////////////
60
- ////////////////////////////////////////////////////////////////////////////////////////
61
- // Private Methods //
62
- ////////////////////////////////////////////////////////////////////////////////////////
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- // Listeners //
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerWidget.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- class FMControllerWidget extends WP_Widget {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $view;
14
- private $model;
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- // Constructor & Destructor //
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
- public function __construct() {
19
- $widget_ops = array(
20
- 'classname' => 'form_maker_widget',
21
- 'description' => 'Add Form Maker widget.'
22
- );
23
- // Widget Control Settings.
24
- $control_ops = array('id_base' => 'form_maker_widget');
25
- // Create the widget.
26
- parent::__construct('form_maker_widget', 'Form Maker', $widget_ops, $control_ops);
27
- require_once WD_FM_DIR . "/admin/models/FMModelWidget.php";
28
- $this->model = new FMModelWidget();
29
-
30
- require_once WD_FM_DIR . "/admin/views/FMViewWidget.php";
31
- $this->view = new FMViewWidget($this->model);
32
- }
33
- ////////////////////////////////////////////////////////////////////////////////////////
34
- // Public Methods //
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
-
37
- public function widget($args, $instance) {
38
- $this->view->widget($args, $instance);
39
- }
40
-
41
- public function form( $instance ) {
42
- $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('form_id'), parent::get_field_name('form_id'));
43
- }
44
-
45
- // Update Settings.
46
- public function update($new_instance, $old_instance) {
47
- $instance['title'] = $new_instance['title'];
48
- $instance['form_id'] = $new_instance['form_id'];
49
- return $instance;
50
- }
51
-
52
- ////////////////////////////////////////////////////////////////////////////////////////
53
- // Getters & Setters //
54
- ////////////////////////////////////////////////////////////////////////////////////////
55
- ////////////////////////////////////////////////////////////////////////////////////////
56
- // Private Methods //
57
- ////////////////////////////////////////////////////////////////////////////////////////
58
- ////////////////////////////////////////////////////////////////////////////////////////
59
- // Listeners //
60
- ////////////////////////////////////////////////////////////////////////////////////////
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMShortocde.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFMShortocde
5
+ */
6
+ class FMControllerFMShortocde {
7
+ private $model;
8
+ private $view;
9
+
10
+ /**
11
+ * FMControllerFMShortocde constructor.
12
+ */
13
+ public function __construct() {
14
+ require_once WDFM()->plugin_dir . "/admin/models/FMShortocde.php";
15
+ $this->model = new FMModelFMShortocde();
16
+
17
+ require_once WDFM()->plugin_dir . "/admin/views/FMShortocde.php";
18
+ $this->view = new FMViewFMShortocde();
19
+ }
20
+
21
+ /**
22
+ * Execute.
23
+ */
24
+ public function execute() {
25
+ $task = WDW_FM_Library::get('task');
26
+ $this->display($task);
27
+ }
28
+
29
+ /**
30
+ * Display.
31
+ */
32
+ public function display($task) {
33
+ // Get forms.
34
+ $forms = $this->model->get_form_data();
35
+
36
+ if ( method_exists($this->view, $task) ) {
37
+ $this->view->$task($forms);
38
+ }
39
+ else {
40
+ $this->view->form($forms);
41
+ }
42
+ }
43
+ }
admin/controllers/FormMakerEditCountryinPopup.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormmakereditcountryinpopup
5
+ */
6
+ class FMControllerFormmakereditcountryinpopup {
7
+ /**
8
+ * @var $view
9
+ */
10
+ private $view;
11
+
12
+ /**
13
+ * Execute.
14
+ */
15
+ public function execute() {
16
+ $this->display();
17
+ }
18
+
19
+ /**
20
+ * Display.
21
+ */
22
+ public function display() {
23
+ // Load FMViewFromeditcountryinpopup class.
24
+ require_once WDFM()->plugin_dir . "/admin/views/FMEditCountryinPopup.php";
25
+ $this->view = new FMViewFromeditcountryinpopup();
26
+ // Set params for view.
27
+ $params = array();
28
+ $params['field_id'] = WDW_FM_Library::get('field_id', 0);
29
+ $this->view->display($params);
30
+ }
31
+ }
admin/controllers/FormMakerIpinfoinPopup.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormmakeripinfoinpopup
5
+ */
6
+ class FMControllerFormmakeripinfoinpopup {
7
+ /**
8
+ * @var view
9
+ */
10
+ private $view;
11
+
12
+ /**
13
+ * Execute.
14
+ */
15
+ public function execute() {
16
+ $this->display();
17
+ }
18
+
19
+ /**
20
+ * Display.
21
+ */
22
+ public function display() {
23
+ // Load FMViewFromipinfoinpopup class.
24
+ require_once WDFM()->plugin_dir . "/admin/views/FMIpinfoinPopup.php";
25
+ $this->view = new FMViewFromipinfoinpopup();
26
+ // Get IP
27
+ $ip = WDW_FM_Library::get('data_ip', '');
28
+ // Connect to IP api service and get IP info.
29
+ $ipinfo = @unserialize(file_get_contents('http://ip-api.com/php/' . $ip));
30
+ $city = '-';
31
+ $country = '-';
32
+ $countryCode = '-';
33
+ $country_flag = '-';
34
+ $timezone = '-';
35
+ $lat = '-';
36
+ $lon = '-';
37
+ if ( $ipinfo && $ipinfo['status'] == 'success' && $ipinfo['countryCode'] ) {
38
+ $city = $ipinfo['city'];
39
+ $country = $ipinfo['country'];
40
+ $countryCode = $ipinfo['countryCode'];
41
+ $country_flag = '<img width="16px" src="' . WDFM()->plugin_url . '/images/flags/' . strtolower($ipinfo['countryCode']) . '.png" class="sub-align" alt="' . $ipinfo['country'] . '" title="' . $ipinfo['country'] . '" />';
42
+ $timezone = $ipinfo['timezone'];
43
+ $lat = $ipinfo['lat'];
44
+ $lon = $ipinfo['lon'];
45
+ }
46
+ // Set params for view.
47
+ $params = array();
48
+ $params['ip'] = $ip;
49
+ $params['city'] = $city;
50
+ $params['country'] = $country;
51
+ $params['country_flag'] = $country_flag;
52
+ $params['countryCode'] = $countryCode;
53
+ $params['timezone'] = $timezone;
54
+ $params['lat'] = $lat;
55
+ $params['lon'] = $lon;
56
+ $this->view->display($params);
57
+ }
58
+ }
admin/controllers/FormMakerMapEditinPopup.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormmakermapeditinpopup
5
+ */
6
+ class FMControllerFormmakermapeditinpopup {
7
+ /**
8
+ * @var view
9
+ */
10
+ private $view;
11
+
12
+ /**
13
+ * Execute.
14
+ */
15
+ public function execute() {
16
+ $this->display();
17
+ }
18
+
19
+ /**
20
+ * Display.
21
+ */
22
+ public function display() {
23
+ // Load FMViewFrommapeditinpopup class.
24
+ require_once WDFM()->plugin_dir . "/admin/views/FMMapEditinPopup.php";
25
+ $this->view = new FMViewFrommapeditinpopup();
26
+ // Get form maker settings.
27
+ $fm_settings = get_option('fm_settings');
28
+ // Set params for view.
29
+ $params = array();
30
+ $params['map_key'] = !empty($fm_settings['map_key']) ? '&key=' . $fm_settings['map_key'] : '';
31
+ $params['long'] = WDW_FM_Library::get('long', 0);
32
+ $params['lat'] = WDW_FM_Library::get('lat', 0);
33
+ $this->view->display($params);
34
+ }
35
+ }
admin/controllers/FormMakerPreview.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormMakerPreview
5
+ */
6
+ class FMControllerFormMakerPreview {
7
+ /**
8
+ * @var $model
9
+ */
10
+ private $model;
11
+ /**
12
+ * @var $view
13
+ */
14
+ private $view;
15
+
16
+ /**
17
+ * Execute.
18
+ */
19
+ public function execute() {
20
+ WDFM()->register_frontend_scripts();
21
+ $this->display();
22
+ }
23
+
24
+ /**
25
+ * Display.
26
+ */
27
+ public function display() {
28
+ // Load FMModelFormMakerPreview class.
29
+ require_once WDFM()->plugin_dir . "/admin/models/FMPreview.php";
30
+ $this->model = new FMModelFormMakerPreview();
31
+ // Load FMViewFormMakerPreview class.
32
+ require_once WDFM()->plugin_dir . "/admin/views/FMPreview.php";
33
+ $this->view = new FMViewFormMakerPreview();
34
+ // Get form by id.
35
+ $form_id = WDW_FM_Library::get('form_id', '');
36
+ $form = $this->model->get_form($form_id);
37
+ $error_message = '';
38
+ if ( !$form ) {
39
+ $error_message = __('Form not found, please try again.', WDFM()->prefix);
40
+ }
41
+ // Set params for view.
42
+ $params = array();
43
+ $params['form_id'] = $form_id;
44
+ $params['error_message'] = $error_message;
45
+ $this->view->display($params);
46
+ }
47
+ }
admin/controllers/FormMakerSQLMapping.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormMakerSQLMapping
5
+ */
6
+ class FMControllerFormMakerSQLMapping {
7
+ /**
8
+ * @var $model
9
+ */
10
+ private $model;
11
+ /**
12
+ * @var $view
13
+ */
14
+ private $view;
15
+
16
+ /**
17
+ * FMControllerFormMakerSQLMapping constructor.
18
+ */
19
+ public function __construct() {
20
+ // Load FMModelFormMakerSQLMapping class.
21
+ require_once WDFM()->plugin_dir . "/admin/models/FMSqlMapping.php";
22
+ $this->model = new FMModelFormMakerSQLMapping();
23
+ // Load FMViewFormMakerSQLMapping class.
24
+ require_once WDFM()->plugin_dir . "/admin/views/FMSqlMapping.php";
25
+ $this->view = new FMViewFormMakerSQLMapping();
26
+ }
27
+
28
+ /**
29
+ * Execute.
30
+ */
31
+ public function execute() {
32
+ $id = WDW_FM_Library::get('id', '');
33
+ $form_id = WDW_FM_Library::get('form_id', '');
34
+ $task = WDW_FM_Library::get('task', '');
35
+ if ( $task && method_exists($this, $task) ) {
36
+ $this->$task($form_id);
37
+ }
38
+ else {
39
+ if ( $id ) {
40
+ $this->edit_query($id, $form_id);
41
+ }
42
+ else {
43
+ $this->add_query($form_id);
44
+ }
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Add query.
50
+ *
51
+ * @param int $form_id
52
+ */
53
+ public function add_query( $form_id ) {
54
+ // Get labels by form id.
55
+ $label = $this->model->get_labels($form_id);
56
+ // Set params for view.
57
+ $params = array();
58
+ $params['label'] = $label;
59
+ $params['form_id'] = $form_id;
60
+ $this->view->add_query($params);
61
+ }
62
+
63
+ /**
64
+ * Edit query.
65
+ *
66
+ * @param int $id
67
+ * @param int $form_id
68
+ */
69
+ public function edit_query( $id, $form_id ) {
70
+ // Get labels by form id.
71
+ $label = $this->model->get_labels($form_id);
72
+ // Get query by id.
73
+ $query_obj = $this->model->get_query($id);
74
+ $temp = explode('***wdfcon_typewdf***', $query_obj->details);
75
+ $con_type = $temp[0];
76
+ $temp = explode('***wdfcon_methodwdf***', $temp[1]);
77
+ $con_method = $temp[0];
78
+ $temp = explode('***wdftablewdf***', $temp[1]);
79
+ $table_cur = $temp[0];
80
+ $temp = explode('***wdfhostwdf***', $temp[1]);
81
+ $host = $temp[0];
82
+ $temp = explode('***wdfportwdf***', $temp[1]);
83
+ $port = $temp[0];
84
+ $temp = explode('***wdfusernamewdf***', $temp[1]);
85
+ $username = $temp[0];
86
+ $temp = explode('***wdfpasswordwdf***', $temp[1]);
87
+ $password = $temp[0];
88
+ $temp = explode('***wdfdatabasewdf***', $temp[1]);
89
+ $database = $temp[0];
90
+ $details = $temp[1];
91
+ $tables = $this->model->get_tables_saved($con_type, $username, $password, $database, $host);
92
+ $table_struct = $this->model->get_table_struct_saved($con_type, $username, $password, $database, $host, $table_cur, $con_method);
93
+ // Set params for view.
94
+ $params = array();
95
+ $params['id'] = $id;
96
+ $params['form_id'] = $form_id;
97
+ $params['label'] = $label;
98
+ $params['query_obj'] = $query_obj;
99
+ $params['tables'] = $tables;
100
+ $params['table_struct'] = $table_struct;
101
+ $this->view->edit_query($params);
102
+ }
103
+
104
+ /**
105
+ * DB tables.
106
+ *
107
+ * @param int $form_id
108
+ */
109
+ public function db_tables( $form_id ) {
110
+ // Get all tables.
111
+ $tables = $this->model->get_tables();
112
+ // Set params for view.
113
+ $params = array();
114
+ $params['tables'] = $tables;
115
+ $params['form_id'] = $form_id;
116
+ $this->view->db_tables($params);
117
+ }
118
+
119
+ /**
120
+ * DB table struct.
121
+ *
122
+ * @param int $form_id
123
+ */
124
+ public function db_table_struct( $form_id ) {
125
+ $con_method = WDW_FM_Library::get('con_method', '');
126
+ // Get labels by form id.
127
+ $label = $this->model->get_labels($form_id);
128
+ // Get table struct.
129
+ $table_struct = $this->model->get_table_struct();
130
+ // Set params for view.
131
+ $params = array();
132
+ $params['form_id'] = $form_id;
133
+ $params['label'] = $label;
134
+ $params['table_struct'] = $table_struct;
135
+ $params['con_method'] = $con_method;
136
+ $this->view->db_table_struct($params);
137
+ }
138
+
139
+ public function save_query() {
140
+ global $wpdb;
141
+ $form_id = ((isset($_GET['form_id'])) ? (int) $_GET['form_id'] : 0);
142
+ $query = ((isset($_POST['query'])) ? stripslashes(wp_specialchars_decode($_POST['query'])) : "");
143
+ $details = ((isset($_POST['details'])) ? esc_html($_POST['details']) : "");
144
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker_query', array(
145
+ 'form_id' => $form_id,
146
+ 'query' => $query,
147
+ 'details' => $details,
148
+ ), array(
149
+ '%d',
150
+ '%s',
151
+ '%s',
152
+ ));
153
+ }
154
+
155
+ public function update_query() {
156
+ global $wpdb;
157
+ $id = ((isset($_GET['id'])) ? (int) $_GET['id'] : 0);
158
+ $form_id = ((isset($_GET['form_id'])) ? (int) $_GET['form_id'] : 0);
159
+ $query = ((isset($_POST['query'])) ? stripslashes(wp_specialchars_decode($_POST['query'])) : "");
160
+ $details = ((isset($_POST['details'])) ? esc_html($_POST['details']) : "");
161
+ $save = $wpdb->update($wpdb->prefix . 'formmaker_query', array(
162
+ 'form_id' => $form_id,
163
+ 'query' => $query,
164
+ 'details' => $details,
165
+ ), array( 'id' => $id ));
166
+ }
167
+ }
admin/controllers/FormMakerSubmits.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormMakerSubmits
5
+ */
6
+ class FMControllerFormMakerSubmits {
7
+ private $model;
8
+ private $view;
9
+
10
+ public function __construct() {
11
+ require_once WDFM()->plugin_dir . "/admin/models/FormMakerSubmits.php";
12
+ $this->model = new FMModelFormMakerSubmits();
13
+ require_once WDFM()->plugin_dir . "/admin/views/FormMakerSubmits.php";
14
+ $this->view = new FMViewFormMakerSubmits();
15
+ }
16
+
17
+ public function execute() {
18
+ $this->display();
19
+ }
20
+
21
+ public function display() {
22
+ $params = array();
23
+ $form_id = esc_html(stripslashes($_GET['form_id']));
24
+ $params['label_order'] = $this->model->get_from_label_order($form_id);
25
+ $group_id = esc_html(stripslashes($_GET['group_id']));
26
+ $params['rows'] = $this->model->get_submissions($group_id);
27
+ $labels_id = array();
28
+ $labels_name = array();
29
+ $labels_type = array();
30
+ $label_all = explode('#****#', $params['label_order']);
31
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
32
+ foreach ( $label_all as $key => $label_each ) {
33
+ $label_id_each = explode('#**id**#', $label_each);
34
+ array_push($labels_id, $label_id_each[0]);
35
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
36
+ array_push($labels_name, $label_oder_each[0]);
37
+ array_push($labels_type, $label_oder_each[1]);
38
+ }
39
+ $params['labels_id'] = $labels_id;
40
+ $params['labels_name'] = $labels_name;
41
+ $params['labels_type'] = $labels_type;
42
+ $this->view->display($params);
43
+ }
44
+ }
admin/controllers/Formmakerwdcaptcha.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class FMControllerFormmakerwdcaptcha
4
+ */
5
+ class FMControllerFormmakerwdcaptcha {
6
+ /**
7
+ * @var view
8
+ */
9
+ private $view;
10
+
11
+ /**
12
+ * Execute.
13
+ */
14
+ public function execute() {
15
+ $this->display();
16
+ }
17
+
18
+ /**
19
+ * Display.
20
+ */
21
+ public function display() {
22
+ // Load FMViewFormmakerwdcaptcha class.
23
+ require_once WDFM()->plugin_dir . "/admin/views/FMCaptcha.php";
24
+ $this->view = new FMViewFormmakerwdcaptcha();
25
+ // Set params for view.
26
+ $params = array();
27
+ $this->view->display($params);
28
+ }
29
+ }
admin/controllers/Formmakerwdmathcaptcha.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerFormmakerwdmathcaptcha
5
+ */
6
+ class FMControllerFormmakerwdmathcaptcha {
7
+ /**
8
+ * @var $view
9
+ */
10
+ private $view;
11
+
12
+ /**
13
+ * Execute.
14
+ */
15
+ public function execute() {
16
+ $this->display();
17
+ }
18
+
19
+ /**
20
+ * Display.
21
+ */
22
+ public function display() {
23
+ // Load FMViewFormmakerwdmathcaptcha class.
24
+ require_once WDFM()->plugin_dir . "/admin/views/FMMathCaptcha.php";
25
+ $this->view = new FMViewFormmakerwdmathcaptcha();
26
+ // Set params for view.
27
+ $params = array();
28
+ $this->view->display($params);
29
+ }
30
+ }
admin/controllers/Generete_csv.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerGenerete_csv
5
+ */
6
+ class FMControllerGenerete_csv {
7
+ /**
8
+ * Execute.
9
+ */
10
+ public function execute() {
11
+ $this->display();
12
+ }
13
+
14
+ /**
15
+ * display.
16
+ */
17
+ public function display() {
18
+ // Get form maker settings
19
+ $fm_settings = get_option('fm_settings');
20
+ $csv_delimiter = isset($fm_settings['csv_delimiter']) ? $fm_settings['csv_delimiter'] : ',';
21
+ $form_id = (int) $_REQUEST['form_id'];
22
+ $limitstart = (int) $_REQUEST['limitstart'];
23
+ $send_header = (int) $_REQUEST['send_header'];
24
+ $params = WDW_FM_Library::get_submissions_to_export();
25
+ $data = $params[0];
26
+ $title = $params[1];
27
+ $is_paypal_info = $params[2];
28
+ $all_keys = array();
29
+ foreach ( $data as $row ) {
30
+ $all_keys = array_merge($all_keys, $row);
31
+ }
32
+ $keys_array = array_keys($all_keys);
33
+ foreach ( $data as $key => $row ) {
34
+ foreach ( $keys_array as $key1 => $value ) {
35
+ if ( !array_key_exists($value, $row) ) {
36
+ array_splice($row, $key1, 0, '');
37
+ }
38
+ }
39
+ $data[$key] = $row;
40
+ }
41
+ $upload_dir = wp_upload_dir();
42
+ $file_path = $upload_dir['basedir'] . '/form-maker';
43
+ if ( !is_dir($file_path) ) {
44
+ mkdir($file_path, 0777);
45
+ }
46
+ $tempfile = $file_path . '/export' . $form_id . '.txt';
47
+ if ( $limitstart == 0 && file_exists($tempfile) ) {
48
+ unlink($tempfile);
49
+ }
50
+ $output = fopen($tempfile, "a");
51
+ if ( $limitstart == 0 ) {
52
+ fputcsv($output, str_replace('PAYPAL_', '', $keys_array), $csv_delimiter);
53
+ }
54
+ foreach ( $data as $record ) {
55
+ fputcsv($output, $record, $csv_delimiter);
56
+ }
57
+ fclose($output);
58
+ if ( $send_header == 1 ) {
59
+ $txtfile = fopen($tempfile, "r");
60
+ $txtfilecontent = fread($txtfile, filesize($tempfile));
61
+ fclose($txtfile);
62
+ $filename = $title . "_" . date('Ymd') . ".csv";
63
+ header('Content-Encoding: Windows-1252');
64
+ header('Content-type: text/csv; charset=Windows-1252');
65
+ header("Content-Disposition: attachment; filename=\"$filename\"");
66
+ echo $txtfilecontent;
67
+ unlink($tempfile);
68
+ }
69
+ die();
70
+ }
71
+ }
admin/controllers/Generete_xml.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerGenerete_xml
5
+ */
6
+ class FMControllerGenerete_xml {
7
+ /**
8
+ * Execute.
9
+ */
10
+ public function execute() {
11
+ $this->display();
12
+ }
13
+
14
+ public function display() {
15
+ $form_id = (int) $_REQUEST['form_id'];
16
+ $limitstart = (int) $_REQUEST['limitstart'];
17
+ $send_header = (int) $_REQUEST['send_header'];
18
+ $params = WDW_FM_Library::get_submissions_to_export();
19
+ $data = $params[0];
20
+ $title = $params[1];
21
+ define('PHP_TAB', "\t");
22
+ $upload_dir = wp_upload_dir();
23
+ $file_path = $upload_dir['basedir'] . '/form-maker';
24
+ if ( !is_dir($file_path) ) {
25
+ mkdir($file_path, 0777);
26
+ }
27
+ $tempfile = $file_path . '/export' . $form_id . '.txt';
28
+ if ( $limitstart == 0 && file_exists($tempfile) ) {
29
+ unlink($tempfile);
30
+ }
31
+ $output = fopen($tempfile, "a");
32
+ if ( $limitstart == 0 ) {
33
+ fwrite($output, '<?xml version="1.0" encoding="utf-8" ?>' . PHP_EOL);
34
+ fwrite($output, '<form title="' . $title . '">' . PHP_EOL);
35
+ }
36
+ foreach ( $data as $key1 => $value1 ) {
37
+ fwrite($output, PHP_TAB . '<submission id="' . $key1 . '">' . PHP_EOL);
38
+ foreach ( $value1 as $key => $value ) {
39
+ fwrite($output, PHP_TAB . PHP_TAB . '<field title="' . $key . '">' . PHP_EOL);
40
+ fwrite($output, PHP_TAB . PHP_TAB . PHP_TAB . '<![CDATA[' . $value . ']]>' . PHP_EOL);
41
+ fwrite($output, PHP_TAB . PHP_TAB . '</field>' . PHP_EOL);
42
+ }
43
+ fwrite($output, PHP_TAB . '</submission>' . PHP_EOL);
44
+ }
45
+ if ( $send_header == 1 ) {
46
+ fwrite($output, '</form>');
47
+ fclose($output);
48
+ $txtfile = fopen($tempfile, "r");
49
+ $txtfilecontent = fread($txtfile, filesize($tempfile));
50
+ fclose($txtfile);
51
+ $filename = $title . "_" . date('Ymd') . ".xml";
52
+ header('Content-Encoding: Windows-1252');
53
+ header('Content-type: text/xml; charset=utf-8');
54
+ header("Content-Disposition: attachment; filename=\"$filename\"");
55
+ echo $txtfilecontent;
56
+ unlink($tempfile);
57
+ }
58
+
59
+ die();
60
+ }
61
+ }
admin/controllers/Licensing_fm.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerLicensing_fm
5
+ */
6
+ class FMControllerLicensing_fm {
7
+ private $view;
8
+ public function __construct() {
9
+ require_once WDFM()->plugin_dir . "/admin/views/Licensing_fm.php";
10
+ $this->view = new FMViewLicensing_fm();
11
+ }
12
+ public function execute() {
13
+ $task = WDW_FM_Library::get('task');
14
+ $id = (int) WDW_FM_Library::get('current_id', 0);
15
+ if (method_exists($this, $task)) {
16
+ $this->$task($id);
17
+ }
18
+ else {
19
+ $this->display();
20
+ }
21
+ }
22
+
23
+ public function display() {
24
+ $this->view->display();
25
+ }
26
+ }
admin/controllers/Manage_fm.php ADDED
@@ -0,0 +1,1386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerManage_fm {
4
+ private $model;
5
+ private $view;
6
+ private $page;
7
+ private $page_url;
8
+ private $bulk_action_name = '';
9
+ private $items_per_page = 20;
10
+ private $animation_effects = array();
11
+ private $actions = array();
12
+
13
+ function __construct() {
14
+ require_once WDFM()->plugin_dir . "/admin/models/Manage_fm.php";
15
+ require_once WDFM()->plugin_dir . "/admin/views/Manage_fm.php";
16
+ $this->model = new FMModelManage_fm();
17
+ $this->view = new FMViewManage_fm();
18
+
19
+ $this->page = WDW_FM_Library::get('page');
20
+ $this->page_url = add_query_arg(array(
21
+ 'page' => $this->page,
22
+ WDFM()->nonce => wp_create_nonce(WDFM()->nonce),
23
+ ), admin_url('admin.php')
24
+ );
25
+ $this->bulk_action_name = 'bulk_action';
26
+
27
+ $this->actions = array(
28
+ 'publish' => array(
29
+ 'title' => __('Publish', WDFM()->prefix),
30
+ $this->bulk_action_name => __('published', WDFM()->prefix),
31
+ ),
32
+ 'unpublish' => array(
33
+ 'title' => __('Unpublish', WDFM()->prefix),
34
+ $this->bulk_action_name => __('unpublished', WDFM()->prefix),
35
+ ),
36
+ 'duplicate' => array(
37
+ 'title' => __('Duplicate', WDFM()->prefix),
38
+ $this->bulk_action_name => __('duplicated', WDFM()->prefix),
39
+ ),
40
+ 'delete' => array(
41
+ 'title' => __('Delete', WDFM()->prefix),
42
+ $this->bulk_action_name => __('deleted', WDFM()->prefix),
43
+ ),
44
+ );
45
+
46
+ $this->animation_effects = array(
47
+ 'none' => 'None',
48
+ 'bounce' => 'Bounce',
49
+ 'tada' => 'Tada',
50
+ 'bounceInDown' => 'BounceInDown',
51
+ 'fadeInLeft' => 'FadeInLeft',
52
+ 'flash' => 'Flash',
53
+ 'pulse' => 'Pulse',
54
+ 'rubberBand' => 'RubberBand',
55
+ 'shake' => 'Shake',
56
+ 'swing' => 'Swing',
57
+ 'wobble' => 'Wobble',
58
+ 'hinge' => 'Hinge',
59
+ 'lightSpeedIn' => 'LightSpeedIn',
60
+ 'rollIn' => 'RollIn',
61
+ 'bounceIn' => 'BounceIn',
62
+ 'bounceInLeft' => 'BounceInLeft',
63
+ 'bounceInRight' => 'BounceInRight',
64
+ 'bounceInUp' => 'BounceInUp',
65
+ 'fadeIn' => 'FadeIn',
66
+ 'fadeInDown' => 'FadeInDown',
67
+ 'fadeInDownBig' => 'FadeInDownBig',
68
+ 'fadeInLeftBig' => 'FadeInLeftBig',
69
+ 'fadeInRight' => 'FadeInRight',
70
+ 'fadeInRightBig' => 'FadeInRightBig',
71
+ 'fadeInUp' => 'FadeInUp',
72
+ 'fadeInUpBig' => 'FadeInUpBig',
73
+ 'flip' => 'Flip',
74
+ 'flipInX' => 'FlipInX',
75
+ 'flipInY' => 'FlipInY',
76
+ 'rotateIn' => 'RotateIn',
77
+ 'rotateInDownLeft' => 'RotateInDownLeft',
78
+ 'rotateInDownRight' => 'RotateInDownRight',
79
+ 'rotateInUpLeft' => 'RotateInUpLeft',
80
+ 'rotateInUpRight' => 'RotateInUpRight',
81
+ 'zoomIn' => 'ZoomIn',
82
+ 'zoomInDown' => 'ZoomInDown',
83
+ 'zoomInLeft' => 'ZoomInLeft',
84
+ 'zoomInRight' => 'ZoomInRight',
85
+ 'zoomInUp' => 'ZoomInUp',
86
+ );
87
+ }
88
+
89
+ public function execute() {
90
+ $task = WDW_FM_Library::get('task');
91
+ $id = (int) WDW_FM_Library::get('current_id', 0);
92
+ if ( method_exists($this, $task) ) {
93
+ if ( $task != 'add' && $task != 'edit' && $task != 'display' ) {
94
+ check_admin_referer(WDFM()->nonce, WDFM()->nonce);
95
+ }
96
+ $block_action = $this->bulk_action_name;
97
+ $action = WDW_FM_Library::get( $block_action, -1 );
98
+ if ( $action != -1 ) {
99
+ $this->$block_action($action);
100
+ }
101
+ else {
102
+ $this->$task($id);
103
+ }
104
+ }
105
+ else {
106
+ $this->display();
107
+ }
108
+ }
109
+
110
+ public function display() {
111
+ $params = array();
112
+ $params['order'] = WDW_FM_Library::get('order', 'asc');
113
+ $params['orderby'] = WDW_FM_Library::get('orderby', 'id');
114
+ // To prevent SQL injections.
115
+ if ( !in_array($params['orderby'], array( 'id', 'title', 'type' )) ) {
116
+ $params['orderby'] = 'id';
117
+ }
118
+ $params['order'] = $params['order'] == 'desc' ? 'desc' : 'asc';
119
+
120
+ $params['items_per_page'] = $this->items_per_page;
121
+
122
+ $params['rows_data'] = $this->model->get_rows_data($params);
123
+
124
+ $params['total'] = $this->model->total();
125
+
126
+ $params['actions'] = $this->actions;
127
+ $params['page'] = $this->page;
128
+ $params['form_preview_link'] = $this->model->get_form_preview_post();
129
+
130
+ $this->view->display($params);
131
+ }
132
+
133
+ /**
134
+ * Bulk actions.
135
+ *
136
+ * @param $task
137
+ */
138
+ public function bulk_action($task) {
139
+ $message = 0;
140
+ $successfully_updated = 0;
141
+
142
+ $check = WDW_FM_Library::get('check', '');
143
+
144
+ if ( $check ) {
145
+ foreach ( $check as $id => $item ) {
146
+ if ( method_exists($this, $task) ) {
147
+ $message = $this->$task($id, TRUE);
148
+ if ( $message != 2 ) {
149
+ // Increase successfully updated items count, if action doesn't failed.
150
+ $successfully_updated++;
151
+ }
152
+ }
153
+ }
154
+ if ( $successfully_updated ) {
155
+ $block_action = $this->bulk_action_name;
156
+ $message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $successfully_updated, WDFM()->prefix), $successfully_updated, $this->actions[$task][$block_action]);
157
+ }
158
+ }
159
+
160
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
161
+ 'page' => $this->page,
162
+ 'task' => 'display',
163
+ ($message === 2 ? 'message' : 'msg') => $message,
164
+ ), admin_url('admin.php')));
165
+
166
+ }
167
+
168
+ /**
169
+ * Delete form by id.
170
+ *
171
+ * @param $id
172
+ * @param bool $bulk
173
+ *
174
+ * @return int
175
+ */
176
+ public function delete( $id, $bulk = FALSE ) {
177
+ if ( $this->model->delete_rows(array( "table" => "formmaker", "where" => "id = " . $id )) ) {
178
+ $this->model->delete_rows(array( "table" => "formmaker_views", "where" => "form_id = " . $id ));
179
+ $this->model->delete_rows(array( "table" => "formmaker_submits", "where" => "form_id = " . $id ));
180
+ $this->model->delete_rows(array( "table" => "formmaker_sessions", "where" => "form_id = " . $id ));
181
+ $this->model->delete_rows(array( "table" => "formmaker_backup", "where" => "id = " . $id ));
182
+ $this->model->delete_rows(array( "table" => "formmaker_display_options", "where" => "form_id = " . $id ));
183
+
184
+ // To delete DB rows with form ids from add-ons.
185
+ do_action('fm_delete_addon_init', $id);
186
+ $message = 3;
187
+ }
188
+ else {
189
+ $message = 2;
190
+ }
191
+
192
+ if ( $bulk ) {
193
+ return $message;
194
+ }
195
+ else {
196
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
197
+ 'page' => $this->page,
198
+ 'task' => 'display',
199
+ 'message' => $message,
200
+ ), admin_url('admin.php')));
201
+ }
202
+ }
203
+
204
+ /**
205
+ * Publish by id.
206
+ *
207
+ * @param $id
208
+ * @param bool $bulk
209
+ *
210
+ * @return int
211
+ */
212
+ public function publish( $id, $bulk = FALSE ) {
213
+ $updated = $this->model->update_data("formmaker", array('published' => 1), array('id' => $id));
214
+ if ( $updated !== FALSE ) {
215
+ $message = 9;
216
+ }
217
+ else {
218
+ $message = 2;
219
+ }
220
+
221
+ if ( $bulk ) {
222
+ return $message;
223
+ }
224
+ else {
225
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
226
+ 'page' => $this->page,
227
+ 'task' => 'display',
228
+ 'message' => $message,
229
+ ), admin_url('admin.php')));
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Unpublish by id.
235
+ *
236
+ * @param $id
237
+ * @param bool $bulk
238
+ *
239
+ * @return int
240
+ */
241
+ public function unpublish( $id, $bulk = FALSE ) {
242
+ $updated = $this->model->update_data("formmaker", array('published' => 0), array('id' => $id));
243
+ if ( $updated !== FALSE ) {
244
+ $message = 10;
245
+ }
246
+ else {
247
+ $message = 2;
248
+ }
249
+
250
+ if ( $bulk ) {
251
+ return $message;
252
+ }
253
+ else {
254
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
255
+ 'page' => $this->page,
256
+ 'task' => 'display',
257
+ 'message' => $message,
258
+ ), admin_url('admin.php')));
259
+ }
260
+ }
261
+
262
+ /**
263
+ * Duplicate by id.
264
+ *
265
+ * @param $id
266
+ * @param bool $bulk
267
+ *
268
+ * @return int
269
+ */
270
+ public function duplicate( $id, $bulk = FALSE ) {
271
+ $message = 2;
272
+ $row = $this->model->select_rows("get_row", array(
273
+ "selection" => "*",
274
+ "table" => "formmaker",
275
+ "where" => "id=" . (int) $id,
276
+ ));
277
+
278
+ if ( $row ) {
279
+ $row = (array) $row;
280
+ unset($row['id']);
281
+ $inserted = $this->model->insert_data_to_db("formmaker", (array) $row);
282
+ if ( $inserted !== FALSE ) {
283
+ $message = 11;
284
+ }
285
+ }
286
+
287
+ if ( $bulk ) {
288
+ return $message;
289
+ }
290
+ else {
291
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
292
+ 'page' => $this->page,
293
+ 'task' => 'display',
294
+ 'message' => $message,
295
+ ), admin_url('admin.php')));
296
+ }
297
+ }
298
+
299
+ public function add() {
300
+ $backup_id = 0;
301
+ $params = array();
302
+ $params['id'] = $backup_id;
303
+ $params['row'] = $this->model->get_row_data_new($backup_id);
304
+ $params['page_url'] = $this->page_url;
305
+ // Check if Stripe add-on is active.
306
+ $stripe_addon = array('enable' => 0);
307
+ $params['stripe_addon'] = $stripe_addon;
308
+
309
+ $params['themes'] = $this->model->get_theme_rows_data();
310
+ $params['default_theme'] = $this->model->get_default_theme_id();
311
+ $params['form_preview_link'] = "";
312
+
313
+ $params['autogen_layout'] = 1;
314
+ $labels = array();
315
+ $label_id = array();
316
+ $label_order_original = array();
317
+ $label_type = array();
318
+ $label_all = explode('#****#', $params['row']->label_order);
319
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
320
+ foreach ( $label_all as $key => $label_each ) {
321
+ $label_id_each = explode('#**id**#', $label_each);
322
+ array_push($label_id, $label_id_each[0]);
323
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
324
+ array_push($label_order_original, addslashes($label_oder_each[0]));
325
+ array_push($label_type, $label_oder_each[1]);
326
+ }
327
+
328
+ $labels['id'] = '"' . implode('","', $label_id) . '"';
329
+ $labels['label'] = '"' . implode('","', $label_order_original) . '"';
330
+ $labels['type'] = '"' . implode('","', $label_type) . '"';
331
+ $params['labels'] = $labels;
332
+
333
+ $params['page_title'] = __('Create new form', WDFM()->prefix);
334
+ $params['animation_effects'] = $this->animation_effects;
335
+
336
+ $this->view->edit($params);
337
+ }
338
+
339
+ public function edit($id = 0, $backup_id = 0) {
340
+ $fm_settings = get_option('fm_settings');
341
+ $fm_advanced_layout = isset($fm_settings['fm_advanced_layout']) && $fm_settings['fm_advanced_layout'] == '1' ? 1 : 0;
342
+ if ( $id && !$fm_advanced_layout ) {
343
+ $fm_advanced_layout = !$this->model->get_autogen_layout($id);
344
+ }
345
+ if ( !$backup_id ) {
346
+ $backup_id = $this->model->select_rows("get_var", array(
347
+ "selection" => "backup_id",
348
+ "table" => "formmaker_backup",
349
+ "where" => "cur=1 and id=" . $id,
350
+ ));
351
+
352
+ if ( !$backup_id ) {
353
+ $backup_id = $this->model->get_max_row("formmaker_backup", "backup_id");
354
+ if ( $backup_id ) {
355
+ $backup_id++;
356
+ }
357
+ else {
358
+ $backup_id = 1;
359
+ }
360
+ $this->model->insert_formmaker_backup($backup_id, $id);
361
+ }
362
+ }
363
+
364
+ $params = array();
365
+ $params['id'] = $id;
366
+ $params['row'] = $this->model->get_row_data_new($backup_id);
367
+
368
+ // Check stripe add-on is active.
369
+ $stripe_addon = array( 'enable' => 0 );
370
+ $addon_stripe = $this->get_stripe_addon($id);
371
+ if ( !empty($addon_stripe['html']) ) {
372
+ $stripe_addon = $addon_stripe;
373
+ }
374
+ $params['stripe_addon'] = $stripe_addon;
375
+ $params['page_url'] = $this->page_url;
376
+ $params['themes'] = $this->model->get_theme_rows_data();
377
+ $params['default_theme'] = $this->model->get_default_theme_id();
378
+ $params['form_preview_link'] = $this->model->get_form_preview_post();
379
+
380
+ if ( $id ) {
381
+ $params['form_options_url'] = add_query_arg( array( 'page' => $this->page , 'task' => 'form_options', 'current_id' => $id ), $this->page_url );
382
+ $params['display_options_url'] = add_query_arg( array( 'page' => $this->page , 'task' => 'display_options', 'current_id' => $id ), $this->page_url );
383
+ $params['advanced_layout_url'] = $fm_advanced_layout ? add_query_arg( array( 'page' => $this->page , 'task' => 'form_layout', 'current_id' => $id ), $this->page_url ) : '';
384
+ }
385
+
386
+ if ( isset($params['row']->backup_id) ) {
387
+ if ( $params['row']->backup_id != "" ) {
388
+ $params['next_backup_id'] = $this->model->get_backup_id($params['row']->backup_id, $params['row']->id);
389
+ $params['prev_backup_id'] = $this->model->get_prev_backup_id($params['row']->backup_id, $params['row']->id);
390
+ }
391
+ }
392
+
393
+ $labels = array();
394
+ $label_id = array();
395
+ $label_order_original = array();
396
+ $label_type = array();
397
+ $label_all = explode('#****#', $params['row']->label_order);
398
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
399
+ foreach ( $label_all as $key => $label_each ) {
400
+ $label_id_each = explode('#**id**#', $label_each);
401
+ array_push($label_id, $label_id_each[0]);
402
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
403
+ array_push($label_order_original, addslashes($label_oder_each[0]));
404
+ array_push($label_type, $label_oder_each[1]);
405
+ }
406
+
407
+ $labels['id'] = '"' . implode('","', $label_id) . '"';
408
+ $labels['label'] = '"' . implode('","', $label_order_original) . '"';
409
+ $labels['type'] = '"' . implode('","', $label_type) . '"';
410
+ $params['labels'] = $labels;
411
+
412
+ $params['page_title'] = (($params['id'] != 0) ? 'Edit form ' . $params['row']->title : 'Create new form');
413
+
414
+ $params['animation_effects'] = $this->animation_effects;
415
+
416
+ $this->view->edit($params);
417
+ }
418
+
419
+ public function undo() {
420
+ $backup_id = (int) WDW_FM_Library::get('backup_id');
421
+ $id = (int) WDW_FM_Library::get('id');
422
+ $backup_id = $this->model->get_undo_redo_id($backup_id, $id, 0);
423
+ $this->edit($id, $backup_id);
424
+ }
425
+
426
+ public function redo() {
427
+ $backup_id = (int) WDW_FM_Library::get('backup_id');
428
+ $id = (int) WDW_FM_Library::get('id');
429
+ $backup_id = $this->model->get_undo_redo_id($backup_id, $id, 1);
430
+ $this->edit($id, $backup_id);
431
+ }
432
+
433
+ /**
434
+ * Form options.
435
+ *
436
+ * @param int $id
437
+ */
438
+ public function form_options( $id ) {
439
+ // Set params for view.
440
+ $params = array();
441
+ $params['id'] = $id;
442
+ $params['page'] = $this->page;
443
+ $params['page_url'] = $this->page_url;
444
+
445
+ $params['back_url'] = add_query_arg( array (
446
+ 'page' => 'manage_fm',
447
+ 'task' => 'edit',
448
+ 'current_id' => $id,
449
+
450
+ ), admin_url('admin.php')
451
+ );
452
+
453
+ $params['fieldset_id'] = WDW_FM_Library::get('fieldset_id', 'general');
454
+
455
+ $params['row'] = $this->model->get_row_data($id);
456
+ if ( empty($params['row']) ) {
457
+ WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $this->page), admin_url('admin.php')));
458
+ }
459
+
460
+ $params['themes'] = $this->model->get_theme_rows_data();
461
+ $params['default_theme'] = $this->model->get_default_theme_id();
462
+ $params['queries'] = $this->model->get_queries_rows_data($id);
463
+ $params['userGroups'] = get_editable_roles();
464
+ $params['page_title'] = '"' . $params['row']->title . '" ' . __('options', WDFM()->prefix);
465
+
466
+ $label_id = array();
467
+ $label_label = array();
468
+ $label_type = array();
469
+ $label_all = explode('#****#', $params['row']->label_order_current);
470
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
471
+ foreach ( $label_all as $key => $label_each ) {
472
+ $label_id_each = explode('#**id**#', $label_each);
473
+ array_push($label_id, $label_id_each[0]);
474
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
475
+ array_push($label_label, $label_order_each[0]);
476
+ array_push($label_type, $label_order_each[1]);
477
+ }
478
+ $params['fields'] = explode('*:*id*:*type_submitter_mail*:*type*:*', $params['row']->form_fields);
479
+ $params['fields_count'] = count($params['fields']);
480
+
481
+ // chechk stripe addon is active.
482
+ $stripe_addon = array('enable' => 0);
483
+ $addon_stripe = $this->get_stripe_addon($id);
484
+ if( !empty($addon_stripe['html']) ) {
485
+ $stripe_addon = $addon_stripe;
486
+ }
487
+ $params['stripe_addon'] = $stripe_addon;
488
+
489
+ /*
490
+ TODO.
491
+ Remember. 0 => none, 1 => paypal, 2 => stripe
492
+ Change. rename paypal_mode name to payment_method of wp_formmaker table.
493
+ */
494
+ $paypal_mode = $params['row']->paypal_mode;
495
+ $payment_method = 'none';
496
+ if($paypal_mode == 1){
497
+ $payment_method = 'paypal';
498
+ }
499
+ if($paypal_mode == 2 && isset($stripe_addon['stripe_enable']) && $stripe_addon['stripe_enable'] == 1 ){
500
+ $payment_method = 'stripe';
501
+ }
502
+
503
+ $params['payment_method'] = $payment_method;
504
+ $params['label_label'] = $label_label;
505
+ $params['label_type'] = $label_type;
506
+ $params['labels_for_submissions'] = $this->model->get_labels($id);
507
+ $params['payment_info'] = $this->model->is_paypal($id);
508
+
509
+ $labels_id_for_submissions = array();
510
+ $label_titles_for_submissions = array();
511
+ $labels_type_for_submissions = array();
512
+ if ( $params['labels_for_submissions'] ) {
513
+ $label_id_for_submissions = array();
514
+ $label_order_original_for_submissions = array();
515
+ $label_type_for_submissions = array();
516
+ if ( strpos($params['row']->label_order, 'type_paypal_') ) {
517
+ $params['row']->label_order = $params['row']->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
518
+ }
519
+ $label_all_for_submissions = explode('#****#', $params['row']->label_order);
520
+ $label_all_for_submissions = array_slice($label_all_for_submissions, 0, count($label_all_for_submissions) - 1);
521
+ foreach ( $label_all_for_submissions as $key => $label_each ) {
522
+ $label_id_each = explode('#**id**#', $label_each);
523
+ array_push($label_id_for_submissions, $label_id_each[0]);
524
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
525
+ array_push($label_order_original_for_submissions, $label_order_each[0]);
526
+ array_push($label_type_for_submissions, $label_order_each[1]);
527
+ }
528
+ foreach ( $label_id_for_submissions as $key => $label ) {
529
+ if ( in_array($label, $params['labels_for_submissions']) ) {
530
+ array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
531
+ array_push($labels_id_for_submissions, $label);
532
+ array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
533
+ }
534
+ }
535
+ $params['labels_id_for_submissions'] = $labels_id_for_submissions;
536
+ $params['label_titles_for_submissions'] = $label_titles_for_submissions;
537
+ }
538
+
539
+ $stats_labels = array();
540
+ $stats_labels_ids = array();
541
+ foreach ( $labels_type_for_submissions as $key => $label_type_cur ) {
542
+ if ( $label_type_cur == "type_checkbox" || $label_type_cur == "type_radio" || $label_type_cur == "type_own_select" || $label_type_cur == "type_country" || $label_type_cur == "type_paypal_select" || $label_type_cur == "type_paypal_radio" || $label_type_cur == "type_paypal_checkbox" || $label_type_cur == "type_paypal_shipping" ) {
543
+ $stats_labels_ids[] = $labels_id_for_submissions[$key];
544
+ $stats_labels[] = $label_titles_for_submissions[$key];
545
+ }
546
+ }
547
+
548
+ $params['stats_labels_ids'] = $stats_labels_ids;
549
+ $params['stats_labels'] = $stats_labels;
550
+ $params['mail_ver_id'] = $this->model->get_emailverification_post_id();
551
+
552
+ $params['addons'] = $this->get_addon_tabs( array('form_id' => $id) );
553
+
554
+ $this->view->form_options($params);
555
+ }
556
+
557
+ /**
558
+ * Get active addons.
559
+ *
560
+ * @param $params
561
+ *
562
+ * @return mixed|void
563
+ */
564
+ private function get_addon_tabs( $params ) {
565
+ $addons = apply_filters('fm_get_addon_init', array('tabs' => array(), 'html' => array()), $params);
566
+ return $addons;
567
+ }
568
+
569
+ /**
570
+ * Apply form options.
571
+ *
572
+ * @param int $id
573
+ */
574
+ public function apply_form_options( $id ) {
575
+ $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
576
+ $message = $this->save_db_form_options( $id );
577
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
578
+ 'page' => $this->page,
579
+ 'task' => 'form_options',
580
+ 'current_id' => $id,
581
+ 'fieldset_id' => $fieldset_id,
582
+ 'message' => $message,
583
+ ), admin_url('admin.php')));
584
+ }
585
+
586
+ /**
587
+ * Save db Form options.
588
+ *
589
+ * @param int $id
590
+ *
591
+ * @return int $id_message
592
+ */
593
+ public function save_db_form_options( $id ) {
594
+ $javascript = "// Occurs before the form is loaded
595
+ function before_load() {
596
+
597
+ }
598
+ // Occurs just before submitting the form
599
+ function before_submit() {
600
+ // IMPORTANT! If you want to interrupt (stop) the submitting of the form, this function should return true. You don't need to return any value if you don't want to stop the submission.
601
+ }
602
+ // Occurs just before resetting the form
603
+ function before_reset() {
604
+
605
+ }";
606
+
607
+ $published = stripslashes(WDW_FM_Library::get('published', ''));
608
+ $savedb = stripslashes(WDW_FM_Library::get('savedb', ''));
609
+ $theme = stripslashes((int) WDW_FM_Library::get('theme', $this->model->get_default_theme_id()));
610
+ $requiredmark = stripslashes(WDW_FM_Library::get('requiredmark', '*'));
611
+ $sendemail = stripslashes(WDW_FM_Library::get('sendemail', ''));
612
+ $save_uploads = stripslashes(WDW_FM_Library::get('save_uploads', ''));
613
+ $mail = stripslashes(WDW_FM_Library::get('mail', ''));
614
+ if ( isset($_POST['mailToAdd']) && esc_html(stripslashes($_POST['mailToAdd'])) != '' ) {
615
+ $mail .= esc_html(stripslashes($_POST['mailToAdd'])) . ',';
616
+ }
617
+ $from_mail = stripslashes(WDW_FM_Library::get('from_mail', ''));
618
+ $from_name = stripslashes(WDW_FM_Library::get('from_name', ''));
619
+ $reply_to = stripslashes(WDW_FM_Library::get('reply_to', ''));
620
+ if ( $from_mail == "other" ) {
621
+ $from_mail = stripslashes(WDW_FM_Library::get('mail_from_other', ''));
622
+ }
623
+ if ( $reply_to == "other" ) {
624
+ $reply_to = stripslashes(WDW_FM_Library::get('reply_to_other', ''));
625
+ }
626
+ $script_mail = WDW_FM_Library::get('script_mail', '%all%');
627
+ $mail_from_user = WDW_FM_Library::get('mail_from_user', '');
628
+ $mail_from_name_user = WDW_FM_Library::get('mail_from_name_user', '');
629
+ $reply_to_user = WDW_FM_Library::get('reply_to_user', '');
630
+ $condition = WDW_FM_Library::get('condition', '');
631
+ $mail_cc = WDW_FM_Library::get('mail_cc', '');
632
+ $mail_cc_user = WDW_FM_Library::get('mail_cc_user', '');
633
+ $mail_bcc = WDW_FM_Library::get('mail_bcc', '');
634
+ $mail_bcc_user = WDW_FM_Library::get('mail_bcc_user', '');
635
+ $mail_subject = WDW_FM_Library::get('mail_subject', '');
636
+ $mail_subject_user = WDW_FM_Library::get('mail_subject_user', '');
637
+ $mail_mode = WDW_FM_Library::get('mail_mode', '');
638
+ $mail_mode_user = WDW_FM_Library::get('mail_mode_user', '');
639
+ $mail_attachment = WDW_FM_Library::get('mail_attachment', '');
640
+ $mail_attachment_user = WDW_FM_Library::get('mail_attachment_user', '');
641
+ $script_mail_user = WDW_FM_Library::get('script_mail_user', '%all%');
642
+ $submit_text = WDW_FM_Library::get('submit_text', '');
643
+ $url = WDW_FM_Library::get('url', '');
644
+ $tax = WDW_FM_Library::get('tax', 0);
645
+ $payment_currency = WDW_FM_Library::get('payment_currency', '');
646
+ $paypal_email = WDW_FM_Library::get('paypal_email', '');
647
+ $checkout_mode = WDW_FM_Library::get('checkout_mode', 'testmode');
648
+ $paypal_mode = WDW_FM_Library::get('paypal_mode', 0);
649
+
650
+ // TODO Seclude payment method and payment status.
651
+ if($paypal_mode == 'paypal'){
652
+ $paypal_mode = 1;
653
+ }
654
+ if($paypal_mode == 'stripe'){
655
+ $paypal_mode = 2;
656
+ }
657
+
658
+ $javascript = stripslashes(WDW_FM_Library::get('javascript', $javascript));
659
+ $user_id_wd = stripslashes(WDW_FM_Library::get('user_id_wd', 'administrator,'));
660
+ $frontend_submit_fields = stripslashes(WDW_FM_Library::get('frontend_submit_fields', ''));
661
+ $frontend_submit_stat_fields = stripslashes(WDW_FM_Library::get('frontend_submit_stat_fields', ''));
662
+ $mail_emptyfields = stripslashes(WDW_FM_Library::get('mail_emptyfields', 0));
663
+ $mail_verify = stripslashes(WDW_FM_Library::get('mail_verify', 0));
664
+ $mail_verify_expiretime = stripslashes(WDW_FM_Library::get('mail_verify_expiretime', ''));
665
+ $send_to = '';
666
+ for ( $i = 0; $i < 20; $i++ ) {
667
+ if ( WDW_FM_Library::get('send_to' . $i, 0) ) {
668
+ $send_to .= '*' . WDW_FM_Library::get('send_to' . $i, 0) . '*';
669
+ }
670
+ }
671
+ if ( WDW_FM_Library::get('submit_text_type', 0) ) {
672
+ $submit_text_type = WDW_FM_Library::get('submit_text_type', 0);
673
+ if ( $submit_text_type == 5 ) {
674
+ $article_id = WDW_FM_Library::get('page_name', 0);
675
+ }
676
+ else {
677
+ $article_id = WDW_FM_Library::get('post_name', 0);
678
+ }
679
+ }
680
+ else {
681
+ $submit_text_type = 1;
682
+ $article_id = 0;
683
+ }
684
+ $mail_verification_post_id = (int) $this->model->get_mail_verification_post_id();
685
+ if ( $mail_verify ) {
686
+ $email_verification_post = array(
687
+ 'post_title' => 'Email Verification',
688
+ 'post_content' => '[email_verification]',
689
+ 'post_status' => 'publish',
690
+ 'post_author' => 1,
691
+ 'post_type' => 'fmemailverification',
692
+ );
693
+ if ( !$mail_verification_post_id || get_post($mail_verification_post_id) === NULL ) {
694
+ $mail_verification_post_id = wp_insert_post($email_verification_post);
695
+ }
696
+ }
697
+
698
+ $data = array(
699
+ 'published' => $published,
700
+ 'savedb' => $savedb,
701
+ 'theme' => $theme,
702
+ 'requiredmark' => $requiredmark,
703
+ 'sendemail' => $sendemail,
704
+ 'save_uploads' => $save_uploads,
705
+ 'mail' => $mail,
706
+ 'from_mail' => $from_mail,
707
+ 'from_name' => $from_name,
708
+ 'reply_to' => $reply_to,
709
+ 'script_mail' => $script_mail,
710
+ 'mail_from_user' => $mail_from_user,
711
+ 'mail_from_name_user' => $mail_from_name_user,
712
+ 'reply_to_user' => $reply_to_user,
713
+ 'condition' => $condition,
714
+ 'mail_cc' => $mail_cc,
715
+ 'mail_cc_user' => $mail_cc_user,
716
+ 'mail_bcc' => $mail_bcc,
717
+ 'mail_bcc_user' => $mail_bcc_user,
718
+ 'mail_subject' => $mail_subject,
719
+ 'mail_subject_user' => $mail_subject_user,
720
+ 'mail_mode' => $mail_mode,
721
+ 'mail_mode_user' => $mail_mode_user,
722
+ 'mail_attachment' => $mail_attachment,
723
+ 'mail_attachment_user' => $mail_attachment_user,
724
+ 'script_mail_user' => $script_mail_user,
725
+ 'submit_text' => $submit_text,
726
+ 'url' => $url,
727
+ 'submit_text_type' => $submit_text_type,
728
+ 'article_id' => $article_id,
729
+ 'tax' => $tax,
730
+ 'payment_currency' => $payment_currency,
731
+ 'paypal_email' => $paypal_email,
732
+ 'checkout_mode' => $checkout_mode,
733
+ 'paypal_mode' => $paypal_mode,
734
+ 'javascript' => $javascript,
735
+ 'user_id_wd' => $user_id_wd,
736
+ 'send_to' => $send_to,
737
+ 'frontend_submit_fields' => $frontend_submit_fields,
738
+ 'frontend_submit_stat_fields' => $frontend_submit_stat_fields,
739
+ 'mail_emptyfields' => $mail_emptyfields,
740
+ 'mail_verify' => $mail_verify,
741
+ 'mail_verify_expiretime' => $mail_verify_expiretime,
742
+ 'mail_verification_post_id' => $mail_verification_post_id,
743
+ );
744
+
745
+ $message_id = 2;
746
+ $save = $this->model->update_data('formmaker', $data, array( 'id' => $id ));
747
+ if ( $save !== FALSE ) {
748
+ $this->model->update_data("formmaker_backup", array(
749
+ 'theme' => $theme,
750
+ ), array( 'id' => $id )); //save theme in backup
751
+ $this->model->create_js($id);
752
+ $save_addon = do_action('fm_save_addon_init', $id);
753
+ $message_id = 8;
754
+ }
755
+ return $message_id;
756
+ }
757
+
758
+ /**
759
+ * Form layout.
760
+ *
761
+ * @param int $id
762
+ */
763
+ public function form_layout( $id ) {
764
+ $ids = array();
765
+ $types = array();
766
+ $labels = array();
767
+
768
+ $row = $this->model->get_row_data( $id );
769
+ $fields = explode('*:*new_field*:*', $row->form_fields);
770
+ $fields = array_slice($fields, 0, count($fields) - 1);
771
+ foreach ( $fields as $field ) {
772
+ $temp = explode('*:*id*:*', $field);
773
+ array_push($ids, $temp[0]);
774
+ $temp = explode('*:*type*:*', $temp[1]);
775
+ array_push($types, $temp[0]);
776
+ $temp = explode('*:*w_field_label*:*', $temp[1]);
777
+ array_push($labels, $temp[0]);
778
+ }
779
+
780
+ // Set params for view.
781
+ $params = array();
782
+ $params['id'] = $id;
783
+ $params['row'] = $row;
784
+ $params['page'] = $this->page;
785
+ $params['page_url'] = $this->page_url;
786
+ $params['page_title'] = '"'. $row->title . '" ' . __('layout', WDFM()->prefix);
787
+ $params['back_url'] = add_query_arg( array ('page' => 'manage_fm','task' => 'edit','current_id' => $id ), admin_url('admin.php'));
788
+ $params['ids'] = $ids;
789
+ $params['types'] = $types;
790
+ $params['labels'] = $labels;
791
+ $this->view->form_layout($params);
792
+ }
793
+
794
+ public function apply_layout( $id ) {
795
+ $message = $this->save_db_layout( $id );
796
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
797
+ 'page' => $this->page,
798
+ 'task' => 'form_layout',
799
+ 'current_id' => $id,
800
+ 'message' => $message,
801
+ ), admin_url('admin.php')));
802
+ }
803
+
804
+ /**
805
+ * Save db layout.
806
+ *
807
+ * @param int $id
808
+ *
809
+ * @return int $id_message
810
+ */
811
+ public function save_db_layout( $id ) {
812
+ $custom_front = WDW_FM_Library::get('custom_front', '', false);
813
+ $autogen_layout = WDW_FM_Library::get('autogen_layout', '');
814
+
815
+ $update = $this->model->update_data('formmaker', array(
816
+ 'custom_front' => $custom_front,
817
+ 'autogen_layout' => $autogen_layout,
818
+ ), array( 'id' => $id ));
819
+ if ( $update !== FALSE ) {
820
+ return 1;
821
+ }
822
+ else {
823
+ return 2;
824
+ }
825
+ }
826
+
827
+ public function display_options() {
828
+ $id = (int) WDW_FM_Library::get('current_id', $this->model->get_max_row("formmaker", "id"));
829
+ $params = array();
830
+ $params['row_form'] = $this->model->get_row_data($id);
831
+ $params['row'] = $this->model->get_display_options($id);
832
+ $params['page_title'] = '"'. $params['row_form']->title . '" ' . __('display options', WDFM()->prefix);
833
+ $params['animation_effects'] = $this->animation_effects;
834
+ $params['posts_and_pages'] = $this->model->fm_posts_query();
835
+ $params['categories'] = $this->model->fm_categories_query();
836
+ $params['selected_categories'] = explode(',', $params['row']->display_on_categories);
837
+ $params['current_categories_array'] = explode(',', $params['row']->current_categories);
838
+ $params['id'] = $id;
839
+ $params['page'] = $this->page;
840
+ $params['page_url'] = $this->page_url;
841
+ $params['back_url'] = add_query_arg( array (
842
+ 'page' => 'manage_fm',
843
+ 'task' => 'edit',
844
+ 'current_id' => $id,
845
+ ), admin_url('admin.php')
846
+ );
847
+
848
+ $params['fieldset_id'] = WDW_FM_Library::get('fieldset_id', 'embedded');
849
+ $this->view->display_options($params);
850
+ }
851
+
852
+ public function save_display_options() {
853
+ $message = $this->save_dis_options();
854
+ $page = WDW_FM_Library::get('page');
855
+
856
+ $current_id = (int) WDW_FM_Library::get('current_id', 0);
857
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
858
+ 'page' => $page,
859
+ 'task' => 'edit',
860
+ 'current_id' => $current_id,
861
+ 'message' => $message,
862
+ ), admin_url('admin.php')));
863
+ }
864
+
865
+ public function apply_display_options() {
866
+ $message = $this->save_dis_options();
867
+ $page = WDW_FM_Library::get('page');
868
+ $fieldset_id = WDW_FM_Library::get('fieldset_id', 'embedded');
869
+ $current_id = (int) WDW_FM_Library::get('current_id', 0);
870
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
871
+ 'page' => $page,
872
+ 'task' => 'display_options',
873
+ 'current_id' => $current_id,
874
+ 'fieldset_id'=> $fieldset_id,
875
+ 'message' => $message,
876
+ ), admin_url('admin.php')));
877
+ }
878
+
879
+ /**
880
+ * Remove query for MySQL Mapping.
881
+ * @param int $id
882
+ */
883
+ public function remove_query( $id ) {
884
+ $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
885
+ $query_id = WDW_FM_Library::get('query_id',0);
886
+ $message = 2;
887
+ if( $this->model->delete_formmaker_query( $query_id ) ) {
888
+ $message = 3;
889
+ }
890
+
891
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
892
+ 'page' => $this->page,
893
+ 'task' => 'form_options',
894
+ 'current_id' => $id,
895
+ 'fieldset_id' => $fieldset_id,
896
+ 'message' => $message,
897
+ ), admin_url('admin.php')));
898
+ }
899
+
900
+ /**
901
+ * Check if loading_delay or frequency is positive numbers
902
+ *
903
+ * @param int $delay
904
+ *
905
+ * @return int
906
+ */
907
+ public function set_delay_freq_positive_val( $delay ) {
908
+ if( $delay < 0 ) return 0;
909
+ return $delay;
910
+ }
911
+
912
+ public function save_dis_options() {
913
+ $option_data = array(
914
+ 'form_id' => (int) WDW_FM_Library::get('current_id', 0),
915
+ 'scrollbox_loading_delay' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('scrollbox_loading_delay', 0) ),
916
+ 'popover_animate_effect' => WDW_FM_Library::get('popover_animate_effect', ''),
917
+ 'popover_loading_delay' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('popover_loading_delay', 0) ),
918
+ 'popover_frequency' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('popover_frequency', 0) ),
919
+ 'topbar_position' => WDW_FM_Library::get('topbar_position', 1),
920
+ 'topbar_remain_top' => WDW_FM_Library::get('topbar_remain_top', 1),
921
+ 'topbar_closing' => WDW_FM_Library::get('topbar_closing', 1),
922
+ 'topbar_hide_duration' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('topbar_hide_duration', 0) ),
923
+ 'scrollbox_position' => WDW_FM_Library::get('scrollbox_position', 1),
924
+ 'scrollbox_trigger_point' => WDW_FM_Library::get('scrollbox_trigger_point', 20),
925
+ 'scrollbox_hide_duration' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('scrollbox_hide_duration', 0)),
926
+ 'scrollbox_auto_hide' => WDW_FM_Library::get('scrollbox_auto_hide', 1),
927
+ 'hide_mobile' => WDW_FM_Library::get('hide_mobile', 0),
928
+ 'scrollbox_closing' => WDW_FM_Library::get('scrollbox_closing', 1),
929
+ 'scrollbox_minimize' => WDW_FM_Library::get('scrollbox_minimize', 1),
930
+ 'scrollbox_minimize_text' => WDW_FM_Library::get('scrollbox_minimize_text', ''),
931
+ 'type' => WDW_FM_Library::get('form_type', 'embadded'),
932
+ 'display_on' => implode(',', WDW_FM_Library::get('display_on', array())),
933
+ 'posts_include' => WDW_FM_Library::get('posts_include', ''),
934
+ 'pages_include' => WDW_FM_Library::get('pages_include', ''),
935
+ 'display_on_categories' => implode(',', WDW_FM_Library::get('display_on_categories', array())),
936
+ 'current_categories' => WDW_FM_Library::get('current_categories', ''),
937
+ 'show_for_admin' => WDW_FM_Library::get('show_for_admin', 0),
938
+ );
939
+
940
+ $save = $this->model->replace_display_options($option_data);
941
+ if ( $save !== FALSE ) {
942
+ $this->model->update_data('formmaker_backup', array(
943
+ 'type' => $option_data['type'],
944
+ ), array( 'id' => $option_data['form_id'] ));
945
+ $this->model->update_data('formmaker', array(
946
+ 'type' => $option_data['type'],
947
+ ), array( 'id' => $option_data['form_id'] ));
948
+ $this->model->create_js($option_data['form_id']);
949
+
950
+ return 8;
951
+ }
952
+ else {
953
+ return 2;
954
+ }
955
+ }
956
+
957
+ // TODO: remove this function.
958
+ public function save_as_copy() {
959
+ $message = $this->save_db_as_copy();
960
+ $page = WDW_FM_Library::get('page');
961
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
962
+ 'page' => $page,
963
+ 'task' => 'display',
964
+ 'message' => $message,
965
+ ), admin_url('admin.php')));
966
+ }
967
+
968
+ public function save() {
969
+ $message = $this->save_db();
970
+ $page = WDW_FM_Library::get('page');
971
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
972
+ 'page' => $page,
973
+ 'task' => 'display',
974
+ 'message' => $message,
975
+ ), admin_url('admin.php')));
976
+ }
977
+
978
+ public function apply() {
979
+ $message = $this->save_db();
980
+ $current_id = (int) WDW_FM_Library::get('current_id', 0);
981
+ if ( !$current_id ) {
982
+ $current_id = (int) $this->model->get_max_row('formmaker', 'id');
983
+ }
984
+ $page = WDW_FM_Library::get('page');
985
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
986
+ 'page' => $page,
987
+ 'task' => 'edit',
988
+ 'current_id' => $current_id,
989
+ 'message' => $message,
990
+ ), admin_url('admin.php')));
991
+ }
992
+
993
+ public function save_db() {
994
+ $javascript = "// Occurs before the form is loaded
995
+ function before_load() {
996
+ }
997
+ // Occurs just before submitting the form
998
+ function before_submit() {
999
+ // IMPORTANT! If you want to interrupt (stop) the submitting of the form, this function should return true. You don't need to return any value if you don't want to stop the submission.
1000
+ }
1001
+ // Occurs just before resetting the form
1002
+ function before_reset() {
1003
+ }";
1004
+ $id = (int) WDW_FM_Library::get('current_id', 0);
1005
+ $title = WDW_FM_Library::get('title', '');
1006
+ $theme = WDW_FM_Library::get('theme', $this->model->get_default_theme_id());
1007
+ $form_front = WDW_FM_Library::get('form_front', '', false);
1008
+ $sortable = WDW_FM_Library::get('sortable', 0);
1009
+ $counter = WDW_FM_Library::get('counter', 0);
1010
+ $label_order = WDW_FM_Library::get('label_order', '');
1011
+ $pagination = WDW_FM_Library::get('pagination', '');
1012
+ $show_title = WDW_FM_Library::get('show_title', '');
1013
+ $show_numbers = WDW_FM_Library::get('show_numbers', '');
1014
+ $public_key = WDW_FM_Library::get('public_key', '');
1015
+ $private_key = WDW_FM_Library::get('private_key', '');
1016
+ $recaptcha_theme = WDW_FM_Library::get('recaptcha_theme', '');
1017
+ $label_order_current = WDW_FM_Library::get('label_order_current', '');
1018
+ $form_fields = WDW_FM_Library::get('form_fields', '', false);
1019
+ $header_title = WDW_FM_Library::get('header_title', '');
1020
+ $header_description = htmlspecialchars_decode(WDW_FM_Library::get('header_description', ''));
1021
+ $header_image_url = WDW_FM_Library::get('header_image_url', '');
1022
+ $header_image_animation = WDW_FM_Library::get('header_image_animation', '');
1023
+ $header_hide_image = WDW_FM_Library::get('header_hide_image', 0);
1024
+ $type = WDW_FM_Library::get('form_type', 'embedded');
1025
+ $scrollbox_minimize_text = $header_title ? $header_title : 'The form is minimized.';
1026
+ if ( $id != 0 ) {
1027
+ $save = $this->model->update_data('formmaker', array(
1028
+ 'title' => $title,
1029
+ 'theme' => $theme,
1030
+ 'form_front' => $form_front,
1031
+ 'sortable' => $sortable,
1032
+ 'counter' => $counter,
1033
+ 'label_order' => $label_order,
1034
+ 'label_order_current' => $label_order_current,
1035
+ 'pagination' => $pagination,
1036
+ 'show_title' => $show_title,
1037
+ 'show_numbers' => $show_numbers,
1038
+ 'public_key' => $public_key,
1039
+ 'private_key' => $private_key,
1040
+ 'recaptcha_theme' => $recaptcha_theme,
1041
+ 'form_fields' => $form_fields,
1042
+ 'header_title' => $header_title,
1043
+ 'header_description' => $header_description,
1044
+ 'header_image_url' => $header_image_url,
1045
+ 'header_image_animation' => $header_image_animation,
1046
+ 'header_hide_image' => $header_hide_image,
1047
+ ), array( 'id' => $id ));
1048
+ }
1049
+ else {
1050
+ $this->model->insert_data_to_db('formmaker', array(
1051
+ 'title' => $title,
1052
+ 'type' => $type,
1053
+ 'mail' => '',
1054
+ 'form_front' => $form_front,
1055
+ 'theme' => $theme,
1056
+ 'counter' => $counter,
1057
+ 'label_order' => $label_order,
1058
+ 'pagination' => $pagination,
1059
+ 'show_title' => $show_title,
1060
+ 'show_numbers' => $show_numbers,
1061
+ 'public_key' => $public_key,
1062
+ 'private_key' => $private_key,
1063
+ 'recaptcha_theme' => $recaptcha_theme,
1064
+ 'javascript' => $javascript,
1065
+ 'submit_text' => '',
1066
+ 'url' => '',
1067
+ 'article_id' => 0,
1068
+ 'submit_text_type' => 1,
1069
+ 'script_mail' => '%all%',
1070
+ 'script_mail_user' => '%all%',
1071
+ 'label_order_current' => $label_order_current,
1072
+ 'tax' => 0,
1073
+ 'payment_currency' => '',
1074
+ 'paypal_email' => '',
1075
+ 'checkout_mode' => 'testmode',
1076
+ 'paypal_mode' => 0,
1077
+ 'published' => 1,
1078
+ 'form_fields' => $form_fields,
1079
+ 'savedb' => 1,
1080
+ 'sendemail' => 1,
1081
+ 'requiredmark' => '*',
1082
+ 'from_mail' => '',
1083
+ 'from_name' => '',
1084
+ 'reply_to' => '',
1085
+ 'send_to' => '',
1086
+ 'autogen_layout' => 1,
1087
+ 'custom_front' => '',
1088
+ 'mail_from_user' => '',
1089
+ 'mail_from_name_user' => '',
1090
+ 'reply_to_user' => '',
1091
+ 'condition' => '',
1092
+ 'mail_cc' => '',
1093
+ 'mail_cc_user' => '',
1094
+ 'mail_bcc' => '',
1095
+ 'mail_bcc_user' => '',
1096
+ 'mail_subject' => '',
1097
+ 'mail_subject_user' => '',
1098
+ 'mail_mode' => 1,
1099
+ 'mail_mode_user' => 1,
1100
+ 'mail_attachment' => 1,
1101
+ 'mail_attachment_user' => 1,
1102
+ 'sortable' => $sortable,
1103
+ 'user_id_wd' => 'administrator,',
1104
+ 'frontend_submit_fields' => '',
1105
+ 'frontend_submit_stat_fields' => '',
1106
+ 'save_uploads' => 1,
1107
+ 'header_title' => $header_title,
1108
+ 'header_description' => $header_description,
1109
+ 'header_image_url' => $header_image_url,
1110
+ 'header_image_animation' => $header_image_animation,
1111
+ 'header_hide_image' => $header_hide_image,
1112
+ ));
1113
+ $id = (int) $this->model->get_max_row('formmaker', 'id');
1114
+ $this->model->insert_data_to_db('formmaker_display_options', array(
1115
+ 'form_id' => $id,
1116
+ 'type' => $type,
1117
+ 'scrollbox_loading_delay' => 0,
1118
+ 'popover_animate_effect' => '',
1119
+ 'popover_loading_delay' => 0,
1120
+ 'popover_frequency' => 0,
1121
+ 'topbar_position' => 1,
1122
+ 'topbar_remain_top' => 1,
1123
+ 'topbar_closing' => 1,
1124
+ 'topbar_hide_duration' => 0,
1125
+ 'scrollbox_position' => 1,
1126
+ 'scrollbox_trigger_point' => 20,
1127
+ 'scrollbox_hide_duration' => 0,
1128
+ 'scrollbox_auto_hide' => 1,
1129
+ 'hide_mobile' => 0,
1130
+ 'scrollbox_closing' => 1,
1131
+ 'scrollbox_minimize' => 1,
1132
+ 'scrollbox_minimize_text' => $scrollbox_minimize_text,
1133
+ 'display_on' => 'home,post,page',
1134
+ 'posts_include' => '',
1135
+ 'pages_include' => '',
1136
+ 'display_on_categories' => '',
1137
+ 'current_categories' => '',
1138
+ 'show_for_admin' => 0,
1139
+ ));
1140
+ $this->model->insert_data_to_db('formmaker_views', array(
1141
+ 'form_id' => $id,
1142
+ 'views' => 0,
1143
+ ));
1144
+ }
1145
+ $backup_id = (int) WDW_FM_Library::get('backup_id', '');
1146
+ if ( $backup_id ) {
1147
+ if ( $this->model->get_backup_id($backup_id, $id) ) {
1148
+ $this->model->delete_rows(array(
1149
+ "table" => "formmaker_backup",
1150
+ "where" => "backup_id > " . $backup_id . " AND id = " . $id,
1151
+ ));
1152
+ }
1153
+ // Get form_fields, form_front
1154
+ $row1 = $this->model->select_rows("get_row", array(
1155
+ "selection" => "form_fields, form_front",
1156
+ "table" => "formmaker_backup",
1157
+ "where" => "backup_id = " . $backup_id,
1158
+ ));
1159
+ if ( $row1->form_fields == $form_fields and $row1->form_front == $form_front ) {
1160
+ $save = $this->model->update_data('formmaker_backup', array(
1161
+ 'cur' => 1,
1162
+ 'title' => $title,
1163
+ 'theme' => $theme,
1164
+ 'form_front' => $form_front,
1165
+ 'sortable' => $sortable,
1166
+ 'counter' => $counter,
1167
+ 'label_order' => $label_order,
1168
+ 'label_order_current' => $label_order_current,
1169
+ 'pagination' => $pagination,
1170
+ 'show_title' => $show_title,
1171
+ 'show_numbers' => $show_numbers,
1172
+ 'public_key' => $public_key,
1173
+ 'private_key' => $private_key,
1174
+ 'recaptcha_theme' => $recaptcha_theme,
1175
+ 'form_fields' => $form_fields,
1176
+ 'header_title' => $header_title,
1177
+ 'header_description' => $header_description,
1178
+ 'header_image_url' => $header_image_url,
1179
+ 'header_image_animation' => $header_image_animation,
1180
+ 'header_hide_image' => $header_hide_image,
1181
+ ), array( 'backup_id' => $backup_id ));
1182
+ if ( $save !== FALSE ) {
1183
+ $this->model->create_js($id);
1184
+
1185
+ return 1;
1186
+ }
1187
+ else {
1188
+ return 2;
1189
+ }
1190
+ }
1191
+ }
1192
+ $this->model->update_data('formmaker_backup', array( 'cur' => 0 ), array( 'id' => $id ));
1193
+ $save = $this->model->insert_data_to_db('formmaker_backup', array(
1194
+ 'cur' => 1,
1195
+ 'id' => $id,
1196
+ 'title' => $title,
1197
+ 'mail' => '',
1198
+ 'form_front' => $form_front,
1199
+ 'theme' => $theme,
1200
+ 'counter' => $counter,
1201
+ 'label_order' => $label_order,
1202
+ 'pagination' => $pagination,
1203
+ 'show_title' => $show_title,
1204
+ 'show_numbers' => $show_numbers,
1205
+ 'public_key' => $public_key,
1206
+ 'private_key' => $private_key,
1207
+ 'recaptcha_theme' => $recaptcha_theme,
1208
+ 'javascript' => $javascript,
1209
+ 'submit_text' => '',
1210
+ 'url' => '',
1211
+ 'article_id' => 0,
1212
+ 'submit_text_type' => 1,
1213
+ 'script_mail' => '%all%',
1214
+ 'script_mail_user' => '%all%',
1215
+ 'label_order_current' => $label_order_current,
1216
+ 'tax' => 0,
1217
+ 'payment_currency' => '',
1218
+ 'paypal_email' => '',
1219
+ 'checkout_mode' => 'testmode',
1220
+ 'paypal_mode' => 0,
1221
+ 'published' => 1,
1222
+ 'form_fields' => $form_fields,
1223
+ 'savedb' => 1,
1224
+ 'sendemail' => 1,
1225
+ 'requiredmark' => '*',
1226
+ 'from_mail' => '',
1227
+ 'from_name' => '',
1228
+ 'reply_to' => '',
1229
+ 'send_to' => '',
1230
+ 'autogen_layout' => 1,
1231
+ 'custom_front' => '',
1232
+ 'mail_from_user' => '',
1233
+ 'mail_from_name_user' => '',
1234
+ 'reply_to_user' => '',
1235
+ 'condition' => '',
1236
+ 'mail_cc' => '',
1237
+ 'mail_cc_user' => '',
1238
+ 'mail_bcc' => '',
1239
+ 'mail_bcc_user' => '',
1240
+ 'mail_subject' => '',
1241
+ 'mail_subject_user' => '',
1242
+ 'mail_mode' => 1,
1243
+ 'mail_mode_user' => 1,
1244
+ 'mail_attachment' => 1,
1245
+ 'mail_attachment_user' => 1,
1246
+ 'sortable' => $sortable,
1247
+ 'user_id_wd' => 'administrator,',
1248
+ 'frontend_submit_fields' => '',
1249
+ 'frontend_submit_stat_fields' => '',
1250
+ 'header_title' => $header_title,
1251
+ 'header_description' => $header_description,
1252
+ 'header_image_url' => $header_image_url,
1253
+ 'header_image_animation' => $header_image_animation,
1254
+ 'header_hide_image' => $header_hide_image,
1255
+ ));
1256
+
1257
+ $backup_count = $this->model->get_count(array(
1258
+ "selection" => "backup_id",
1259
+ "table" => "formmaker_backup",
1260
+ "where" => "backup_id = " . $id,
1261
+ ));
1262
+ if ( $backup_count > 10 ) {
1263
+ $this->model->delete_rows(array(
1264
+ "table" => "formmaker_backup",
1265
+ "where" => "id = " . $id,
1266
+ "order_by" => "ORDER BY backup_id ASC",
1267
+ "limit" => "LIMIT 1",
1268
+ ));
1269
+ }
1270
+ if ( $save !== FALSE ) {
1271
+ $this->model->create_js($id);
1272
+ return 1;
1273
+ }
1274
+ else {
1275
+ return 2;
1276
+ }
1277
+ }
1278
+
1279
+ public function fm_live_search() {
1280
+ $search_string = !empty($_POST['pp_live_search']) ? sanitize_text_field($_POST['pp_live_search']) : '';
1281
+ $post_type = !empty($_POST['pp_post_type']) ? sanitize_text_field($_POST['pp_post_type']) : 'any';
1282
+ $full_content = !empty($_POST['pp_full_content']) ? sanitize_text_field($_POST['pp_full_content']) : 'true';
1283
+ $args['s'] = $search_string;
1284
+ $results = $this->fm_posts_query($args, $post_type);
1285
+ $output = '<ul class="pp_search_results">';
1286
+ if ( empty($results) ) {
1287
+ $output .= sprintf('<li class="pp_no_res">%1$s</li>', esc_html__('No results found', 'fm-text'));
1288
+ }
1289
+ else {
1290
+ foreach ( $results as $single_post ) {
1291
+ $output .= sprintf('<li data-post_id="%2$s">[%3$s] - %1$s</li>', esc_html($single_post['title']), esc_attr($single_post['id']), esc_html($single_post['post_type']));
1292
+ }
1293
+ }
1294
+ $output .= '</ul>';
1295
+ die($output);
1296
+ }
1297
+
1298
+ public function fm_posts_query( $args = array(), $include_post_type = '' ) {
1299
+ if ( 'only_pages' === $include_post_type ) {
1300
+ $pt_names = array( 'page' );
1301
+ }
1302
+ elseif ( 'any' === $include_post_type || 'only_posts' === $include_post_type ) {
1303
+ $default_post_types = array( 'post', 'page' );
1304
+ $custom_post_types = get_post_types(array(
1305
+ 'public' => TRUE,
1306
+ '_builtin' => FALSE,
1307
+ ));
1308
+ $post_types = array_merge($default_post_types, $custom_post_types);
1309
+ $pt_names = array_values($post_types);
1310
+ if ( 'only_posts' === $include_post_type ) {
1311
+ unset($pt_names[1]);
1312
+ }
1313
+ }
1314
+ else {
1315
+ $pt_names = $include_post_type;
1316
+ }
1317
+ $query = array(
1318
+ 'post_type' => $pt_names,
1319
+ 'suppress_filters' => TRUE,
1320
+ 'update_post_term_cache' => FALSE,
1321
+ 'update_post_meta_cache' => FALSE,
1322
+ 'post_status' => 'publish',
1323
+ 'posts_per_page' => -1,
1324
+ );
1325
+ if ( isset($args['s']) ) {
1326
+ $query['s'] = $args['s'];
1327
+ }
1328
+ $get_posts = new WP_Query;
1329
+ $posts = $get_posts->query($query);
1330
+ if ( !$get_posts->post_count ) {
1331
+ return FALSE;
1332
+ }
1333
+ $results = array();
1334
+ foreach ( $posts as $post ) {
1335
+ $results[] = array(
1336
+ 'id' => (int) $post->ID,
1337
+ 'title' => trim(esc_html(strip_tags(get_the_title($post)))),
1338
+ 'post_type' => $post->post_type,
1339
+ );
1340
+ }
1341
+ wp_reset_postdata();
1342
+
1343
+ return $results;
1344
+ }
1345
+
1346
+ public function update_form_title( $id ) {
1347
+ $page = WDW_FM_Library::get('page');
1348
+ $form_name = WDW_FM_Library::get('form_name', '');
1349
+
1350
+ // check id for db
1351
+ if(isset($id) && $id != "") {
1352
+ $id = intval($id);
1353
+ $update = $this->model->update_data( "forms", array('title' => $form_name,), array('id' => $id) );
1354
+ if( !$update ){
1355
+ $message = 2;
1356
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
1357
+ 'page' => $page,
1358
+ 'task' => 'display',
1359
+ 'message' => $message,
1360
+ ), admin_url('admin.php')));
1361
+ }
1362
+
1363
+ }
1364
+ else { // return message Failed
1365
+ $message = 2;
1366
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
1367
+ 'page' => $page,
1368
+ 'task' => 'display',
1369
+ 'message' => $message,
1370
+ ), admin_url('admin.php')));
1371
+ }
1372
+
1373
+ return $message = 1;
1374
+ }
1375
+ /**
1376
+ * Get stripe addon.
1377
+ *
1378
+ * @param int $id
1379
+ *
1380
+ * @return array $data
1381
+ */
1382
+ private function get_stripe_addon($id) {
1383
+ return apply_filters('fm_stripe_display_init', array('form_id' => $id) );
1384
+ }
1385
+
1386
+ }
admin/controllers/Options_fm.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerOptions_fm
5
+ */
6
+ class FMControllerOptions_fm {
7
+ private $model;
8
+ private $view;
9
+
10
+ public function __construct() {
11
+ require_once WDFM()->plugin_dir . "/admin/models/Options_fm.php";
12
+ $this->model = new FMModelOptions_fm();
13
+ require_once WDFM()->plugin_dir . "/admin/views/Options_fm.php";
14
+ $this->view = new FMViewOptions_fm();
15
+ }
16
+
17
+ public function execute() {
18
+ $task = WDW_FM_Library::get('task');
19
+ $id = (int) WDW_FM_Library::get('current_id', 0);
20
+ if ( method_exists($this, $task) ) {
21
+ check_admin_referer(WDFM()->nonce, WDFM()->nonce);
22
+ $this->$task($id);
23
+ }
24
+ else {
25
+ $this->display();
26
+ }
27
+ }
28
+
29
+ public function display() {
30
+ $fm_settings = get_option('fm_settings');
31
+ $this->view->display($fm_settings);
32
+ }
33
+
34
+ public function save() {
35
+ $message = $this->model->save_db();
36
+ $page = WDW_FM_Library::get('page');
37
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
38
+ 'page' => $page,
39
+ 'task' => 'display',
40
+ 'message' => $message,
41
+ ), admin_url('admin.php')));
42
+ }
43
+ }
admin/controllers/Paypal_info.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerPaypal_info {
4
+ /**
5
+ * @var $model
6
+ */
7
+ private $model;
8
+ /**
9
+ * @var $view
10
+ */
11
+ private $view;
12
+
13
+ /**
14
+ * Execute.
15
+ */
16
+ public function execute() {
17
+ $this->display();
18
+ }
19
+
20
+ /**
21
+ * Display.
22
+ */
23
+ public function display() {
24
+ // Load FMModelPaypal_info class.
25
+ require_once WDFM()->plugin_dir . "/admin/models/FMPaypalInfo.php";
26
+ $this->model = new FMModelPaypal_info();
27
+ // Load FMViewPaypal_info class.
28
+ require_once WDFM()->plugin_dir . "/admin/views/FMPaypalInfo.php";
29
+ $this->view = new FMViewPaypal_info();
30
+ $id = WDW_FM_Library::get('id', 0);
31
+ // Get form session by id.
32
+ $row = $this->model->get_form_session($id);
33
+ // Set params for view.
34
+ $params = array();
35
+ $params['row'] = $row;
36
+ $this->view->display($params);
37
+ }
38
+ }
admin/controllers/Product_option.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerProduct_option
5
+ */
6
+ class FMControllerProduct_option {
7
+ /**
8
+ * @var $view
9
+ */
10
+ private $view;
11
+
12
+ /**
13
+ * Execute.
14
+ */
15
+ public function execute() {
16
+ $this->display();
17
+ }
18
+
19
+ /**
20
+ * Display.
21
+ */
22
+ public function display() {
23
+ // Load FMViewProduct_option class.
24
+ require_once WDFM()->plugin_dir . "/admin/views/FMProductOption.php";
25
+ $this->view = new FMViewProduct_option();
26
+ $field_id = WDW_FM_Library::get('field_id', 0);
27
+ $property_id = WDW_FM_Library::get('property_id', '-1');
28
+ $url_for_ajax = WDW_FM_Library::get('url_for_ajax', '');
29
+ // Set params for view.
30
+ $params = array();
31
+ $params['field_id'] = $field_id;
32
+ $params['property_id'] = $property_id;
33
+ $params['url_for_ajax'] = $url_for_ajax;
34
+ $this->view->display($params);
35
+ }
36
+ }
admin/controllers/Select_data_from_db.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerSelect_data_from_db
5
+ */
6
+ class FMControllerSelect_data_from_db {
7
+ /**
8
+ * @var $model
9
+ */
10
+ private $model;
11
+ /**
12
+ * @var $view
13
+ */
14
+ private $view;
15
+
16
+ public function __construct() {
17
+ // Load FMModelSelect_data_from_db class.
18
+ require_once WDFM()->plugin_dir . "/admin/models/FMSelectDataFromDb.php";
19
+ $this->model = new FMModelSelect_data_from_db();
20
+ // Load FMViewSelect_data_from_db class.
21
+ require_once WDFM()->plugin_dir . "/admin/views/FMSelectDataFromDb.php";
22
+ $this->view = new FMViewSelect_data_from_db();
23
+ }
24
+
25
+ /**
26
+ * Execute.
27
+ */
28
+ public function execute() {
29
+ $task = WDW_FM_Library::get('task', 0);
30
+ $id = WDW_FM_Library::get('id', 0);
31
+ $form_id = WDW_FM_Library::get('form_id', 0);
32
+ $field_id = WDW_FM_Library::get('field_id', 0);
33
+ $value_disabled = WDW_FM_Library::get('value_disabled', 0);
34
+ $field_type = WDW_FM_Library::get('field_type', '');
35
+ if ( $task && method_exists($this, $task) ) {
36
+ $this->$task($form_id, $field_type = "");
37
+ }
38
+ else {
39
+ $this->display($id, $form_id, $field_id, $field_type, $value_disabled);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Display.
45
+ *
46
+ * @param int $id
47
+ * @param int $form_id
48
+ * @param int $field_id
49
+ * @param string $field_type
50
+ * @param int $value_disabled
51
+ */
52
+ public function display( $id, $form_id, $field_id, $field_type, $value_disabled ) {
53
+ // Set params for view.
54
+ $params = array();
55
+ $params['id'] = $id;
56
+ $params['form_id'] = $form_id;
57
+ $params['field_id'] = $field_id;
58
+ $params['field_type'] = $field_type;
59
+ $params['value_disabled'] = $value_disabled;
60
+ $this->view->display($params);
61
+ }
62
+
63
+ /**
64
+ * Data base tables.
65
+ *
66
+ * @param int $form_id
67
+ * @param string $field_type
68
+ */
69
+ public function db_tables( $form_id, $field_type ) {
70
+ // Get tables.
71
+ $tables = $this->model->get_tables();
72
+ // Set params for view.
73
+ $params = array();
74
+ $params['form_id'] = $form_id;
75
+ $params['field_type'] = $field_type;
76
+ $params['tables'] = $tables;
77
+ $this->view->db_tables($params);
78
+ }
79
+
80
+ public function db_table_struct_select( $form_id, $field_type ) {
81
+ // Get labels by form id.
82
+ $label = $this->model->get_labels($form_id);
83
+ // Get table struct.
84
+ $table_struct = $this->model->get_table_struct();
85
+ // Set params for view.
86
+ $params = array();
87
+ $params['form_id'] = $form_id;
88
+ $params['field_type'] = $field_type;
89
+ $params['label'] = $label;
90
+ $params['table_struct'] = $table_struct;
91
+ $this->view->db_table_struct_select($params);
92
+ }
93
+ }
admin/controllers/Show_matrix.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerShow_matrix {
4
+ /**
5
+ * @var $view
6
+ */
7
+ private $view;
8
+
9
+ /**
10
+ * Execute.
11
+ */
12
+ public function execute() {
13
+ $this->display();
14
+ }
15
+
16
+ /**
17
+ * Display.
18
+ */
19
+ public function display() {
20
+ // Load FMViewShow_matrix class.
21
+ require_once WDFM()->plugin_dir . "/admin/views/FMShowMatrix.php";
22
+ $this->view = new FMViewShow_matrix();
23
+ // Set params for view.
24
+ $params = array();
25
+ $this->view->display($params);
26
+ }
27
+ }
admin/controllers/Submissions_fm.php ADDED
@@ -0,0 +1,562 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class FMControllerSubmissions_fm
4
+ */
5
+ class FMControllerSubmissions_fm {
6
+ /**
7
+ * @var $model
8
+ */
9
+ private $model;
10
+ /**
11
+ * @var $view
12
+ */
13
+ private $view;
14
+ /**
15
+ * @var string $page
16
+ */
17
+ private $page;
18
+ /**
19
+ * @var string $bulk_action_name
20
+ */
21
+ private $bulk_action_name;
22
+ /**
23
+ * @var string $page_url
24
+ */
25
+ private $page_url;
26
+ /**
27
+ * @var int $page_per_num
28
+ */
29
+ private $page_per_num = 20;
30
+ /**
31
+ * @var array $actions
32
+ */
33
+ private $actions = array();
34
+
35
+ public function __construct() {
36
+ // Load FMModelSubmissions_fm class.
37
+ require_once WDFM()->plugin_dir . "/admin/models/Submissions_fm.php";
38
+ $this->model = new FMModelSubmissions_fm();
39
+ // Load FMViewSubmissions_fm class.
40
+ require_once WDFM()->plugin_dir . "/admin/views/Submissions_fm.php";
41
+ $this->view = new FMViewSubmissions_fm($this->model);
42
+
43
+ $this->page = WDW_FM_Library::get('page');
44
+ $this->page_url = add_query_arg( array (
45
+ 'page' => $this->page,
46
+ WDFM()->nonce => wp_create_nonce(WDFM()->nonce),
47
+ ), admin_url('admin.php')
48
+ );
49
+
50
+ $this->bulk_action_name = 'bulk_action';
51
+ $this->actions = array(
52
+ 'block_ip' => array(
53
+ 'title' => __('Block IPs', WDFM()->prefix),
54
+ $this->bulk_action_name => __('Blocked', WDFM()->prefix),
55
+ ),
56
+ 'unblock_ip' => array(
57
+ 'title' => __('Unblock IPs', WDFM()->prefix),
58
+ $this->bulk_action_name => __('Unblocked', WDFM()->prefix),
59
+ ),
60
+ 'delete' => array(
61
+ 'title' => __('Delete', WDFM()->prefix),
62
+ $this->bulk_action_name => __('Deleted', WDFM()->prefix),
63
+ ),
64
+ );
65
+
66
+ $user = get_current_user_id();
67
+ $screen = get_current_screen();
68
+ if ( !empty($user) && !empty($screen) ) {
69
+ $option = $screen->get_option('per_page', 'option');
70
+ $per_page = get_user_meta($user, $option, true);
71
+ if ( $per_page ) {
72
+ $this->page_per_num = $per_page;
73
+ }
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Execute.
79
+ */
80
+ public function execute() {
81
+ $task = WDW_FM_Library::get('task');
82
+ $id = (int) WDW_FM_Library::get('current_id', 0);
83
+ if ( method_exists($this, $task) ) {
84
+ if ( $task != 'display' ) {
85
+ check_admin_referer(WDFM()->nonce, WDFM()->nonce);
86
+ }
87
+ $block_action = $this->bulk_action_name;
88
+ $action = WDW_FM_Library::get( $block_action , -1 );
89
+ if ( $action != -1 ) {
90
+ $this->$block_action($action);
91
+ }
92
+ else {
93
+ $this->$task($id);
94
+ }
95
+ }
96
+ else {
97
+ $this->forms($id);
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Bulk actions.
103
+ *
104
+ * @param $task
105
+ */
106
+ public function bulk_action($task) {
107
+ $form_id = WDW_FM_Library::get('form_id', 0);
108
+ $check = WDW_FM_Library::get('check', '');
109
+
110
+ $message = 0;
111
+ $successfully_updated = 0;
112
+
113
+ if ( $check ) {
114
+ foreach ( $check as $id => $item ) {
115
+ if ( method_exists($this, $task) ) {
116
+ $message = $this->$task($id, TRUE);
117
+ if ( $message != 2 ) {
118
+ // Increase successfully updated items count, if action doesn't failed.
119
+ $successfully_updated++;
120
+ }
121
+ }
122
+ }
123
+ if ( $successfully_updated ) {
124
+ $block_action = $this->bulk_action_name;
125
+ $message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $successfully_updated, WDFM()->prefix), $successfully_updated, $this->actions[$task][$block_action]);
126
+ }
127
+ }
128
+
129
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
130
+ 'page' => $this->page,
131
+ 'task' => 'display',
132
+ 'current_id' => $form_id,
133
+ ($message === 2 ? 'message' : 'msg') => $message,
134
+ ), admin_url('admin.php')));
135
+
136
+ }
137
+
138
+ /**
139
+ * Forms.
140
+ * @param int $id
141
+ */
142
+ public function forms($id) {
143
+ // Set params for view.
144
+ $params = array();
145
+ $params['id'] = $id;
146
+ $params['page'] = $this->page;
147
+ $params['page_url'] = $this->page_url;
148
+ $params['page_title'] = __('Submissions', WDFM()->prefix);
149
+ $params['forms'] = $this->model->get_forms();
150
+
151
+ $this->view->forms($params);
152
+ }
153
+
154
+ /**
155
+ * Display.
156
+ * @param int $id
157
+ */
158
+ public function display( $id = 0 ) {
159
+ // Set params for view.
160
+ $params = array();
161
+ $params['id'] = $id;
162
+ $params['page'] = $this->page;
163
+ $params['page_url'] = $this->page_url;
164
+ $params['page_title'] = __('Submissions', WDFM()->prefix);
165
+ $params['actions'] = $this->actions;
166
+
167
+ // Set pagination params.
168
+ $params['pagination_url'] = add_query_arg( array( 'task' => 'display', 'current_id' => $id ), $this->page_url );
169
+ $params['page_per_num'] = $this->page_per_num;
170
+ $page = (int) WDW_FM_Library::get('paged', 1);
171
+ $page_num = $page ? ($page - 1) * $params['page_per_num'] : 0;
172
+
173
+ $params['forms'] = $this->model->get_forms();
174
+ $params['statistics'] = $this->model->get_statistics( $id );
175
+ $params['blocked_ips'] = $this->model->blocked_ips();
176
+
177
+ $labels_parameters = $this->model->get_labels_parameters( $id , $page_num, $params['page_per_num'] );
178
+
179
+ $params['sorted_labels_id'] = $labels_parameters[0];
180
+ $params['sorted_label_types'] = $labels_parameters[1];
181
+ $params['sorted_label_names'] = $labels_parameters[3];
182
+ $params['sorted_label_names_original'] = $labels_parameters[4];
183
+
184
+ $label_name_ids = array();
185
+ foreach($labels_parameters[0] as $key => $label_id) {
186
+ $label_name_ids[$label_id] = $labels_parameters[4][$key];
187
+ }
188
+ $params['label_name_ids'] = $label_name_ids;
189
+
190
+ $group_ids = ((isset($labels_parameters[6])) ? $labels_parameters[6] : NULL);
191
+ $params['group_id_s'] = $this->model->sort_group_ids(count($params['sorted_label_names']), $group_ids);
192
+ $params['where_choices'] = $labels_parameters[7];
193
+ $params['searched_ids'] = $labels_parameters[8] ? implode(',', $labels_parameters[8]) : '';
194
+
195
+ $params['order_by'] = (isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
196
+ $params['asc_or_desc'] = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
197
+
198
+ $lists = $labels_parameters[2];
199
+ $params['lists'] = $lists;
200
+ $params['style_id'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
201
+ $params['style_date'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
202
+ $params['style_ip'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
203
+ $params['style_username'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
204
+ $params['style_useremail'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
205
+ $params['style_payment_info'] = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
206
+
207
+ $params['oder_class_default'] = "manage-column column-autor sortable desc";
208
+ $params['oder_class'] = "manage-column column-title sorted " . $params['asc_or_desc'];
209
+
210
+ $params['m'] = count($params['sorted_label_names']);
211
+
212
+ $is_search = false;
213
+ foreach($lists as $list_key => $list_val){
214
+ if(!empty($_POST[$list_key])) {
215
+ $is_search = true;
216
+ }
217
+ }
218
+ $params['is_search'] = $is_search; // (($lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] || $lists['id_search']) ? true : false );
219
+ $params['is_stats'] = FALSE;
220
+
221
+ $params['rows_data'] = $lists;
222
+ $params['rows'] = ((isset($labels_parameters[5])) ? $labels_parameters[5] : NULL);
223
+ $params['subs_count'] = $labels_parameters[2]['total'];
224
+
225
+ // Check is active pdf-integration add-on.
226
+ $params['pdf_data'] = array();
227
+ if ( defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF')) ) {
228
+ require_once(WD_FM_PDF_DIR . '/model.php');
229
+ $params['pdf_data'] = WD_FM_PDF_model::get_pdf_data( $id );
230
+ }
231
+ $this->view->display($params);
232
+ }
233
+
234
+ /**
235
+ * Show stats.
236
+ * @param int $id
237
+ */
238
+ public function show_stats( $id = 0 ) {
239
+ ob_clean();
240
+ $key = (int) WDW_FM_Library::get('sorted_label_key', '');
241
+
242
+ $page = (int) WDW_FM_Library::get('paged', 1);
243
+ $page_num = $page ? ($page - 1) * $this->page_per_num : 0;
244
+
245
+ $labels_parameters = $this->model->get_labels_parameters( $id, $page_num, $this->page_per_num);
246
+ $where_choices = $labels_parameters[7];
247
+ $sorted_label_names_original = $labels_parameters[4];
248
+ $sorted_labels_id = $labels_parameters[0];
249
+
250
+ $all = 0;
251
+ $choices_labels = array();
252
+ $sorted_label_name_original = '';
253
+ $choices_count = '';
254
+ $unanswered = NULL;
255
+ $colors = array();
256
+ $choices_colors = array();
257
+ if ( !empty($key) && count($sorted_labels_id) != 0 && $key < count($sorted_labels_id) ) {
258
+ $choices_params = $this->model->statistic_for_radio($where_choices, $sorted_labels_id[$key]);
259
+ $sorted_label_name_original = $sorted_label_names_original[$key];
260
+ $choices_count = $choices_params[0];
261
+ $choices_labels = $choices_params[1];
262
+ $unanswered = $choices_params[2];
263
+ $all = $choices_params[3];
264
+ $colors = $choices_params[4];
265
+ $choices_colors = $choices_params[5];
266
+ }
267
+
268
+ // Set params for view.
269
+ $params = array();
270
+ $params['key'] = $key;
271
+ $params['all'] = $all;
272
+ $params['choices_labels'] = $choices_labels;
273
+ $params['sorted_label_name_original'] = $sorted_label_name_original;
274
+ $params['choices_count'] = $choices_count;
275
+ $params['unanswered'] = $unanswered;
276
+ $params['colors'] = $colors;
277
+ $params['choices_colors'] = $choices_colors;
278
+
279
+ $json = array();
280
+ $json['html'] = $this->view->show_stats($params);
281
+ echo json_encode($json); exit;
282
+ }
283
+
284
+ /**
285
+ * Edit.
286
+ * @param int $id
287
+ */
288
+ public function edit( $id=0 ) {
289
+ $form_id = WDW_FM_Library::get('form_id', 0);
290
+ $data = $this->model->get_data_of_group_id( $id );
291
+ $labels_id = '';
292
+ $rows = array();
293
+ $labels_type = array();
294
+ $labels_name = array();
295
+ $ispaypal = array();
296
+ if ( !empty($data) ) {
297
+ $labels_id = $data[1];
298
+ $rows = $data[0];
299
+ $labels_name = $data[2];
300
+ $labels_type = $data[3];
301
+ $ispaypal = $data[4];
302
+ $form = $data[5];
303
+ $userinfo = get_userdata($rows[0]->user_id_wd);
304
+ }
305
+
306
+ $username = $userinfo ? $userinfo->display_name : "";
307
+ $useremail = $userinfo ? $userinfo->user_email : "";
308
+
309
+ // Set params for view.
310
+ $params = array();
311
+ $params['form_id'] = $form_id;
312
+ $params['form'] = $form;
313
+ $params['current_id'] = $id;
314
+ $params['rows'] = $rows;
315
+ $params['labels_id'] = $labels_id;
316
+ $params['labels_name'] = $labels_name;
317
+ $params['labels_type'] = $labels_type;
318
+ $params['ispaypal'] = $ispaypal;
319
+ $params['username'] = $username;
320
+ $params['useremail'] = $useremail;
321
+ $this->view->edit($params);
322
+ }
323
+
324
+ /**
325
+ * Save.
326
+ * @param int $id
327
+ */
328
+ public function save( $id = 0 ) {
329
+ $form_id = WDW_FM_Library::get('form_id', 0);
330
+ $this->save_db( $id, $form_id );
331
+ }
332
+
333
+ /**
334
+ * Save.
335
+ * @param int $id
336
+ * @param int $form_id
337
+ */
338
+ public function save_db( $id, $form_id) {
339
+ $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
340
+ $date = esc_html($_POST['date']);
341
+ $ip = esc_html($_POST['ip']);
342
+
343
+ $form = $this->model->get_all($form_id);
344
+ $label_id = array();
345
+ $label_order_original = array();
346
+ $label_type = array();
347
+ if ( strpos($form->label_order, 'type_paypal_') ) {
348
+ $form->label_order = $form->label_order . "0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
349
+ }
350
+ $label_all = explode('#****#', $form->label_order);
351
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
352
+ foreach ( $label_all as $key => $label_each ) {
353
+ $label_id_each = explode('#**id**#', $label_each);
354
+ array_push($label_id, $label_id_each[0]);
355
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
356
+ array_push($label_order_original, $label_oder_each[0]);
357
+ array_push($label_type, $label_oder_each[1]);
358
+ }
359
+ foreach ( $label_id as $key => $label_id_1 ) {
360
+ if ( isset($_POST["submission_" . $label_id_1]) ) {
361
+ $element_value = (isset($_POST["submission_" . $label_id_1]) ? esc_html(stripslashes($_POST["submission_" . $label_id_1])) : " ");
362
+ $result = $this->model->get_id($id, $label_id_1);
363
+ if ( $label_type[$key] == 'type_file_upload' ) {
364
+ if ( $element_value ) {
365
+ $element_value = $element_value . "*@@url@@*";
366
+ }
367
+ }
368
+ if ( $result ) {
369
+ $save = $this->model->update_fm_submits(array(
370
+ 'element_value' => stripslashes($element_value),
371
+ ), array(
372
+ 'group_id' => $id,
373
+ 'element_label' => $label_id_1,
374
+ ), array(
375
+ '%s',
376
+ ), array(
377
+ '%d',
378
+ '%s',
379
+ ));
380
+ }
381
+ else {
382
+ $save = $this->model->insert_fm_submits(array(
383
+ 'form_id' => $form_id,
384
+ 'element_label' => $label_id_1,
385
+ 'element_value' => stripslashes($element_value),
386
+ 'group_id' => $id,
387
+ 'date' => $date,
388
+ 'ip' => $ip,
389
+ ), array(
390
+ '%d',
391
+ '%s',
392
+ '%s',
393
+ '%d',
394
+ '%s',
395
+ '%s',
396
+ ));
397
+ }
398
+ }
399
+ else {
400
+ if ( isset($_POST["submission_" . $label_id_1 . '_0']) ) {
401
+ $element_value = '';
402
+ for ( $z = 0; $z < 21; $z++ ) {
403
+ $element_value_ch = isset($_POST["submission_" . $label_id_1 . '_' . $z]) ? $_POST["submission_" . $label_id_1 . '_' . $z] : NULL;
404
+ if ( isset($element_value_ch) ) {
405
+ $element_value = $element_value . $element_value_ch . '***br***';
406
+ }
407
+ else {
408
+ break;
409
+ }
410
+ }
411
+ $result = $this->model->get_id($id, $label_id_1);
412
+ if ( $result ) {
413
+ $save = $this->model->update_fm_submits(array(
414
+ 'element_value' => stripslashes($element_value),
415
+ ), array(
416
+ 'group_id' => $id,
417
+ 'element_label' => $label_id_1,
418
+ ), array(
419
+ '%s',
420
+ ), array(
421
+ '%d',
422
+ '%s',
423
+ ));
424
+ }
425
+ else {
426
+ $save = $this->model->insert_fm_submits(array(
427
+ 'form_id' => $form_id,
428
+ 'element_label' => $label_id_1,
429
+ 'element_value' => stripslashes($element_value),
430
+ 'group_id' => $id,
431
+ 'date' => $date,
432
+ 'ip' => $ip,
433
+ ), array(
434
+ '%d',
435
+ '%s',
436
+ '%s',
437
+ '%d',
438
+ '%s',
439
+ '%s',
440
+ ));
441
+ }
442
+ }
443
+ }
444
+ }
445
+
446
+ $message = 2;
447
+ if ( $save !== FALSE ) {
448
+ $message = 14;
449
+ }
450
+ $args = array(
451
+ 'page' => $this->page,
452
+ 'task' => 'edit',
453
+ 'current_id' => $id,
454
+ 'form_id' => $form_id,
455
+ 'message' => $message,
456
+ );
457
+
458
+ WDW_FM_Library::fm_redirect(add_query_arg( $args, admin_url('admin.php')) );
459
+ }
460
+
461
+ /**
462
+ * Delete form by id.
463
+ *
464
+ * @param $id
465
+ * @param bool $bulk
466
+ *
467
+ * @return int
468
+ */
469
+ public function delete( $id, $bulk = FALSE ) {
470
+ $form_id = (int) WDW_FM_Library::get('form_id', 0);
471
+ $delete = $this->model->delete_row($id);
472
+ $message = 2;
473
+ if ( $delete ) {
474
+ $message = 3;
475
+ }
476
+
477
+ if ( $bulk ) {
478
+ return $message;
479
+ }
480
+
481
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
482
+ 'page' => $this->page,
483
+ 'task' => 'display',
484
+ 'current_id'=> $form_id,
485
+ 'message' => $message,
486
+ ), admin_url('admin.php')));
487
+ }
488
+
489
+ /**
490
+ * Block IP form by id.
491
+ *
492
+ * @param $id
493
+ * @param bool $bulk
494
+ *
495
+ * @return int
496
+ */
497
+ public function block_ip( $id, $bulk = FALSE ) {
498
+ global $wpdb;
499
+
500
+ $form_id = (int) WDW_FM_Library::get('form_id', 0);
501
+ $q = $wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id ="%d"', $id);
502
+ $row = $wpdb->get_row($q);
503
+ $message = 2;
504
+
505
+ if( !empty($row) ) {
506
+ if( !$this->model->get_ips( $row->ip ) ) {
507
+ $save = $this->model->set_ips( array('ip' => $row->ip), array( '%s', ) );
508
+
509
+ if($save){
510
+ $message = 12;
511
+ }
512
+ }
513
+ }
514
+ if ( $bulk ) {
515
+ return $message;
516
+ }
517
+
518
+ WDW_FM_Library::fm_redirect(add_query_arg( array(
519
+ 'page' => $this->page,
520
+ 'task' => 'display',
521
+ 'current_id'=> $form_id,
522
+ 'message' => $message,
523
+ ), admin_url('admin.php')) );
524
+ }
525
+
526
+ /**
527
+ * Unblock IP form by id.
528
+ *
529
+ * @param $id
530
+ * @param bool $bulk
531
+ *
532
+ * @return int
533
+ */
534
+ public function unblock_ip( $id, $bulk = FALSE ) {
535
+ global $wpdb;
536
+
537
+ $form_id = (int) WDW_FM_Library::get('form_id', 0);
538
+ $q = $wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id ="%d"', $id);
539
+ $row = $wpdb->get_row($q);
540
+ $message = 2;
541
+
542
+ if( !empty($row) ) {
543
+ if( $this->model->get_ips( $row->ip ) ) {
544
+ $delete = $this->model->delete_by_ip( $row->ip );
545
+ if($delete){
546
+ $message = 13;
547
+ }
548
+ }
549
+ }
550
+
551
+ if ( $bulk ) {
552
+ return $message;
553
+ }
554
+
555
+ WDW_FM_Library::fm_redirect(add_query_arg( array(
556
+ 'page' => $this->page,
557
+ 'task' => 'display',
558
+ 'current_id'=> $form_id,
559
+ 'message' => $message,
560
+ ), admin_url('admin.php')) );
561
+ }
562
+ }
admin/controllers/Themes_fm.php ADDED
@@ -0,0 +1,3044 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerThemes_fm
5
+ */
6
+ class FMControllerThemes_fm {
7
+ /**
8
+ * @var $model
9
+ */
10
+ private $model;
11
+ /**
12
+ * @var $view
13
+ */
14
+ private $view;
15
+ /**
16
+ * @var string $page
17
+ */
18
+ private $page;
19
+ /**
20
+ * @var string $bulk_action_name
21
+ */
22
+ private $bulk_action_name;
23
+ /**
24
+ * @var int $items_per_page
25
+ */
26
+ private $items_per_page = 20;
27
+ /**
28
+ * @var array $actions
29
+ */
30
+ private $actions = array();
31
+
32
+ public function __construct() {
33
+ require_once WDFM()->plugin_dir . "/admin/models/Themes_fm.php";
34
+ $this->model = new FMModelThemes_fm();
35
+ require_once WDFM()->plugin_dir . "/admin/views/Themes_fm.php";
36
+ $this->view = new FMViewThemes_fm();
37
+ $this->page = WDW_FM_Library::get('page');
38
+ $this->bulk_action_name = 'bulk_action';
39
+
40
+ $this->actions = array(
41
+ 'duplicate' => array(
42
+ 'title' => __('Duplicate', WDFM()->prefix),
43
+ $this->bulk_action_name => __('duplicated', WDFM()->prefix),
44
+ ),
45
+ 'delete' => array(
46
+ 'title' => __('Delete', WDFM()->prefix),
47
+ $this->bulk_action_name => __('deleted', WDFM()->prefix),
48
+ ),
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Execute.
54
+ */
55
+ public function execute() {
56
+ $task = WDW_FM_Library::get('task');
57
+ $id = (int) WDW_FM_Library::get('current_id', 0);
58
+ if ( method_exists($this, $task) ) {
59
+ if ( $task != 'add' && $task != 'edit' && $task != 'display' ) {
60
+ check_admin_referer(WDFM()->nonce, WDFM()->nonce);
61
+ }
62
+ $block_action = $this->bulk_action_name;
63
+ $action = WDW_FM_Library::get($block_action, -1);
64
+ if ( $action != -1 ) {
65
+ $this->$block_action($action);
66
+ }
67
+ else {
68
+ $this->$task($id);
69
+ }
70
+ }
71
+ else {
72
+ $this->display();
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Display.
78
+ */
79
+ public function display() {
80
+ // Set params for view.
81
+ $params = array();
82
+ $params['page'] = $this->page;
83
+ $params['page_title'] = __('Themes', WDFM()->prefix);
84
+ $params['actions'] = $this->actions;
85
+ $params['order'] = WDW_FM_Library::get('order', 'desc');
86
+ $params['orderby'] = WDW_FM_Library::get('orderby', 'default');
87
+ // To prevent SQL injections.
88
+ $params['order'] = ($params['order'] == 'desc') ? 'desc' : 'asc';
89
+ if ( !in_array($params['orderby'], array( 'title', 'default' )) ) {
90
+ $params['orderby'] = 'default';
91
+ }
92
+ $params['items_per_page'] = $this->items_per_page;
93
+ $page = (int) WDW_FM_Library::get('paged', 1);
94
+ $page_num = $page ? ($page - 1) * $params['items_per_page'] : 0;
95
+ $params['page_num'] = $page_num;
96
+ $params['search'] = WDW_FM_Library::get('s', '');;
97
+ $params['total'] = $this->model->total();
98
+ $params['rows_data'] = $this->model->get_rows_data($params);
99
+ $this->view->display($params);
100
+ }
101
+
102
+ /**
103
+ * Bulk actions.
104
+ *
105
+ * @param $task
106
+ */
107
+ public function bulk_action($task) {
108
+ $message = 0;
109
+ $successfully_updated = 0;
110
+
111
+ $check = WDW_FM_Library::get('check', '');
112
+
113
+ if ( $check ) {
114
+ foreach ( $check as $form_id => $item ) {
115
+ if ( method_exists($this, $task) ) {
116
+ $message = $this->$task($form_id, TRUE);
117
+ if ( $message != 2 ) {
118
+ // Increase successfully updated items count, if action doesn't failed.
119
+ $successfully_updated++;
120
+ }
121
+ }
122
+ }
123
+ if ( $successfully_updated ) {
124
+ $block_action = $this->bulk_action_name;
125
+ $message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $successfully_updated, WDFM()->prefix), $successfully_updated, $this->actions[$task][$block_action]);
126
+ }
127
+ }
128
+
129
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
130
+ 'page' => $this->page,
131
+ 'task' => 'display',
132
+ ($message === 2 ? 'message' : 'msg') => $message,
133
+ ), admin_url('admin.php')));
134
+
135
+ }
136
+
137
+ /**
138
+ * Delete form by id.
139
+ *
140
+ * @param $id
141
+ * @param bool $bulk
142
+ *
143
+ * @return int
144
+ */
145
+ public function delete( $id, $bulk = FALSE ) {
146
+ $isDefault = $this->model->get_default($id);
147
+ if ( $isDefault ) {
148
+ $message = 4;
149
+ }
150
+ else {
151
+ $table = 'formmaker_themes';
152
+ $delete = $this->model->delete_rows(array(
153
+ 'table' => $table,
154
+ 'where' => 'id = ' . $id,
155
+ ));
156
+ if ( $delete ) {
157
+ $message = 3;
158
+ }
159
+ else {
160
+ $message = 2;
161
+ }
162
+ }
163
+ if ( $bulk ) {
164
+ return $message;
165
+ }
166
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
167
+ 'page' => $this->page,
168
+ 'task' => 'display',
169
+ 'message' => $message,
170
+ ), admin_url('admin.php')));
171
+ }
172
+
173
+ /**
174
+ * Duplicate by id.
175
+ *
176
+ * @param $id
177
+ * @param bool $bulk
178
+ *
179
+ * @return int
180
+ */
181
+ public function duplicate( $id, $bulk = FALSE ) {
182
+ $message = 2;
183
+ $table = 'formmaker_themes';
184
+ $row = $this->model->select_rows("get_row", array(
185
+ "selection" => "*",
186
+ "table" => $table,
187
+ "where" => "id=" . (int) $id,
188
+ ));
189
+ if ( $row ) {
190
+ $row = (array) $row;
191
+ unset($row['id']);
192
+ $row['default'] = 0;
193
+ $inserted = $this->model->insert_data_to_db($table, (array) $row);
194
+ if ( $inserted !== FALSE ) {
195
+ $message = 11;
196
+ }
197
+ }
198
+ if ( $bulk ) {
199
+ return $message;
200
+ }
201
+ else {
202
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
203
+ 'page' => $this->page,
204
+ 'task' => 'display',
205
+ 'message' => $message,
206
+ ), admin_url('admin.php')));
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Edit.
212
+ *
213
+ * @param int $id
214
+ */
215
+ public function edit($id = 0 ) {
216
+ $params = array();
217
+ $params['id'] = (int) $id;
218
+ $params['row'] = $this->model->get_row_data($params['id'], FALSE);
219
+ $params['page_title'] = $params['row']->title;
220
+ $params['param_values'] = $params['row']->css;
221
+ $params['border_types'] = array(
222
+ 'solid' => 'Solid',
223
+ 'dotted' => 'Dotted',
224
+ 'dashed' => 'Dashed',
225
+ 'double' => 'Double',
226
+ 'groove' => 'Groove',
227
+ 'ridge' => 'Ridge',
228
+ 'inset' => 'Inset',
229
+ 'outset' => 'Outset',
230
+ 'initial' => 'Initial',
231
+ 'inherit' => 'Inherit',
232
+ 'hidden' => 'Hidden',
233
+ 'none' => 'None',
234
+ );
235
+ $borders = array( 'top' => 'Top', 'right' => 'Right', 'bottom' => 'Bottom', 'left' => 'Left' );
236
+ $border_values = array(
237
+ 'top' => 'BorderTop',
238
+ 'right' => 'BorderRight',
239
+ 'bottom' => 'BorderBottom',
240
+ 'left' => 'BorderLeft',
241
+ );
242
+ $position_types = array(
243
+ 'static' => 'Static',
244
+ 'relative' => 'Relative',
245
+ 'fixed' => 'Fixed',
246
+ 'absolute' => 'Absolute',
247
+ );
248
+ $font_weights = array(
249
+ 'normal' => 'Normal',
250
+ 'bold' => 'Bold',
251
+ 'bolder' => 'Bolder',
252
+ 'lighter' => 'Lighter',
253
+ 'initial' => 'Initial',
254
+ );
255
+ $aligns = array( 'left' => 'Left', 'center' => 'Center', 'right' => 'Right' );
256
+ $aligns_no_center = array( 'left' => 'Left', 'right' => 'Right' );
257
+ $basic_fonts = array(
258
+ 'arial' => 'Arial',
259
+ 'lucida grande' => 'Lucida grande',
260
+ 'segoe ui' => 'Segoe ui',
261
+ 'tahoma' => 'Tahoma',
262
+ 'trebuchet ms' => 'Trebuchet ms',
263
+ 'verdana' => 'Verdana',
264
+ 'cursive' => 'Cursive',
265
+ 'fantasy' => 'Fantasy',
266
+ 'monospace' => 'Monospace',
267
+ 'serif' => 'Serif',
268
+ );
269
+ $bg_repeats = array(
270
+ 'repeat' => 'repeat',
271
+ 'repeat-x' => 'repeat-x',
272
+ 'repeat-y' => 'repeat-y',
273
+ 'no-repeat' => 'no-repeat',
274
+ 'initial' => 'initial',
275
+ 'inherit' => 'inherit',
276
+ );
277
+ $google_fonts = WDW_FM_Library::get_google_fonts();
278
+ $font_families = $basic_fonts + $google_fonts;
279
+ $params['fonts'] = implode("|", str_replace(' ', '+', $google_fonts));
280
+ $params['tabs'] = array(
281
+ 'global' => 'Global Parameters',
282
+ 'header' => 'Header',
283
+ 'content' => 'Content',
284
+ 'input_select' => 'Inputbox',
285
+ 'choices' => 'Choices',
286
+ 'subscribe' => 'General Buttons',
287
+ 'paigination' => 'Pagination',
288
+ 'buttons' => 'Buttons',
289
+ 'close_button' => 'Close(Minimize) Button',
290
+ 'minimize' => 'Minimize Text',
291
+ 'other' => 'Other',
292
+ 'custom_css' => 'Custom CSS',
293
+ );
294
+ $params['all_params'] = $this->all_params($params['param_values'], $borders, $font_weights, $border_values, $position_types, $aligns_no_center, $aligns, $bg_repeats, $font_families);
295
+ $this->view->edit($params);
296
+ }
297
+
298
+ // set all params in array
299
+ public function all_params( $param_values, $borders, $border_types, $font_weights, $position_types, $aligns_no_center, $aligns, $bg_repeats, $font_families ) {
300
+ $all_params = array(
301
+ 'global' => array(
302
+ array(
303
+ 'label' => '',
304
+ 'type' => 'panel',
305
+ 'class' => 'col-md-12',
306
+ 'label_class' => '',
307
+ 'after' => '',
308
+ ),
309
+ array(
310
+ 'label' => 'Font Family',
311
+ 'name' => 'GPFontFamily',
312
+ 'type' => 'select',
313
+ 'options' => $font_families,
314
+ 'class' => '',
315
+ 'value' => isset($param_values->GPFontFamily) ? $param_values->GPFontFamily : '',
316
+ 'after' => '',
317
+ ),
318
+ array(
319
+ 'label' => 'Width',
320
+ 'name' => 'AGPWidth',
321
+ 'type' => 'text',
322
+ 'class' => '',
323
+ 'value' => isset($param_values->AGPWidth) ? $param_values->AGPWidth : '',
324
+ 'after' => '%',
325
+ ),
326
+ array(
327
+ 'label' => 'Width (for scrollbox, popup form types)',
328
+ 'name' => 'AGPSPWidth',
329
+ 'type' => 'text',
330
+ 'class' => '',
331
+ 'value' => isset($param_values->AGPSPWidth) ? $param_values->AGPSPWidth : '',
332
+ 'after' => '%',
333
+ ),
334
+ array(
335
+ 'label' => 'Padding',
336
+ 'name' => 'AGPPadding',
337
+ 'type' => 'text',
338
+ 'class' => '',
339
+ 'value' => isset($param_values->AGPPadding) ? $param_values->AGPPadding : '',
340
+ 'after' => 'px/%',
341
+ ),
342
+ array(
343
+ 'label' => 'Margin',
344
+ 'name' => 'AGPMargin',
345
+ 'type' => 'text',
346
+ 'class' => '',
347
+ 'value' => isset($param_values->AGPMargin) ? $param_values->AGPMargin : '',
348
+ 'placeholder' => 'e.g. 5px 10px or 5% 10%',
349
+ 'after' => 'px/%',
350
+ ),
351
+ array(
352
+ 'label' => 'Border',
353
+ 'name' => 'AGPBorder',
354
+ 'type' => 'checkbox',
355
+ 'options' => $borders,
356
+ 'class' => '',
357
+ 'after' => '',
358
+ ),
359
+ array(
360
+ 'label' => 'Border Color',
361
+ 'name' => 'AGPBorderColor',
362
+ 'type' => 'text',
363
+ 'class' => 'color',
364
+ 'value' => isset($param_values->AGPBorderColor) ? $param_values->AGPBorderColor : '',
365
+ 'after' => '',
366
+ ),
367
+ array(
368
+ 'label' => 'Border Type',
369
+ 'name' => 'AGPBorderType',
370
+ 'type' => 'select',
371
+ 'options' => $border_types,
372
+ 'class' => '',
373
+ 'value' => isset($param_values->AGPBorderType) ? $param_values->AGPBorderType : '',
374
+ 'after' => '',
375
+ ),
376
+ array(
377
+ 'label' => 'Border Width',
378
+ 'name' => 'AGPBorderWidth',
379
+ 'type' => 'text',
380
+ 'class' => '',
381
+ 'value' => isset($param_values->AGPBorderWidth) ? $param_values->AGPBorderWidth : '',
382
+ 'after' => 'px',
383
+ ),
384
+ array(
385
+ 'label' => 'Border Radius',
386
+ 'name' => 'AGPBorderRadius',
387
+ 'type' => 'text',
388
+ 'class' => '',
389
+ 'value' => isset($param_values->AGPBorderRadius) ? $param_values->AGPBorderRadius : '',
390
+ 'after' => 'px',
391
+ ),
392
+ array(
393
+ 'label' => 'Box Shadow',
394
+ 'name' => 'AGPBoxShadow',
395
+ 'type' => 'text',
396
+ 'class' => '',
397
+ 'value' => isset($param_values->AGPBoxShadow) ? $param_values->AGPBoxShadow : '',
398
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
399
+ 'after' => '</div>',
400
+ ),
401
+ ),
402
+ 'header' => array(
403
+ array(
404
+ 'label' => 'General Parameters',
405
+ 'type' => 'panel',
406
+ 'class' => 'col-md-6',
407
+ 'label_class' => 'fm-mini-title',
408
+ 'after' => '<br/>',
409
+ ),
410
+ array(
411
+ 'label' => 'Alignment',
412
+ 'name' => 'HPAlign',
413
+ 'type' => 'select',
414
+ 'options' => $borders,
415
+ 'class' => '',
416
+ 'value' => isset($param_values->HPAlign) ? $param_values->HPAlign : '',
417
+ 'after' => '',
418
+ ),
419
+ array(
420
+ 'label' => 'Background Color',
421
+ 'name' => 'HPBGColor',
422
+ 'type' => 'text',
423
+ 'class' => 'color',
424
+ 'value' => isset($param_values->HPBGColor) ? $param_values->HPBGColor : '',
425
+ 'after' => '',
426
+ ),
427
+ array(
428
+ 'label' => 'Width',
429
+ 'name' => 'HPWidth',
430
+ 'type' => 'text',
431
+ 'class' => '',
432
+ 'value' => isset($param_values->HPWidth) ? $param_values->HPWidth : '',
433
+ 'after' => '%',
434
+ ),
435
+ array(
436
+ 'label' => 'Width (for topbar form type)',
437
+ 'name' => 'HTPWidth',
438
+ 'type' => 'text',
439
+ 'class' => '',
440
+ 'value' => isset($param_values->HTPWidth) ? $param_values->HTPWidth : '',
441
+ 'after' => '%',
442
+ ),
443
+ array(
444
+ 'label' => 'Padding',
445
+ 'name' => 'HPPadding',
446
+ 'type' => 'text',
447
+ 'class' => '',
448
+ 'value' => isset($param_values->HPPadding) ? $param_values->HPPadding : '',
449
+ 'after' => 'px/%',
450
+ ),
451
+ array(
452
+ 'label' => 'Margin',
453
+ 'name' => 'HPMargin',
454
+ 'type' => 'text',
455
+ 'class' => '',
456
+ 'value' => isset($param_values->HPMargin) ? $param_values->HPMargin : '',
457
+ 'placeholder' => 'e.g. 5px 10px or 5% 10%',
458
+ 'after' => 'px/%',
459
+ ),
460
+ array(
461
+ 'label' => 'Text Align',
462
+ 'name' => 'HPTextAlign',
463
+ 'type' => 'select',
464
+ 'options' => $aligns,
465
+ 'class' => '',
466
+ 'value' => isset($param_values->HPTextAlign) ? $param_values->HPTextAlign : '',
467
+ 'after' => '',
468
+ ),
469
+ array(
470
+ 'label' => 'Border',
471
+ 'name' => 'HPBorder',
472
+ 'type' => 'checkbox',
473
+ 'options' => $borders,
474
+ 'class' => '',
475
+ 'after' => '',
476
+ ),
477
+ array(
478
+ 'label' => 'Border Color',
479
+ 'name' => 'HPBorderColor',
480
+ 'type' => 'text',
481
+ 'class' => 'color',
482
+ 'value' => isset($param_values->HPBorderColor) ? $param_values->HPBorderColor : '',
483
+ 'after' => '',
484
+ ),
485
+ array(
486
+ 'label' => 'Border Type',
487
+ 'name' => 'HPBorderType',
488
+ 'type' => 'select',
489
+ 'options' => $border_types,
490
+ 'class' => '',
491
+ 'value' => isset($param_values->HPBorderType) ? $param_values->HPBorderType : '',
492
+ 'after' => '',
493
+ ),
494
+ array(
495
+ 'label' => 'Border Width',
496
+ 'name' => 'HPBorderWidth',
497
+ 'type' => 'text',
498
+ 'class' => '',
499
+ 'value' => isset($param_values->HPBorderWidth) ? $param_values->HPBorderWidth : '',
500
+ 'after' => 'px',
501
+ ),
502
+ array(
503
+ 'label' => 'Border Radius',
504
+ 'name' => 'HPBorderRadius',
505
+ 'type' => 'text',
506
+ 'class' => '',
507
+ 'value' => isset($param_values->HPBorderRadius) ? $param_values->HPBorderRadius : '',
508
+ 'after' => 'px</div>',
509
+ ),
510
+ array(
511
+ 'label' => 'Title Parameters',
512
+ 'type' => 'panel',
513
+ 'class' => 'col-md-6',
514
+ 'label_class' => 'fm-mini-title',
515
+ 'after' => '<br/>',
516
+ ),
517
+ array(
518
+ 'label' => 'Font Size',
519
+ 'name' => 'HTPFontSize',
520
+ 'type' => 'text',
521
+ 'class' => '',
522
+ 'value' => isset($param_values->HTPFontSize) ? $param_values->HTPFontSize : '',
523
+ 'after' => 'px',
524
+ ),
525
+ array(
526
+ 'label' => 'Font Weight',
527
+ 'name' => 'HTPWeight',
528
+ 'type' => 'select',
529
+ 'options' => $font_weights,
530
+ 'class' => '',
531
+ 'value' => isset($param_values->HTPWeight) ? $param_values->HTPWeight : '',
532
+ 'after' => '',
533
+ ),
534
+ array(
535
+ 'label' => 'Color',
536
+ 'name' => 'HTPColor',
537
+ 'type' => 'text',
538
+ 'class' => 'color',
539
+ 'value' => isset($param_values->HTPColor) ? $param_values->HTPColor : '',
540
+ 'after' => '',
541
+ ),
542
+ array(
543
+ 'label' => 'Description Parameters',
544
+ 'type' => 'label',
545
+ 'class' => 'fm-mini-title',
546
+ 'after' => '<br/>',
547
+ ),
548
+ array(
549
+ 'label' => 'Font Size',
550
+ 'name' => 'HDPFontSize',
551
+ 'type' => 'text',
552
+ 'class' => '',
553
+ 'value' => isset($param_values->HDPFontSize) ? $param_values->HDPFontSize : '',
554
+ 'after' => 'px',
555
+ ),
556
+ array(
557
+ 'label' => 'Color',
558
+ 'name' => 'HDPColor',
559
+ 'type' => 'text',
560
+ 'class' => 'color',
561
+ 'value' => isset($param_values->HDPColor) ? $param_values->HDPColor : '',
562
+ 'after' => '',
563
+ ),
564
+ array(
565
+ 'label' => 'Image Parameters',
566
+ 'type' => 'label',
567
+ 'class' => 'fm-mini-title',
568
+ 'after' => '<br/>',
569
+ ),
570
+ array(
571
+ 'label' => 'Alignment',
572
+ 'name' => 'HIPAlign',
573
+ 'type' => 'select',
574
+ 'options' => $borders,
575
+ 'class' => '',
576
+ 'value' => isset($param_values->HIPAlign) ? $param_values->HIPAlign : '',
577
+ 'after' => 'px',
578
+ ),
579
+ array(
580
+ 'label' => 'Width',
581
+ 'name' => 'HIPWidth',
582
+ 'type' => 'text',
583
+ 'class' => '',
584
+ 'value' => isset($param_values->HIPWidth) ? $param_values->HIPWidth : '',
585
+ 'after' => 'px',
586
+ ),
587
+ array(
588
+ 'label' => 'Height',
589
+ 'name' => 'HIPHeight',
590
+ 'type' => 'text',
591
+ 'class' => '',
592
+ 'value' => isset($param_values->HIPHeight) ? $param_values->HIPHeight : '',
593
+ 'after' => 'px</div>',
594
+ ),
595
+ ),
596
+ 'content' => array(
597
+ array(
598
+ 'label' => 'General Parameters',
599
+ 'type' => 'panel',
600
+ 'class' => 'col-md-6',
601
+ 'label_class' => 'fm-mini-title',
602
+ 'after' => '<br/>',
603
+ ),
604
+ array(
605
+ 'label' => 'Background Color',
606
+ 'name' => 'GPBGColor',
607
+ 'type' => 'text',
608
+ 'class' => 'color',
609
+ 'value' => isset($param_values->GPBGColor) ? $param_values->GPBGColor : '',
610
+ 'after' => '',
611
+ ),
612
+ array(
613
+ 'label' => 'Font Size',
614
+ 'name' => 'GPFontSize',
615
+ 'type' => 'text',
616
+ 'class' => '',
617
+ 'value' => isset($param_values->GPFontSize) ? $param_values->GPFontSize : '',
618
+ 'after' => 'px',
619
+ ),
620
+ array(
621
+ 'label' => 'Font Weight',
622
+ 'name' => 'GPFontWeight',
623
+ 'type' => 'select',
624
+ 'options' => $font_weights,
625
+ 'class' => '',
626
+ 'value' => isset($param_values->GPFontWeight) ? $param_values->GPFontWeight : '',
627
+ 'after' => '',
628
+ ),
629
+ array(
630
+ 'label' => 'Width',
631
+ 'name' => 'GPWidth',
632
+ 'type' => 'text',
633
+ 'class' => '',
634
+ 'value' => isset($param_values->GPWidth) ? $param_values->GPWidth : '',
635
+ 'after' => '%',
636
+ ),
637
+ array(
638
+ 'label' => 'Width (for topbar form type)',
639
+ 'name' => 'GTPWidth',
640
+ 'type' => 'text',
641
+ 'class' => '',
642
+ 'value' => isset($param_values->GTPWidth) ? $param_values->GTPWidth : '',
643
+ 'after' => '%',
644
+ ),
645
+ array(
646
+ 'label' => 'Alignment',
647
+ 'name' => 'GPAlign',
648
+ 'type' => 'select',
649
+ 'options' => $aligns,
650
+ 'class' => '',
651
+ 'value' => isset($param_values->GPAlign) ? $param_values->GPAlign : '',
652
+ 'after' => '',
653
+ ),
654
+ array(
655
+ 'label' => 'Background URL',
656
+ 'name' => 'GPBackground',
657
+ 'type' => 'text',
658
+ 'class' => '',
659
+ 'value' => isset($param_values->GPBackground) ? $param_values->GPBackground : '',
660
+ 'after' => '',
661
+ ),
662
+ array(
663
+ 'label' => 'Background Repeat',
664
+ 'name' => 'GPBackgroundRepeat',
665
+ 'type' => 'select',
666
+ 'options' => $bg_repeats,
667
+ 'class' => '',
668
+ 'value' => isset($param_values->GPBackgroundRepeat) ? $param_values->GPBackgroundRepeat : '',
669
+ 'after' => '',
670
+ ),
671
+ array(
672
+ 'label' => 'Background Position',
673
+ 'name1' => 'GPBGPosition1',
674
+ 'name2' => 'GPBGPosition2',
675
+ 'type' => '2text',
676
+ 'class' => 'fm-2text',
677
+ 'value1' => isset($param_values->GPBGPosition1) ? $param_values->GPBGPosition1 : '',
678
+ 'value2' => isset($param_values->GPBGPosition2) ? $param_values->GPBGPosition2 : '',
679
+ 'before1' => '',
680
+ 'before2' => '',
681
+ 'after' => '%/left..',
682
+ ),
683
+ array(
684
+ 'label' => 'Background Size',
685
+ 'name1' => 'GPBGSize1',
686
+ 'name2' => 'GPBGSize2',
687
+ 'type' => '2text',
688
+ 'class' => 'fm-2text',
689
+ 'value1' => isset($param_values->GPBGSize1) ? $param_values->GPBGSize1 : '',
690
+ 'value2' => isset($param_values->GPBGSize2) ? $param_values->GPBGSize2 : '',
691
+ 'before1' => '',
692
+ 'before2' => '',
693
+ 'after' => '%/px',
694
+ ),
695
+ array(
696
+ 'label' => 'Color',
697
+ 'name' => 'GPColor',
698
+ 'type' => 'text',
699
+ 'class' => 'color',
700
+ 'value' => isset($param_values->GPColor) ? $param_values->GPColor : '',
701
+ 'after' => '',
702
+ ),
703
+ array(
704
+ 'label' => 'Padding',
705
+ 'name' => 'GPPadding',
706
+ 'type' => 'text',
707
+ 'class' => '',
708
+ 'value' => isset($param_values->GPPadding) ? $param_values->GPPadding : '',
709
+ 'after' => 'px/%',
710
+ ),
711
+ array(
712
+ 'label' => 'Margin',
713
+ 'name' => 'GPMargin',
714
+ 'type' => 'text',
715
+ 'class' => '',
716
+ 'value' => isset($param_values->GPMargin) ? $param_values->GPMargin : '',
717
+ 'placeholder' => 'e.g. 5px 10px or 5% 10%',
718
+ 'after' => 'px/%',
719
+ ),
720
+ array(
721
+ 'label' => 'Border',
722
+ 'name' => 'GPBorder',
723
+ 'type' => 'checkbox',
724
+ 'options' => $borders,
725
+ 'class' => '',
726
+ 'after' => '',
727
+ ),
728
+ array(
729
+ 'label' => 'Border Color',
730
+ 'name' => 'GPBorderColor',
731
+ 'type' => 'text',
732
+ 'class' => 'color',
733
+ 'value' => isset($param_values->GPBorderColor) ? $param_values->GPBorderColor : '',
734
+ 'after' => '',
735
+ ),
736
+ array(
737
+ 'label' => 'Border Type',
738
+ 'name' => 'GPBorderType',
739
+ 'type' => 'select',
740
+ 'options' => $border_types,
741
+ 'class' => '',
742
+ 'value' => isset($param_values->GPBorderType) ? $param_values->GPBorderType : '',
743
+ 'after' => '',
744
+ ),
745
+ array(
746
+ 'label' => 'Border Width',
747
+ 'name' => 'GPBorderWidth',
748
+ 'type' => 'text',
749
+ 'class' => '',
750
+ 'value' => isset($param_values->GPBorderWidth) ? $param_values->GPBorderWidth : '',
751
+ 'after' => 'px',
752
+ ),
753
+ array(
754
+ 'label' => 'Border Radius',
755
+ 'name' => 'GPBorderRadius',
756
+ 'type' => 'text',
757
+ 'class' => '',
758
+ 'value' => isset($param_values->GPBorderRadius) ? $param_values->GPBorderRadius : '',
759
+ 'after' => 'px</div>',
760
+ ),
761
+ array(
762
+ 'label' => 'Mini labels (name, phone, address, checkbox, radio) Parameters',
763
+ 'type' => 'panel',
764
+ 'class' => 'col-md-6',
765
+ 'label_class' => 'fm-mini-title',
766
+ 'after' => '<br/>',
767
+ ),
768
+ array(
769
+ 'label' => 'Font Size',
770
+ 'name' => 'GPMLFontSize',
771
+ 'type' => 'text',
772
+ 'class' => '',
773
+ 'value' => isset($param_values->GPMLFontSize) ? $param_values->GPMLFontSize : '',
774
+ 'after' => 'px',
775
+ ),
776
+ array(
777
+ 'label' => 'Font Weight',
778
+ 'name' => 'GPMLFontWeight',
779
+ 'type' => 'select',
780
+ 'options' => $font_weights,
781
+ 'class' => '',
782
+ 'value' => isset($param_values->GPMLFontWeight) ? $param_values->GPMLFontWeight : '',
783
+ 'after' => '',
784
+ ),
785
+ array(
786
+ 'label' => 'Color',
787
+ 'name' => 'GPMLColor',
788
+ 'type' => 'text',
789
+ 'class' => 'color',
790
+ 'value' => isset($param_values->GPMLColor) ? $param_values->GPMLColor : '',
791
+ 'after' => '',
792
+ ),
793
+ array(
794
+ 'label' => 'Padding',
795
+ 'name' => 'GPMLPadding',
796
+ 'type' => 'text',
797
+ 'class' => '',
798
+ 'value' => isset($param_values->GPMLPadding) ? $param_values->GPMLPadding : '',
799
+ 'after' => 'px/%',
800
+ ),
801
+ array(
802
+ 'label' => 'Margin',
803
+ 'name' => 'GPMLMargin',
804
+ 'type' => 'text',
805
+ 'class' => '',
806
+ 'value' => isset($param_values->GPMLMargin) ? $param_values->GPMLMargin : '',
807
+ 'after' => 'px/%',
808
+ ),
809
+ array(
810
+ 'label' => 'Section Parameters',
811
+ 'type' => 'label',
812
+ 'class' => 'fm-mini-title',
813
+ 'after' => '<br/>',
814
+ ),
815
+ array(
816
+ 'label' => 'Background Color',
817
+ 'name' => 'SEPBGColor',
818
+ 'type' => 'text',
819
+ 'class' => 'color',
820
+ 'value' => isset($param_values->SEPBGColor) ? $param_values->SEPBGColor : '',
821
+ 'after' => '',
822
+ ),
823
+ array(
824
+ 'label' => 'Padding',
825
+ 'name' => 'SEPPadding',
826
+ 'type' => 'text',
827
+ 'class' => '',
828
+ 'value' => isset($param_values->SEPPadding) ? $param_values->SEPPadding : '',
829
+ 'after' => 'px/%',
830
+ ),
831
+ array(
832
+ 'label' => 'Margin',
833
+ 'name' => 'SEPMargin',
834
+ 'type' => 'text',
835
+ 'class' => '',
836
+ 'value' => isset($param_values->SEPMargin) ? $param_values->SEPMargin : '',
837
+ 'after' => 'px/%',
838
+ ),
839
+ array(
840
+ 'label' => 'Section Column Parameters',
841
+ 'type' => 'label',
842
+ 'class' => 'fm-mini-title',
843
+ 'after' => '<br/>',
844
+ ),
845
+ array(
846
+ 'label' => 'Padding',
847
+ 'name' => 'COPPadding',
848
+ 'type' => 'text',
849
+ 'class' => '',
850
+ 'value' => isset($param_values->COPPadding) ? $param_values->COPPadding : '',
851
+ 'after' => 'px/%',
852
+ ),
853
+ array(
854
+ 'label' => 'Margin',
855
+ 'name' => 'COPMargin',
856
+ 'type' => 'text',
857
+ 'class' => '',
858
+ 'value' => isset($param_values->COPMargin) ? $param_values->COPMargin : '',
859
+ 'after' => 'px/%',
860
+ ),
861
+ array(
862
+ 'label' => 'Footer Parameters',
863
+ 'type' => 'label',
864
+ 'class' => 'fm-mini-title',
865
+ 'after' => '<br/>',
866
+ ),
867
+ array(
868
+ 'label' => 'Width',
869
+ 'name' => 'FPWidth',
870
+ 'type' => 'text',
871
+ 'class' => '',
872
+ 'value' => isset($param_values->FPWidth) ? $param_values->FPWidth : '',
873
+ 'after' => '%',
874
+ ),
875
+ array(
876
+ 'label' => 'Padding',
877
+ 'name' => 'FPPadding',
878
+ 'type' => 'text',
879
+ 'class' => '',
880
+ 'value' => isset($param_values->FPPadding) ? $param_values->FPPadding : '',
881
+ 'after' => 'px/%',
882
+ ),
883
+ array(
884
+ 'label' => 'Margin',
885
+ 'name' => 'FPMargin',
886
+ 'type' => 'text',
887
+ 'class' => '',
888
+ 'value' => isset($param_values->FPMargin) ? $param_values->FPMargin : '',
889
+ 'after' => 'px/%</div>',
890
+ ),
891
+ ),
892
+ 'input_select' => array(
893
+ array(
894
+ 'label' => '',
895
+ 'type' => 'panel',
896
+ 'class' => 'col-md-12',
897
+ 'label_class' => '',
898
+ 'after' => '',
899
+ ),
900
+ array(
901
+ 'label' => 'Height',
902
+ 'name' => 'IPHeight',
903
+ 'type' => 'text',
904
+ 'class' => '',
905
+ 'value' => isset($param_values->IPHeight) ? $param_values->IPHeight : '',
906
+ 'after' => 'px',
907
+ ),
908
+ array(
909
+ 'label' => 'Font Size',
910
+ 'name' => 'IPFontSize',
911
+ 'type' => 'text',
912
+ 'class' => '',
913
+ 'value' => isset($param_values->IPFontSize) ? $param_values->IPFontSize : '',
914
+ 'after' => 'px',
915
+ ),
916
+ array(
917
+ 'label' => 'Font Weight',
918
+ 'name' => 'IPFontWeight',
919
+ 'type' => 'select',
920
+ 'options' => $font_weights,
921
+ 'class' => '',
922
+ 'value' => isset($param_values->IPFontWeight) ? $param_values->IPFontWeight : '',
923
+ 'after' => '',
924
+ ),
925
+ array(
926
+ 'label' => 'Background Color',
927
+ 'name' => 'IPBGColor',
928
+ 'type' => 'text',
929
+ 'class' => 'color',
930
+ 'value' => isset($param_values->IPBGColor) ? $param_values->IPBGColor : '',
931
+ 'after' => '',
932
+ ),
933
+ array(
934
+ 'label' => 'Color',
935
+ 'name' => 'IPColor',
936
+ 'type' => 'text',
937
+ 'class' => 'color',
938
+ 'value' => isset($param_values->IPColor) ? $param_values->IPColor : '',
939
+ 'after' => '',
940
+ ),
941
+ array(
942
+ 'label' => 'Padding',
943
+ 'name' => 'IPPadding',
944
+ 'type' => 'text',
945
+ 'class' => '',
946
+ 'value' => isset($param_values->IPPadding) ? $param_values->IPPadding : '',
947
+ 'after' => 'px/%',
948
+ ),
949
+ array(
950
+ 'label' => 'Margin',
951
+ 'name' => 'IPMargin',
952
+ 'type' => 'text',
953
+ 'class' => '',
954
+ 'value' => isset($param_values->IPMargin) ? $param_values->IPMargin : '',
955
+ 'after' => 'px/%',
956
+ ),
957
+ array(
958
+ 'label' => 'Border',
959
+ 'name' => 'IPBorder',
960
+ 'type' => 'checkbox',
961
+ 'options' => $borders,
962
+ 'class' => '',
963
+ 'after' => '',
964
+ ),
965
+ array(
966
+ 'label' => 'Border Color',
967
+ 'name' => 'IPBorderColor',
968
+ 'type' => 'text',
969
+ 'class' => 'color',
970
+ 'value' => isset($param_values->IPBorderColor) ? $param_values->IPBorderColor : '',
971
+ 'after' => '',
972
+ ),
973
+ array(
974
+ 'label' => 'Border Type',
975
+ 'name' => 'IPBorderType',
976
+ 'type' => 'select',
977
+ 'options' => $border_types,
978
+ 'class' => '',
979
+ 'value' => isset($param_values->IPBorderType) ? $param_values->IPBorderType : '',
980
+ 'after' => '',
981
+ ),
982
+ array(
983
+ 'label' => 'Border Width',
984
+ 'name' => 'IPBorderWidth',
985
+ 'type' => 'text',
986
+ 'class' => '',
987
+ 'value' => isset($param_values->IPBorderWidth) ? $param_values->IPBorderWidth : '',
988
+ 'after' => 'px',
989
+ ),
990
+ array(
991
+ 'label' => 'Border Radius',
992
+ 'name' => 'IPBorderRadius',
993
+ 'type' => 'text',
994
+ 'class' => '',
995
+ 'value' => isset($param_values->IPBorderRadius) ? $param_values->IPBorderRadius : '',
996
+ 'after' => 'px',
997
+ ),
998
+ array(
999
+ 'label' => 'Box Shadow',
1000
+ 'name' => 'IPBoxShadow',
1001
+ 'type' => 'text',
1002
+ 'class' => '',
1003
+ 'value' => isset($param_values->IPBoxShadow) ? $param_values->IPBoxShadow : '',
1004
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
1005
+ 'after' => '</div>',
1006
+ ),
1007
+ array(
1008
+ 'label' => 'Dropdown additional',
1009
+ 'type' => 'panel',
1010
+ 'class' => 'col-md-12',
1011
+ 'label_class' => 'fm-mini-title',
1012
+ 'after' => '<br/>',
1013
+ ),
1014
+ array(
1015
+ 'label' => 'Appearance',
1016
+ 'name' => 'SBPAppearance',
1017
+ 'type' => 'text',
1018
+ 'class' => '',
1019
+ 'value' => isset($param_values->SBPAppearance) ? $param_values->SBPAppearance : '',
1020
+ 'after' => '',
1021
+ ),
1022
+ array(
1023
+ 'label' => 'Background URL',
1024
+ 'name' => 'SBPBackground',
1025
+ 'type' => 'text',
1026
+ 'class' => '',
1027
+ 'value' => isset($param_values->SBPBackground) ? $param_values->SBPBackground : '',
1028
+ 'after' => '',
1029
+ ),
1030
+ array(
1031
+ 'label' => 'Background Repeat',
1032
+ 'name' => 'SBPBGRepeat',
1033
+ 'type' => 'select',
1034
+ 'options' => $bg_repeats,
1035
+ 'class' => '',
1036
+ 'value' => isset($param_values->SBPBGRepeat) ? $param_values->SBPBGRepeat : '',
1037
+ 'after' => '',
1038
+ ),
1039
+ array(
1040
+ 'label' => 'Background Position',
1041
+ 'name1' => 'SBPBGPos1',
1042
+ 'name2' => 'SBPBGPos2',
1043
+ 'type' => '2text',
1044
+ 'class' => 'fm-2text',
1045
+ 'value1' => isset($param_values->SBPBGPos1) ? $param_values->SBPBGPos1 : '',
1046
+ 'value2' => isset($param_values->SBPBGPos2) ? $param_values->SBPBGPos2 : '',
1047
+ 'before1' => '',
1048
+ 'before2' => '',
1049
+ 'after' => '%/left..',
1050
+ ),
1051
+ array(
1052
+ 'label' => 'Background Size',
1053
+ 'name1' => 'SBPBGSize1',
1054
+ 'name2' => 'SBPBGSize2',
1055
+ 'type' => '2text',
1056
+ 'class' => 'fm-2text',
1057
+ 'value1' => isset($param_values->SBPBGSize1) ? $param_values->SBPBGSize1 : '',
1058
+ 'value2' => isset($param_values->SBPBGSize2) ? $param_values->SBPBGSize2 : '',
1059
+ 'before1' => '',
1060
+ 'before2' => '',
1061
+ 'after' => '%/px',
1062
+ ),
1063
+ array(
1064
+ 'label' => '',
1065
+ 'type' => 'label',
1066
+ 'class' => '',
1067
+ 'after' => '</div>',
1068
+ ),
1069
+ ),
1070
+ 'choices' => array(
1071
+ array(
1072
+ 'label' => 'Single Choice',
1073
+ 'type' => 'panel',
1074
+ 'class' => 'col-md-6',
1075
+ 'label_class' => 'fm-mini-title',
1076
+ 'after' => '<br/>',
1077
+ ),
1078
+ array(
1079
+ 'label' => 'Input Parameters',
1080
+ 'type' => 'label',
1081
+ 'class' => 'fm-mini-title',
1082
+ 'after' => '<br/>',
1083
+ ),
1084
+ array(
1085
+ 'label' => 'Background Color',
1086
+ 'name' => 'SCPBGColor',
1087
+ 'type' => 'text',
1088
+ 'class' => 'color',
1089
+ 'value' => isset($param_values->SCPBGColor) ? $param_values->SCPBGColor : '',
1090
+ 'after' => '',
1091
+ ),
1092
+ array(
1093
+ 'label' => 'Width',
1094
+ 'name' => 'SCPWidth',
1095
+ 'type' => 'text',
1096
+ 'class' => '',
1097
+ 'value' => isset($param_values->SCPWidth) ? $param_values->SCPWidth : '',
1098
+ 'after' => 'px',
1099
+ ),
1100
+ array(
1101
+ 'label' => 'Height',
1102
+ 'name' => 'SCPHeight',
1103
+ 'type' => 'text',
1104
+ 'class' => '',
1105
+ 'value' => isset($param_values->SCPHeight) ? $param_values->SCPHeight : '',
1106
+ 'after' => 'px',
1107
+ ),
1108
+ array(
1109
+ 'label' => 'Border',
1110
+ 'name' => 'SCPBorder',
1111
+ 'type' => 'checkbox',
1112
+ 'options' => $borders,
1113
+ 'class' => '',
1114
+ 'after' => '',
1115
+ ),
1116
+ array(
1117
+ 'label' => 'Border Color',
1118
+ 'name' => 'SCPBorderColor',
1119
+ 'type' => 'text',
1120
+ 'class' => 'color',
1121
+ 'value' => isset($param_values->SCPBorderColor) ? $param_values->SCPBorderColor : '',
1122
+ 'after' => '',
1123
+ ),
1124
+ array(
1125
+ 'label' => 'Border Type',
1126
+ 'name' => 'SCPBorderType',
1127
+ 'type' => 'select',
1128
+ 'options' => $border_types,
1129
+ 'class' => '',
1130
+ 'value' => isset($param_values->SCPBorderType) ? $param_values->SCPBorderType : '',
1131
+ 'after' => '',
1132
+ ),
1133
+ array(
1134
+ 'label' => 'Border Width',
1135
+ 'name' => 'SCPBorderWidth',
1136
+ 'type' => 'text',
1137
+ 'class' => '',
1138
+ 'value' => isset($param_values->SCPBorderWidth) ? $param_values->SCPBorderWidth : '',
1139
+ 'after' => 'px',
1140
+ ),
1141
+ array(
1142
+ 'label' => 'Margin',
1143
+ 'name' => 'SCPMargin',
1144
+ 'type' => 'text',
1145
+ 'class' => '5px',
1146
+ 'value' => isset($param_values->SCPMargin) ? $param_values->SCPMargin : '',
1147
+ 'after' => '',
1148
+ ),
1149
+ array(
1150
+ 'label' => 'Border Radius',
1151
+ 'name' => 'SCPBorderRadius',
1152
+ 'type' => 'text',
1153
+ 'class' => '',
1154
+ 'value' => isset($param_values->SCPBorderRadius) ? $param_values->SCPBorderRadius : '',
1155
+ 'after' => 'px',
1156
+ ),
1157
+ array(
1158
+ 'label' => 'Box Shadow',
1159
+ 'name' => 'SCPBoxShadow',
1160
+ 'type' => 'text',
1161
+ 'class' => '',
1162
+ 'value' => isset($param_values->SCPBoxShadow) ? $param_values->SCPBoxShadow : '',
1163
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
1164
+ 'after' => '',
1165
+ ),
1166
+ array(
1167
+ 'label' => 'Checked Parameters',
1168
+ 'type' => 'label',
1169
+ 'class' => 'fm-mini-title',
1170
+ 'after' => '<br/>',
1171
+ ),
1172
+ array(
1173
+ 'label' => 'Background Color',
1174
+ 'name' => 'SCCPBGColor',
1175
+ 'type' => 'text',
1176
+ 'class' => 'color',
1177
+ 'value' => isset($param_values->SCCPBGColor) ? $param_values->SCCPBGColor : '',
1178
+ 'after' => '',
1179
+ ),
1180
+ array(
1181
+ 'label' => 'Width',
1182
+ 'name' => 'SCCPWidth',
1183
+ 'type' => 'text',
1184
+ 'class' => '',
1185
+ 'value' => isset($param_values->SCCPWidth) ? $param_values->SCCPWidth : '',
1186
+ 'after' => 'px',
1187
+ ),
1188
+ array(
1189
+ 'label' => 'Height',
1190
+ 'name' => 'SCCPHeight',
1191
+ 'type' => 'text',
1192
+ 'class' => '',
1193
+ 'value' => isset($param_values->SCCPHeight) ? $param_values->SCCPHeight : '',
1194
+ 'after' => 'px',
1195
+ ),
1196
+ array(
1197
+ 'label' => 'Margin',
1198
+ 'name' => 'SCCPMargin',
1199
+ 'type' => 'text',
1200
+ 'class' => '',
1201
+ 'value' => isset($param_values->SCCPMargin) ? $param_values->SCCPMargin : '',
1202
+ 'after' => '',
1203
+ ),
1204
+ array(
1205
+ 'label' => 'Border Radius',
1206
+ 'name' => 'SCCPBorderRadius',
1207
+ 'type' => 'text',
1208
+ 'class' => '',
1209
+ 'value' => isset($param_values->SCCPBorderRadius) ? $param_values->SCCPBorderRadius : '',
1210
+ 'after' => 'px</div>',
1211
+ ),
1212
+ array(
1213
+ 'label' => 'Multiple Choice',
1214
+ 'type' => 'panel',
1215
+ 'class' => 'col-md-6',
1216
+ 'label_class' => 'fm-mini-title',
1217
+ 'after' => '<br/>',
1218
+ ),
1219
+ array(
1220
+ 'label' => 'Input Parameters',
1221
+ 'type' => 'label',
1222
+ 'class' => 'fm-mini-title',
1223
+ 'after' => '<br/>',
1224
+ ),
1225
+ array(
1226
+ 'label' => 'Background Color',
1227
+ 'name' => 'MCPBGColor',
1228
+ 'type' => 'text',
1229
+ 'class' => 'color',
1230
+ 'value' => isset($param_values->MCPBGColor) ? $param_values->MCPBGColor : '',
1231
+ 'after' => '',
1232
+ ),
1233
+ array(
1234
+ 'label' => 'Width',
1235
+ 'name' => 'MCPWidth',
1236
+ 'type' => 'text',
1237
+ 'class' => '',
1238
+ 'value' => isset($param_values->MCPWidth) ? $param_values->MCPWidth : '',
1239
+ 'after' => 'px',
1240
+ ),
1241
+ array(
1242
+ 'label' => 'Height',
1243
+ 'name' => 'MCPHeight',
1244
+ 'type' => 'text',
1245
+ 'class' => '',
1246
+ 'value' => isset($param_values->MCPHeight) ? $param_values->MCPHeight : '',
1247
+ 'after' => 'px',
1248
+ ),
1249
+ array(
1250
+ 'label' => 'Border',
1251
+ 'name' => 'MCPBorder',
1252
+ 'type' => 'checkbox',
1253
+ 'options' => $borders,
1254
+ 'class' => '',
1255
+ 'after' => '',
1256
+ ),
1257
+ array(
1258
+ 'label' => 'Border Color',
1259
+ 'name' => 'MCPBorderColor',
1260
+ 'type' => 'text',
1261
+ 'class' => 'color',
1262
+ 'value' => isset($param_values->MCPBorderColor) ? $param_values->MCPBorderColor : '',
1263
+ 'after' => '',
1264
+ ),
1265
+ array(
1266
+ 'label' => 'Border Type',
1267
+ 'name' => 'MCPBorderType',
1268
+ 'type' => 'select',
1269
+ 'options' => $border_types,
1270
+ 'class' => '',
1271
+ 'value' => isset($param_values->MCPBorderType) ? $param_values->MCPBorderType : '',
1272
+ 'after' => '',
1273
+ ),
1274
+ array(
1275
+ 'label' => 'Border Width',
1276
+ 'name' => 'MCPBorderWidth',
1277
+ 'type' => 'text',
1278
+ 'class' => '',
1279
+ 'value' => isset($param_values->MCPBorderWidth) ? $param_values->MCPBorderWidth : '',
1280
+ 'after' => 'px',
1281
+ ),
1282
+ array(
1283
+ 'label' => 'Margin',
1284
+ 'name' => 'MCPMargin',
1285
+ 'type' => 'text',
1286
+ 'class' => '5px',
1287
+ 'value' => isset($param_values->MCPMargin) ? $param_values->MCPMargin : '',
1288
+ 'after' => '',
1289
+ ),
1290
+ array(
1291
+ 'label' => 'Border Radius',
1292
+ 'name' => 'MCPBorderRadius',
1293
+ 'type' => 'text',
1294
+ 'class' => '',
1295
+ 'value' => isset($param_values->MCPBorderRadius) ? $param_values->MCPBorderRadius : '',
1296
+ 'after' => 'px',
1297
+ ),
1298
+ array(
1299
+ 'label' => 'Box Shadow',
1300
+ 'name' => 'MCPBoxShadow',
1301
+ 'type' => 'text',
1302
+ 'class' => '',
1303
+ 'value' => isset($param_values->MCPBoxShadow) ? $param_values->MCPBoxShadow : '',
1304
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
1305
+ 'after' => '',
1306
+ ),
1307
+ array(
1308
+ 'label' => 'Checked Parameters',
1309
+ 'type' => 'label',
1310
+ 'class' => 'fm-mini-title',
1311
+ 'after' => '<br/>',
1312
+ ),
1313
+ array(
1314
+ 'label' => 'Background Color',
1315
+ 'name' => 'MCCPBGColor',
1316
+ 'type' => 'text',
1317
+ 'class' => 'color',
1318
+ 'value' => isset($param_values->MCCPBGColor) ? $param_values->MCCPBGColor : '',
1319
+ 'after' => '',
1320
+ ),
1321
+ array(
1322
+ 'label' => 'Background URL',
1323
+ 'name' => 'MCCPBackground',
1324
+ 'type' => 'text',
1325
+ 'class' => '',
1326
+ 'value' => isset($param_values->MCCPBackground) ? $param_values->MCCPBackground : '',
1327
+ 'after' => '',
1328
+ ),
1329
+ array(
1330
+ 'label' => 'Background Repeat',
1331
+ 'name' => 'MCCPBGRepeat',
1332
+ 'type' => 'select',
1333
+ 'options' => $bg_repeats,
1334
+ 'class' => '',
1335
+ 'value' => isset($param_values->MCCPBGRepeat) ? $param_values->MCCPBGRepeat : '',
1336
+ 'after' => '',
1337
+ ),
1338
+ array(
1339
+ 'label' => 'Background Position',
1340
+ 'name1' => 'MCCPBGPos1',
1341
+ 'name2' => 'MCCPBGPos2',
1342
+ 'type' => '2text',
1343
+ 'class' => 'fm-2text',
1344
+ 'value1' => isset($param_values->MCCPBGPos1) ? $param_values->MCCPBGPos1 : '',
1345
+ 'value2' => isset($param_values->MCCPBGPos2) ? $param_values->MCCPBGPos2 : '',
1346
+ 'before1' => '',
1347
+ 'before2' => '',
1348
+ 'after' => '%/left..',
1349
+ ),
1350
+ array(
1351
+ 'label' => 'Width',
1352
+ 'name' => 'MCCPWidth',
1353
+ 'type' => 'text',
1354
+ 'class' => '',
1355
+ 'value' => isset($param_values->MCCPWidth) ? $param_values->MCCPWidth : '',
1356
+ 'after' => 'px',
1357
+ ),
1358
+ array(
1359
+ 'label' => 'Height',
1360
+ 'name' => 'MCCPHeight',
1361
+ 'type' => 'text',
1362
+ 'class' => '',
1363
+ 'value' => isset($param_values->MCCPHeight) ? $param_values->MCCPHeight : '',
1364
+ 'after' => 'px',
1365
+ ),
1366
+ array(
1367
+ 'label' => 'Margin',
1368
+ 'name' => 'MCCPMargin',
1369
+ 'type' => 'text',
1370
+ 'class' => '',
1371
+ 'value' => isset($param_values->MCCPMargin) ? $param_values->MCCPMargin : '',
1372
+ 'after' => '',
1373
+ ),
1374
+ array(
1375
+ 'label' => 'Border Radius',
1376
+ 'name' => 'MCCPBorderRadius',
1377
+ 'type' => 'text',
1378
+ 'class' => '',
1379
+ 'value' => isset($param_values->MCCPBorderRadius) ? $param_values->MCCPBorderRadius : '',
1380
+ 'after' => 'px</div>',
1381
+ ),
1382
+ ),
1383
+ 'subscribe' => array(
1384
+ array(
1385
+ 'label' => 'Global Parameters',
1386
+ 'type' => 'panel',
1387
+ 'class' => 'col-md-12',
1388
+ 'label_class' => 'fm-mini-title',
1389
+ 'after' => '<br/>',
1390
+ ),
1391
+ array(
1392
+ 'label' => 'Alignment',
1393
+ 'name' => 'SPAlign',
1394
+ 'type' => 'select',
1395
+ 'options' => $aligns_no_center,
1396
+ 'class' => '',
1397
+ 'value' => isset($param_values->SPAlign) ? $param_values->SPAlign : '',
1398
+ 'after' => '</div>',
1399
+ ),
1400
+ array(
1401
+ 'label' => 'Submit',
1402
+ 'type' => 'panel',
1403
+ 'class' => 'col-md-6',
1404
+ 'label_class' => 'fm-mini-title',
1405
+ 'after' => '<br/>',
1406
+ ),
1407
+ array(
1408
+ 'label' => 'Background Color',
1409
+ 'name' => 'SPBGColor',
1410
+ 'type' => 'text',
1411
+ 'class' => 'color',
1412
+ 'value' => isset($param_values->SPBGColor) ? $param_values->SPBGColor : '',
1413
+ 'after' => '',
1414
+ ),
1415
+ array(
1416
+ 'label' => 'Width',
1417
+ 'name' => 'SPWidth',
1418
+ 'type' => 'text',
1419
+ 'class' => '',
1420
+ 'value' => isset($param_values->SPWidth) ? $param_values->SPWidth : '',
1421
+ 'after' => 'px',
1422
+ ),
1423
+ array(
1424
+ 'label' => 'Height',
1425
+ 'name' => 'SPHeight',
1426
+ 'type' => 'text',
1427
+ 'class' => '',
1428
+ 'value' => isset($param_values->SPHeight) ? $param_values->SPHeight : '',
1429
+ 'after' => 'px',
1430
+ ),
1431
+ array(
1432
+ 'label' => 'Font Size',
1433
+ 'name' => 'SPFontSize',
1434
+ 'type' => 'text',
1435
+ 'class' => '',
1436
+ 'value' => isset($param_values->SPFontSize) ? $param_values->SPFontSize : '',
1437
+ 'after' => 'px',
1438
+ ),
1439
+ array(
1440
+ 'label' => 'Font Weight',
1441
+ 'name' => 'SPFontWeight',
1442
+ 'type' => 'select',
1443
+ 'options' => $font_weights,
1444
+ 'class' => '',
1445
+ 'value' => isset($param_values->SPFontWeight) ? $param_values->SPFontWeight : '',
1446
+ 'after' => '',
1447
+ ),
1448
+ array(
1449
+ 'label' => 'Color',
1450
+ 'name' => 'SPColor',
1451
+ 'type' => 'text',
1452
+ 'class' => 'color',
1453
+ 'value' => isset($param_values->SPColor) ? $param_values->SPColor : '',
1454
+ 'after' => '',
1455
+ ),
1456
+ array(
1457
+ 'label' => 'Padding',
1458
+ 'name' => 'SPPadding',
1459
+ 'type' => 'text',
1460
+ 'class' => '',
1461
+ 'value' => isset($param_values->SPPadding) ? $param_values->SPPadding : '',
1462
+ 'after' => 'px/%',
1463
+ ),
1464
+ array(
1465
+ 'label' => 'Margin',
1466
+ 'name' => 'SPMargin',
1467
+ 'type' => 'text',
1468
+ 'class' => '',
1469
+ 'value' => isset($param_values->SPMargin) ? $param_values->SPMargin : '',
1470
+ 'after' => 'px/%',
1471
+ ),
1472
+ array(
1473
+ 'label' => 'Border',
1474
+ 'name' => 'SPBorder',
1475
+ 'type' => 'checkbox',
1476
+ 'options' => $borders,
1477
+ 'class' => '',
1478
+ 'after' => '',
1479
+ ),
1480
+ array(
1481
+ 'label' => 'Border Color',
1482
+ 'name' => 'SPBorderColor',
1483
+ 'type' => 'text',
1484
+ 'class' => 'color',
1485
+ 'value' => isset($param_values->SPBorderColor) ? $param_values->SPBorderColor : '',
1486
+ 'after' => '',
1487
+ ),
1488
+ array(
1489
+ 'label' => 'Border Type',
1490
+ 'name' => 'SPBorderType',
1491
+ 'type' => 'select',
1492
+ 'options' => $border_types,
1493
+ 'class' => '',
1494
+ 'value' => isset($param_values->SPBorderType) ? $param_values->SPBorderType : '',
1495
+ 'after' => '',
1496
+ ),
1497
+ array(
1498
+ 'label' => 'Border Width',
1499
+ 'name' => 'SPBorderWidth',
1500
+ 'type' => 'text',
1501
+ 'class' => '',
1502
+ 'value' => isset($param_values->SPBorderWidth) ? $param_values->SPBorderWidth : '',
1503
+ 'after' => 'px',
1504
+ ),
1505
+ array(
1506
+ 'label' => 'Border Radius',
1507
+ 'name' => 'SPBorderRadius',
1508
+ 'type' => 'text',
1509
+ 'class' => '',
1510
+ 'value' => isset($param_values->SPBorderRadius) ? $param_values->SPBorderRadius : '',
1511
+ 'after' => 'px',
1512
+ ),
1513
+ array(
1514
+ 'label' => 'Box Shadow',
1515
+ 'name' => 'SPBoxShadow',
1516
+ 'type' => 'text',
1517
+ 'class' => '',
1518
+ 'value' => isset($param_values->SPBoxShadow) ? $param_values->SPBoxShadow : '',
1519
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
1520
+ 'after' => '',
1521
+ ),
1522
+ array(
1523
+ 'label' => 'Hover Parameters',
1524
+ 'type' => 'label',
1525
+ 'class' => 'fm-mini-title',
1526
+ 'after' => '<br/>',
1527
+ ),
1528
+ array(
1529
+ 'label' => 'Background Color',
1530
+ 'name' => 'SHPBGColor',
1531
+ 'type' => 'text',
1532
+ 'class' => 'color',
1533
+ 'value' => isset($param_values->SHPBGColor) ? $param_values->SHPBGColor : '',
1534
+ 'after' => '',
1535
+ ),
1536
+ array(
1537
+ 'label' => 'Color',
1538
+ 'name' => 'SHPColor',
1539
+ 'type' => 'text',
1540
+ 'class' => 'color',
1541
+ 'value' => isset($param_values->SHPColor) ? $param_values->SHPColor : '',
1542
+ 'after' => '',
1543
+ ),
1544
+ array(
1545
+ 'label' => 'Border',
1546
+ 'name' => 'SHPBorder',
1547
+ 'type' => 'checkbox',
1548
+ 'options' => $borders,
1549
+ 'class' => '',
1550
+ 'after' => '',
1551
+ ),
1552
+ array(
1553
+ 'label' => 'Border Color',
1554
+ 'name' => 'SHPBorderColor',
1555
+ 'type' => 'text',
1556
+ 'class' => 'color',
1557
+ 'value' => isset($param_values->SHPBorderColor) ? $param_values->SHPBorderColor : '',
1558
+ 'after' => '',
1559
+ ),
1560
+ array(
1561
+ 'label' => 'Border Type',
1562
+ 'name' => 'SHPBorderType',
1563
+ 'type' => 'select',
1564
+ 'options' => $border_types,
1565
+ 'class' => '',
1566
+ 'value' => isset($param_values->SHPBorderType) ? $param_values->SHPBorderType : '',
1567
+ 'after' => '',
1568
+ ),
1569
+ array(
1570
+ 'label' => 'Border Width',
1571
+ 'name' => 'SHPBorderWidth',
1572
+ 'type' => 'text',
1573
+ 'class' => '',
1574
+ 'value' => isset($param_values->SHPBorderWidth) ? $param_values->SHPBorderWidth : '',
1575
+ 'after' => 'px</div>',
1576
+ ),
1577
+ array(
1578
+ 'label' => 'Reset',
1579
+ 'type' => 'panel',
1580
+ 'class' => 'col-md-6',
1581
+ 'label_class' => 'fm-mini-title',
1582
+ 'after' => '<br/>',
1583
+ ),
1584
+ array(
1585
+ 'label' => 'Background Color',
1586
+ 'name' => 'BPBGColor',
1587
+ 'type' => 'text',
1588
+ 'class' => 'color',
1589
+ 'value' => isset($param_values->BPBGColor) ? $param_values->BPBGColor : '',
1590
+ 'after' => '',
1591
+ ),
1592
+ array(
1593
+ 'label' => 'Width',
1594
+ 'name' => 'BPWidth',
1595
+ 'type' => 'text',
1596
+ 'class' => '',
1597
+ 'value' => isset($param_values->BPWidth) ? $param_values->BPWidth : '',
1598
+ 'after' => 'px',
1599
+ ),
1600
+ array(
1601
+ 'label' => 'Height',
1602
+ 'name' => 'BPHeight',
1603
+ 'type' => 'text',
1604
+ 'class' => '',
1605
+ 'value' => isset($param_values->BPHeight) ? $param_values->BPHeight : '',
1606
+ 'after' => 'px',
1607
+ ),
1608
+ array(
1609
+ 'label' => 'Font Size',
1610
+ 'name' => 'BPFontSize',
1611
+ 'type' => 'text',
1612
+ 'class' => '',
1613
+ 'value' => isset($param_values->BPFontSize) ? $param_values->BPFontSize : '',
1614
+ 'after' => 'px',
1615
+ ),
1616
+ array(
1617
+ 'label' => 'Font Weight',
1618
+ 'name' => 'BPFontWeight',
1619
+ 'type' => 'select',
1620
+ 'options' => $font_weights,
1621
+ 'class' => '',
1622
+ 'value' => isset($param_values->BPFontWeight) ? $param_values->BPFontWeight : '',
1623
+ 'after' => '',
1624
+ ),
1625
+ array(
1626
+ 'label' => 'Color',
1627
+ 'name' => 'BPColor',
1628
+ 'type' => 'text',
1629
+ 'class' => 'color',
1630
+ 'value' => isset($param_values->BPColor) ? $param_values->BPColor : '',
1631
+ 'after' => '',
1632
+ ),
1633
+ array(
1634
+ 'label' => 'Padding',
1635
+ 'name' => 'BPPadding',
1636
+ 'type' => 'text',
1637
+ 'class' => '',
1638
+ 'value' => isset($param_values->BPPadding) ? $param_values->BPPadding : '',
1639
+ 'after' => 'px/%',
1640
+ ),
1641
+ array(
1642
+ 'label' => 'Margin',
1643
+ 'name' => 'BPMargin',
1644
+ 'type' => 'text',
1645
+ 'class' => '',
1646
+ 'value' => isset($param_values->BPMargin) ? $param_values->BPMargin : '',
1647
+ 'after' => 'px/%',
1648
+ ),
1649
+ array(
1650
+ 'label' => 'Border',
1651
+ 'name' => 'BPBorder',
1652
+ 'type' => 'checkbox',
1653
+ 'options' => $borders,
1654
+ 'class' => '',
1655
+ 'after' => '',
1656
+ ),
1657
+ array(
1658
+ 'label' => 'Border Color',
1659
+ 'name' => 'BPBorderColor',
1660
+ 'type' => 'text',
1661
+ 'class' => 'color',
1662
+ 'value' => isset($param_values->BPBorderColor) ? $param_values->BPBorderColor : '',
1663
+ 'after' => '',
1664
+ ),
1665
+ array(
1666
+ 'label' => 'Border Type',
1667
+ 'name' => 'BPBorderType',
1668
+ 'type' => 'select',
1669
+ 'options' => $border_types,
1670
+ 'class' => '',
1671
+ 'value' => isset($param_values->BPBorderType) ? $param_values->BPBorderType : '',
1672
+ 'after' => '',
1673
+ ),
1674
+ array(
1675
+ 'label' => 'Border Width',
1676
+ 'name' => 'BPBorderWidth',
1677
+ 'type' => 'text',
1678
+ 'class' => '',
1679
+ 'value' => isset($param_values->BPBorderWidth) ? $param_values->BPBorderWidth : '',
1680
+ 'after' => 'px',
1681
+ ),
1682
+ array(
1683
+ 'label' => 'Border Radius',
1684
+ 'name' => 'BPBorderRadius',
1685
+ 'type' => 'text',
1686
+ 'class' => '',
1687
+ 'value' => isset($param_values->BPBorderRadius) ? $param_values->BPBorderRadius : '',
1688
+ 'after' => 'px',
1689
+ ),
1690
+ array(
1691
+ 'label' => 'Box Shadow',
1692
+ 'name' => 'BPBoxShadow',
1693
+ 'type' => 'text',
1694
+ 'class' => '',
1695
+ 'value' => isset($param_values->BPBoxShadow) ? $param_values->BPBoxShadow : '',
1696
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
1697
+ 'after' => '',
1698
+ ),
1699
+ array(
1700
+ 'label' => 'Hover Parameters',
1701
+ 'type' => 'label',
1702
+ 'class' => 'fm-mini-title',
1703
+ 'after' => '<br/>',
1704
+ ),
1705
+ array(
1706
+ 'label' => 'Background Color',
1707
+ 'name' => 'BHPBGColor',
1708
+ 'type' => 'text',
1709
+ 'class' => 'color',
1710
+ 'value' => isset($param_values->BHPBGColor) ? $param_values->BHPBGColor : '',
1711
+ 'after' => '',
1712
+ ),
1713
+ array(
1714
+ 'label' => 'Color',
1715
+ 'name' => 'BHPColor',
1716
+ 'type' => 'text',
1717
+ 'class' => 'color',
1718
+ 'value' => isset($param_values->BHPColor) ? $param_values->BHPColor : '',
1719
+ 'after' => '',
1720
+ ),
1721
+ array(
1722
+ 'label' => 'Border',
1723
+ 'name' => 'BHPBorder',
1724
+ 'type' => 'checkbox',
1725
+ 'options' => $borders,
1726
+ 'class' => '',
1727
+ 'after' => '',
1728
+ ),
1729
+ array(
1730
+ 'label' => 'Border Color',
1731
+ 'name' => 'BHPBorderColor',
1732
+ 'type' => 'text',
1733
+ 'class' => 'color',
1734
+ 'value' => isset($param_values->BHPBorderColor) ? $param_values->BHPBorderColor : '',
1735
+ 'after' => '',
1736
+ ),
1737
+ array(
1738
+ 'label' => 'Border Type',
1739
+ 'name' => 'BHPBorderType',
1740
+ 'type' => 'select',
1741
+ 'options' => $border_types,
1742
+ 'class' => '',
1743
+ 'value' => isset($param_values->BHPBorderType) ? $param_values->BHPBorderType : '',
1744
+ 'after' => '',
1745
+ ),
1746
+ array(
1747
+ 'label' => 'Border Width',
1748
+ 'name' => 'BHPBorderWidth',
1749
+ 'type' => 'text',
1750
+ 'class' => '',
1751
+ 'value' => isset($param_values->BHPBorderWidth) ? $param_values->BHPBorderWidth : '',
1752
+ 'after' => 'px</div>',
1753
+ ),
1754
+ ),
1755
+ 'paigination' => array(
1756
+ array(
1757
+ 'label' => 'Active',
1758
+ 'type' => 'panel',
1759
+ 'class' => 'col-md-6',
1760
+ 'label_class' => 'fm-mini-title',
1761
+ 'after' => '',
1762
+ ),
1763
+ array(
1764
+ 'label' => 'Background Color',
1765
+ 'name' => 'PSAPBGColor',
1766
+ 'type' => 'text',
1767
+ 'class' => 'color',
1768
+ 'value' => isset($param_values->PSAPBGColor) ? $param_values->PSAPBGColor : '',
1769
+ 'after' => '',
1770
+ ),
1771
+ array(
1772
+ 'label' => 'Font Size',
1773
+ 'name' => 'PSAPFontSize',
1774
+ 'type' => 'text',
1775
+ 'class' => '',
1776
+ 'value' => isset($param_values->PSAPFontSize) ? $param_values->PSAPFontSize : '',
1777
+ 'after' => 'px',
1778
+ ),
1779
+ array(
1780
+ 'label' => 'Font Weight',
1781
+ 'name' => 'PSAPFontWeight',
1782
+ 'type' => 'select',
1783
+ 'options' => $font_weights,
1784
+ 'class' => '',
1785
+ 'value' => isset($param_values->PSAPFontWeight) ? $param_values->PSAPFontWeight : '',
1786
+ 'after' => '',
1787
+ ),
1788
+ array(
1789
+ 'label' => 'Color',
1790
+ 'name' => 'PSAPColor',
1791
+ 'type' => 'text',
1792
+ 'class' => 'color',
1793
+ 'value' => isset($param_values->PSAPColor) ? $param_values->PSAPColor : '',
1794
+ 'after' => '',
1795
+ ),
1796
+ array(
1797
+ 'label' => 'Height',
1798
+ 'name' => 'PSAPHeight',
1799
+ 'type' => 'text',
1800
+ 'class' => '',
1801
+ 'value' => isset($param_values->PSAPHeight) ? $param_values->PSAPHeight : '',
1802
+ 'after' => 'px',
1803
+ ),
1804
+ array(
1805
+ 'label' => 'Line Height',
1806
+ 'name' => 'PSAPLineHeight',
1807
+ 'type' => 'text',
1808
+ 'class' => '',
1809
+ 'value' => isset($param_values->PSAPLineHeight) ? $param_values->PSAPLineHeight : '',
1810
+ 'after' => 'px',
1811
+ ),
1812
+ array(
1813
+ 'label' => 'Padding',
1814
+ 'name' => 'PSAPPadding',
1815
+ 'type' => 'text',
1816
+ 'class' => '',
1817
+ 'value' => isset($param_values->PSAPPadding) ? $param_values->PSAPPadding : '',
1818
+ 'after' => 'px/%',
1819
+ ),
1820
+ array(
1821
+ 'label' => 'Margin',
1822
+ 'name' => 'PSAPMargin',
1823
+ 'type' => 'text',
1824
+ 'class' => '',
1825
+ 'value' => isset($param_values->PSAPMargin) ? $param_values->PSAPMargin : '',
1826
+ 'after' => 'px/%',
1827
+ ),
1828
+ array(
1829
+ 'label' => 'Border',
1830
+ 'name' => 'PSAPBorder',
1831
+ 'type' => 'checkbox',
1832
+ 'options' => $borders,
1833
+ 'class' => '',
1834
+ 'after' => '',
1835
+ ),
1836
+ array(
1837
+ 'label' => 'Border Color',
1838
+ 'name' => 'PSAPBorderColor',
1839
+ 'type' => 'text',
1840
+ 'class' => 'color',
1841
+ 'value' => isset($param_values->PSAPBorderColor) ? $param_values->PSAPBorderColor : '',
1842
+ 'after' => '',
1843
+ ),
1844
+ array(
1845
+ 'label' => 'Border Type',
1846
+ 'name' => 'PSAPBorderType',
1847
+ 'type' => 'select',
1848
+ 'options' => $border_types,
1849
+ 'class' => '',
1850
+ 'value' => isset($param_values->PSAPBorderType) ? $param_values->PSAPBorderType : '',
1851
+ 'after' => '',
1852
+ ),
1853
+ array(
1854
+ 'label' => 'Border Width',
1855
+ 'name' => 'PSAPBorderWidth',
1856
+ 'type' => 'text',
1857
+ 'class' => '',
1858
+ 'value' => isset($param_values->PSAPBorderWidth) ? $param_values->PSAPBorderWidth : '',
1859
+ 'after' => 'px',
1860
+ ),
1861
+ array(
1862
+ 'label' => 'Border Radius',
1863
+ 'name' => 'PSAPBorderRadius',
1864
+ 'type' => 'text',
1865
+ 'class' => '',
1866
+ 'value' => isset($param_values->PSAPBorderRadius) ? $param_values->PSAPBorderRadius : '',
1867
+ 'after' => 'px</div>',
1868
+ ),
1869
+ array(
1870
+ 'label' => 'Deactive',
1871
+ 'type' => 'panel',
1872
+ 'class' => 'col-md-6',
1873
+ 'label_class' => 'fm-mini-title',
1874
+ 'after' => '',
1875
+ ),
1876
+ array(
1877
+ 'label' => 'Background Color',
1878
+ 'name' => 'PSDPBGColor',
1879
+ 'type' => 'text',
1880
+ 'class' => 'color',
1881
+ 'value' => isset($param_values->PSDPBGColor) ? $param_values->PSDPBGColor : '',
1882
+ 'after' => '',
1883
+ ),
1884
+ array(
1885
+ 'label' => 'Font Size',
1886
+ 'name' => 'PSDPFontSize',
1887
+ 'type' => 'text',
1888
+ 'class' => '',
1889
+ 'value' => isset($param_values->PSDPFontSize) ? $param_values->PSDPFontSize : '',
1890
+ 'after' => 'px',
1891
+ ),
1892
+ array(
1893
+ 'label' => 'Font Weight',
1894
+ 'name' => 'PSDPFontWeight',
1895
+ 'type' => 'select',
1896
+ 'options' => $font_weights,
1897
+ 'class' => '',
1898
+ 'value' => isset($param_values->PSDPFontWeight) ? $param_values->PSDPFontWeight : '',
1899
+ 'after' => '',
1900
+ ),
1901
+ array(
1902
+ 'label' => 'Color',
1903
+ 'name' => 'PSDPColor',
1904
+ 'type' => 'text',
1905
+ 'class' => 'color',
1906
+ 'value' => isset($param_values->PSDPColor) ? $param_values->PSDPColor : '',
1907
+ 'after' => '',
1908
+ ),
1909
+ array(
1910
+ 'label' => 'Height',
1911
+ 'name' => 'PSDPHeight',
1912
+ 'type' => 'text',
1913
+ 'class' => '',
1914
+ 'value' => isset($param_values->PSDPHeight) ? $param_values->PSDPHeight : '',
1915
+ 'after' => 'px',
1916
+ ),
1917
+ array(
1918
+ 'label' => 'Line Height',
1919
+ 'name' => 'PSDPLineHeight',
1920
+ 'type' => 'text',
1921
+ 'class' => '',
1922
+ 'value' => isset($param_values->PSDPLineHeight) ? $param_values->PSDPLineHeight : '',
1923
+ 'after' => 'px',
1924
+ ),
1925
+ array(
1926
+ 'label' => 'Padding',
1927
+ 'name' => 'PSDPPadding',
1928
+ 'type' => 'text',
1929
+ 'class' => '',
1930
+ 'value' => isset($param_values->PSDPPadding) ? $param_values->PSDPPadding : '',
1931
+ 'after' => 'px/%',
1932
+ ),
1933
+ array(
1934
+ 'label' => 'Margin',
1935
+ 'name' => 'PSDPMargin',
1936
+ 'type' => 'text',
1937
+ 'class' => '',
1938
+ 'value' => isset($param_values->PSDPMargin) ? $param_values->PSDPMargin : '',
1939
+ 'after' => 'px/%',
1940
+ ),
1941
+ array(
1942
+ 'label' => 'Border',
1943
+ 'name' => 'PSDPBorder',
1944
+ 'type' => 'checkbox',
1945
+ 'options' => $borders,
1946
+ 'class' => '',
1947
+ 'after' => '',
1948
+ ),
1949
+ array(
1950
+ 'label' => 'Border Color',
1951
+ 'name' => 'PSDPBorderColor',
1952
+ 'type' => 'text',
1953
+ 'class' => 'color',
1954
+ 'value' => isset($param_values->PSDPBorderColor) ? $param_values->PSDPBorderColor : '',
1955
+ 'after' => '',
1956
+ ),
1957
+ array(
1958
+ 'label' => 'Border Type',
1959
+ 'name' => 'PSDPBorderType',
1960
+ 'type' => 'select',
1961
+ 'options' => $border_types,
1962
+ 'class' => '',
1963
+ 'value' => isset($param_values->PSDPBorderType) ? $param_values->PSDPBorderType : '',
1964
+ 'after' => '',
1965
+ ),
1966
+ array(
1967
+ 'label' => 'Border Width',
1968
+ 'name' => 'PSDPBorderWidth',
1969
+ 'type' => 'text',
1970
+ 'class' => '',
1971
+ 'value' => isset($param_values->PSDPBorderWidth) ? $param_values->PSDPBorderWidth : '',
1972
+ 'after' => 'px',
1973
+ ),
1974
+ array(
1975
+ 'label' => 'Border Radius',
1976
+ 'name' => 'PSDPBorderRadius',
1977
+ 'type' => 'text',
1978
+ 'class' => '',
1979
+ 'value' => isset($param_values->PSDPBorderRadius) ? $param_values->PSDPBorderRadius : '',
1980
+ 'after' => 'px</div>',
1981
+ ),
1982
+ array(
1983
+ 'label' => 'Steps',
1984
+ 'type' => 'panel',
1985
+ 'class' => 'col-md-12',
1986
+ 'label_class' => 'fm-mini-title',
1987
+ 'after' => '',
1988
+ ),
1989
+ array(
1990
+ 'label' => 'Alignment',
1991
+ 'name' => 'PSAPAlign',
1992
+ 'type' => 'select',
1993
+ 'options' => $aligns,
1994
+ 'class' => '',
1995
+ 'value' => isset($param_values->PSAPAlign) ? $param_values->PSAPAlign : '',
1996
+ 'after' => '',
1997
+ ),
1998
+ array(
1999
+ 'label' => 'Width',
2000
+ 'name' => 'PSAPWidth',
2001
+ 'type' => 'text',
2002
+ 'class' => '',
2003
+ 'value' => isset($param_values->PSAPWidth) ? $param_values->PSAPWidth : '',
2004
+ 'after' => 'px</div>',
2005
+ ),
2006
+ array(
2007
+ 'label' => 'Percentage',
2008
+ 'type' => 'panel',
2009
+ 'class' => 'col-md-12',
2010
+ 'label_class' => 'fm-mini-title',
2011
+ 'after' => '',
2012
+ ),
2013
+ array(
2014
+ 'label' => 'Width',
2015
+ 'name' => 'PPAPWidth',
2016
+ 'type' => 'text',
2017
+ 'class' => '',
2018
+ 'value' => isset($param_values->PPAPWidth) ? $param_values->PPAPWidth : '',
2019
+ 'placeholder' => 'e.g. 100% or 500px',
2020
+ 'after' => 'px/%</div>',
2021
+ ),
2022
+ ),
2023
+ 'buttons' => array(
2024
+ array(
2025
+ 'label' => 'Global Parameters',
2026
+ 'type' => 'panel',
2027
+ 'class' => 'col-md-12',
2028
+ 'label_class' => 'fm-mini-title',
2029
+ 'after' => '<br/>',
2030
+ ),
2031
+ array(
2032
+ 'label' => 'Font Size',
2033
+ 'name' => 'BPFontSize',
2034
+ 'type' => 'text',
2035
+ 'class' => '',
2036
+ 'value' => isset($param_values->BPFontSize) ? $param_values->BPFontSize : '',
2037
+ 'after' => 'px',
2038
+ ),
2039
+ array(
2040
+ 'label' => 'Font Weight',
2041
+ 'name' => 'BPFontWeight',
2042
+ 'type' => 'select',
2043
+ 'options' => $font_weights,
2044
+ 'class' => '',
2045
+ 'value' => isset($param_values->BPFontWeight) ? $param_values->BPFontWeight : '',
2046
+ 'after' => '</div>',
2047
+ ),
2048
+ array(
2049
+ 'label' => 'Next Button Parameters',
2050
+ 'type' => 'panel',
2051
+ 'class' => 'col-md-6',
2052
+ 'label_class' => 'fm-mini-title',
2053
+ 'after' => '<br/>',
2054
+ ),
2055
+ array(
2056
+ 'label' => 'Background Color',
2057
+ 'name' => 'NBPBGColor',
2058
+ 'type' => 'text',
2059
+ 'class' => 'color',
2060
+ 'value' => isset($param_values->NBPBGColor) ? $param_values->NBPBGColor : '',
2061
+ 'after' => '',
2062
+ ),
2063
+ array(
2064
+ 'label' => 'Width',
2065
+ 'name' => 'NBPWidth',
2066
+ 'type' => 'text',
2067
+ 'class' => '',
2068
+ 'value' => isset($param_values->NBPWidth) ? $param_values->NBPWidth : '',
2069
+ 'after' => 'px',
2070
+ ),
2071
+ array(
2072
+ 'label' => 'Height',
2073
+ 'name' => 'NBPHeight',
2074
+ 'type' => 'text',
2075
+ 'class' => '',
2076
+ 'value' => isset($param_values->NBPHeight) ? $param_values->NBPHeight : '',
2077
+ 'after' => 'px',
2078
+ ),
2079
+ array(
2080
+ 'label' => 'Line Height',
2081
+ 'name' => 'NBPLineHeight',
2082
+ 'type' => 'text',
2083
+ 'class' => '',
2084
+ 'value' => isset($param_values->NBPLineHeight) ? $param_values->NBPLineHeight : '',
2085
+ 'after' => 'px',
2086
+ ),
2087
+ array(
2088
+ 'label' => 'Color',
2089
+ 'name' => 'NBPColor',
2090
+ 'type' => 'text',
2091
+ 'class' => 'color',
2092
+ 'value' => isset($param_values->NBPColor) ? $param_values->NBPColor : '',
2093
+ 'after' => '',
2094
+ ),
2095
+ array(
2096
+ 'label' => 'Padding',
2097
+ 'name' => 'NBPPadding',
2098
+ 'type' => 'text',
2099
+ 'class' => '',
2100
+ 'value' => isset($param_values->NBPPadding) ? $param_values->NBPPadding : '',
2101
+ 'after' => 'px/%',
2102
+ ),
2103
+ array(
2104
+ 'label' => 'Margin',
2105
+ 'name' => 'NBPMargin',
2106
+ 'type' => 'text',
2107
+ 'class' => '',
2108
+ 'value' => isset($param_values->NBPMargin) ? $param_values->NBPMargin : '',
2109
+ 'after' => 'px/%',
2110
+ ),
2111
+ array(
2112
+ 'label' => 'Border',
2113
+ 'name' => 'NBPBorder',
2114
+ 'type' => 'checkbox',
2115
+ 'options' => $borders,
2116
+ 'class' => '',
2117
+ 'after' => '',
2118
+ ),
2119
+ array(
2120
+ 'label' => 'Border Color',
2121
+ 'name' => 'NBPBorderColor',
2122
+ 'type' => 'text',
2123
+ 'class' => 'color',
2124
+ 'value' => isset($param_values->NBPBorderColor) ? $param_values->NBPBorderColor : '',
2125
+ 'after' => '',
2126
+ ),
2127
+ array(
2128
+ 'label' => 'Border Type',
2129
+ 'name' => 'NBPBorderType',
2130
+ 'type' => 'select',
2131
+ 'options' => $border_types,
2132
+ 'class' => '',
2133
+ 'value' => isset($param_values->NBPBorderType) ? $param_values->NBPBorderType : '',
2134
+ 'after' => '',
2135
+ ),
2136
+ array(
2137
+ 'label' => 'Border Width',
2138
+ 'name' => 'NBPBorderWidth',
2139
+ 'type' => 'text',
2140
+ 'class' => '',
2141
+ 'value' => isset($param_values->NBPBorderWidth) ? $param_values->NBPBorderWidth : '',
2142
+ 'after' => 'px',
2143
+ ),
2144
+ array(
2145
+ 'label' => 'Border Radius',
2146
+ 'name' => 'NBPBorderRadius',
2147
+ 'type' => 'text',
2148
+ 'class' => '',
2149
+ 'value' => isset($param_values->NBPBorderRadius) ? $param_values->NBPBorderRadius : '',
2150
+ 'after' => 'px',
2151
+ ),
2152
+ array(
2153
+ 'label' => 'Box Shadow',
2154
+ 'name' => 'NBPBoxShadow',
2155
+ 'type' => 'text',
2156
+ 'class' => '',
2157
+ 'value' => isset($param_values->NBPBoxShadow) ? $param_values->NBPBoxShadow : '',
2158
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
2159
+ 'after' => '',
2160
+ ),
2161
+ array(
2162
+ 'label' => 'Hover Parameters',
2163
+ 'type' => 'label',
2164
+ 'class' => 'fm-mini-title',
2165
+ 'after' => '<br/>',
2166
+ ),
2167
+ array(
2168
+ 'label' => 'Background Color',
2169
+ 'name' => 'NBHPBGColor',
2170
+ 'type' => 'text',
2171
+ 'class' => 'color',
2172
+ 'value' => isset($param_values->NBHPBGColor) ? $param_values->NBHPBGColor : '',
2173
+ 'after' => '',
2174
+ ),
2175
+ array(
2176
+ 'label' => 'Color',
2177
+ 'name' => 'NBHPColor',
2178
+ 'type' => 'text',
2179
+ 'class' => 'color',
2180
+ 'value' => isset($param_values->NBHPColor) ? $param_values->NBHPColor : '',
2181
+ 'after' => '',
2182
+ ),
2183
+ array(
2184
+ 'label' => 'Border',
2185
+ 'name' => 'NBHPBorder',
2186
+ 'type' => 'checkbox',
2187
+ 'options' => $borders,
2188
+ 'class' => '',
2189
+ 'after' => '',
2190
+ ),
2191
+ array(
2192
+ 'label' => 'Border Color',
2193
+ 'name' => 'NBHPBorderColor',
2194
+ 'type' => 'text',
2195
+ 'class' => 'color',
2196
+ 'value' => isset($param_values->NBHPBorderColor) ? $param_values->NBHPBorderColor : '',
2197
+ 'after' => '',
2198
+ ),
2199
+ array(
2200
+ 'label' => 'Border Type',
2201
+ 'name' => 'NBHPBorderType',
2202
+ 'type' => 'select',
2203
+ 'options' => $border_types,
2204
+ 'class' => '',
2205
+ 'value' => isset($param_values->NBHPBorderType) ? $param_values->NBHPBorderType : '',
2206
+ 'after' => '',
2207
+ ),
2208
+ array(
2209
+ 'label' => 'Border Width',
2210
+ 'name' => 'NBHPBorderWidth',
2211
+ 'type' => 'text',
2212
+ 'class' => '',
2213
+ 'value' => isset($param_values->NBHPBorderWidth) ? $param_values->NBHPBorderWidth : '',
2214
+ 'after' => 'px</div>',
2215
+ ),
2216
+ array(
2217
+ 'label' => 'Previous Button Parameters',
2218
+ 'type' => 'panel',
2219
+ 'class' => 'col-md-6',
2220
+ 'label_class' => 'fm-mini-title',
2221
+ 'after' => '<br/>',
2222
+ ),
2223
+ array(
2224
+ 'label' => 'Background Color',
2225
+ 'name' => 'PBPBGColor',
2226
+ 'type' => 'text',
2227
+ 'class' => 'color',
2228
+ 'value' => isset($param_values->PBPBGColor) ? $param_values->PBPBGColor : '',
2229
+ 'after' => '',
2230
+ ),
2231
+ array(
2232
+ 'label' => 'Width',
2233
+ 'name' => 'PBPWidth',
2234
+ 'type' => 'text',
2235
+ 'class' => '',
2236
+ 'value' => isset($param_values->PBPWidth) ? $param_values->PBPWidth : '',
2237
+ 'after' => 'px',
2238
+ ),
2239
+ array(
2240
+ 'label' => 'Height',
2241
+ 'name' => 'PBPHeight',
2242
+ 'type' => 'text',
2243
+ 'class' => '',
2244
+ 'value' => isset($param_values->PBPHeight) ? $param_values->PBPHeight : '',
2245
+ 'after' => 'px',
2246
+ ),
2247
+ array(
2248
+ 'label' => 'Line Height',
2249
+ 'name' => 'PBPLineHeight',
2250
+ 'type' => 'text',
2251
+ 'class' => '',
2252
+ 'value' => isset($param_values->PBPLineHeight) ? $param_values->PBPLineHeight : '',
2253
+ 'after' => 'px',
2254
+ ),
2255
+ array(
2256
+ 'label' => 'Color',
2257
+ 'name' => 'PBPColor',
2258
+ 'type' => 'text',
2259
+ 'class' => 'color',
2260
+ 'value' => isset($param_values->PBPColor) ? $param_values->PBPColor : '',
2261
+ 'after' => '',
2262
+ ),
2263
+ array(
2264
+ 'label' => 'Padding',
2265
+ 'name' => 'PBPPadding',
2266
+ 'type' => 'text',
2267
+ 'class' => '',
2268
+ 'value' => isset($param_values->PBPPadding) ? $param_values->PBPPadding : '',
2269
+ 'after' => 'px/%',
2270
+ ),
2271
+ array(
2272
+ 'label' => 'Margin',
2273
+ 'name' => 'PBPMargin',
2274
+ 'type' => 'text',
2275
+ 'class' => '',
2276
+ 'value' => isset($param_values->PBPMargin) ? $param_values->PBPMargin : '',
2277
+ 'after' => 'px/%',
2278
+ ),
2279
+ array(
2280
+ 'label' => 'Border',
2281
+ 'name' => 'PBPBorder',
2282
+ 'type' => 'checkbox',
2283
+ 'options' => $borders,
2284
+ 'class' => '',
2285
+ 'after' => '',
2286
+ ),
2287
+ array(
2288
+ 'label' => 'Border Color',
2289
+ 'name' => 'PBPBorderColor',
2290
+ 'type' => 'text',
2291
+ 'class' => 'color',
2292
+ 'value' => isset($param_values->PBPBorderColor) ? $param_values->PBPBorderColor : '',
2293
+ 'after' => '',
2294
+ ),
2295
+ array(
2296
+ 'label' => 'Border Type',
2297
+ 'name' => 'PBPBorderType',
2298
+ 'type' => 'select',
2299
+ 'options' => $border_types,
2300
+ 'class' => '',
2301
+ 'value' => isset($param_values->PBPBorderType) ? $param_values->PBPBorderType : '',
2302
+ 'after' => '',
2303
+ ),
2304
+ array(
2305
+ 'label' => 'Border Width',
2306
+ 'name' => 'PBPBorderWidth',
2307
+ 'type' => 'text',
2308
+ 'class' => '',
2309
+ 'value' => isset($param_values->PBPBorderWidth) ? $param_values->PBPBorderWidth : '',
2310
+ 'after' => 'px',
2311
+ ),
2312
+ array(
2313
+ 'label' => 'Border Radius',
2314
+ 'name' => 'PBPBorderRadius',
2315
+ 'type' => 'text',
2316
+ 'class' => '',
2317
+ 'value' => isset($param_values->PBPBorderRadius) ? $param_values->PBPBorderRadius : '',
2318
+ 'after' => 'px',
2319
+ ),
2320
+ array(
2321
+ 'label' => 'Box Shadow',
2322
+ 'name' => 'PBPBoxShadow',
2323
+ 'type' => 'text',
2324
+ 'class' => '',
2325
+ 'value' => isset($param_values->PBPBoxShadow) ? $param_values->PBPBoxShadow : '',
2326
+ 'placeholder' => 'e.g. 5px 5px 2px #888888',
2327
+ 'after' => '',
2328
+ ),
2329
+ array(
2330
+ 'label' => 'Hover Parameters',
2331
+ 'type' => 'label',
2332
+ 'class' => 'fm-mini-title',
2333
+ 'after' => '<br/>',
2334
+ ),
2335
+ array(
2336
+ 'label' => 'Background Color',
2337
+ 'name' => 'PBHPBGColor',
2338
+ 'type' => 'text',
2339
+ 'class' => 'color',
2340
+ 'value' => isset($param_values->PBHPBGColor) ? $param_values->PBHPBGColor : '',
2341
+ 'after' => '',
2342
+ ),
2343
+ array(
2344
+ 'label' => 'Color',
2345
+ 'name' => 'PBHPColor',
2346
+ 'type' => 'text',
2347
+ 'class' => 'color',
2348
+ 'value' => isset($param_values->PBHPColor) ? $param_values->PBHPColor : '',
2349
+ 'after' => '',
2350
+ ),
2351
+ array(
2352
+ 'label' => 'Border',
2353
+ 'name' => 'PBHPBorder',
2354
+ 'type' => 'checkbox',
2355
+ 'options' => $borders,
2356
+ 'class' => '',
2357
+ 'after' => '',
2358
+ ),
2359
+ array(
2360
+ 'label' => 'Border Color',
2361
+ 'name' => 'PBHPBorderColor',
2362
+ 'type' => 'text',
2363
+ 'class' => 'color',
2364
+ 'value' => isset($param_values->PBHPBorderColor) ? $param_values->PBHPBorderColor : '',
2365
+ 'after' => '',
2366
+ ),
2367
+ array(
2368
+ 'label' => 'Border Type',
2369
+ 'name' => 'PBHPBorderType',
2370
+ 'type' => 'select',
2371
+ 'options' => $border_types,
2372
+ 'class' => '',
2373
+ 'value' => isset($param_values->PBHPBorderType) ? $param_values->PBHPBorderType : '',
2374
+ 'after' => '',
2375
+ ),
2376
+ array(
2377
+ 'label' => 'Border Width',
2378
+ 'name' => 'PBHPBorderWidth',
2379
+ 'type' => 'text',
2380
+ 'class' => '',
2381
+ 'value' => isset($param_values->PBHPBorderWidth) ? $param_values->PBHPBorderWidth : '',
2382
+ 'after' => 'px</div>',
2383
+ ),
2384
+ ),
2385
+ 'close_button' => array(
2386
+ array(
2387
+ 'label' => '',
2388
+ 'type' => 'panel',
2389
+ 'class' => 'col-md-12',
2390
+ 'label_class' => '',
2391
+ 'after' => '',
2392
+ ),
2393
+ array(
2394
+ 'label' => 'Position',
2395
+ 'name' => 'CBPPosition',
2396
+ 'type' => 'select',
2397
+ 'options' => $position_types,
2398
+ 'class' => '',
2399
+ 'value' => isset($param_values->CBPPosition) ? $param_values->CBPPosition : '',
2400
+ 'after' => '',
2401
+ ),
2402
+ array(
2403
+ 'label' => 'Top',
2404
+ 'name' => 'CBPTop',
2405
+ 'type' => 'text',
2406
+ 'class' => '',
2407
+ 'value' => isset($param_values->CBPTop) ? $param_values->CBPTop : '',
2408
+ 'after' => 'px/%',
2409
+ ),
2410
+ array(
2411
+ 'label' => 'Right',
2412
+ 'name' => 'CBPRight',
2413
+ 'type' => 'text',
2414
+ 'class' => '',
2415
+ 'value' => isset($param_values->CBPRight) ? $param_values->CBPRight : '',
2416
+ 'after' => 'px/%',
2417
+ ),
2418
+ array(
2419
+ 'label' => 'Bottom',
2420
+ 'name' => 'CBPBottom',
2421
+ 'type' => 'text',
2422
+ 'class' => '',
2423
+ 'value' => isset($param_values->CBPBottom) ? $param_values->CBPBottom : '',
2424
+ 'after' => 'px/%',
2425
+ ),
2426
+ array(
2427
+ 'label' => 'Left',
2428
+ 'name' => 'CBPLeft',
2429
+ 'type' => 'text',
2430
+ 'class' => '',
2431
+ 'value' => isset($param_values->CBPLeft) ? $param_values->CBPLeft : '',
2432
+ 'after' => 'px/%',
2433
+ ),
2434
+ array(
2435
+ 'label' => 'Background Color',
2436
+ 'name' => 'CBPBGColor',
2437
+ 'type' => 'text',
2438
+ 'class' => 'color',
2439
+ 'value' => isset($param_values->CBPBGColor) ? $param_values->CBPBGColor : '',
2440
+ 'after' => '',
2441
+ ),
2442
+ array(
2443
+ 'label' => 'Font Size',
2444
+ 'name' => 'CBPFontSize',
2445
+ 'type' => 'text',
2446
+ 'class' => '13',
2447
+ 'value' => isset($param_values->CBPFontSize) ? $param_values->CBPFontSize : '',
2448
+ 'after' => 'px',
2449
+ ),
2450
+ array(
2451
+ 'label' => 'Font Weight',
2452
+ 'name' => 'CBPFontWeight',
2453
+ 'type' => 'select',
2454
+ 'options' => $font_weights,
2455
+ 'class' => '',
2456
+ 'value' => isset($param_values->CBPFontWeight) ? $param_values->CBPFontWeight : '',
2457
+ 'after' => '',
2458
+ ),
2459
+ array(
2460
+ 'label' => 'Color',
2461
+ 'name' => 'CBPColor',
2462
+ 'type' => 'text',
2463
+ 'class' => 'color',
2464
+ 'value' => isset($param_values->CBPColor) ? $param_values->CBPColor : '',
2465
+ 'after' => '',
2466
+ ),
2467
+ array(
2468
+ 'label' => 'Padding',
2469
+ 'name' => 'CBPPadding',
2470
+ 'type' => 'text',
2471
+ 'class' => '',
2472
+ 'value' => isset($param_values->CBPPadding) ? $param_values->CBPPadding : '',
2473
+ 'after' => 'px/%',
2474
+ ),
2475
+ array(
2476
+ 'label' => 'Margin',
2477
+ 'name' => 'CBPMargin',
2478
+ 'type' => 'text',
2479
+ 'class' => '',
2480
+ 'value' => isset($param_values->CBPMargin) ? $param_values->CBPMargin : '',
2481
+ 'after' => 'px/%',
2482
+ ),
2483
+ array(
2484
+ 'label' => 'Border',
2485
+ 'name' => 'CBPBorder',
2486
+ 'type' => 'checkbox',
2487
+ 'options' => $borders,
2488
+ 'class' => '',
2489
+ 'after' => '',
2490
+ ),
2491
+ array(
2492
+ 'label' => 'Border Color',
2493
+ 'name' => 'CBPBorderColor',
2494
+ 'type' => 'text',
2495
+ 'class' => 'color',
2496
+ 'value' => isset($param_values->CBPBorderColor) ? $param_values->CBPBorderColor : '',
2497
+ 'after' => '',
2498
+ ),
2499
+ array(
2500
+ 'label' => 'Border Type',
2501
+ 'name' => 'CBPBorderType',
2502
+ 'type' => 'select',
2503
+ 'options' => $border_types,
2504
+ 'class' => '',
2505
+ 'value' => isset($param_values->CBPBorderType) ? $param_values->CBPBorderType : '',
2506
+ 'after' => '',
2507
+ ),
2508
+ array(
2509
+ 'label' => 'Border Width',
2510
+ 'name' => 'CBPBorderWidth',
2511
+ 'type' => 'text',
2512
+ 'class' => '',
2513
+ 'value' => isset($param_values->CBPBorderWidth) ? $param_values->CBPBorderWidth : '',
2514
+ 'after' => 'px',
2515
+ ),
2516
+ array(
2517
+ 'label' => 'Border Radius',
2518
+ 'name' => 'CBPBorderRadius',
2519
+ 'type' => 'text',
2520
+ 'class' => '',
2521
+ 'value' => isset($param_values->CBPBorderRadius) ? $param_values->CBPBorderRadius : '',
2522
+ 'after' => 'px',
2523
+ ),
2524
+ array(
2525
+ 'label' => 'Hover Parameters',
2526
+ 'type' => 'label',
2527
+ 'class' => 'fm-mini-title',
2528
+ 'after' => '<br/>',
2529
+ ),
2530
+ array(
2531
+ 'label' => 'Background Color',
2532
+ 'name' => 'CBHPBGColor',
2533
+ 'type' => 'text',
2534
+ 'class' => 'color',
2535
+ 'value' => isset($param_values->CBHPBGColor) ? $param_values->CBHPBGColor : '',
2536
+ 'after' => '',
2537
+ ),
2538
+ array(
2539
+ 'label' => 'Color',
2540
+ 'name' => 'CBHPColor',
2541
+ 'type' => 'text',
2542
+ 'class' => 'color',
2543
+ 'value' => isset($param_values->CBHPColor) ? $param_values->CBHPColor : '',
2544
+ 'after' => '',
2545
+ ),
2546
+ array(
2547
+ 'label' => 'Border',
2548
+ 'name' => 'CBHPBorder',
2549
+ 'type' => 'checkbox',
2550
+ 'options' => $borders,
2551
+ 'class' => '',
2552
+ 'after' => '',
2553
+ ),
2554
+ array(
2555
+ 'label' => 'Border Color',
2556
+ 'name' => 'CBHPBorderColor',
2557
+ 'type' => 'text',
2558
+ 'class' => 'color',
2559
+ 'value' => isset($param_values->CBHPBorderColor) ? $param_values->CBHPBorderColor : '',
2560
+ 'after' => '',
2561
+ ),
2562
+ array(
2563
+ 'label' => 'Border Type',
2564
+ 'name' => 'CBHPBorderType',
2565
+ 'type' => 'select',
2566
+ 'options' => $border_types,
2567
+ 'class' => '',
2568
+ 'value' => isset($param_values->CBHPBorderType) ? $param_values->CBHPBorderType : '',
2569
+ 'after' => '',
2570
+ ),
2571
+ array(
2572
+ 'label' => 'Border Width',
2573
+ 'name' => 'CBHPBorderWidth',
2574
+ 'type' => 'text',
2575
+ 'class' => '',
2576
+ 'value' => isset($param_values->CBHPBorderWidth) ? $param_values->CBHPBorderWidth : '',
2577
+ 'after' => 'px</div>',
2578
+ ),
2579
+ ),
2580
+ 'minimize' => array(
2581
+ array(
2582
+ 'label' => '',
2583
+ 'type' => 'panel',
2584
+ 'class' => 'col-md-12',
2585
+ 'label_class' => '',
2586
+ 'after' => '',
2587
+ ),
2588
+ array(
2589
+ 'label' => 'Background Color',
2590
+ 'name' => 'MBPBGColor',
2591
+ 'type' => 'text',
2592
+ 'class' => 'color',
2593
+ 'value' => isset($param_values->MBPBGColor) ? $param_values->MBPBGColor : '',
2594
+ 'after' => '',
2595
+ ),
2596
+ array(
2597
+ 'label' => 'Font Size',
2598
+ 'name' => 'MBPFontSize',
2599
+ 'type' => 'text',
2600
+ 'class' => '13',
2601
+ 'value' => isset($param_values->MBPFontSize) ? $param_values->MBPFontSize : '',
2602
+ 'after' => 'px',
2603
+ ),
2604
+ array(
2605
+ 'label' => 'Font Weight',
2606
+ 'name' => 'MBPFontWeight',
2607
+ 'type' => 'select',
2608
+ 'options' => $font_weights,
2609
+ 'class' => '',
2610
+ 'value' => isset($param_values->MBPFontWeight) ? $param_values->MBPFontWeight : '',
2611
+ 'after' => '',
2612
+ ),
2613
+ array(
2614
+ 'label' => 'Color',
2615
+ 'name' => 'MBPColor',
2616
+ 'type' => 'text',
2617
+ 'class' => 'color',
2618
+ 'value' => isset($param_values->MBPColor) ? $param_values->MBPColor : '',
2619
+ 'after' => '',
2620
+ ),
2621
+ array(
2622
+ 'label' => 'Text Align',
2623
+ 'name' => 'MBPTextAlign',
2624
+ 'type' => 'select',
2625
+ 'options' => $aligns,
2626
+ 'class' => '',
2627
+ 'value' => isset($param_values->MBPTextAlign) ? $param_values->MBPTextAlign : '',
2628
+ 'after' => '',
2629
+ ),
2630
+ array(
2631
+ 'label' => 'Padding',
2632
+ 'name' => 'MBPPadding',
2633
+ 'type' => 'text',
2634
+ 'class' => '',
2635
+ 'value' => isset($param_values->MBPPadding) ? $param_values->MBPPadding : '',
2636
+ 'after' => 'px/%',
2637
+ ),
2638
+ array(
2639
+ 'label' => 'Margin',
2640
+ 'name' => 'MBPMargin',
2641
+ 'type' => 'text',
2642
+ 'class' => '',
2643
+ 'value' => isset($param_values->MBPMargin) ? $param_values->MBPMargin : '',
2644
+ 'after' => 'px/%',
2645
+ ),
2646
+ array(
2647
+ 'label' => 'Border',
2648
+ 'name' => 'MBPBorder',
2649
+ 'type' => 'checkbox',
2650
+ 'options' => $borders,
2651
+ 'class' => '',
2652
+ 'after' => '',
2653
+ ),
2654
+ array(
2655
+ 'label' => 'Border Color',
2656
+ 'name' => 'MBPBorderColor',
2657
+ 'type' => 'text',
2658
+ 'class' => 'color',
2659
+ 'value' => isset($param_values->MBPBorderColor) ? $param_values->MBPBorderColor : '',
2660
+ 'after' => '',
2661
+ ),
2662
+ array(
2663
+ 'label' => 'Border Type',
2664
+ 'name' => 'MBPBorderType',
2665
+ 'type' => 'select',
2666
+ 'options' => $border_types,
2667
+ 'class' => '',
2668
+ 'value' => isset($param_values->MBPBorderType) ? $param_values->MBPBorderType : '',
2669
+ 'after' => '',
2670
+ ),
2671
+ array(
2672
+ 'label' => 'Border Width',
2673
+ 'name' => 'MBPBorderWidth',
2674
+ 'type' => 'text',
2675
+ 'class' => '',
2676
+ 'value' => isset($param_values->MBPBorderWidth) ? $param_values->MBPBorderWidth : '',
2677
+ 'after' => 'px',
2678
+ ),
2679
+ array(
2680
+ 'label' => 'Border Radius',
2681
+ 'name' => 'MBPBorderRadius',
2682
+ 'type' => 'text',
2683
+ 'class' => '',
2684
+ 'value' => isset($param_values->MBPBorderRadius) ? $param_values->MBPBorderRadius : '',
2685
+ 'after' => 'px',
2686
+ ),
2687
+ array(
2688
+ 'label' => 'Hover Parameters',
2689
+ 'type' => 'label',
2690
+ 'class' => 'fm-mini-title',
2691
+ 'after' => '<br/>',
2692
+ ),
2693
+ array(
2694
+ 'label' => 'Background Color',
2695
+ 'name' => 'MBHPBGColor',
2696
+ 'type' => 'text',
2697
+ 'class' => 'color',
2698
+ 'value' => isset($param_values->MBHPBGColor) ? $param_values->MBHPBGColor : '',
2699
+ 'after' => '',
2700
+ ),
2701
+ array(
2702
+ 'label' => 'Color',
2703
+ 'name' => 'MBHPColor',
2704
+ 'type' => 'text',
2705
+ 'class' => 'color',
2706
+ 'value' => isset($param_values->MBHPColor) ? $param_values->MBHPColor : '',
2707
+ 'after' => '',
2708
+ ),
2709
+ array(
2710
+ 'label' => 'Border',
2711
+ 'name' => 'MBHPBorder',
2712
+ 'type' => 'checkbox',
2713
+ 'options' => $borders,
2714
+ 'class' => '',
2715
+ 'after' => '',
2716
+ ),
2717
+ array(
2718
+ 'label' => 'Border Color',
2719
+ 'name' => 'MBHPBorderColor',
2720
+ 'type' => 'text',
2721
+ 'class' => 'color',
2722
+ 'value' => isset($param_values->MBHPBorderColor) ? $param_values->MBHPBorderColor : '',
2723
+ 'after' => '',
2724
+ ),
2725
+ array(
2726
+ 'label' => 'Border Type',
2727
+ 'name' => 'MBHPBorderType',
2728
+ 'type' => 'select',
2729
+ 'options' => $border_types,
2730
+ 'class' => '',
2731
+ 'value' => isset($param_values->MBHPBorderType) ? $param_values->MBHPBorderType : '',
2732
+ 'after' => '',
2733
+ ),
2734
+ array(
2735
+ 'label' => 'Border Width',
2736
+ 'name' => 'MBHPBorderWidth',
2737
+ 'type' => 'text',
2738
+ 'class' => '',
2739
+ 'value' => isset($param_values->MBHPBorderWidth) ? $param_values->MBHPBorderWidth : '',
2740
+ 'after' => 'px</div>',
2741
+ ),
2742
+ ),
2743
+ 'other' => array(
2744
+ array(
2745
+ 'label' => 'Deactive Text',
2746
+ 'type' => 'panel',
2747
+ 'class' => 'col-md-12',
2748
+ 'label_class' => 'fm-mini-title',
2749
+ 'after' => '<br/>',
2750
+ ),
2751
+ array(
2752
+ 'label' => 'Color',
2753
+ 'name' => 'OPDeInputColor',
2754
+ 'type' => 'text',
2755
+ 'class' => 'color',
2756
+ 'value' => isset($param_values->OPDeInputColor) ? $param_values->OPDeInputColor : '',
2757
+ 'after' => '',
2758
+ ),
2759
+ array(
2760
+ 'label' => 'Font Style',
2761
+ 'name' => 'OPFontStyle',
2762
+ 'type' => 'text',
2763
+ 'class' => '',
2764
+ 'value' => isset($param_values->OPFontStyle) ? $param_values->OPFontStyle : '',
2765
+ 'after' => '',
2766
+ ),
2767
+ array(
2768
+ 'label' => 'Required',
2769
+ 'type' => 'label',
2770
+ 'class' => 'fm-mini-title',
2771
+ 'after' => '<br/>',
2772
+ ),
2773
+ array(
2774
+ 'label' => 'Color',
2775
+ 'name' => 'OPRColor',
2776
+ 'type' => 'text',
2777
+ 'class' => 'color',
2778
+ 'value' => isset($param_values->OPRColor) ? $param_values->OPRColor : '',
2779
+ 'after' => '',
2780
+ ),
2781
+ array(
2782
+ 'label' => 'Date Picker',
2783
+ 'type' => 'label',
2784
+ 'class' => 'fm-mini-title',
2785
+ 'after' => '<br/>',
2786
+ ),
2787
+ array(
2788
+ 'label' => 'Background URL',
2789
+ 'name' => 'OPDPIcon',
2790
+ 'type' => 'text',
2791
+ 'class' => '',
2792
+ 'placeholder' => '',
2793
+ 'value' => isset($param_values->OPDPIcon) ? $param_values->OPDPIcon : '',
2794
+ 'after' => '',
2795
+ ),
2796
+ array(
2797
+ 'label' => 'Background Repeat',
2798
+ 'name' => 'OPDPRepeat',
2799
+ 'type' => 'select',
2800
+ 'options' => $bg_repeats,
2801
+ 'class' => '',
2802
+ 'value' => isset($param_values->OPDPRepeat) ? $param_values->OPDPRepeat : '',
2803
+ 'after' => '',
2804
+ ),
2805
+ array(
2806
+ 'label' => 'Background Position',
2807
+ 'name1' => 'OPDPPos1',
2808
+ 'name2' => 'OPDPPos2',
2809
+ 'type' => '2text',
2810
+ 'class' => 'fm-2text',
2811
+ 'value1' => isset($param_values->OPDPPos1) ? $param_values->OPDPPos1 : '',
2812
+ 'value2' => isset($param_values->OPDPPos2) ? $param_values->OPDPPos2 : '',
2813
+ 'before1' => '',
2814
+ 'before2' => '',
2815
+ 'after' => '%/left..',
2816
+ ),
2817
+ array(
2818
+ 'label' => 'Margin',
2819
+ 'name' => 'OPDPMargin',
2820
+ 'type' => 'text',
2821
+ 'class' => '',
2822
+ 'value' => isset($param_values->OPDPMargin) ? $param_values->OPDPMargin : '',
2823
+ 'after' => 'px/%',
2824
+ ),
2825
+ array(
2826
+ 'label' => 'File Upload',
2827
+ 'type' => 'label',
2828
+ 'class' => 'fm-mini-title',
2829
+ 'after' => '<br/>',
2830
+ ),
2831
+ array(
2832
+ 'label' => 'Background URL',
2833
+ 'name' => 'OPFBgUrl',
2834
+ 'type' => 'text',
2835
+ 'class' => '',
2836
+ 'value' => isset($param_values->OPFBgUrl) ? $param_values->OPFBgUrl : '',
2837
+ 'after' => '',
2838
+ ),
2839
+ array(
2840
+ 'label' => 'Background Repeat',
2841
+ 'name' => 'OPFBGRepeat',
2842
+ 'type' => 'select',
2843
+ 'options' => $bg_repeats,
2844
+ 'class' => '',
2845
+ 'value' => isset($param_values->OPFBGRepeat) ? $param_values->OPFBGRepeat : '',
2846
+ 'after' => '',
2847
+ ),
2848
+ array(
2849
+ 'label' => 'Background Position',
2850
+ 'name1' => 'OPFPos1',
2851
+ 'name2' => 'OPFPos2',
2852
+ 'type' => '2text',
2853
+ 'class' => 'fm-2text',
2854
+ 'value1' => isset($param_values->OPFPos1) ? $param_values->OPFPos1 : '',
2855
+ 'value2' => isset($param_values->OPFPos2) ? $param_values->OPFPos2 : '',
2856
+ 'before1' => '',
2857
+ 'before2' => '',
2858
+ 'after' => '%/left..',
2859
+ ),
2860
+ array(
2861
+ 'label' => 'Grading',
2862
+ 'type' => 'label',
2863
+ 'class' => 'fm-mini-title',
2864
+ 'after' => '<br/>',
2865
+ ),
2866
+ array(
2867
+ 'label' => 'Text Width',
2868
+ 'name' => 'OPGWidth',
2869
+ 'type' => 'text',
2870
+ 'class' => '',
2871
+ 'value' => isset($param_values->OPGWidth) ? $param_values->OPGWidth : '',
2872
+ 'after' => 'px</div>',
2873
+ ),
2874
+ ),
2875
+ 'custom_css' => array(
2876
+ array(
2877
+ 'label' => '',
2878
+ 'type' => 'panel',
2879
+ 'class' => 'col-md-12',
2880
+ 'label_class' => '',
2881
+ 'after' => '',
2882
+ ),
2883
+ array(
2884
+ 'label' => 'Custom CSS',
2885
+ 'name' => 'CUPCSS',
2886
+ 'type' => 'textarea',
2887
+ 'class' => '',
2888
+ 'value' => isset($param_values->CUPCSS) ? $param_values->CUPCSS : '',
2889
+ 'after' => '</div>',
2890
+ ),
2891
+ ),
2892
+ );
2893
+
2894
+ return $all_params;
2895
+ }
2896
+
2897
+ public function save() {
2898
+ $message = $this->save_db();
2899
+ $page = WDW_FM_Library::get('page');
2900
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
2901
+ 'page' => $page,
2902
+ 'task' => 'display',
2903
+ 'message' => $message,
2904
+ ), admin_url('admin.php')));
2905
+ }
2906
+
2907
+ public function apply() {
2908
+ $message = $this->save_db();
2909
+ $id = (int) $this->model->get_max_id();
2910
+ $current_id = (int) WDW_FM_Library::get('current_id', $id);
2911
+ $page = WDW_FM_Library::get('page');
2912
+ $active_tab = WDW_FM_Library::get('active_tab');
2913
+ $pagination = WDW_FM_Library::get('pagination-type');
2914
+ $form_type = WDW_FM_Library::get('form_type');
2915
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
2916
+ 'page' => $page,
2917
+ 'task' => 'edit',
2918
+ 'current_id' => $current_id,
2919
+ 'message' => $message,
2920
+ 'active_tab' => $active_tab,
2921
+ 'pagination' => $pagination,
2922
+ 'form_type' => $form_type,
2923
+ ), admin_url('admin.php')));
2924
+ }
2925
+
2926
+ public function copy_themes() {
2927
+ global $wpdb;
2928
+ $theme_ids_col = $this->model->get_all_ids();
2929
+ foreach ( $theme_ids_col as $theme_id ) {
2930
+ if ( isset($_POST['check_' . $theme_id]) ) {
2931
+ $theme = $this->model->get_row_data($theme_id, 0);
2932
+ $title = $theme->title;
2933
+ $params = $theme->css;
2934
+ $version = $theme->version;
2935
+ $save = $this->model->insert_theme(array(
2936
+ 'title' => $title,
2937
+ 'css' => $params,
2938
+ 'version' => $version,
2939
+ 'default' => 0,
2940
+ ));
2941
+ }
2942
+ }
2943
+ if ( $save !== FALSE ) {
2944
+ $message = 1;
2945
+ }
2946
+ else {
2947
+ $message = 2;
2948
+ }
2949
+ $page = WDW_FM_Library::get('page');
2950
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
2951
+ 'page' => $page,
2952
+ 'task' => 'display',
2953
+ 'message' => $message,
2954
+ ), admin_url('admin.php')));
2955
+ }
2956
+
2957
+ public function save_as_copy() {
2958
+ $message = $this->save_db_as_copy();
2959
+ $page = WDW_FM_Library::get('page');
2960
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
2961
+ 'page' => $page,
2962
+ 'task' => 'display',
2963
+ 'message' => $message,
2964
+ ), admin_url('admin.php')));
2965
+ }
2966
+
2967
+ public function save_db() {
2968
+ global $wpdb;
2969
+ $id = (int) WDW_FM_Library::get('current_id', 0);
2970
+ $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
2971
+ $version = 2;
2972
+ $params = (isset($_POST['params']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['params'])) : '');
2973
+ $default = (isset($_POST['default']) ? esc_html(stripslashes($_POST['default'])) : 0);
2974
+ if ( $id != 0 ) {
2975
+ $save = $this->model->update_formmaker_themes(array(
2976
+ 'title' => $title,
2977
+ 'css' => $params,
2978
+ 'default' => $default,
2979
+ ), array( 'id' => $id ));
2980
+ $version = $this->model->get_theme_version($id);
2981
+ }
2982
+ else {
2983
+ $save = $this->model->insert_theme(array(
2984
+ 'title' => $title,
2985
+ 'css' => $params,
2986
+ 'default' => $default,
2987
+ 'version' => $version,
2988
+ ));
2989
+ $id = $wpdb->insert_id;
2990
+ }
2991
+ if ( $save !== FALSE ) {
2992
+ require_once WDFM()->plugin_dir . "/frontend/models/form_maker.php";
2993
+ $model_frontend = new FMModelForm_maker();
2994
+ $form_theme = json_decode(html_entity_decode($params), TRUE);
2995
+ $model_frontend->create_css($id, $form_theme, $version == 1, TRUE);
2996
+
2997
+ return 1;
2998
+ }
2999
+ else {
3000
+ return 2;
3001
+ }
3002
+ }
3003
+
3004
+ public function save_db_as_copy() {
3005
+ $id = (int) WDW_FM_Library::get('current_id', 0);
3006
+ $title = isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '';
3007
+ $params = isset($_POST['params']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['params'])) : '';
3008
+ $version = $this->model->get_theme_version($id);
3009
+ $save = $this->model->insert_theme(array(
3010
+ 'title' => $title,
3011
+ 'css' => $params,
3012
+ 'version' => $version,
3013
+ 'default' => 0,
3014
+ ));
3015
+ if ( $save !== FALSE ) {
3016
+ return 1;
3017
+ }
3018
+ else {
3019
+ return 2;
3020
+ }
3021
+ }
3022
+ /*
3023
+ * Set default.
3024
+ *
3025
+ * @param int $id
3026
+ */
3027
+ public function setdefault( $id ) {
3028
+ global $wpdb;
3029
+ $this->model->update_formmaker_themes( array( 'default' => 0 ), array( 'default' => 1 ) );
3030
+ $save = $this->model->update_formmaker_themes( array( 'default' => 1 ), array( 'id' => $id ) );
3031
+ if ( $save !== FALSE ) {
3032
+ $message = 7;
3033
+ }
3034
+ else {
3035
+ $message = 2;
3036
+ }
3037
+ $page = WDW_FM_Library::get('page');
3038
+ WDW_FM_Library::fm_redirect(add_query_arg(array(
3039
+ 'page' => $page,
3040
+ 'task' => 'display',
3041
+ 'message' => $message,
3042
+ ), admin_url('admin.php')));
3043
+ }
3044
+ }
admin/controllers/Uninstall_fm.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerUninstall_fm {
4
+ private $model;
5
+ private $view;
6
+ private $addons = array(
7
+ 'WD_FM_MAILCHIMP' => 'mailchimp',
8
+ 'WD_FM_REG' => 'reg',
9
+ 'WD_FM_POST_GEN' => 'post_gen_options',
10
+ 'WD_FM_EMAIL_COND' => 'email_conditions',
11
+ 'WD_FM_DBOX_INT' => 'dbox_int',
12
+ 'WD_FM_GDRIVE_INT' => 'formmaker_gdrive_int',
13
+ 'WD_FM_PDF' => array( 'pdf_options', 'pdf' ),
14
+ 'WD_FM_PUSHOVER' => 'pushover',
15
+ 'WD_FM_SAVE_PROG' => array( 'save_options', 'saved_entries', 'saved_attributes' ),
16
+ 'WD_FM_STRIPE' => 'stripe',
17
+ 'WD_FM_CALCULATOR' => 'calculator',
18
+ );
19
+
20
+ public function __construct() {
21
+ require_once WDFM()->plugin_dir . "/admin/models/Uninstall_fm.php";
22
+ $this->model = new FMModelUninstall_fm();
23
+ require_once WDFM()->plugin_dir . "/admin/views/Uninstall_fm.php";
24
+ $this->view = new FMViewUninstall_fm();
25
+
26
+ if ( !WDFM()->is_pro ) {
27
+ global $fm_options;
28
+ if (!class_exists("DoradoWebConfig")) {
29
+ include_once(WD_FM_DIR . "/wd/config.php");
30
+ }
31
+ $config = new DoradoWebConfig();
32
+ $config->set_options($fm_options);
33
+ $deactivate_reasons = new DoradoWebDeactivate($config);
34
+ $deactivate_reasons->submit_and_deactivate();
35
+ }
36
+ }
37
+
38
+ public function execute() {
39
+ $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
40
+ if ( method_exists($this, $task) ) {
41
+ check_admin_referer(WDFM()->nonce, WDFM()->nonce);
42
+ $this->$task();
43
+ }
44
+ else {
45
+ $this->display();
46
+ }
47
+ }
48
+
49
+ public function display() {
50
+ $params = array();
51
+ $params['addons'] = $this->addons;
52
+ $this->view->display($params);
53
+ }
54
+
55
+ public function uninstall() {
56
+ $this->model->delete_db_tables();
57
+ global $wpdb;
58
+ $params = array();
59
+ $params['prefix'] = $wpdb->prefix;
60
+ $params['addons'] = $this->addons;
61
+ // Deactivate all addons
62
+ WDW_FM_Library::deactivate_all_addons();
63
+ $this->view->uninstall($params);
64
+ }
65
+ }
admin/controllers/Widget.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMControllerWidget
5
+ */
6
+ class FMControllerWidget extends WP_Widget {
7
+ private $view;
8
+ private $model;
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'form_maker_widget',
13
+ 'description' => 'Add Form Maker widget.',
14
+ );
15
+ // Widget Control Settings.
16
+ $control_ops = array( 'id_base' => 'form_maker_widget' );
17
+ // Create the widget.
18
+ parent::__construct('form_maker_widget', 'Form Maker', $widget_ops, $control_ops);
19
+ require_once WDFM()->plugin_dir . "/admin/models/Widget.php";
20
+ $this->model = new FMModelWidget();
21
+ require_once WDFM()->plugin_dir . "/admin/views/Widget.php";
22
+ $this->view = new FMViewWidget($this->model);
23
+ }
24
+
25
+ public function widget( $args, $instance ) {
26
+ require_once(WDFM()->plugin_dir . '/frontend/controllers/form_maker.php');
27
+ $controller_class = 'FMControllerForm_maker';
28
+ $controller = new $controller_class();
29
+ $execute = $controller->execute($instance['form_id']);
30
+ $this->view->widget($args, $instance, $execute);
31
+ }
32
+
33
+ public function form( $instance ) {
34
+ $ids_FM = $this->model->get_gallery_rows_data(); // ids_Form_Maker
35
+ $this->view->form($instance, $ids_FM, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('form_id'), parent::get_field_name('form_id'));
36
+ }
37
+
38
+ // Update Settings.
39
+ public function update( $new_instance, $old_instance ) {
40
+ $instance['title'] = $new_instance['title'];
41
+ $instance['form_id'] = $new_instance['form_id'];
42
+
43
+ return $instance;
44
+ }
45
+ }
admin/models/Blocked_ips_fm.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelBlocked_ips_fm
5
+ */
6
+ class FMModelBlocked_ips_fm {
7
+ /**
8
+ * Get blocked Ips.
9
+ *
10
+ * @param $params
11
+ *
12
+ * @return array|null|object
13
+ */
14
+ public function get_rows_data($params) {
15
+ $order = $params['order'];
16
+ $orderby = $params['orderby'];
17
+ $items_per_page = $params['items_per_page'];
18
+ $search = WDW_FM_Library::get('s', '');
19
+ $page = (int) WDW_FM_Library::get('paged', 1);
20
+ $limit = $page ? ($page - 1) * $items_per_page : 0;
21
+
22
+ global $wpdb;
23
+ $query = "SELECT * FROM `" . $wpdb->prefix . "formmaker_blocked` ";
24
+ if ( $search ) {
25
+ $query .= 'WHERE `ip` LIKE "%' . $search . '%"';
26
+ }
27
+ $query .= ' ORDER BY `' . $orderby . '` ' . $order;
28
+ $query .= " LIMIT " . $limit . "," . $items_per_page;
29
+ $rows = $wpdb->get_results($query);
30
+
31
+ return $rows;
32
+ }
33
+
34
+ public function get_row_data( $id ) {
35
+ global $wpdb;
36
+ if ( $id != 0 ) {
37
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $id));
38
+ }
39
+ else {
40
+ $row = new stdClass();
41
+ $row->id = 0;
42
+ $row->ip = '';
43
+ }
44
+
45
+ return $row;
46
+ }
47
+
48
+ /**
49
+ * Return total count of blocked IPs.
50
+ *
51
+ * @return null|string
52
+ */
53
+ public function total() {
54
+ global $wpdb;
55
+ $query = "SELECT COUNT(*) FROM `" . $wpdb->prefix . "formmaker_blocked`";
56
+
57
+ $search = WDW_FM_Library::get('s', '');
58
+ if ( $search ) {
59
+ $query .= ' WHERE `ip` LIKE "%' . $search . '%"';
60
+ }
61
+
62
+ $total = $wpdb->get_var($query);
63
+ return $total;
64
+ }
65
+
66
+ /**
67
+ * Update formmaker_blocked table.
68
+ *
69
+ * @param array $params
70
+ * @param array $where
71
+ *
72
+ * @return bool
73
+ */
74
+ public function update_fm_blocked( $params, $where ) {
75
+ global $wpdb;
76
+ return $wpdb->update($wpdb->prefix . 'formmaker_blocked', $params, $where);
77
+ }
78
+
79
+ /**
80
+ * Insert to formmaker_blocked table.
81
+ *
82
+ * @param array $param_ins
83
+ * @param array $param_type
84
+ *
85
+ * @return bool
86
+ */
87
+ public function insert_fm_blocked( $param_ins, $param_type ) {
88
+ global $wpdb;
89
+ return $wpdb->insert($wpdb->prefix . 'formmaker_blocked', $param_ins, $param_type);
90
+ }
91
+
92
+ /**
93
+ * Get col id from formmaker_blocked table.
94
+ *
95
+ * @return array
96
+ */
97
+ public function get_col_data() {
98
+ global $wpdb;
99
+ return $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_blocked');
100
+ }
101
+
102
+ /**
103
+ * Delete blocked IP.
104
+ *
105
+ * @param int $id
106
+ *
107
+ * @return array
108
+ */
109
+ public function delete_data( $id ) {
110
+ global $wpdb;
111
+ return $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'formmaker_blocked` WHERE id="%d"', $id));
112
+ }
113
+ }
admin/models/FMCheckpaypal.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelCheckpaypal
5
+ */
6
+ class FMModelCheckpaypal {
7
+ /**
8
+ * Get form by id.
9
+ *
10
+ * @param int $id
11
+ *
12
+ * @return object $row
13
+ */
14
+ public function get_form_by_id( $id ) {
15
+ global $wpdb;
16
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
17
+
18
+ return $row;
19
+ }
20
+
21
+ /**
22
+ * Get form session by group id.
23
+ *
24
+ * @param int $id
25
+ *
26
+ * @return object $row
27
+ */
28
+ public function get_form_session_by_group_id( $id ) {
29
+ global $wpdb;
30
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE group_id="%d"', $id));
31
+
32
+ return $row;
33
+ }
34
+
35
+ /**
36
+ * Update submission status.
37
+ *
38
+ * @param int $payment_status
39
+ * @param int $group_id
40
+ */
41
+ public function update_submission_status( $payment_status, $group_id ) {
42
+ global $wpdb;
43
+ $wpdb->update($wpdb->prefix . "formmaker_submits", array(
44
+ 'element_value' => $payment_status,
45
+ ), array(
46
+ 'group_id' => $group_id,
47
+ 'element_label' => 0,
48
+ ));
49
+
50
+ return;
51
+ }
52
+
53
+ /**
54
+ * Connect PayPal.
55
+ *
56
+ * @param array $params
57
+ *
58
+ * @return array $response
59
+ */
60
+ public function connect_to_paypal( $params ) {
61
+ // Set paypal action, default connect to sandbox.
62
+ $action = "https://www.sandbox.paypal.com/cgi-bin/webscr";
63
+ if ( $params['checkout_mode'] == 1 || $params['checkout_mode'] == "production" ) {
64
+ $action = "https://www.paypal.com/cgi-bin/webscr";
65
+ }
66
+ $post_fields = $params['post_fields'];
67
+ $curl = curl_init($action);
68
+ curl_setopt($curl, CURLOPT_HEADER, 0);
69
+ curl_setopt($curl, CURLOPT_POST, 1);
70
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
71
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
72
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
73
+ curl_setopt($curl, CURLOPT_SSLVERSION, 6);
74
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
75
+ $response = curl_exec($curl);
76
+ curl_close($curl);
77
+
78
+ return $response;
79
+ }
80
+
81
+ /**
82
+ * Add form maker sessions.
83
+ *
84
+ * @param array $data
85
+ */
86
+ public function add_formmaker_sessions( $data ) {
87
+ global $wpdb;
88
+ $wpdb->insert($wpdb->prefix . "formmaker_sessions", $data);
89
+
90
+ return;
91
+ }
92
+
93
+ /**
94
+ * Update form maker sessions by group_id.
95
+ *
96
+ * @param int $group_id
97
+ * @param array $data
98
+ */
99
+ public function update_formmaker_sessions_by_group_id( $group_id, $data ) {
100
+ global $wpdb;
101
+ $wpdb->update($wpdb->prefix . "formmaker_sessions", $data, array( 'group_id' => $group_id ));
102
+
103
+ return;
104
+ }
105
+ }
admin/models/FMModelBlocked_ips_fm.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- class FMModelBlocked_ips_fm {
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_rows_data() {
22
- global $wpdb;
23
- $where = ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? 'WHERE `ip` LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
24
- $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
25
- $order_by_array = array('id', 'ip');
26
- $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
27
- $order_by = ' ORDER BY `' . $order_by . '` ' . $asc_or_desc;
28
- if (isset($_POST['page_number']) && $_POST['page_number']) {
29
- $limit = ((int) $_POST['page_number'] - 1) * 20;
30
- }
31
- else {
32
- $limit = 0;
33
- }
34
- $query = "SELECT * FROM " . $wpdb->prefix . "formmaker_blocked " . $where . $order_by . " LIMIT " . $limit . ",20";
35
- $rows = $wpdb->get_results($query);
36
- return $rows;
37
- }
38
-
39
- public function get_row_data($id) {
40
- global $wpdb;
41
- if ($id != 0) {
42
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $id));
43
- }
44
- else {
45
- $row->id = 0;
46
- $row->ip = '';
47
- }
48
- return $row;
49
- }
50
-
51
- public function page_nav() {
52
- global $wpdb;
53
- $where = ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? 'WHERE `ip` LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
54
- $query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_blocked " . $where;
55
- $total = $wpdb->get_var($query);
56
- $page_nav['total'] = $total;
57
- if (isset($_POST['page_number']) && $_POST['page_number']) {
58
- $limit = ((int) $_POST['page_number'] - 1) * 20;
59
- }
60
- else {
61
- $limit = 0;
62
- }
63
- $page_nav['limit'] = (int) ($limit / 20 + 1);
64
- return $page_nav;
65
- }
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- // Getters & Setters //
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
- ////////////////////////////////////////////////////////////////////////////////////////
70
- // Private Methods //
71
- ////////////////////////////////////////////////////////////////////////////////////////
72
- ////////////////////////////////////////////////////////////////////////////////////////
73
- // Listeners //
74
- ////////////////////////////////////////////////////////////////////////////////////////
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFormMakerPreview.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- class FMModelFormMakerPreview {
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_form($form_id) {
23
- global $wpdb;
24
- $form = $wpdb->get_var($wpdb->prepare('SELECT form_front FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $form_id));
25
- return $form;
26
- }
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- // Getters & Setters //
29
- ////////////////////////////////////////////////////////////////////////////////////////
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- // Private Methods //
32
- ////////////////////////////////////////////////////////////////////////////////////////
33
- ////////////////////////////////////////////////////////////////////////////////////////
34
- // Listeners //
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFormMakerSQLMapping.php DELETED
@@ -1,121 +0,0 @@
1
- <?php
2
-
3
- class FMModelFormMakerSQLMapping {
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
- function get_query($id) {
23
- global $wpdb;
24
- $rows = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker_query where id=" . $id);
25
- return $rows;
26
- }
27
-
28
- function get_labels($form_id) {
29
- global $wpdb;
30
- // $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
31
- // wp_set_wpdb_vars();
32
- $rows = $wpdb->get_var("SELECT label_order_current FROM " . $wpdb->prefix . "formmaker where id=" . $form_id);
33
- return $rows;
34
- }
35
-
36
- function get_tables() {
37
- global $wpdb;
38
- $con_type = $_POST['con_type'];
39
-
40
- if($con_type == 'local') {
41
- $query = "SHOW TABLES";
42
- $tables = $wpdb->get_col($query);
43
- }
44
- else if($con_type == 'remote') {
45
- $username = isset($_POST['username']) ? $_POST['username'] : '';
46
- $password = isset($_POST['password']) ? $_POST['password'] : '';
47
- $database = isset($_POST['database']) ? $_POST['database'] : '';
48
- $host = isset($_POST['host']) ? $_POST['host'] : '';
49
- $wpdb_temp = new wpdb($username, $password, $database, $host);
50
- $query = "SHOW TABLES";
51
- $tables = $wpdb_temp->get_col($query);
52
- }
53
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
54
- return $tables;
55
- }
56
-
57
- function get_tables_saved($con_type, $username, $password, $database, $host) {
58
- global $wpdb;
59
-
60
- if($con_type == 'local') {
61
- $query = "SHOW TABLES";
62
- $tables = $wpdb->get_col($query);
63
- }
64
- else if($con_type == 'remote') {
65
- $wpdb_temp = new wpdb($username, $password, $database, $host);
66
- $query = "SHOW TABLES";
67
- $tables = $wpdb_temp->get_col($query);
68
- }
69
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
70
- return $tables;
71
- }
72
-
73
- function get_table_struct() {
74
- global $wpdb;
75
- $name = isset($_POST['name']) ? $_POST['name'] : NULL;
76
- if(!$name)
77
- return array();
78
- $con_method = $_POST['con_method'];
79
- $con_type = $_POST['con_type'];
80
- $query = "SHOW COLUMNS FROM " . $name;
81
- if($con_type == 'remote') {
82
- $username = isset($_POST['username']) ? $_POST['username'] : '';
83
- $password = isset($_POST['password']) ? $_POST['password'] : '';
84
- $database = isset($_POST['database']) ? $_POST['database'] : '';
85
- $host = isset($_POST['host']) ? $_POST['host'] : '';
86
- $wpdb_temp = new wpdb($username, $password, $database, $host);
87
- $table_struct = $wpdb_temp->get_results($query);
88
- }
89
- else {
90
- $table_struct = $wpdb->get_results($query);
91
- }
92
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
93
- return $table_struct;
94
- }
95
-
96
- function get_table_struct_saved($con_type, $username, $password, $database, $host, $name, $con_method) {
97
- global $wpdb;
98
- if(!$name)
99
- return array();
100
- $query = "SHOW COLUMNS FROM " . $name;
101
- if($con_type == 'remote') {
102
- $wpdb_temp = new wpdb($username, $password, $database, $host);
103
- $table_struct = $wpdb_temp->get_results($query);
104
- }
105
- else {
106
- $table_struct = $wpdb->get_results($query);
107
- }
108
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
109
- return $table_struct;
110
- }
111
-
112
- ////////////////////////////////////////////////////////////////////////////////////////
113
- // Getters & Setters //
114
- ////////////////////////////////////////////////////////////////////////////////////////
115
- ////////////////////////////////////////////////////////////////////////////////////////
116
- // Private Methods //
117
- ////////////////////////////////////////////////////////////////////////////////////////
118
- ////////////////////////////////////////////////////////////////////////////////////////
119
- // Listeners //
120
- ////////////////////////////////////////////////////////////////////////////////////////
121
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFormMakerSubmits.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class FMModelFormMakerSubmits {
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_from_label_order($form_id) {
23
- global $wpdb;
24
- $label_order = $wpdb->get_var($wpdb->prepare('SELECT `label_order` FROM `' . $wpdb->prefix . 'formmaker` WHERE id="%d"', $form_id));
25
- return $label_order;
26
- }
27
-
28
- public function get_submissions($group_id) {
29
- global $wpdb;
30
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'formmaker_submits` WHERE group_id="%d"', $group_id));
31
- return $row;
32
- }
33
-
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Getters & Setters //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- // Private Methods //
39
- ////////////////////////////////////////////////////////////////////////////////////////
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Listeners //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFormmakerwdcaptcha.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class FMModelFormmakerwdcaptcha {
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
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Getters & Setters //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Private Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Listeners //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFormmakerwdmathcaptcha.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class FMModelFormmakerwdmathcaptcha {
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
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Getters & Setters //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Private Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Listeners //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFormmakerwindow.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- class FMModelFormmakerwindow {
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_form_data() {
23
- global $wpdb;
24
- $row = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE `id` NOT IN(" . get_option('contact_form_forms', 0) . ") order by `title`");
25
- return $row;
26
- }
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- // Getters & Setters //
29
- ////////////////////////////////////////////////////////////////////////////////////////
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- // Private Methods //
32
- ////////////////////////////////////////////////////////////////////////////////////////
33
- ////////////////////////////////////////////////////////////////////////////////////////
34
- // Listeners //
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFromeditcountryinpopup.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class FMModelFromeditcountryinpopup {
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
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Getters & Setters //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Private Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Listeners //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFromipinfoinpopup.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class FMModelFromipinfoinpopup {
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
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Getters & Setters //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Private Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Listeners //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelFrommapeditinpopup.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class FMModelFrommapeditinpopup {
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
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Getters & Setters //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Private Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Listeners //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelGenerete_csv.php DELETED
@@ -1,300 +0,0 @@
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 DELETED
@@ -1,301 +0,0 @@
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/models/FMModelGoptions_fm.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- class FMModelGoptions_fm {
4
- }
 
 
 
 
admin/models/FMModelLicensing_fm.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
-
3
- class FMModelLicensing_fm {
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
- // Getters & Setters //
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- // Private Methods //
26
- ////////////////////////////////////////////////////////////////////////////////////////
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- // Listeners //
29
- ////////////////////////////////////////////////////////////////////////////////////////
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelManage_fm.php DELETED
@@ -1,2887 +0,0 @@
1
- <?php
2
-
3
- class FMModelManage_fm {
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_rows_data() {
22
- global $wpdb;
23
- $where = 'WHERE `id` NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')';
24
- $where .= ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? ' AND title LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
25
- $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
26
- $order_by_array = array('id', 'title', 'mail');
27
- $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
28
- $order_by = ' ORDER BY `' . $order_by . '` ' . $asc_or_desc;
29
- if (isset($_POST['page_number']) && $_POST['page_number']) {
30
- $limit = ((int)$_POST['page_number'] - 1) * 20;
31
- }
32
- else {
33
- $limit = 0;
34
- }
35
- $query = "SELECT * FROM " . $wpdb->prefix . "formmaker " . $where . $order_by . " LIMIT " . $limit . ",20";
36
- $rows = $wpdb->get_results($query);
37
- return $rows;
38
- }
39
-
40
- public function get_row_data($id) {
41
- global $wpdb;
42
- if ($id != 0) {
43
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
44
- }
45
- else {
46
- $row = new stdClass();
47
- $row->id = 0;
48
- $row->title = '';
49
- $row->mail = '';
50
- $row->form = '';
51
- $row->form_front = '';
52
- $row->theme = 0;
53
- $row->javascript = '';
54
- $row->submit_text = '';
55
- $row->url = '';
56
- $row->submit_text_type = 0;
57
- $row->script1 = '';
58
- $row->script2 = '';
59
- $row->script_user1 = '';
60
- $row->script_user2 = '';
61
- $row->counter = 0;
62
- $row->label_order = '';
63
- $row->article_id = '';
64
- $row->pagination = '';
65
- $row->show_title = '';
66
- $row->show_numbers = '';
67
- $row->public_key = '';
68
- $row->private_key = '';
69
- $row->recaptcha_theme = '';
70
- $row->from_name = '';
71
- $row->from_mail = '';
72
- $row->label_order_current = '';
73
- $row->script_mail_user = '';
74
- $row->script_mail = '';
75
- $row->tax = 0;
76
- $row->payment_currency = '$';
77
- $row->paypal_email = '';
78
- $row->checkout_mode = 'testmode';
79
- $row->paypal_mode = 0;
80
-
81
- $row->published = 1;
82
- $row->form_fields = '';
83
- $row->savedb = 1;
84
- $row->sendemail = 1;
85
- $row->requiredmark = '*';
86
- $row->reply_to = 0;
87
- $row->send_to = 0;
88
- $row->autogen_layout = 1;
89
- $row->custom_front = '';
90
- $row->mail_from_user = '';
91
- $row->mail_from_name_user = '';
92
- $row->reply_to_user = '';
93
- $row->save_uploads = 1;
94
- $row->header_title = '';
95
- $row->header_description = '';
96
- $row->header_image_url = '';
97
- $row->header_image_animation = '';
98
- $row->header_hide_image = '';
99
- }
100
- return $row;
101
- }
102
-
103
- public function get_row_data_new($id) {
104
- global $wpdb;
105
- if ($id != 0) {
106
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_backup WHERE backup_id="%d"', $id));
107
- $labels2 = array();
108
- $label_id = array();
109
- $label_order_original = array();
110
- $label_type = array();
111
- $label_all = explode('#****#', $row->label_order);
112
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
113
- foreach($label_all as $key => $label_each) {
114
- $label_id_each=explode('#**id**#',$label_each);
115
- array_push($label_id, $label_id_each[0]);
116
- $label_oder_each=explode('#**label**#', $label_id_each[1]);
117
- array_push($label_order_original, addslashes($label_oder_each[0]));
118
- array_push($label_type, $label_oder_each[1]);
119
- }
120
- $labels2['id'] = '"' . implode('","', $label_id) . '"';
121
- $labels2['label'] = '"' . implode('","', $label_order_original) . '"';
122
- $labels2['type'] = '"' . implode('","', $label_type) . '"';
123
- $ids = array();
124
- $types = array();
125
- $labels = array();
126
- $paramss = array();
127
- $fields = explode('*:*new_field*:*', $row->form_fields);
128
- $fields = array_slice($fields, 0, count($fields) - 1);
129
- foreach ($fields as $field) {
130
- $temp=explode('*:*id*:*',$field);
131
- array_push($ids, $temp[0]);
132
- $temp=explode('*:*type*:*',$temp[1]);
133
- array_push($types, $temp[0]);
134
- $temp=explode('*:*w_field_label*:*',$temp[1]);
135
- array_push($labels, $temp[0]);
136
- array_push($paramss, $temp[1]);
137
- }
138
- $form = $row->form_front;
139
- foreach ($ids as $ids_key => $id) {
140
- $label = $labels[$ids_key];
141
- $type = $types[$ids_key];
142
- $params = $paramss[$ids_key];
143
- if (strpos($form, '%'.$id.' - '.$label.'%') || strpos($form, '%'.$id.' -'.$label.'%')) {
144
- $rep = '';
145
- $arrows='';
146
- $param = array();
147
- $param['attributes'] = '';
148
- switch($type)
149
- {
150
- case 'type_section_break':
151
- {
152
- $arrows =$arrows.'<div id="wdform_arrows'.$id.'" class="wdform_arrows" ><div id="X_'.$id.'" class="element_toolbar"><img src="' . WD_FM_URL . '/images/delete_el.png?ver='. WD_FM_VERSION.'" title="Remove the field" onclick="remove_section_break(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;delete_el&quot;)" onmouseout="chnage_icons_src(this,&quot;delete_el&quot;)"></div><div id="edit_'.$id.'" class="element_toolbar"><img src="' . WD_FM_URL . '/images/edit.png?ver='. WD_FM_VERSION.'" title="Edit the field" onclick="edit(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;edit&quot;)" onmouseout="chnage_icons_src(this,&quot;edit&quot;)"><span id="'.$id.'_element_labelform_id_temp" style="display: none;">custom_'.$id.'</span></div><div id="duplicate_'.$id.'" class="element_toolbar"><img src="' . WD_FM_URL . '/images/duplicate.png?ver='. WD_FM_VERSION.'" title="Duplicate the field" onclick="duplicate(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;duplicate&quot;)" onmouseout="chnage_icons_src(this,&quot;duplicate&quot;)"></div></div>';
153
- break;
154
- }
155
- case 'type_editor':
156
- {
157
- $arrows =$arrows.'<div id="wdform_arrows'.$id.'" class="wdform_arrows" type="type_editor" style="margin-top:0px;"><div id="X_'.$id.'" valign="middle" align="right" class="element_toolbar"><img src="' . WD_FM_URL . '/images/delete_el.png?ver='. WD_FM_VERSION.'" title="Remove the field" onclick="remove_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;delete_el&quot;)" onmouseout="chnage_icons_src(this,&quot;delete_el&quot;)"></div><div id="left_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/left.png?ver='. WD_FM_VERSION.'" title="Move the field to the left" onclick="left_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;left&quot;)" onmouseout="chnage_icons_src(this,&quot;left&quot;)"></div><div id="up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/up.png?ver='. WD_FM_VERSION.'" title="Move the field up" onclick="up_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;up&quot;)" onmouseout="chnage_icons_src(this,&quot;up&quot;)"></div><div id="down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/down.png?ver='. WD_FM_VERSION.'" title="Move the field down" onclick="down_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;down&quot;)" onmouseout="chnage_icons_src(this,&quot;down&quot;)"></div><div id="right_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/right.png?ver='. WD_FM_VERSION.'" title="Move the field to the right" onclick="right_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;right&quot;)" onmouseout="chnage_icons_src(this,&quot;right&quot;)"></div><div id="edit_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/edit.png?ver='. WD_FM_VERSION.'" title="Edit the field" onclick="edit(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;edit&quot;)" onmouseout="chnage_icons_src(this,&quot;edit&quot;)"></div><div id="duplicate_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/duplicate.png?ver='. WD_FM_VERSION.'" title="Duplicate the field" onclick="duplicate(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;duplicate&quot;)" onmouseout="chnage_icons_src(this,&quot;duplicate&quot;)"></div><div id="page_up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_up.png?ver='. WD_FM_VERSION.'" title="Move the field to the upper page" onclick="page_up(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;page_up&quot;)" onmouseout="chnage_icons_src(this,&quot;page_up&quot;)"></div><div id="page_down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_down.png?ver='. WD_FM_VERSION.'" title="Move the field to the lower page" onclick="page_down(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;page_down&quot;)" onmouseout="chnage_icons_src(this,&quot;page_down&quot;)"></div></div>';
158
- break;
159
- }
160
-
161
- case 'type_send_copy':
162
- case 'type_stripe':
163
- case 'type_captcha':
164
- case 'type_arithmetic_captcha':
165
- case 'type_recaptcha':
166
- {
167
- $arrows =$arrows.'<div id="wdform_arrows'.$id.'" class="wdform_arrows"><div id="X_'.$id.'" valign="middle" align="right" class="element_toolbar"><img src="' . WD_FM_URL . '/images/delete_el.png?ver='. WD_FM_VERSION.'" title="Remove the field" onclick="remove_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;delete_el&quot;)" onmouseout="chnage_icons_src(this,&quot;delete_el&quot;)"></div><div id="left_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/left.png?ver='. WD_FM_VERSION.'" title="Move the field to the left" onclick="left_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;left&quot;)" onmouseout="chnage_icons_src(this,&quot;left&quot;)"></div><div id="up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/up.png?ver='. WD_FM_VERSION.'" title="Move the field up" onclick="up_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;up&quot;)" onmouseout="chnage_icons_src(this,&quot;up&quot;)"></div><div id="down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/down.png?ver='. WD_FM_VERSION.'" title="Move the field down" onclick="down_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;down&quot;)" onmouseout="chnage_icons_src(this,&quot;down&quot;)"></div><div id="right_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/right.png?ver='. WD_FM_VERSION.'" title="Move the field to the right" onclick="right_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;right&quot;)" onmouseout="chnage_icons_src(this,&quot;right&quot;)"></div><div id="edit_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/edit.png?ver='. WD_FM_VERSION.'" title="Edit the field" onclick="edit(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;edit&quot;)" onmouseout="chnage_icons_src(this,&quot;edit&quot;)"></div><div id="duplicate_'.$id.'" valign="middle" class="element_toolbar"></div><div id="page_up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_up.png?ver='. WD_FM_VERSION.'" title="Move the field to the upper page" onclick="page_up(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;page_up&quot;)" onmouseout="chnage_icons_src(this,&quot;page_up&quot;)"></div><div id="page_down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_down.png?ver='. WD_FM_VERSION.'" title="Move the field to the lower page" onclick="page_down(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;page_down&quot;)" onmouseout="chnage_icons_src(this,&quot;page_down&quot;)"></div></div>';
168
- break;
169
- }
170
-
171
- default :
172
- {
173
- $arrows =$arrows.'<div id="wdform_arrows'.$id.'" class="wdform_arrows" ><div id="X_'.$id.'" valign="middle" align="right" class="element_toolbar"><img src="' . WD_FM_URL . '/images/delete_el.png?ver='. WD_FM_VERSION.'" title="Remove the field" onclick="remove_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;delete_el&quot;)" onmouseout="chnage_icons_src(this,&quot;delete_el&quot;)"></div><div id="left_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/left.png?ver='. WD_FM_VERSION.'" title="Move the field to the left" onclick="left_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;left&quot;)" onmouseout="chnage_icons_src(this,&quot;left&quot;)"></div><div id="up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/up.png?ver='. WD_FM_VERSION.'" title="Move the field up" onclick="up_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;up&quot;)" onmouseout="chnage_icons_src(this,&quot;up&quot;)"></div><div id="down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/down.png?ver='. WD_FM_VERSION.'" title="Move the field down" onclick="down_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;down&quot;)" onmouseout="chnage_icons_src(this,&quot;down&quot;)"></div><div id="right_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/right.png?ver='. WD_FM_VERSION.'" title="Move the field to the right" onclick="right_row(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;right&quot;)" onmouseout="chnage_icons_src(this,&quot;right&quot;)"></div><div id="edit_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/edit.png?ver='. WD_FM_VERSION.'" title="Edit the field" onclick="edit(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;edit&quot;)" onmouseout="chnage_icons_src(this,&quot;edit&quot;)"></div><div id="duplicate_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/duplicate.png?ver='. WD_FM_VERSION.'" title="Duplicate the field" onclick="duplicate(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;duplicate&quot;)" onmouseout="chnage_icons_src(this,&quot;duplicate&quot;)"></div><div id="page_up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_up.png?ver='. WD_FM_VERSION.'" title="Move the field to the upper page" onclick="page_up(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;page_up&quot;)" onmouseout="chnage_icons_src(this,&quot;page_up&quot;)"></div><div id="page_down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_down.png?ver='. WD_FM_VERSION.'" title="Move the field to the lower page" onclick="page_down(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;page_down&quot;)" onmouseout="chnage_icons_src(this,&quot;page_down&quot;)"></div></div>';
174
- break;
175
- }
176
-
177
- }
178
-
179
-
180
-
181
-
182
- switch ($type) {
183
- case 'type_section_break': {
184
- $params_names = array('w_editor');
185
- $temp = $params;
186
- foreach ($params_names as $params_name) {
187
- $temp = explode('*:*' . $params_name . '*:*', $temp);
188
- $param[$params_name] = $temp[0];
189
- $temp = $temp[1];
190
- }
191
- $rep ='<div id="wdform_field'.$id.'" type="type_section_break" class="wdform_field_section_break">'.$arrows.'<span id="'.$id.'_element_labelform_id_temp" style="display: none;">custom_'.$id.'</span><div id="'.$id.'_element_sectionform_id_temp" align="left" class="wdform_section_break">'.$param['w_editor'].'</div></div><div id="'.$id.'_element_labelform_id_temp" style="color:red;">custom_'.$id.'</div>';
192
- break;
193
- }
194
- case 'type_editor': {
195
- $params_names = array('w_editor');
196
- $temp = $params;
197
- foreach ($params_names as $params_name ) {
198
- $temp = explode('*:*' . $params_name . '*:*', $temp);
199
- $param[$params_name] = $temp[0];
200
- $temp = $temp[1];
201
- }
202
- $rep =$arrows.'<div id="wdform_field'.$id.'" type="type_editor" class="wdform_field" >'.$param['w_editor'].'</div><div id="'.$id.'_element_labelform_id_temp" style="color: red;">custom_'.$id.'</div>';
203
- break;
204
- }
205
- case 'type_send_copy': {
206
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required');
207
- $temp = $params;
208
-
209
- if(strpos($temp, 'w_hide_label') > -1)
210
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_first_val', 'w_required');
211
-
212
- foreach ($params_names as $params_name ) {
213
- $temp = explode('*:*' . $params_name . '*:*', $temp);
214
- $param[$params_name] = $temp[0];
215
- $temp = $temp[1];
216
- }
217
- if ($temp) {
218
- $temp = explode('*:*w_attr_name*:*', $temp);
219
- $attrs = array_slice($temp, 0, count($temp) - 1);
220
- foreach ($attrs as $attr) {
221
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
222
- }
223
- }
224
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
225
-
226
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
227
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
228
-
229
- $input_active = ($param['w_first_val'] == 'true' ? "checked='checked'" : "");
230
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
231
- $rep ='<div id="wdform_field'.$id.'" type="type_send_copy" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" style="display: '.$param['w_field_label_pos'].'"><input type="hidden" value="type_send_copy" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp" /><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp" /><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="checkbox" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" onclick="set_checked(&quot;'.$id.'&quot;,&quot;&quot;,&quot;form_id_temp&quot;)" '.$input_active.' '.$param['attributes'].' disabled /></div></div>';
232
- break;
233
- }
234
- case 'type_text': {
235
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique');
236
- $temp = $params;
237
- if(strpos($temp, 'w_regExp_status') > -1)
238
- $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');
239
-
240
- if(strpos($temp, 'w_readonly') > -1)
241
- $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');
242
-
243
- if(strpos($temp, 'w_hide_label') > -1)
244
- $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');
245
-
246
- foreach ($params_names as $params_name) {
247
- $temp = explode('*:*' . $params_name . '*:*', $temp);
248
- $param[$params_name] = $temp[0];
249
- $temp = $temp[1];
250
- }
251
- if ($temp) {
252
- $temp = explode('*:*w_attr_name*:*', $temp);
253
- $attrs = array_slice($temp, 0, count($temp) - 1);
254
- foreach ($attrs as $attr) {
255
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
256
- }
257
- }
258
-
259
-
260
-
261
-
262
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
263
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
264
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
265
-
266
- $param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no");
267
- $param['w_regExp_value'] = (isset($param['w_regExp_value']) ? $param['w_regExp_value'] : "");
268
- $param['w_regExp_common'] = (isset($param['w_regExp_common']) ? $param['w_regExp_common'] : "");
269
- $param['w_regExp_arg'] = (isset($param['w_regExp_arg']) ? $param['w_regExp_arg'] : "");
270
- $param['w_regExp_alert'] = (isset($param['w_regExp_alert']) ? $param['w_regExp_alert'] : "Incorrect Value");
271
-
272
- $param['w_readonly'] = (isset($param['w_readonly']) ? $param['w_readonly'] : "no");
273
-
274
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
275
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
276
-
277
-
278
- $rep ='<div id="wdform_field'.$id.'" type="type_text" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" style="display: '.$param['w_field_label_pos'].'"><input type="hidden" value="type_text" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp" /><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp" /><input type="hidden" value="'.$param['w_readonly'].'" name="'.$id.'_readonlyform_id_temp" id="'.$id.'_readonlyform_id_temp"/><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_regExp_status'].'" name="'.$id.'_regExpStatusform_id_temp" id="'.$id.'_regExpStatusform_id_temp"><input type="hidden" value="'.$param['w_regExp_value'].'" name="'.$id.'_regExp_valueform_id_temp" id="'.$id.'_regExp_valueform_id_temp"><input type="hidden" value="'.$param['w_regExp_common'].'" name="'.$id.'_regExp_commonform_id_temp" id="'.$id.'_regExp_commonform_id_temp"><input type="hidden" value="'.$param['w_regExp_alert'].'" name="'.$id.'_regExp_alertform_id_temp" id="'.$id.'_regExp_alertform_id_temp"><input type="hidden" value="'.$param['w_regExp_arg'].'" name="'.$id.'_regArgumentform_id_temp" id="'.$id.'_regArgumentform_id_temp"><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp" /><input type="text" class="'.$input_active.'" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" value="'.$param['w_first_val'].'" title="'.$param['w_title'].'" onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div></div>';
279
-
280
- break;
281
- }
282
- case 'type_number': {
283
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
284
- $temp = $params;
285
- foreach ($params_names as $params_name) {
286
- $temp = explode('*:*' . $params_name . '*:*', $temp);
287
- $param[$params_name] = $temp[0];
288
- $temp = $temp[1];
289
- }
290
- if ($temp) {
291
- $temp = explode('*:*w_attr_name*:*', $temp);
292
- $attrs = array_slice($temp, 0, count($temp) - 1);
293
- foreach ($attrs as $attr) {
294
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
295
- }
296
- }
297
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
298
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
299
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
300
- $rep ='<div id="wdform_field'.$id.'" type="type_number" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'"><input type="hidden" value="type_number" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><input type="text" class="'.$input_active.'" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" value="'.$param['w_first_val'].'" title="'.$param['w_title'].'" onkeypress="return check_isnum(event)" onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div></div>';
301
- break;
302
- }
303
- case 'type_password': {
304
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_required', 'w_unique', 'w_class');
305
- $temp = $params;
306
-
307
- if(strpos($temp, 'w_hide_label') > -1)
308
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_size', 'w_required', 'w_unique', 'w_class');
309
-
310
- if(strpos($temp, 'w_verification') > -1)
311
- $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');
312
-
313
-
314
-
315
- foreach ($params_names as $params_name) {
316
- $temp = explode('*:*' . $params_name . '*:*', $temp);
317
- $param[$params_name] = $temp[0];
318
- $temp = $temp[1];
319
- }
320
- if ($temp) {
321
- $temp = explode('*:*w_attr_name*:*', $temp);
322
- $attrs = array_slice($temp, 0, count($temp) - 1);
323
- foreach ($attrs as $attr) {
324
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
325
- }
326
- }
327
-
328
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
329
-
330
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
331
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
332
-
333
-
334
- if(isset($param['w_verification']) && $param['w_verification'] == "yes"){
335
- $display_label_confirm = $display_label;
336
- $display_element_confirm = $param['w_field_label_pos'];
337
- }
338
- else{
339
- $display_label_confirm = "none";
340
- $display_element_confirm = "none";
341
- }
342
-
343
- $param['w_verification'] = isset($param['w_verification']) ? $param['w_verification'] : "no";
344
- $param['w_verification_label'] = isset($param['w_verification_label']) ? $param['w_verification_label'] : "Password confirmation:";
345
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
346
-
347
-
348
- $confirm_password ='<br><div align="left" id="'.$id.'_1_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label_confirm.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_1_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$param['w_verification_label'].'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_1_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_element_confirm.';"><input type="hidden" value="'.$param['w_verification'].'" name="'.$id.'_verification_id_temp" id="'.$id.'_verification_id_temp"><input type="text" class="input_deactive" id="'.$id.'_1_elementform_id_temp" name="'.$id.'_1_elementform_id_temp" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div>';
349
-
350
-
351
-
352
- $rep ='<div id="wdform_field'.$id.'" type="type_password" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'"><input type="hidden" value="type_password" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><input type="password" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div>'.$confirm_password.'</div>';
353
- break;
354
-
355
- }
356
- case 'type_textarea': {
357
- $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');
358
- $temp = $params;
359
-
360
- if(strpos($temp, 'w_hide_label') > -1)
361
- $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');
362
-
363
-
364
-
365
- foreach ($params_names as $params_name) {
366
- $temp = explode('*:*' . $params_name . '*:*', $temp);
367
- $param[$params_name] = $temp[0];
368
- $temp = $temp[1];
369
- }
370
- if ($temp) {
371
- $temp = explode('*:*w_attr_name*:*', $temp);
372
- $attrs = array_slice($temp, 0, count($temp) - 1);
373
- foreach ($attrs as $attr) {
374
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
375
- }
376
- }
377
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
378
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
379
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
380
-
381
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
382
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
383
-
384
-
385
- $rep ='<div id="wdform_field'.$id.'" type="type_textarea" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display:'.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><input type="hidden" value="type_textarea" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><textarea class="'.$input_active.'" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" title="'.$param['w_title'].'" onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" style="width: '.$param['w_size_w'].'px; height: '.$param['w_size_h'].'px;" '.$param['attributes'].' disabled>'.$param['w_first_val'].'</textarea></div></div>';
386
- break;
387
- }
388
- case 'type_phone': {
389
- $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');
390
- $temp = $params;
391
-
392
- if(strpos($temp, 'w_hide_label') > -1)
393
- $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');
394
-
395
-
396
- foreach ($params_names as $params_name) {
397
- $temp = explode('*:*' . $params_name . '*:*', $temp);
398
- $param[$params_name] = $temp[0];
399
- $temp = $temp[1];
400
- }
401
- if ($temp) {
402
- $temp = explode('*:*w_attr_name*:*', $temp);
403
- $attrs = array_slice($temp, 0, count($temp) - 1);
404
- foreach ($attrs as $attr) {
405
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
406
- }
407
- }
408
- $w_first_val = explode('***', $param['w_first_val']);
409
- $w_title = explode('***', $param['w_title']);
410
- $w_mini_labels = explode('***', $param['w_mini_labels']);
411
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
412
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
413
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
414
-
415
- $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
416
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
417
- $rep ='<div id="wdform_field'.$id.'" type="type_phone" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_phone" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><div id="'.$id.'_table_name" style="display: table;"><div id="'.$id.'_tr_name1" style="display: table-row;"><div id="'.$id.'_td_name_input_first" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_firstform_id_temp" name="'.$id.'_element_firstform_id_temp" value="'.$w_first_val[0].'" title="'.$w_title[0].'" onfocus="delete_value(&quot;'.$id.'_element_firstform_id_temp&quot;)"onblur="return_value(&quot;'.$id.'_element_firstform_id_temp&quot;)"onchange="change_value(&quot;'.$id.'_element_firstform_id_temp&quot;)" onkeypress="return check_isnum(event)"style="width: 50px;" '.$param['attributes'].' disabled /><span class="wdform_line" style="margin: 0px 4px; padding: 0px;">-</span></div><div id="'.$id.'_td_name_input_last" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_lastform_id_temp" name="'.$id.'_element_lastform_id_temp" value="'.$w_first_val[1].'" title="'.$w_title[1].'" onfocus="delete_value(&quot;'.$id.'_element_lastform_id_temp&quot;)"onblur="return_value(&quot;'.$id.'_element_lastform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_element_lastform_id_temp&quot;)" onkeypress="return check_isnum(event)"style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div></div><div id="'.$id.'_tr_name2" style="display: table-row;"><div id="'.$id.'_td_name_label_first" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_area_code">'.$w_mini_labels[0].'</label></div><div id="'.$id.'_td_name_label_last" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_phone_number">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
418
- break;
419
- }
420
-
421
- case 'type_phone_new': {
422
- $temp = $params;
423
- $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');
424
-
425
- foreach ($params_names as $params_name) {
426
- $temp = explode('*:*' . $params_name . '*:*', $temp);
427
- $param[$params_name] = $temp[0];
428
- $temp = $temp[1];
429
- }
430
- if ($temp) {
431
- $temp = explode('*:*w_attr_name*:*', $temp);
432
- $attrs = array_slice($temp, 0, count($temp) - 1);
433
- foreach ($attrs as $attr) {
434
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
435
- }
436
- }
437
-
438
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
439
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
440
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
441
-
442
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
443
-
444
- $rep ='<div id="wdform_field'.$id.'" type="type_phone_new" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_phone_new" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><div id="'.$id.'_table_name" style="display: table;"><div id="'.$id.'_tr_name1" style="display: table-row;"><div id="'.$id.'_td_name_input_first" style="display: table-cell;"><input type="text" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" value="'.$param['w_first_val'].'" top-country = "'.$param['w_top_country'].'" onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" onkeypress="return check_isnum(&quot;'.$id.'_elementform_id_temp&quot;)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled></div></div></div></div></div>';
445
- break;
446
- }
447
-
448
-
449
- case 'type_name': {
450
- $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');
451
- $temp = $params;
452
- if(strpos($temp, 'w_name_fields') > -1)
453
- $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');
454
-
455
- if(strpos($temp, 'w_autofill') > -1)
456
- $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');
457
-
458
- if(strpos($temp, 'w_hide_label') > -1)
459
- $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');
460
-
461
- foreach ($params_names as $params_name) {
462
- $temp = explode('*:*' . $params_name . '*:*', $temp);
463
- $param[$params_name] = $temp[0];
464
- $temp = $temp[1];
465
- }
466
- if ($temp) {
467
- $temp = explode('*:*w_attr_name*:*', $temp);
468
- $attrs = array_slice($temp, 0, count($temp) - 1);
469
- foreach ($attrs as $attr) {
470
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
471
- }
472
- }
473
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
474
-
475
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
476
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
477
-
478
-
479
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
480
- $w_first_val = explode('***', $param['w_first_val']);
481
- $w_title = explode('***', $param['w_title']);
482
- $w_mini_labels = explode('***', $param['w_mini_labels']);
483
-
484
- $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
485
- $w_name_fields = explode('***', $param['w_name_fields']);
486
- $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
487
-
488
- $w_name_format = '<div id="'.$id.'_td_name_input_first" style="display: table-cell;"><input type="text" class="'.($w_first_val[0]==$w_title[0] ? "input_deactive" : "input_active").'" id="'.$id.'_element_firstform_id_temp" name="'.$id.'_element_firstform_id_temp" value="'.$w_first_val[0].'" title="'.$w_title[0].'" onfocus="delete_value(&quot;'.$id.'_element_firstform_id_temp&quot;)"onblur="return_value(&quot;'.$id.'_element_firstform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_element_firstform_id_temp&quot;)" style="margin-right: 10px; width: '.$param['w_size'].'px;"'.$param['attributes'].' disabled /></div><div id="'.$id.'_td_name_input_last" style="display: table-cell;"><input type="text" class="'.($w_first_val[1]==$w_title[1] ? "input_deactive" : "input_active").'" id="'.$id.'_element_lastform_id_temp" name="'.$id.'_element_lastform_id_temp" value="'.$w_first_val[1].'" title="'.$w_title[1].'" onfocus="delete_value(&quot;'.$id.'_element_lastform_id_temp&quot;)"onblur="return_value(&quot;'.$id.'_element_lastform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_element_lastform_id_temp&quot;)" style="margin-right: 10px; width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div>';
489
- $w_name_format_mini_labels = '<div id="'.$id.'_td_name_label_first" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_first">'.$w_mini_labels[1].'</label></div><div id="'.$id.'_td_name_label_last" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_last">'.$w_mini_labels[2].'</label></div>';
490
-
491
- if($w_name_fields[0] == 'yes') {
492
- $w_name_format = '<div id="'.$id.'_td_name_input_title" style="display: table-cell;"><input type="text" class="'.($w_first_val[2]==$w_title[2] ? "input_deactive" : "input_active").'" id="'.$id.'_element_titleform_id_temp" name="'.$id.'_element_titleform_id_temp" value="'.$w_first_val[2].'" title="'.$w_title[2].'" onfocus="delete_value(&quot;'.$id.'_element_titleform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_element_titleform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_element_titleform_id_temp&quot;)" style="margin: 0px 10px 0px 0px; width: 40px;" disabled /></div>'.$w_name_format;
493
- $w_name_format_mini_labels ='<div id="'.$id.'_td_name_label_title" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_title">'.$w_mini_labels[0].'</label></div>'.$w_name_format_mini_labels;
494
- }
495
-
496
- if($w_name_fields[1] == 'yes') {
497
- $w_name_format = $w_name_format.'<div id="'.$id.'_td_name_input_middle" style="display: table-cell;"><input type="text" class="'.($w_first_val[3]==$w_title[3] ? "input_deactive" : "input_active").'" id="'.$id.'_element_middleform_id_temp" name="'.$id.'_element_middleform_id_temp" value="'.$w_first_val[3].'" title="'.$w_title[3].'" onfocus="delete_value(&quot;'.$id.'_element_middleform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_element_middleform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_element_middleform_id_temp&quot;)" style="width: '.$param['w_size'].'px;" disabled /></div>';
498
- $w_name_format_mini_labels = $w_name_format_mini_labels.'<div id="'.$id.'_td_name_label_middle" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_middle">'.$w_mini_labels[3].'</label></div>';
499
- }
500
-
501
- $rep ='<div id="wdform_field'.$id.'" type="type_name" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_name" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><input type="hidden" value="'.$param['w_autofill'].'" name="'.$id.'_autofillform_id_temp" id="'.$id.'_autofillform_id_temp"><input type="hidden" name="'.$id.'_enable_fieldsform_id_temp" id="'.$id.'_enable_fieldsform_id_temp" title="'.$w_name_fields[0].'" first="yes" last="yes" middle="'.$w_name_fields[1].'"><div id="'.$id.'_table_name" cellpadding="0" cellspacing="0" style="display: table;"><div id="'.$id.'_tr_name1" style="display: table-row;">'.$w_name_format.'</div><div id="'.$id.'_tr_name2" style="display: table-row;">'.$w_name_format_mini_labels.'</div></div></div></div>';
502
- break;
503
- }
504
- case 'type_address': {
505
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
506
- $temp = $params;
507
-
508
- if(strpos($temp, 'w_hide_label') > -1)
509
- $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');
510
-
511
-
512
-
513
- foreach ($params_names as $params_name) {
514
- $temp = explode('*:*' . $params_name . '*:*', $temp);
515
- $param[$params_name] = $temp[0];
516
- $temp = $temp[1];
517
- }
518
- if ($temp) {
519
- $temp = explode('*:*w_attr_name*:*', $temp);
520
- $attrs = array_slice($temp, 0, count($temp) - 1);
521
- foreach ($attrs as $attr) {
522
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
523
- }
524
- }
525
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
526
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
527
-
528
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
529
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
530
-
531
-
532
- $w_mini_labels = explode('***', $param['w_mini_labels']);
533
- $w_disabled_fields = explode('***', $param['w_disabled_fields']);
534
- $hidden_inputs = '';
535
- $labels_for_id = array('street1', 'street2', 'city', 'state', 'postal', 'country');
536
- foreach ($w_disabled_fields as $key => $w_disabled_field) {
537
- if ($key != 6) {
538
- if ($w_disabled_field == 'yes') {
539
- $hidden_inputs .= '<input type="hidden" id="'.$id.'_'.$labels_for_id[$key].'form_id_temp" value="'.$w_mini_labels[$key].'" id_for_label="'.($id+$key).'">';
540
- }
541
- }
542
- }
543
- $address_fields ='';
544
- $g=0;
545
- if($w_disabled_fields[0]=='no')
546
- {
547
- $g+=2;
548
- $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="'.$id.'_street1form_id_temp" name="'.$id.'_street1form_id_temp" onchange="change_value(&quot;'.$id.'_street1form_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled /><label class="mini_label" id="'.$id.'_mini_label_street1" style="display: block;">'.$w_mini_labels[0].'</label></span>';
549
- }
550
-
551
- if($w_disabled_fields[1]=='no')
552
- {
553
- $g+=2;
554
- $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="'.$id.'_street2form_id_temp" name="'.($id+1).'_street2form_id_temp" onchange="change_value(&quot;'.$id.'_street2form_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled /><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_street2">'.$w_mini_labels[1].'</label></span>';
555
- }
556
-
557
- if($w_disabled_fields[2]=='no')
558
- {
559
- $g++;
560
- $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="'.$id.'_cityform_id_temp" name="'.($id+2).'_cityform_id_temp" onchange="change_value(&quot;'.$id.'_cityform_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled /><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_city">'.$w_mini_labels[2].'</label></span>';
561
- }
562
-
563
- if($w_disabled_fields[3]=='no')
564
- {
565
- $g++;
566
- if($w_disabled_fields[5]=='yes' && $w_disabled_fields[6]=='yes')
567
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><select type="text" id="'.$id.'_stateform_id_temp" name="'.($id+3).'_stateform_id_temp" onchange="change_value(&quot;'.$id.'_stateform_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled ><option value=""></option><option value="Alabama">Alabama</option><option value="Alaska">Alaska</option><option value="Arizona">Arizona</option><option value="Arkansas">Arkansas</option><option value="California">California</option><option value="Colorado">Colorado</option><option value="Connecticut">Connecticut</option><option value="Delaware">Delaware</option><option value="Florida">Florida</option><option value="Georgia">Georgia</option><option value="Hawaii">Hawaii</option><option value="Idaho">Idaho</option><option value="Illinois">Illinois</option><option value="Indiana">Indiana</option><option value="Iowa">Iowa</option><option value="Kansas">Kansas</option><option value="Kentucky">Kentucky</option><option value="Louisiana">Louisiana</option><option value="Maine">Maine</option><option value="Maryland">Maryland</option><option value="Massachusetts">Massachusetts</option><option value="Michigan">Michigan</option><option value="Minnesota">Minnesota</option><option value="Mississippi">Mississippi</option><option value="Missouri">Missouri</option><option value="Montana">Montana</option><option value="Nebraska">Nebraska</option><option value="Nevada">Nevada</option><option value="New Hampshire">New Hampshire</option><option value="New Jersey">New Jersey</option><option value="New Mexico">New Mexico</option><option value="New York">New York</option><option value="North Carolina">North Carolina</option><option value="North Dakota">North Dakota</option><option value="Ohio">Ohio</option><option value="Oklahoma">Oklahoma</option><option value="Oregon">Oregon</option><option value="Pennsylvania">Pennsylvania</option><option value="Rhode Island">Rhode Island</option><option value="South Carolina">South Carolina</option><option value="South Dakota">South Dakota</option><option value="Tennessee">Tennessee</option><option value="Texas">Texas</option><option value="Utah">Utah</option><option value="Vermont">Vermont</option><option value="Virginia">Virginia</option><option value="Washington">Washington</option><option value="West Virginia">West Virginia</option><option value="Wisconsin">Wisconsin</option><option value="Wyoming">Wyoming</option></select><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_state">'.$w_mini_labels[3].'</label></span>';
568
- else
569
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><input type="text" id="'.$id.'_stateform_id_temp" name="'.($id+3).'_stateform_id_temp" onchange="change_value(&quot;'.$id.'_stateform_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_state">'.$w_mini_labels[3].'</label></span>';
570
- }
571
-
572
- if($w_disabled_fields[4]=='no')
573
- {
574
- $g++;
575
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><input type="text" id="'.$id.'_postalform_id_temp" name="'.($id+4).'_postalform_id_temp" onchange="change_value(&quot;'.$id.'_postalform_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_postal">'.$w_mini_labels[4].'</label></span>';
576
- }
577
-
578
- if($w_disabled_fields[5]=='no')
579
- {
580
- $g++;
581
- $address_fields .= '<span style="float: '.(($g%2==0) ? 'right' : 'left').'; width: 48%; padding-bottom: 8px;"><select type="text" id="'.$id.'_countryform_id_temp" name="'.($id+5).'_countryform_id_temp" onchange="change_value(&quot;'.$id.'_countryform_id_temp&quot;)" style="width: 100%;" '.$param['attributes'].' disabled><option value=""></option><option value="Afghanistan">Afghanistan</option><option value="Albania">Albania</option><option value="Algeria">Algeria</option><option value="Andorra">Andorra</option><option value="Angola">Angola</option><option value="Antigua and Barbuda">Antigua and Barbuda</option><option value="Argentina">Argentina</option><option value="Armenia">Armenia</option><option value="Australia">Australia</option><option value="Austria">Austria</option><option value="Azerbaijan">Azerbaijan</option><option value="Bahamas">Bahamas</option><option value="Bahrain">Bahrain</option><option value="Bangladesh">Bangladesh</option><option value="Barbados">Barbados</option><option value="Belarus">Belarus</option><option value="Belgium">Belgium</option><option value="Belize">Belize</option><option value="Benin">Benin</option><option value="Bhutan">Bhutan</option><option value="Bolivia">Bolivia</option><option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option><option value="Botswana">Botswana</option><option value="Brazil">Brazil</option><option value="Brunei">Brunei</option><option value="Bulgaria">Bulgaria</option><option value="Burkina Faso">Burkina Faso</option><option value="Burundi">Burundi</option><option value="Cambodia">Cambodia</option><option value="Cameroon">Cameroon</option><option value="Canada">Canada</option><option value="Cape Verde">Cape Verde</option><option value="Central African Republic">Central African Republic</option><option value="Chad">Chad</option><option value="Chile">Chile</option><option value="China">China</option><option value="Colombia">Colombia</option><option value="Comoros">Comoros</option><option value="Congo (Brazzaville)">Congo (Brazzaville)</option><option value="Congo">Congo</option><option value="Costa Rica">Costa Rica</option><option value="Cote d\'Ivoire">Cote d\'Ivoire</option><option value="Croatia">Croatia</option><option value="Cuba">Cuba</option><option value="Cyprus">Cyprus</option><option value="Czech Republic">Czech Republic</option><option value="Denmark">Denmark</option><option value="Djibouti">Djibouti</option><option value="Dominica">Dominica</option><option value="Dominican Republic">Dominican Republic</option><option value="East Timor (Timor Timur)">East Timor (Timor Timur)</option><option value="Ecuador">Ecuador</option><option value="Egypt">Egypt</option><option value="El Salvador">El Salvador</option><option value="Equatorial Guinea">Equatorial Guinea</option><option value="Eritrea">Eritrea</option><option value="Estonia">Estonia</option><option value="Ethiopia">Ethiopia</option><option value="Fiji">Fiji</option><option value="Finland">Finland</option><option value="France">France</option><option value="Gabon">Gabon</option><option value="Gambia, The">Gambia, The</option><option value="Georgia">Georgia</option><option value="Germany">Germany</option><option value="Ghana">Ghana</option><option value="Greece">Greece</option><option value="Grenada">Grenada</option><option value="Guatemala">Guatemala</option><option value="Guinea">Guinea</option><option value="Guinea-Bissau">Guinea-Bissau</option><option value="Guyana">Guyana</option><option value="Haiti">Haiti</option><option value="Honduras">Honduras</option><option value="Hungary">Hungary</option><option value="Iceland">Iceland</option><option value="India">India</option><option value="Indonesia">Indonesia</option><option value="Iran">Iran</option><option value="Iraq">Iraq</option><option value="Ireland">Ireland</option><option value="Israel">Israel</option><option value="Italy">Italy</option><option value="Jamaica">Jamaica</option><option value="Japan">Japan</option><option value="Jordan">Jordan</option><option value="Kazakhstan">Kazakhstan</option><option value="Kenya">Kenya</option><option value="Kiribati">Kiribati</option><option value="Korea, North">Korea, North</option><option value="Korea, South">Korea, South</option><option value="Kuwait">Kuwait</option><option value="Kyrgyzstan">Kyrgyzstan</option><option value="Laos">Laos</option><option value="Latvia">Latvia</option><option value="Lebanon">Lebanon</option><option value="Lesotho">Lesotho</option><option value="Liberia">Liberia</option><option value="Libya">Libya</option><option value="Liechtenstein">Liechtenstein</option><option value="Lithuania">Lithuania</option><option value="Luxembourg">Luxembourg</option><option value="Macedonia">Macedonia</option><option value="Madagascar">Madagascar</option><option value="Malawi">Malawi</option><option value="Malaysia">Malaysia</option><option value="Maldives">Maldives</option><option value="Mali">Mali</option><option value="Malta">Malta</option><option value="Marshall Islands">Marshall Islands</option><option value="Mauritania">Mauritania</option><option value="Mauritius">Mauritius</option><option value="Mexico">Mexico</option><option value="Micronesia">Micronesia</option><option value="Moldova">Moldova</option><option value="Monaco">Monaco</option><option value="Mongolia">Mongolia</option><option value="Morocco">Morocco</option><option value="Mozambique">Mozambique</option><option value="Myanmar">Myanmar</option><option value="Namibia">Namibia</option><option value="Nauru">Nauru</option><option value="Nepal">Nepal</option><option value="Netherlands">Netherlands</option><option value="New Zealand">New Zealand</option><option value="Nicaragua">Nicaragua</option><option value="Niger">Niger</option><option value="Nigeria">Nigeria</option><option value="Norway">Norway</option><option value="Oman">Oman</option><option value="Pakistan">Pakistan</option><option value="Palau">Palau</option><option value="Panama">Panama</option><option value="Papua New Guinea">Papua New Guinea</option><option value="Paraguay">Paraguay</option><option value="Peru">Peru</option><option value="Philippines">Philippines</option><option value="Poland">Poland</option><option value="Portugal">Portugal</option><option value="Qatar">Qatar</option><option value="Romania">Romania</option><option value="Russia">Russia</option><option value="Rwanda">Rwanda</option><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option><option value="Saint Lucia">Saint Lucia</option><option value="Saint Vincent">Saint Vincent</option><option value="Samoa">Samoa</option><option value="San Marino">San Marino</option><option value="Sao Tome and Principe">Sao Tome and Principe</option><option value="Saudi Arabia">Saudi Arabia</option><option value="Senegal">Senegal</option><option value="Serbia and Montenegro">Serbia and Montenegro</option><option value="Seychelles">Seychelles</option><option value="Sierra Leone">Sierra Leone</option><option value="Singapore">Singapore</option><option value="Slovakia">Slovakia</option><option value="Slovenia">Slovenia</option><option value="Solomon Islands">Solomon Islands</option><option value="Somalia">Somalia</option><option value="South Africa">South Africa</option><option value="Spain">Spain</option><option value="Sri Lanka">Sri Lanka</option><option value="Sudan">Sudan</option><option value="Suriname">Suriname</option><option value="Swaziland">Swaziland</option><option value="Sweden">Sweden</option><option value="Switzerland">Switzerland</option><option value="Syria">Syria</option><option value="Taiwan">Taiwan</option><option value="Tajikistan">Tajikistan</option><option value="Tanzania">Tanzania</option><option value="Thailand">Thailand</option><option value="Togo">Togo</option><option value="Tonga">Tonga</option><option value="Trinidad and Tobago">Trinidad and Tobago</option><option value="Tunisia">Tunisia</option><option value="Turkey">Turkey</option><option value="Turkmenistan">Turkmenistan</option><option value="Tuvalu">Tuvalu</option><option value="Uganda">Uganda</option><option value="Ukraine">Ukraine</option><option value="United Arab Emirates">United Arab Emirates</option><option value="United Kingdom">United Kingdom</option><option value="United States">United States</option><option value="Uruguay">Uruguay</option><option value="Uzbekistan">Uzbekistan</option><option value="Vanuatu">Vanuatu</option><option value="Vatican City">Vatican City</option><option value="Venezuela">Venezuela</option><option value="Vietnam">Vietnam</option><option value="Yemen">Yemen</option><option value="Zambia">Zambia</option><option value="Zimbabwe">Zimbabwe</option></select><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_country">'.$w_mini_labels[5].'</span>';
582
- }
583
-
584
- $rep ='<div id="wdform_field'.$id.'" type="type_address" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px; vertical-align:top;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_address" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" name="'.$id.'_disable_fieldsform_id_temp" id="'.$id.'_disable_fieldsform_id_temp" street1="'.$w_disabled_fields[0].'" street2="'.$w_disabled_fields[1].'" city="'.$w_disabled_fields[2].'" state="'.$w_disabled_fields[3].'" postal="'.$w_disabled_fields[4].'" country="'.$w_disabled_fields[5].'" us_states="'.$w_disabled_fields[6].'"><div id="'.$id.'_div_address" style="width: '.$param['w_size'].'px;">'.$address_fields.$hidden_inputs.'</div></div></div>';
585
- break;
586
- }
587
- case 'type_submitter_mail': {
588
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique', 'w_class');
589
- $temp=$params;
590
- if(strpos($temp, 'w_autofill') > -1)
591
- $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');
592
-
593
- if(strpos($temp, 'w_hide_label') > -1)
594
- $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');
595
-
596
- if(strpos($temp, 'w_verification') > -1)
597
- $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');
598
-
599
-
600
- foreach($params_names as $params_name )
601
- {
602
- $temp=explode('*:*'.$params_name.'*:*',$temp);
603
- $param[$params_name] = $temp[0];
604
- $temp=$temp[1];
605
- }
606
-
607
- if($temp)
608
- {
609
- $temp =explode('*:*w_attr_name*:*',$temp);
610
- $attrs = array_slice($temp,0, count($temp)-1);
611
- foreach($attrs as $attr)
612
- $param['attributes'] = $param['attributes'].' add_'.$attr;
613
- }
614
-
615
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
616
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
617
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
618
-
619
- $input_active = ($param['w_first_val']==$param['w_title'] ? "input_deactive" : "input_active");
620
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
621
- $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
622
-
623
- if(isset($param['w_verification']) && $param['w_verification'] == "yes"){
624
- $display_label_confirm = $display_label;
625
- $display_element_confirm = $param['w_field_label_pos'];
626
- }
627
- else{
628
- $display_label_confirm = "none";
629
- $display_element_confirm = "none";
630
- }
631
-
632
-
633
- $param['w_verification'] = isset($param['w_verification']) ? $param['w_verification'] : "no";
634
- $param['w_verification_label'] = isset($param['w_verification_label']) ? $param['w_verification_label'] : "E-mail confirmation:";
635
- $param['w_verification_placeholder'] = isset($param['w_verification_placeholder']) ? $param['w_verification_placeholder'] : "";
636
-
637
- $confirm_emeil = '<br><div align="left" id="'.$id.'_1_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label_confirm.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_1_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$param['w_verification_label'].'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_1_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_element_confirm.';"><input type="hidden" value="'.$param['w_verification'].'" name="'.$id.'_verification_id_temp" id="'.$id.'_verification_id_temp"><input type="text" class="input_deactive" id="'.$id.'_1_elementform_id_temp" name="'.$id.'_1_elementform_id_temp" value="'.$param['w_verification_placeholder'].'" title="'.$param['w_verification_placeholder'].'" onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div>';
638
-
639
-
640
- $rep ='<div id="wdform_field'.$id.'" type="type_submitter_mail" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_submitter_mail" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><input type="hidden" value="'.$param['w_autofill'].'" name="'.$id.'_autofillform_id_temp" id="'.$id.'_autofillform_id_temp"><input type="hidden" value="'.$param['w_verification'].'" name="'.$id.'_verification_id_temp" id="'.$id.'_verification_id_temp"><input type="text" class="'.$input_active.'" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" value="'.$param['w_first_val'].'" title="'.$param['w_title'].'" onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div>'.$confirm_emeil.'</div>';
641
- break;
642
- }
643
- case 'type_checkbox':
644
- {
645
- $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');
646
- $temp=$params;
647
- if(strpos($temp, 'w_field_option_pos') > -1)
648
- $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');
649
-
650
- if(strpos($temp, 'w_hide_label') > -1)
651
- $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');
652
-
653
- foreach($params_names as $params_name )
654
- {
655
- $temp=explode('*:*'.$params_name.'*:*',$temp);
656
- $param[$params_name] = $temp[0];
657
- $temp=$temp[1];
658
- }
659
-
660
- if($temp)
661
- {
662
- $temp =explode('*:*w_attr_name*:*',$temp);
663
- $attrs = array_slice($temp,0, count($temp)-1);
664
- foreach($attrs as $attr)
665
- $param['attributes'] = $param['attributes'].' add_'.$attr;
666
- }
667
- if(!isset($param['w_value_disabled']))
668
- $param['w_value_disabled'] = 'no';
669
-
670
- if(!isset($param['w_field_option_pos']))
671
- $param['w_field_option_pos'] = 'left';
672
-
673
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
674
-
675
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
676
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
677
-
678
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
679
- $param['w_choices'] = explode('***',$param['w_choices']);
680
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
681
-
682
- if(isset($param['w_choices_value']))
683
- {
684
- $param['w_choices_value'] = explode('***',$param['w_choices_value']);
685
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
686
- }
687
-
688
- foreach($param['w_choices_checked'] as $key => $choices_checked )
689
- {
690
- if($choices_checked=='true')
691
- $param['w_choices_checked'][$key]='checked="checked"';
692
- else
693
- $param['w_choices_checked'][$key]='';
694
- }
695
-
696
- $rep='<div id="wdform_field'.$id.'" type="type_checkbox" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_checkbox" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_randomize'].'" name="'.$id.'_randomizeform_id_temp" id="'.$id.'_randomizeform_id_temp"><input type="hidden" value="'.$param['w_allow_other'].'" name="'.$id.'_allow_otherform_id_temp" id="'.$id.'_allow_otherform_id_temp"><input type="hidden" value="'.$param['w_allow_other_num'].'" name="'.$id.'_allow_other_numform_id_temp" id="'.$id.'_allow_other_numform_id_temp"><input type="hidden" value="'.$param['w_rowcol'].'" name="'.$id.'_rowcol_numform_id_temp" id="'.$id.'_rowcol_numform_id_temp"><input type="hidden" value="'.$param['w_field_option_pos'].'" id="'.$id.'_option_left_right"><input type="hidden" value="'.$param['w_value_disabled'].'" name="'.$id.'_value_disabledform_id_temp" id="'.$id.'_value_disabledform_id_temp"><div style="display: table;"><div id="'.$id.'_table_little" style="display: table-row-group;" '.($param['w_flow']=='hor' ? 'for_hor="'.$id.'_hor"' : '').'>';
697
-
698
- if($param['w_flow']=='hor')
699
- {
700
- $j = 0;
701
- for($i=0; $i<(int)$param['w_rowcol']; $i++)
702
- {
703
- $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
704
-
705
- for($l=0; $l<=(int)(count($param['w_choices'])/$param['w_rowcol']); $l++)
706
- {
707
- if($j >= count($param['w_choices'])%$param['w_rowcol'] && $l==(int)(count($param['w_choices'])/$param['w_rowcol']))
708
- continue;
709
-
710
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
711
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$l+$i).'" idi="'.((int)$param['w_rowcol']*$l+$i).'" style="display: table-cell;"><input type="checkbox" value="" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" name="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" other="1" onclick="if(set_checked(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$l+$i).'&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$l+$i].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled /><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$l+$i).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'">'.$param['w_choices'][(int)$param['w_rowcol']*$l+$i].'</label></div>';
712
- else
713
- {
714
- $where = '';
715
- $order_by = '';
716
- $db_info = '';
717
- if(isset($param['w_choices_value']))
718
- $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$l+$i];
719
- else
720
- $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$l+$i];
721
-
722
- if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$l+$i])
723
- {
724
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$l+$i]);
725
- $where = "where='".$w_choices_params[0]."'";
726
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
727
- $order_by = "order_by='".$w_choices_params[0]."'";
728
- $db_info = "db_info='".$w_choices_params[1]."'";
729
- }
730
-
731
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$l+$i).'" idi="'.((int)$param['w_rowcol']*$l+$i).'" style="display: table-cell;"><input type="checkbox" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" name="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" onclick="set_checked(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$l+$i).'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$l+$i].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$l+$i).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$l+$i].'</label></div>';
732
- }
733
- }
734
-
735
- $j++;
736
- $rep.='</div>';
737
-
738
- }
739
-
740
- }
741
- else
742
- {
743
- for($i=0; $i<(int)(count($param['w_choices'])/$param['w_rowcol']); $i++)
744
- {
745
- $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
746
-
747
- if(count($param['w_choices']) > (int)$param['w_rowcol'])
748
- for($l=0; $l<$param['w_rowcol']; $l++)
749
- {
750
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
751
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="checkbox" value="" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" other="1" onclick="if(set_checked(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled /><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'">'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
752
- else
753
- {
754
- $where = '' ;
755
- $order_by = '' ;
756
- $db_info = '' ;
757
- if(isset($param['w_choices_value']))
758
- $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
759
- else
760
- $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
761
-
762
- if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
763
- {
764
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
765
- $where = "where='".$w_choices_params[0]."'";
766
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
767
- $order_by = "order_by='".$w_choices_params[0]."'";
768
- $db_info = "db_info='".$w_choices_params[1]."'";
769
- }
770
-
771
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="checkbox" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" onclick="set_checked(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'"
772
- '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
773
- }
774
- }
775
- else
776
- for($l=0; $l<count($param['w_choices']); $l++)
777
- {
778
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
779
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="checkbox" value="" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" other="1" onclick="if(set_checked(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'">'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
780
- else
781
- {
782
- $where = '' ;
783
- $order_by = '' ;
784
- $db_info = '' ;
785
- if(isset($param['w_choices_value']))
786
- $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
787
- else
788
- $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
789
-
790
- if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
791
- {
792
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
793
- $where = "where='".$w_choices_params[0]."'";
794
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
795
- $order_by = "order_by='".$w_choices_params[0]."'";
796
- $db_info = "db_info='".$w_choices_params[1]."'";
797
- }
798
-
799
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="checkbox" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" onclick="set_checked(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
800
- }
801
- }
802
-
803
- $rep.='</div>';
804
- }
805
-
806
- if(count($param['w_choices'])%$param['w_rowcol']!=0)
807
- {
808
- $rep.='<div id="'.$id.'_element_tr'.((int)(count($param['w_choices'])/(int)$param['w_rowcol'])).'" style="display: table-row;">';
809
-
810
- for($k=0; $k<count($param['w_choices'])%$param['w_rowcol']; $k++)
811
- {
812
- $l = count($param['w_choices']) - count($param['w_choices'])%$param['w_rowcol'] + $k;
813
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$l)
814
- $rep.='<div valign="top" id="'.$id.'_td_little'.$l.'" idi="'.$l.'" style="display: table-cell;"><input type="checkbox" value="" id="'.$id.'_elementform_id_temp'.$l.'" name="'.$id.'_elementform_id_temp'.$l.'" other="1" onclick="if(set_checked(&quot;'.$id.'&quot;,&quot;'.$l.'&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$l.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$l.'">'.$param['w_choices'][$l].'</label></div>';
815
- else
816
- {
817
- $where = '' ;
818
- $order_by = '' ;
819
- $db_info = '' ;
820
- if(isset($param['w_choices_value']))
821
- $choise_value = $param['w_choices_value'][$l];
822
- else
823
- $choise_value = $param['w_choices'][$l];
824
-
825
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$l])
826
- {
827
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$l]);
828
- $where = "where='".$w_choices_params[0]."'";
829
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
830
- $order_by = "order_by='".$w_choices_params[0]."'";
831
- $db_info = "db_info='".$w_choices_params[1]."'";
832
- }
833
- $rep.='<div valign="top" id="'.$id.'_td_little'.$l.'" idi="'.$l.'" style="display: table-cell;"><input type="checkbox" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.$l.'" name="'.$id.'_elementform_id_temp'.$l.'" onclick="set_checked(&quot;'.$id.'&quot;,&quot;'.$l.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$l.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$l.'" '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][$l].'</label></div>';
834
- }
835
- }
836
-
837
- $rep.='</div>';
838
- }
839
-
840
-
841
-
842
- }
843
- $rep.='</div></div></div></div>';
844
- break;
845
- }
846
- case 'type_radio':
847
- {
848
-
849
- $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');
850
- $temp=$params;
851
- if(strpos($temp, 'w_field_option_pos') > -1)
852
- $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');
853
-
854
- if(strpos($temp, 'w_hide_label') > -1)
855
- $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');
856
- foreach($params_names as $params_name )
857
- {
858
- $temp=explode('*:*'.$params_name.'*:*',$temp);
859
- $param[$params_name] = $temp[0];
860
- $temp=$temp[1];
861
- }
862
-
863
- if($temp)
864
- {
865
- $temp =explode('*:*w_attr_name*:*',$temp);
866
- $attrs = array_slice($temp,0, count($temp)-1);
867
- foreach($attrs as $attr)
868
- $param['attributes'] = $param['attributes'].' add_'.$attr;
869
- }
870
- if(!isset($param['w_value_disabled']))
871
- $param['w_value_disabled'] = 'no';
872
-
873
- if(!isset($param['w_field_option_pos']))
874
- $param['w_field_option_pos'] = 'left';
875
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
876
-
877
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
878
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
879
-
880
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
881
- $param['w_choices'] = explode('***',$param['w_choices']);
882
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
883
-
884
- if(isset($param['w_choices_value']))
885
- {
886
- $param['w_choices_value'] = explode('***',$param['w_choices_value']);
887
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
888
- }
889
-
890
- foreach($param['w_choices_checked'] as $key => $choices_checked )
891
- {
892
- if($choices_checked=='true')
893
- $param['w_choices_checked'][$key]='checked="checked"';
894
- else
895
- $param['w_choices_checked'][$key]='';
896
- }
897
-
898
- $rep='<div id="wdform_field'.$id.'" type="type_radio" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_radio" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_randomize'].'" name="'.$id.'_randomizeform_id_temp" id="'.$id.'_randomizeform_id_temp"><input type="hidden" value="'.$param['w_allow_other'].'" name="'.$id.'_allow_otherform_id_temp" id="'.$id.'_allow_otherform_id_temp"><input type="hidden" value="'.$param['w_allow_other_num'].'" name="'.$id.'_allow_other_numform_id_temp" id="'.$id.'_allow_other_numform_id_temp"><input type="hidden" value="'.$param['w_rowcol'].'" name="'.$id.'_rowcol_numform_id_temp" id="'.$id.'_rowcol_numform_id_temp"><input type="hidden" value="'.$param['w_field_option_pos'].'" id="'.$id.'_option_left_right"><input type="hidden" value="'.$param['w_value_disabled'].'" name="'.$id.'_value_disabledform_id_temp" id="'.$id.'_value_disabledform_id_temp"><div style="display: table;"><div id="'.$id.'_table_little" style="display: table-row-group;" '.($param['w_flow']=='hor' ? 'for_hor="'.$id.'_hor"' : '').'>';
899
-
900
-
901
- if($param['w_flow']=='hor')
902
- {
903
- $j = 0;
904
- for($i=0; $i<(int)$param['w_rowcol']; $i++)
905
- {
906
- $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
907
-
908
- for($l=0; $l<=(int)(count($param['w_choices'])/$param['w_rowcol']); $l++)
909
- {
910
- if($j >= count($param['w_choices'])%$param['w_rowcol'] && $l==(int)(count($param['w_choices'])/$param['w_rowcol']))
911
- continue;
912
-
913
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$l+$i)
914
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$l+$i).'" idi="'.((int)$param['w_rowcol']*$l+$i).'" style="display: table-cell;"><input type="radio" value="'.$param['w_choices'][(int)$param['w_rowcol']*$l+$i].'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" name="'.$id.'_elementform_id_temp" other="1" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$l+$i).'&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$l+$i].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$l+$i).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'">'.$param['w_choices'][(int)$param['w_rowcol']*$l+$i].'</label></div>';
915
- else
916
- {
917
- $where = '' ;
918
- $order_by = '' ;
919
- $db_info = '' ;
920
- if(isset($param['w_choices_value']))
921
- $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$l+$i];
922
- else
923
- $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$l+$i];
924
-
925
- if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$l+$i])
926
- {
927
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$l+$i]);
928
- $where = "where='".$w_choices_params[0]."'";
929
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
930
- $order_by = "order_by='".$w_choices_params[0]."'";
931
- $db_info = "db_info='".$w_choices_params[1]."'";
932
- }
933
-
934
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$l+$i).'" idi="'.((int)$param['w_rowcol']*$l+$i).'" style="display: table-cell;"><input type="radio" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" name="'.$id.'_elementform_id_temp" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$l+$i).'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$l+$i].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$l+$i).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$l+$i).'" '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$l+$i].'</label></div>';
935
- }
936
- }
937
-
938
- $j++;
939
- $rep.='</div>';
940
-
941
- }
942
-
943
- }
944
- else
945
- {
946
- for($i=0; $i<(int)(count($param['w_choices'])/$param['w_rowcol']); $i++)
947
- {
948
- $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
949
-
950
- if(count($param['w_choices']) > (int)$param['w_rowcol'])
951
- for($l=0; $l<$param['w_rowcol']; $l++)
952
- {
953
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
954
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="radio" value="'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp" other="1" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'">'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
955
- else
956
- {
957
- $where = '' ;
958
- $order_by = '' ;
959
- $db_info = '' ;
960
- if(isset($param['w_choices_value']))
961
- $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
962
- else
963
- $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
964
-
965
- if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
966
- {
967
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
968
- $where = "where='".$w_choices_params[0]."'";
969
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
970
- $order_by = "order_by='".$w_choices_params[0]."'";
971
- $db_info = "db_info='".$w_choices_params[1]."'";
972
- }
973
-
974
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="radio" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
975
- }
976
- }
977
- else
978
- for($l=0; $l<count($param['w_choices']); $l++)
979
- {
980
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
981
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="radio" value="'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp" other="1" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'">'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
982
- else
983
- {
984
- $where = '' ;
985
- $order_by = '' ;
986
- $db_info = '' ;
987
- if(isset($param['w_choices_value']))
988
- $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
989
- else
990
- $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
991
-
992
- if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
993
- {
994
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
995
- $where = "where='".$w_choices_params[0]."'";
996
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
997
- $order_by = "order_by='".$w_choices_params[0]."'";
998
- $db_info = "db_info='".$w_choices_params[1]."'";
999
- }
1000
-
1001
- $rep.='<div valign="top" id="'.$id.'_td_little'.((int)$param['w_rowcol']*$i+$l).'" idi="'.((int)$param['w_rowcol']*$i+$l).'" style="display: table-cell;"><input type="radio" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" name="'.$id.'_elementform_id_temp" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.((int)$param['w_rowcol']*$i+$l).'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][(int)$param['w_rowcol']*$i+$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.((int)$param['w_rowcol']*$i+$l).'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.((int)$param['w_rowcol']*$i+$l).'" '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
1002
- }
1003
- }
1004
-
1005
- $rep.='</div>';
1006
- }
1007
-
1008
- if(count($param['w_choices'])%$param['w_rowcol']!=0)
1009
- {
1010
- $rep.='<div id="'.$id.'_element_tr'.((int)(count($param['w_choices'])/(int)$param['w_rowcol'])).'" style="display: table-row;">';
1011
-
1012
- for($k=0; $k<count($param['w_choices'])%$param['w_rowcol']; $k++)
1013
- {
1014
- $l = count($param['w_choices']) - count($param['w_choices'])%$param['w_rowcol'] + $k;
1015
- if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$l)
1016
- $rep.='<div valign="top" id="'.$id.'_td_little'.$l.'" idi="'.$l.'" style="display: table-cell;"><input type="radio" value="'.$param['w_choices'][$l].'" id="'.$id.'_elementform_id_temp'.$l.'" name="'.$id.'_elementform_id_temp" other="1" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.$l.'&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;'.$id.'&quot;,&quot;form_id_temp&quot;);" '.$param['w_choices_checked'][$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$l.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$l.'">'.$param['w_choices'][$l].'</label></div>';
1017
- else
1018
- {
1019
- $where = '' ;
1020
- $order_by = '' ;
1021
- $db_info = '' ;
1022
- if(isset($param['w_choices_value']))
1023
- $choise_value = $param['w_choices_value'][$l];
1024
- else
1025
- $choise_value = $param['w_choices'][$l];
1026
-
1027
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$l])
1028
- {
1029
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$l]);
1030
- $where = "where='".$w_choices_params[0]."'";
1031
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1032
- $order_by = "order_by='".$w_choices_params[0]."'";
1033
- $db_info = "db_info='".$w_choices_params[1]."'";
1034
- }
1035
-
1036
- $rep.='<div valign="top" id="'.$id.'_td_little'.$l.'" idi="'.$l.'" style="display: table-cell;"><input type="radio" value="'.$choise_value.'" id="'.$id.'_elementform_id_temp'.$l.'" name="'.$id.'_elementform_id_temp" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.$l.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$l].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$l.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$l.'"
1037
- '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][$l].'</label></div>';
1038
- }
1039
- }
1040
-
1041
- $rep.='</div>';
1042
- }
1043
-
1044
- }
1045
-
1046
-
1047
-
1048
- $rep.='</div></div></div></div>';
1049
-
1050
- break;
1051
- }
1052
- case 'type_own_select':
1053
- {
1054
- $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');
1055
- $temp=$params;
1056
- if(strpos($temp, 'w_choices_value') > -1)
1057
- $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');
1058
-
1059
- if(strpos($temp, 'w_hide_label') > -1)
1060
- $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');
1061
-
1062
- foreach($params_names as $params_name )
1063
- {
1064
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1065
- $param[$params_name] = $temp[0];
1066
- $temp=$temp[1];
1067
- }
1068
-
1069
- if($temp)
1070
- {
1071
- $temp =explode('*:*w_attr_name*:*',$temp);
1072
- $attrs = array_slice($temp,0, count($temp)-1);
1073
- foreach($attrs as $attr)
1074
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1075
- }
1076
-
1077
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1078
-
1079
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1080
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1081
-
1082
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1083
- $param['w_choices'] = explode('***',$param['w_choices']);
1084
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1085
- $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
1086
-
1087
- if(isset($param['w_choices_value']))
1088
- {
1089
- $param['w_choices_value'] = explode('***',$param['w_choices_value']);
1090
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1091
- }
1092
-
1093
- if(!isset($param['w_value_disabled']))
1094
- $param['w_value_disabled'] = 'no';
1095
-
1096
- foreach($param['w_choices_checked'] as $key => $choices_checked )
1097
- {
1098
- if($choices_checked=='true')
1099
- $param['w_choices_checked'][$key]='selected="selected"';
1100
- else
1101
- $param['w_choices_checked'][$key]='';
1102
- }
1103
-
1104
- $rep='<div id="wdform_field'.$id.'" type="type_own_select" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; "><input type="hidden" value="type_own_select" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_value_disabled'].'" name="'.$id.'_value_disabledform_id_temp" id="'.$id.'_value_disabledform_id_temp"><select id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" onchange="set_select(this)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled>';
1105
- foreach($param['w_choices'] as $key => $choice)
1106
- {
1107
- $where = '';
1108
- $order_by = '';
1109
- $db_info = '';
1110
- $choice_value = $param['w_choices_disabled'][$key]=='true' ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
1111
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1112
- {
1113
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1114
- $where = "where='".$w_choices_params[0]."'";
1115
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1116
- $order_by = "order_by='".$w_choices_params[0]."'";
1117
- $db_info = "db_info='".$w_choices_params[1]."'";
1118
- }
1119
-
1120
- $rep.='<option id="'.$id.'_option'.$key.'" value="'.$choice_value.'" onselect="set_select(&quot;'.$id.'_option'.$key.'&quot;)" '.$param['w_choices_checked'][$key].' '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</option>';
1121
- }
1122
- $rep.='</select></div></div>';
1123
- break;
1124
- }
1125
-
1126
- case 'type_country':
1127
- {
1128
- $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_countries','w_required','w_class');
1129
- $temp=$params;
1130
-
1131
- if(strpos($temp, 'w_hide_label') > -1)
1132
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_size','w_countries','w_required','w_class');
1133
-
1134
- foreach($params_names as $params_name )
1135
- {
1136
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1137
- $param[$params_name] = $temp[0];
1138
- $temp=$temp[1];
1139
- }
1140
-
1141
- if($temp)
1142
- {
1143
- $temp =explode('*:*w_attr_name*:*',$temp);
1144
- $attrs = array_slice($temp,0, count($temp)-1);
1145
- foreach($attrs as $attr)
1146
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1147
- }
1148
-
1149
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1150
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1151
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1152
-
1153
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1154
- $param['w_countries'] = explode('***',$param['w_countries']);
1155
-
1156
- $rep='<div id="wdform_field'.$id.'" type="type_country" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; "><input type="hidden" value="type_country" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><select id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled>';
1157
- foreach($param['w_countries'] as $key => $choice)
1158
- {
1159
- $choice_value=$choice;
1160
- $rep.='<option value="'.$choice_value.'">'.$choice.'</option>';
1161
- }
1162
- $rep.='</select></div></div>';
1163
- break;
1164
- }
1165
-
1166
- case 'type_time':
1167
- {
1168
- $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');
1169
- $temp=$params;
1170
-
1171
- if(strpos($temp, 'w_hide_label') > -1)
1172
- $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');
1173
-
1174
- foreach($params_names as $params_name )
1175
- {
1176
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1177
- $param[$params_name] = $temp[0];
1178
- $temp=$temp[1];
1179
- }
1180
-
1181
- if($temp)
1182
- {
1183
- $temp =explode('*:*w_attr_name*:*',$temp);
1184
- $attrs = array_slice($temp,0, count($temp)-1);
1185
- foreach($attrs as $attr)
1186
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1187
- }
1188
-
1189
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1190
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1191
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1192
-
1193
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1194
-
1195
- $w_mini_labels = explode('***',$param['w_mini_labels']);
1196
-
1197
-
1198
- if($param['w_sec']=='1')
1199
- {
1200
- $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div id="'.$id.'_td_time_input3" style="width: 32px; display: table-cell;"><input type="text" value="'.$param['w_ss'].'" class="time_box" id="'.$id.'_ssform_id_temp" name="'.$id.'_ssform_id_temp" onkeypress="return check_second(event, &quot;'.$id.'_ssform_id_temp&quot;)" onkeyup="change_second(&quot;'.$id.'_ssform_id_temp&quot;)" onblur="add_0(&quot;'.$id.'_ssform_id_temp&quot;)" '.$param['attributes'].' disabled /></div>';
1201
- $w_sec_label='<div style="display: table-cell;"></div><div id="'.$id.'_td_time_label3" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_ss">'.$w_mini_labels[2].'</label></div>';
1202
- }
1203
- else
1204
- {
1205
- $w_sec = '';
1206
- $w_sec_label='';
1207
- }
1208
-
1209
- if($param['w_time_type']=='12')
1210
- {
1211
- if($param['w_am_pm']=='am')
1212
- {
1213
- $am_ = "selected=\"selected\"";
1214
- $pm_ = "";
1215
- }
1216
- else
1217
- {
1218
- $am_ = "";
1219
- $pm_ = "selected=\"selected\"";
1220
-
1221
- }
1222
-
1223
- $w_time_type = '<div id="'.$id.'_am_pm_select" class="td_am_pm_select" style="display: table-cell;"><select class="am_pm_select" name="'.$id.'_am_pmform_id_temp" id="'.$id.'_am_pmform_id_temp" onchange="set_sel_am_pm(this)" '.$param['attributes'].'><option value="am" '.$am_.'>AM</option><option value="pm" '.$pm_.'>PM</option></select></div>';
1224
-
1225
- $w_time_type_label = '<div id="'.$id.'_am_pm_label" class="td_am_pm_select" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_am_pm">'.$w_mini_labels[3].'</label></div>';
1226
-
1227
- }
1228
- else
1229
- {
1230
- $w_time_type='';
1231
- $w_time_type_label = '';
1232
- }
1233
-
1234
-
1235
- $rep ='<div id="wdform_field'.$id.'" type="type_time" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_time" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><div id="'.$id.'_table_time" style="display: table;"><div id="'.$id.'_tr_time1" style="display: table-row;"><div id="'.$id.'_td_time_input1" style="width: 32px; display: table-cell;"><input type="text" value="'.$param['w_hh'].'" class="time_box" id="'.$id.'_hhform_id_temp" name="'.$id.'_hhform_id_temp" onkeypress="return check_hour(event, &quot;'.$id.'_hhform_id_temp&quot;, &quot;23&quot;)" onkeyup="change_hour(event, &quot;'.$id.'_hhform_id_temp&quot;,&quot;23&quot;)" onblur="add_0(&quot;'.$id.'_hhform_id_temp&quot;)" '.$param['attributes'].' disabled/></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div id="'.$id.'_td_time_input2" style="width: 32px; display: table-cell;"><input type="text" value="'.$param['w_mm'].'" class="time_box" id="'.$id.'_mmform_id_temp" name="'.$id.'_mmform_id_temp" onkeypress="return check_minute(event, &quot;'.$id.'_mmform_id_temp&quot;)" onkeyup="change_minute(event, &quot;'.$id.'_mmform_id_temp&quot;)" onblur="add_0(&quot;'.$id.'_mmform_id_temp&quot;)" '.$param['attributes'].' disabled/></div>'.$w_sec.$w_time_type.'</div><div id="'.$id.'_tr_time2" style="display: table-row;"><div id="'.$id.'_td_time_label1" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_hh">'.$w_mini_labels[0].'</label></div><div style="display: table-cell;"></div><div id="'.$id.'_td_time_label2" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_mm">'.$w_mini_labels[1].'</label></div>'.$w_sec_label.$w_time_type_label.'</div></div></div></div>';
1236
-
1237
- break;
1238
- }
1239
- case 'type_date':
1240
- {
1241
- $params_names=array('w_field_label_size','w_field_label_pos','w_date','w_required','w_class','w_format','w_but_val');
1242
- $temp = $params;
1243
- if(strpos($temp, 'w_disable_past_days') > -1)
1244
- $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');
1245
- foreach($params_names as $params_name )
1246
- {
1247
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1248
- $param[$params_name] = $temp[0];
1249
- $temp=$temp[1];
1250
- }
1251
-
1252
- if($temp)
1253
- {
1254
- $temp =explode('*:*w_attr_name*:*',$temp);
1255
- $attrs = array_slice($temp,0, count($temp)-1);
1256
- foreach($attrs as $attr)
1257
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1258
- }
1259
-
1260
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1261
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1262
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1263
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1264
-
1265
- $rep ='<div id="wdform_field'.$id.'" type="type_date" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_date" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_disable_past_days'].'" name="'.$id.'_dis_past_daysform_id_temp" id="'.$id.'_dis_past_daysform_id_temp"><input type="text" value="'.$param['w_date'].'" class="wdform-date" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" maxlength="10" size="10" onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" '.$param['attributes'].' disabled/><input id="'.$id.'_buttonform_id_temp" class="button" type="reset" value="'.$param['w_but_val'].'" format="'.$param['w_format'].'" src="templates/bluestork/images/system/calendar.png?ver='. WD_FM_VERSION.'" alt="calendario" '.$param['attributes'].' onclick="return showCalendar(&quot;'.$id.'_elementform_id_temp&quot; , &quot;'.$param['w_format'].'&quot;, '.$disable_past_days.')"></div></div>';
1266
-
1267
- break;
1268
- }
1269
-
1270
- ///////////////////////// type_date_new ////////////////////////////
1271
-
1272
- case 'type_date_new':
1273
- {
1274
-
1275
- $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');
1276
- $temp = $params;
1277
-
1278
- if(strpos($temp, 'w_hide_label') > -1)
1279
- $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');
1280
-
1281
-
1282
- foreach($params_names as $params_name )
1283
- {
1284
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1285
- $param[$params_name] = $temp[0];
1286
- $temp=$temp[1];
1287
- }
1288
-
1289
- if($temp)
1290
- {
1291
- $temp =explode('*:*w_attr_name*:*',$temp);
1292
- $attrs = array_slice($temp,0, count($temp)-1);
1293
- foreach($attrs as $attr)
1294
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1295
- }
1296
-
1297
-
1298
- $w_show_week_days = explode('***', $param['w_show_days']);
1299
-
1300
-
1301
-
1302
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1303
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1304
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1305
-
1306
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1307
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1308
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1309
- $display_image_date = $param['w_show_image'] == 'yes' ? 'inline' : 'none';
1310
-
1311
-
1312
- $rep ='<div id="wdform_field'.$id.'" type="type_date_new" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_date_new" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp">
1313
- <input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp">
1314
-
1315
- <input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/>
1316
-
1317
- <input type="hidden" value="'.$param['w_show_image'].'" name="'.$id.'_show_imageform_id_temp" id="'.$id.'_show_imageform_id_temp">
1318
-
1319
- <input type="hidden" value="'.$param['w_disable_past_days'].'" name="'.$id.'_dis_past_daysform_id_temp" id="'.$id.'_dis_past_daysform_id_temp">
1320
-
1321
- <input type="hidden" value="'.$param['w_default_date'].'" name="'.$id.'_default_date_id_temp" id="'.$id.'_default_date_id_temp">
1322
- <input type="hidden" value="'.$param['w_min_date'].'" name="'.$id.'_min_date_id_temp" id="'.$id.'_min_date_id_temp">
1323
- <input type="hidden" value="'.$param['w_max_date'].'" name="'.$id.'_max_date_id_temp" id="'.$id.'_max_date_id_temp">
1324
- <input type="hidden" value="'.$param['w_invalid_dates'].'" name="'.$id.'_invalid_dates_id_temp" id="'.$id.'_invalid_dates_id_temp">
1325
-
1326
- <input type="hidden" value="'.$param['w_start_day'].'" name="'.$id.'_start_dayform_id_temp" id="'.$id.'_start_dayform_id_temp">
1327
-
1328
- <input type="hidden" value="'.$param['w_hide_time'].'" name="'.$id.'_hide_timeform_id_temp" id="'.$id.'_hide_timeform_id_temp">
1329
-
1330
- <input type="hidden" name="'.$id.'_show_week_days" id="'.$id.'_show_week_days" sunday="'.$w_show_week_days[0].'" monday="'.$w_show_week_days[1].'" tuesday="'.$w_show_week_days[2].'" wednesday="'.$w_show_week_days[3].'" thursday="'.$w_show_week_days[4].'" friday="'.$w_show_week_days[5].'" saturday="'.$w_show_week_days[6].'">
1331
-
1332
-
1333
-
1334
- <input type="text" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled/>
1335
- <img src="' . WD_FM_URL . '/images/date.png" id="'.$id.'_show_imagedateform_id_temp" name="'.$id.'_show_imagedateform_id_temp" style="vertical-align : text-top; margin-left : 1px; display:'.$display_image_date.'">
1336
-
1337
- <input id="'.$id.'_buttonform_id_temp" type="hidden" value="'.$param['w_but_val'].'" format="'.$param['w_format'].'" ></div></div>';
1338
-
1339
- break;
1340
- }
1341
-
1342
-
1343
-
1344
- case 'type_date_range':
1345
- {
1346
-
1347
- $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');
1348
- $temp = $params;
1349
-
1350
- if(strpos($temp, 'w_hide_label') > -1)
1351
- $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');
1352
-
1353
-
1354
- foreach($params_names as $params_name )
1355
- {
1356
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1357
- $param[$params_name] = $temp[0];
1358
- $temp=$temp[1];
1359
- }
1360
-
1361
- if($temp)
1362
- {
1363
- $temp =explode('*:*w_attr_name*:*',$temp);
1364
- $attrs = array_slice($temp,0, count($temp)-1);
1365
- foreach($attrs as $attr)
1366
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1367
- }
1368
-
1369
-
1370
- $w_show_week_days = explode('***', $param['w_show_days']);
1371
- $defaul_day_array = explode(',', $param['w_date']);
1372
- $defaul_day_start = $defaul_day_array[0];
1373
- $defaul_day_end = $defaul_day_array[1];
1374
-
1375
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1376
-
1377
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1378
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1379
-
1380
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1381
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1382
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1383
- $display_image_date = $param['w_show_image'] == 'yes' ? 'inline' : 'none';
1384
-
1385
- $rep ='<div id="wdform_field'.$id.'" type="type_date_range" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';">
1386
-
1387
- <input type="hidden" value="type_date_range" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp">
1388
-
1389
- <input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp">
1390
-
1391
- <input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/>
1392
-
1393
- <input type="hidden" value="'.$param['w_show_image'].'" name="'.$id.'_show_imageform_id_temp" id="'.$id.'_show_imageform_id_temp">
1394
-
1395
- <input type="hidden" value="'.$param['w_disable_past_days'].'" name="'.$id.'_dis_past_daysform_id_temp" id="'.$id.'_dis_past_daysform_id_temp">
1396
-
1397
- <input type="hidden" value="'.$param['w_default_date_start'].'" name="'.$id.'_default_date_id_temp_start" id="'.$id.'_default_date_id_temp_start">
1398
-
1399
- <input type="hidden" value="'.$param['w_default_date_end'].'" name="'.$id.'_default_date_id_temp_end" id="'.$id.'_default_date_id_temp_end">
1400
-
1401
- <input type="hidden" value="'.$param['w_min_date'].'" name="'.$id.'_min_date_id_temp" id="'.$id.'_min_date_id_temp">
1402
-
1403
- <input type="hidden" value="'.$param['w_max_date'].'" name="'.$id.'_max_date_id_temp" id="'.$id.'_max_date_id_temp">
1404
-
1405
- <input type="hidden" value="'.$param['w_invalid_dates'].'" name="'.$id.'_invalid_dates_id_temp" id="'.$id.'_invalid_dates_id_temp">
1406
-
1407
- <input type="hidden" value="'.$param['w_start_day'].'" name="'.$id.'_start_dayform_id_temp" id="'.$id.'_start_dayform_id_temp">
1408
-
1409
- <input type="hidden" value="'.$param['w_hide_time'].'" name="'.$id.'_hide_timeform_id_temp" id="'.$id.'_hide_timeform_id_temp">
1410
-
1411
- <input type="hidden" name="'.$id.'_show_week_days" id="'.$id.'_show_week_days" sunday="'.$w_show_week_days[0].'" monday="'.$w_show_week_days[1].'" tuesday="'.$w_show_week_days[2].'" wednesday="'.$w_show_week_days[3].'" thursday="'.$w_show_week_days[4].'" friday="'.$w_show_week_days[5].'" saturday="'.$w_show_week_days[6].'">
1412
-
1413
-
1414
-
1415
-
1416
-
1417
- <input type="text" id="'.$id.'_elementform_id_temp0" name="'.$id.'_elementform_id_temp0" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled/>
1418
- <img src="' . WD_FM_URL . '/images/date.png" id="'.$id.'_show_imagedateform_id_temp0" name="'.$id.'_show_imagedateform_id_temp0" style="vertical-align : text-top; margin-left : 1px; display:'.$display_image_date.'">
1419
-
1420
- <span>-</span>
1421
-
1422
- <input type="text" id="'.$id.'_elementform_id_temp1" name="'.$id.'_elementform_id_temp1" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled/>
1423
- <img src="' . WD_FM_URL . '/images/date.png" id="'.$id.'_show_imagedateform_id_temp1" name="'.$id.'_show_imagedateform_id_temp1" style="vertical-align : text-top; margin-left : 1px; display:'.$display_image_date.'">
1424
-
1425
- <input id="'.$id.'_buttonform_id_temp" type="hidden" value="'.$param['w_but_val'].'" format="'.$param['w_format'].'" >
1426
-
1427
- </div></div>';
1428
-
1429
-
1430
-
1431
- break;
1432
- }
1433
-
1434
-
1435
-
1436
-
1437
-
1438
- case 'type_date_fields':
1439
- {
1440
- $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');
1441
-
1442
- $temp=$params;
1443
-
1444
- if(strpos($temp, 'w_hide_label') > -1)
1445
- $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');
1446
-
1447
-
1448
- foreach($params_names as $params_name )
1449
- {
1450
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1451
- $param[$params_name] = $temp[0];
1452
- $temp=$temp[1];
1453
- }
1454
-
1455
- if($temp)
1456
- {
1457
- $temp =explode('*:*w_attr_name*:*',$temp);
1458
- $attrs = array_slice($temp,0, count($temp)-1);
1459
- foreach($attrs as $attr)
1460
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1461
- }
1462
-
1463
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1464
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1465
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1466
-
1467
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1468
-
1469
-
1470
- if($param['w_day_type']=="SELECT")
1471
- {
1472
-
1473
-
1474
- $w_day_type = '<select id="'.$id.'_dayform_id_temp" name="'.$id.'_dayform_id_temp" onchange="set_select(this)" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].' disabled><option value=""></option>';
1475
- for($k=0; $k<=31; $k++)
1476
- {
1477
- if($k<10)
1478
- {
1479
- if($param['w_day']=='0'.$k)
1480
- $selected = "selected=\"selected\"";
1481
- else
1482
- $selected = "";
1483
-
1484
- $w_day_type .= '<option value="0'.$k.'" '.$selected.'>0'.$k.'</option>';
1485
- }
1486
- else
1487
- {
1488
- if($param['w_day']==''.$k)
1489
- $selected = "selected=\"selected\"";
1490
- else
1491
- $selected = "";
1492
-
1493
- $w_day_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
1494
- }
1495
-
1496
-
1497
-
1498
- }
1499
- $w_day_type .= '</select>';
1500
- }
1501
- else
1502
- {
1503
- $w_day_type = '<input type="text" value="'.$param['w_day'].'" id="'.$id.'_dayform_id_temp" name="'.$id.'_dayform_id_temp" onchange="change_value(&quot;'.$id.'_dayform_id_temp&quot;)" onkeypress="return check_day(event, &quot;'.$id.'_dayform_id_temp&quot;)" onblur="if (this.value==&quot;0&quot;) this.value=&quot;&quot;; else add_0(&quot;'.$id.'_dayform_id_temp&quot;)" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].' disabled/>';
1504
- }
1505
-
1506
- if($param['w_month_type']=="SELECT")
1507
- {
1508
-
1509
- $w_month_type = '<select id="'.$id.'_monthform_id_temp" name="'.$id.'_monthform_id_temp" onchange="set_select(this)" style="width: '.$param['w_month_size'].'px;" '.$param['attributes'].' disabled><option value=""></option><option value="01" '.($param['w_month']=="01" ? "selected=\"selected\"": "").' ><!--repstart-->January<!--repend--></option><option value="02" '.($param['w_month']=="02" ? "selected=\"selected\"": "").'><!--repstart-->February<!--repend--></option><option value="03" '.($param['w_month']=="03"? "selected=\"selected\"": "").'><!--repstart-->March<!--repend--></option><option value="04" '.($param['w_month']=="04" ? "selected=\"selected\"": "").' ><!--repstart-->April<!--repend--></option><option value="05" '.($param['w_month']=="05" ? "selected=\"selected\"": "").' ><!--repstart-->May<!--repend--></option><option value="06" '.($param['w_month']=="06" ? "selected=\"selected\"": "").' ><!--repstart-->June<!--repend--></option><option value="07" '.($param['w_month']=="07" ? "selected=\"selected\"": "").' ><!--repstart-->July<!--repend--></option><option value="08" '.($param['w_month']=="08" ? "selected=\"selected\"": "").' ><!--repstart-->August<!--repend--></option><option value="09" '.($param['w_month']=="09" ? "selected=\"selected\"": "").' ><!--repstart-->September<!--repend--></option><option value="10" '.($param['w_month']=="10" ? "selected=\"selected\"": "").' ><!--repstart-->October<!--repend--></option><option value="11" '.($param['w_month']=="11" ? "selected=\"selected\"": "").'><!--repstart-->November<!--repend--></option><option value="12" '.($param['w_month']=="12" ? "selected=\"selected\"": "").' ><!--repstart-->December<!--repend--></option></select>';
1510
-
1511
- }
1512
- else
1513
- {
1514
- $w_month_type = '<input type="text" value="'.$param['w_month'].'" id="'.$id.'_monthform_id_temp" name="'.$id.'_monthform_id_temp" onkeypress="return check_month(event, &quot;'.$id.'_monthform_id_temp&quot;)" onchange="change_value(&quot;'.$id.'_monthform_id_temp&quot;)" onblur="if (this.value==&quot;0&quot;) this.value=&quot;&quot;; else add_0(&quot;'.$id.'_monthform_id_temp&quot;)" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].' disabled/>';
1515
-
1516
- }
1517
- $param['w_to'] = isset($param['w_to']) && $param['w_to']!="NaN" ? $param['w_to'] : date("Y");
1518
- if($param['w_year_type']=="SELECT")
1519
- {
1520
- $w_year_type = '<select id="'.$id.'_yearform_id_temp" name="'.$id.'_yearform_id_temp" onchange="set_select(this)" from="'.$param['w_from'].'" to="'.$param['w_to'].'" style="width: '.$param['w_year_size'].'px;" '.$param['attributes'].' disabled><option value=""></option>';
1521
- for($k=$param['w_to']; $k>=$param['w_from']; $k--)
1522
- {
1523
- if($param['w_year']==$k)
1524
- $selected = "selected=\"selected\"";
1525
- else
1526
- $selected = "";
1527
-
1528
- $w_year_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
1529
- }
1530
- $w_year_type .= '</select>';
1531
-
1532
- }
1533
- else
1534
- {
1535
- $w_year_type = '<input type="text" value="'.$param['w_year'].'" id="'.$id.'_yearform_id_temp" name="'.$id.'_yearform_id_temp" onchange="change_year(&quot;'.$id.'_yearform_id_temp&quot;)" onkeypress="return check_year1(event, &quot;'.$id.'_yearform_id_temp&quot;)" onblur="check_year2(&quot;'.$id.'_yearform_id_temp&quot;)" from="'.$param['w_from'].'" to="'.$param['w_to'].'" style="width: '.$param['w_day_size'].'px;" '.$param['attributes'].' disabled/>';
1536
- }
1537
-
1538
-
1539
- $rep ='<div id="wdform_field'.$id.'" type="type_date_fields" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_date_fields" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><div id="'.$id.'_table_date" style="display: table;"><div id="'.$id.'_tr_date1" style="display: table-row;"><div id="'.$id.'_td_date_input1" style="display: table-cell;">
1540
- '.$w_day_type.'
1541
-
1542
- </div><div id="'.$id.'_td_date_separator1" style="display: table-cell;"><span id="'.$id.'_separator1" class="wdform_separator">'.$param['w_divider'].'</span></div><div id="'.$id.'_td_date_input2" style="display: table-cell;">'.$w_month_type.'</div><div id="'.$id.'_td_date_separator2" style="display: table-cell;"><span id="'.$id.'_separator2" class="wdform_separator">'.$param['w_divider'].'</span></div><div id="'.$id.'_td_date_input3" style="display: table-cell;">'.$w_year_type.'</div></div><div id="'.$id.'_tr_date2" style="display: table-row;"><div id="'.$id.'_td_date_label1" style="display: table-cell;"><label class="mini_label" id="'.$id.'_day_label">'.$param['w_day_label'].'</label></div><div style="display: table-cell;"></div><div id="'.$id.'_td_date_label2" style="display: table-cell;"><label class="mini_label" id="'.$id.'_month_label">'.$param['w_month_label'].'</label></div><div style="display: table-cell;"></div><div id="'.$id.'_td_date_label3" style="display: table-cell;"><label class="mini_label" id="'.$id.'_year_label">'.$param['w_year_label'].'</label></div></div></div></div></div>';
1543
-
1544
- break;
1545
- }
1546
- case 'type_file_upload':
1547
- {
1548
- $params_names=array('w_field_label_size','w_field_label_pos','w_destination','w_extension','w_max_size','w_required','w_multiple','w_class');
1549
- $temp=$params;
1550
-
1551
- if(strpos($temp, 'w_hide_label') > -1)
1552
- $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');
1553
-
1554
-
1555
- foreach($params_names as $params_name )
1556
- {
1557
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1558
- $param[$params_name] = $temp[0];
1559
- if (isset($temp[1])) {
1560
- $temp = $temp[1];
1561
- }
1562
- else {
1563
- $temp = '';
1564
- }
1565
- }
1566
-
1567
- if($temp)
1568
- {
1569
- $temp =explode('*:*w_attr_name*:*',$temp);
1570
- $attrs = array_slice($temp,0, count($temp)-1);
1571
- foreach($attrs as $attr)
1572
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1573
- }
1574
-
1575
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1576
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1577
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1578
-
1579
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1580
- $multiple = ($param['w_multiple']=="yes" ? "multiple='multiple'" : "");
1581
-
1582
- $rep ='<div id="wdform_field'.$id.'" type="type_file_upload" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_file_upload" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="***max_sizeskizb'.$id.'***'.$param['w_max_size'].'***max_sizeverj'.$id.'***" id="'.$id.'_max_size" name="'.$id.'_max_size"><input type="hidden" value="***destinationskizb'.$id.'***'.$param['w_destination'].'***destinationverj'.$id.'***" id="'.$id.'_destination" name="'.$id.'_destination"><input type="hidden" value="***extensionskizb'.$id.'***'.$param['w_extension'].'***extensionverj'.$id.'***" id="'.$id.'_extension" name="'.$id.'_extension"><input type="file" class="file_upload" id="'.$id.'_elementform_id_temp" name="'.$id.'_fileform_id_temp" '.$multiple.' '.$param['attributes'].' disabled/></div></div>';
1583
-
1584
- break;
1585
- }
1586
- case 'type_captcha':
1587
- {
1588
- $params_names=array('w_field_label_size','w_field_label_pos','w_digit','w_class');
1589
- $temp=$params;
1590
-
1591
- if(strpos($temp, 'w_hide_label') > -1)
1592
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_digit','w_class');
1593
-
1594
- foreach($params_names as $params_name )
1595
- {
1596
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1597
- $param[$params_name] = $temp[0];
1598
- $temp=$temp[1];
1599
- }
1600
-
1601
- if($temp)
1602
- {
1603
- $temp =explode('*:*w_attr_name*:*',$temp);
1604
- $attrs = array_slice($temp,0, count($temp)-1);
1605
- foreach($attrs as $attr)
1606
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1607
- }
1608
-
1609
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1610
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1611
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1612
-
1613
-
1614
- $rep ='<div id="wdform_field'.$id.'" type="type_captcha" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display:'.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_captcha" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><div style="display: table;"><div style="display: table-row;"><div valign="middle" style="display: table-cell;"><img type="captcha" digit="'.$param['w_digit'].'" src="' . add_query_arg(array('action' => 'formmakerwdcaptcha', 'digit' => $param['w_digit'], 'i' => 'form_id_temp'), admin_url('admin-ajax.php')) . '" id="_wd_captchaform_id_temp" class="captcha_img" onclick="captcha_refresh(&quot;_wd_captcha&quot;,&quot;form_id_temp&quot;)" '.$param['attributes'].'></div><div valign="middle" style="display: table-cell;"><div class="captcha_refresh" id="_element_refreshform_id_temp" onclick="captcha_refresh(&quot;_wd_captcha&quot;,&quot;form_id_temp&quot;)" '.$param['attributes'].'></div></div></div><div style="display: table-row;"><div style="display: table-cell;"><input type="text" class="captcha_input" id="_wd_captcha_inputform_id_temp" name="captcha_input" style="width: '.($param['w_digit']*10+15).'px;" '.$param['attributes'].' disabled/><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/></div></div></div></div></div>';
1615
-
1616
- break;
1617
- }
1618
- case 'type_arithmetic_captcha':
1619
- {
1620
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_count', 'w_operations','w_class', 'w_input_size');
1621
- $temp=$params;
1622
-
1623
- if(strpos($temp, 'w_hide_label') > -1)
1624
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_count', 'w_operations','w_class', 'w_input_size');
1625
-
1626
-
1627
- foreach($params_names as $params_name )
1628
- {
1629
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1630
- $param[$params_name] = $temp[0];
1631
- $temp=$temp[1];
1632
- }
1633
-
1634
- if($temp)
1635
- {
1636
- $temp =explode('*:*w_attr_name*:*',$temp);
1637
- $attrs = array_slice($temp,0, count($temp)-1);
1638
- foreach($attrs as $attr)
1639
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1640
- }
1641
-
1642
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1643
-
1644
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1645
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1646
- $param['w_count'] = $param['w_count'] ? $param['w_count'] : 1;
1647
- $param['w_operations'] = $param['w_operations'] ? $param['w_operations'] : '+, -, *, /';
1648
- $param['w_input_size'] = $param['w_input_size'] ? $param['w_input_size'] : 60;
1649
-
1650
- $rep ='<div id="wdform_field'.$id.'" type="type_arithmetic_captcha" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display:'.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_captcha" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><img type="captcha" operations_count="'.$param['w_count'].'" operations="'.$param['w_operations'].'" input_size="'.$param['w_input_size'].'" src="' . add_query_arg(array('action' => 'formmakerwdmathcaptcha', 'operations_count' => $param['w_count'], 'operations' => urlencode($param['w_operations']), 'i' => 'form_id_temp'), admin_url('admin-ajax.php')) . '" id="_wd_arithmetic_captchaform_id_temp" class="arithmetic_captcha_img" onclick="captcha_refresh(&quot;_wd_arithmetic_captcha&quot;,&quot;form_id_temp&quot;)" '.$param['attributes'].'></div><div style="display: table-cell;"><input type="text" class="arithmetic_captcha_input" id="_wd_arithmetic_captcha_inputform_id_temp" name="arithmetic_captcha_input" onkeypress="return check_isnum(event)" style="width: '.$param['w_input_size'].'px;" '.$param['attributes'].' disabled/><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/></div><div style="display: table-cell; vertical-align: middle;"><div class="captcha_refresh" id="_element_refreshform_id_temp" onclick="captcha_refresh(&quot;_wd_arithmetic_captcha&quot;,&quot;form_id_temp&quot;)" '.$param['attributes'].'></div></div></div></div></div></div>';
1651
-
1652
- break;
1653
- }
1654
-
1655
-
1656
- case 'type_recaptcha':
1657
- {
1658
- $params_names=array('w_field_label_size','w_field_label_pos','w_public','w_private','w_theme','w_class');
1659
- $temp=$params;
1660
-
1661
- if(strpos($temp, 'w_hide_label') > -1)
1662
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_public','w_private','w_theme','w_class');
1663
-
1664
- foreach($params_names as $params_name )
1665
- {
1666
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1667
- $param[$params_name] = $temp[0];
1668
- $temp=$temp[1];
1669
- }
1670
-
1671
- if($temp)
1672
- {
1673
- $temp =explode('*:*w_attr_name*:*',$temp);
1674
- $attrs = array_slice($temp,0, count($temp)-1);
1675
- foreach($attrs as $attr)
1676
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1677
- }
1678
-
1679
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1680
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1681
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1682
-
1683
- $rep ='<div id="wdform_field'.$id.'" type="type_recaptcha" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_recaptcha" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><div id="wd_recaptchaform_id_temp" public_key="'.$param['w_public'].'" private_key="'.$param['w_private'].'" theme="'.$param['w_theme'].'" '.$param['attributes'].'><span style="color: red; font-style: italic;">Recaptcha doesn\'t display in back end</span></div></div></div>';
1684
-
1685
- break;
1686
- }
1687
-
1688
- case 'type_hidden':
1689
- {
1690
- $params_names=array('w_name','w_value');
1691
- $temp=$params;
1692
- foreach($params_names as $params_name )
1693
- {
1694
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1695
- $param[$params_name] = $temp[0];
1696
- $temp=$temp[1];
1697
- }
1698
-
1699
- if($temp)
1700
- {
1701
- $temp =explode('*:*w_attr_name*:*',$temp);
1702
- $attrs = array_slice($temp,0, count($temp)-1);
1703
- foreach($attrs as $attr)
1704
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1705
- }
1706
- $param['w_name'] = str_replace('&nbsp;','',$param['w_name']);
1707
- $rep ='<div id="wdform_field'.$id.'" type="type_hidden" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" style="display: table-cell;"><span id="'.$id.'_element_labelform_id_temp" style="display: none;">'.$param['w_name'].'</span><span style="color: red; font-size: 13px;">Hidden field</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" style="display: table-cell; padding-left:7px;"><input type="hidden" value="'.$param['w_value'].'" id="'.$id.'_elementform_id_temp" name="'.$param['w_name'].'" '.$param['attributes'].'><input type="hidden" value="type_hidden" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><div><span align="left">Name: </span><span align="left" id="'.$id.'_hidden_nameform_id_temp">'.$param['w_name'].'</span></div><div><span align="left">Value: </span><span align="left" id="'.$id.'_hidden_valueform_id_temp">'.$param['w_value'].'</span></div></div></div>';
1708
-
1709
- break;
1710
- }
1711
- case 'type_mark_map':
1712
- {
1713
- $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');
1714
- $temp=$params;
1715
-
1716
- if(strpos($temp, 'w_hide_label') > -1)
1717
- $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');
1718
-
1719
-
1720
- foreach($params_names as $params_name )
1721
- {
1722
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1723
- $param[$params_name] = $temp[0];
1724
- $temp=$temp[1];
1725
- }
1726
-
1727
- if($temp)
1728
- {
1729
- $temp =explode('*:*w_attr_name*:*',$temp);
1730
- $attrs = array_slice($temp,0, count($temp)-1);
1731
- foreach($attrs as $attr)
1732
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1733
- }
1734
-
1735
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1736
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1737
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1738
-
1739
- $rep ='<div id="wdform_field'.$id.'" type="type_mark_map" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="type_mark_map" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><div id="'.$id.'_elementform_id_temp" long0="'.$param['w_long'].'" lat0="'.$param['w_lat'].'" zoom="'.$param['w_zoom'].'" info0="'.$param['w_info'].'" center_x="'.$param['w_center_x'].'" center_y="'.$param['w_center_y'].'" style="width: '.$param['w_width'].'px; height: '.$param['w_height'].'px;" '.$param['attributes'].'></div></div></div> ';
1740
-
1741
- break;
1742
- }
1743
-
1744
- case 'type_map':
1745
- {
1746
- $params_names=array('w_center_x','w_center_y','w_long','w_lat','w_zoom','w_width','w_height','w_info','w_class');
1747
- $temp=$params;
1748
- foreach($params_names as $params_name )
1749
- {
1750
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1751
- $param[$params_name] = $temp[0];
1752
- $temp=$temp[1];
1753
- }
1754
-
1755
- if($temp)
1756
- {
1757
- $temp =explode('*:*w_attr_name*:*',$temp);
1758
- $attrs = array_slice($temp,0, count($temp)-1);
1759
- foreach($attrs as $attr)
1760
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1761
- }
1762
-
1763
- $marker='';
1764
-
1765
- $param['w_long'] = explode('***',$param['w_long']);
1766
- $param['w_lat'] = explode('***',$param['w_lat']);
1767
- $param['w_info'] = explode('***',$param['w_info']);
1768
- foreach($param['w_long'] as $key => $w_long )
1769
- {
1770
- $marker.='long'.$key.'="'.$w_long.'" lat'.$key.'="'.$param['w_lat'][$key].'" info'.$key.'="'.$param['w_info'][$key].'"';
1771
- }
1772
-
1773
- $rep ='<div id="wdform_field'.$id.'" type="type_map" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><span id="'.$id.'_element_labelform_id_temp" style="display: none;">'.$label.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><input type="hidden" value="type_map" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><div id="'.$id.'_elementform_id_temp" zoom="'.$param['w_zoom'].'" center_x="'.$param['w_center_x'].'" center_y="'.$param['w_center_y'].'" style="width: '.$param['w_width'].'px; height: '.$param['w_height'].'px;" '.$marker.' '.$param['attributes'].'></div></div></div>';
1774
-
1775
- break;
1776
- }
1777
- case 'type_paypal_price':
1778
- {
1779
-
1780
- $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');
1781
- $temp=$params;
1782
- foreach($params_names as $params_name )
1783
- {
1784
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1785
- $param[$params_name] = $temp[0];
1786
- $temp=$temp[1];
1787
- }
1788
-
1789
- if($temp)
1790
- {
1791
- $temp =explode('*:*w_attr_name*:*',$temp);
1792
- $attrs = array_slice($temp,0, count($temp)-1);
1793
- foreach($attrs as $attr)
1794
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1795
- }
1796
-
1797
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1798
- $input_active = ($param['w_first_val']==$param['w_title'] ? "input_deactive" : "input_active");
1799
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1800
- $hide_cents = ($param['w_hide_cents']=="yes" ? "none;" : "table-cell;");
1801
-
1802
-
1803
- $w_first_val = explode('***',$param['w_first_val']);
1804
- $w_title = explode('***',$param['w_title']);
1805
- $w_mini_labels = explode('***',$param['w_mini_labels']);
1806
-
1807
- $rep ='<div id="wdform_field'.$id.'" type="type_paypal_price" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required"style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_paypal_price" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_range_min'].'" name="'.$id.'_range_minform_id_temp" id="'.$id.'_range_minform_id_temp"><input type="hidden" value="'.$param['w_range_max'].'" name="'.$id.'_range_maxform_id_temp" id="'.$id.'_range_maxform_id_temp"><div id="'.$id.'_table_price" style="display: table;"><div id="'.$id.'_tr_price1" style="display: table-row;"><div id="'.$id.'_td_name_currency" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;$&nbsp;<!--repend--></span></div><div id="'.$id.'_td_name_dollars" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_dollarsform_id_temp" name="'.$id.'_element_dollarsform_id_temp" value="'.$w_first_val[0].'" title="'.$w_title[0].'"onfocus="delete_value(&quot;'.$id.'_element_dollarsform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_element_dollarsform_id_temp&quot;)"onchange="change_value(&quot;'.$id.'_element_dollarsform_id_temp&quot;)" onkeypress="return check_isnum(event)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled/></div><div id="'.$id.'_td_name_divider" style="display: '.$hide_cents.';"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;.&nbsp;</span></div><div id="'.$id.'_td_name_cents" style="display: '.$hide_cents.'"><input type="text" class="'.$input_active.'" id="'.$id.'_element_centsform_id_temp" name="'.$id.'_element_centsform_id_temp" value="'.$w_first_val[1].'" title="'.$w_title[1].'"onfocus="delete_value(&quot;'.$id.'_element_centsform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_element_centsform_id_temp&quot;); add_0(&quot;'.$id.'_element_centsform_id_temp&quot;)"onchange="change_value(&quot;'.$id.'_element_centsform_id_temp&quot;)" onkeypress="return check_isnum_interval(event,&quot;'.$id.'_element_centsform_id_temp&quot;,0,99)"style="width: 30px;" '.$param['attributes'].' disabled/></div></div><div id="'.$id.'_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" id="'.$id.'_mini_label_dollars">'.$w_mini_labels[0].'</label></div><div id="'.$id.'_td_name_label_divider" style="display: '.$hide_cents.'"><label class="mini_label"></label></div><div align="left" id="'.$id.'_td_name_label_cents" style="display: '.$hide_cents.'"><label class="mini_label" id="'.$id.'_mini_label_cents">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
1808
- break;
1809
- }
1810
-
1811
- case 'type_paypal_price_new':
1812
- {
1813
- $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');
1814
-
1815
- $temp=$params;
1816
-
1817
- if(strpos($temp, 'w_hide_label') > -1)
1818
- $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');
1819
-
1820
-
1821
- foreach($params_names as $params_name )
1822
- {
1823
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1824
- $param[$params_name] = $temp[0];
1825
- $temp=$temp[1];
1826
- }
1827
-
1828
- if($temp)
1829
- {
1830
- $temp =explode('*:*w_attr_name*:*',$temp);
1831
- $attrs = array_slice($temp,0, count($temp)-1);
1832
- foreach($attrs as $attr)
1833
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1834
- }
1835
-
1836
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1837
-
1838
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1839
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1840
-
1841
- $input_active = ($param['w_first_val']==$param['w_title'] ? "input_deactive" : "input_active");
1842
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1843
- $currency_sumbol = ($param['w_currency']=="yes" ? "display:none;" : "display: table-cell;");
1844
- $param['w_readonly'] = (isset($param['w_readonly']) ? $param['w_readonly'] : "no");
1845
-
1846
- $rep ='<div id="wdform_field'.$id.'" type="type_paypal_price_new" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required"style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_paypal_price_new" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_readonly'].'" name="'.$id.'_readonlyform_id_temp" id="'.$id.'_readonlyform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_range_min'].'" name="'.$id.'_range_minform_id_temp" id="'.$id.'_range_minform_id_temp"><input type="hidden" value="'.$param['w_range_max'].'" name="'.$id.'_range_maxform_id_temp" id="'.$id.'_range_maxform_id_temp"><div id="'.$id.'_table_price" style="display: table;"><div id="'.$id.'_tr_price1" style="display: table-row;"><div id="'.$id.'_td_name_currency" style="'.$currency_sumbol.'"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;$&nbsp;<!--repend--></span></div><div id="'.$id.'_td_name_dollars" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" value="'.$param['w_first_val'].'" title="'.$param['w_title'].'"onfocus="delete_value(&quot;'.$id.'_elementform_id_temp&quot;)" onblur="return_value(&quot;'.$id.'_elementform_id_temp&quot;)"onchange="change_value(&quot;'.$id.'_elementform_id_temp&quot;)" onkeypress="return check_isnum(event)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled/></div></div></div></div></div>';
1847
- break;
1848
- }
1849
-
1850
-
1851
-
1852
-
1853
-
1854
- case 'type_paypal_select':
1855
- {
1856
- $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');
1857
- $temp=$params;
1858
- if(strpos($temp, 'w_choices_params') > -1)
1859
- $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');
1860
-
1861
- if(strpos($temp, 'w_hide_label') > -1)
1862
- $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');
1863
-
1864
- foreach($params_names as $params_name )
1865
- {
1866
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1867
- $param[$params_name] = $temp[0];
1868
- $temp=$temp[1];
1869
- }
1870
-
1871
- if($temp)
1872
- {
1873
- $temp =explode('*:*w_attr_name*:*',$temp);
1874
- $attrs = array_slice($temp,0, count($temp)-1);
1875
- foreach($attrs as $attr)
1876
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1877
- }
1878
-
1879
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1880
-
1881
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1882
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1883
-
1884
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1885
- $param['w_choices'] = explode('***',$param['w_choices']);
1886
-
1887
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
1888
-
1889
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1890
-
1891
- $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
1892
- $param['w_property'] = explode('***',$param['w_property']);
1893
- $param['w_property_values'] = explode('***',$param['w_property_values']);
1894
- if(isset($param['w_choices_params']))
1895
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1896
- foreach($param['w_choices_checked'] as $key => $choices_checked )
1897
- {
1898
- if($choices_checked=='true')
1899
- $param['w_choices_checked'][$key]='selected="selected"';
1900
- else
1901
- $param['w_choices_checked'][$key]='';
1902
- }
1903
-
1904
-
1905
- $rep='<div id="wdform_field'.$id.'" type="type_paypal_select" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; "><input type="hidden" value="type_paypal_select" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><select id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" onchange="set_select(this)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled>';
1906
- foreach($param['w_choices'] as $key => $choice)
1907
- {
1908
- $where = '';
1909
- $order_by = '';
1910
- $db_info = '';
1911
- $choice_value = $param['w_choices_disabled'][$key]=="true" ? '' : $param['w_choices_price'][$key];
1912
-
1913
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1914
- {
1915
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1916
- $where = "where='".$w_choices_params[0]."'";
1917
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1918
- $order_by = "order_by='".$w_choices_params[0]."'";
1919
- $db_info = "db_info='".$w_choices_params[1]."'";
1920
- }
1921
- $rep.='<option id="'.$id.'_option'.$key.'" value="'.$choice_value.'" onselect="set_select(&quot;'.$id.'_option'.$key.'&quot;)" '.$param['w_choices_checked'][$key].' '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</option>';
1922
- }
1923
- $rep.='</select><div id="'.$id.'_divform_id_temp">';
1924
- if($param['w_quantity']=="yes")
1925
- $rep.='<span id="'.$id.'_element_quantity_spanform_id_temp" style="margin-right: 15px;"><label class="mini_label" id="'.$id.'_element_quantity_label_form_id_temp" style="margin-right: 5px;"><!--repstart-->Quantity<!--repend--></label><input type="text" value="'.$param['w_quantity_value'].'" id="'.$id.'_element_quantityform_id_temp" name="'.$id.'_element_quantityform_id_temp" onkeypress="return check_isnum(event)" onchange="change_value(&quot;'.$id.'_element_quantityform_id_temp&quot;, this.value)" style="width: 30px; margin: 2px 0px;" disabled /></span>';
1926
- if($param['w_property'][0])
1927
- foreach($param['w_property'] as $key => $property)
1928
- {
1929
-
1930
- $rep.='
1931
- <span id="'.$id.'_property_'.$key.'" style="margin-right: 15px;">
1932
-
1933
- <label class="mini_label" id="'.$id.'_property_label_form_id_temp'.$key.'" style="margin-right: 5px;">'.$property.'</label>
1934
- <select id="'.$id.'_propertyform_id_temp'.$key.'" name="'.$id.'_propertyform_id_temp'.$key.'" style="width: auto; margin: 2px 0px;" disabled>';
1935
- $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
1936
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
1937
- foreach($param['w_property_values'][$key] as $subkey => $property_value)
1938
- {
1939
- $rep.='<option id="'.$id.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'">'.$property_value.'</option>';
1940
- }
1941
- $rep.='</select></span>';
1942
- }
1943
-
1944
- $rep.='</div></div></div>';
1945
- break;
1946
- }
1947
-
1948
- case 'type_paypal_checkbox':
1949
- {
1950
-
1951
- $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');
1952
- $temp=$params;
1953
- if(strpos($temp, 'w_field_option_pos') > -1)
1954
- $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');
1955
-
1956
- if(strpos($temp, 'w_hide_label') > -1)
1957
- $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');
1958
- foreach($params_names as $params_name )
1959
- {
1960
- $temp=explode('*:*'.$params_name.'*:*',$temp);
1961
- $param[$params_name] = $temp[0];
1962
- $temp=$temp[1];
1963
- }
1964
-
1965
- if($temp)
1966
- {
1967
- $temp =explode('*:*w_attr_name*:*',$temp);
1968
- $attrs = array_slice($temp,0, count($temp)-1);
1969
- foreach($attrs as $attr)
1970
- $param['attributes'] = $param['attributes'].' add_'.$attr;
1971
- }
1972
- if(!isset($param['w_field_option_pos']))
1973
- $param['w_field_option_pos'] = 'left';
1974
-
1975
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1976
-
1977
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1978
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1979
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
1980
- $param['w_choices'] = explode('***',$param['w_choices']);
1981
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
1982
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1983
- $param['w_property'] = explode('***',$param['w_property']);
1984
- $param['w_property_values'] = explode('***',$param['w_property_values']);
1985
-
1986
- if(isset($param['w_choices_params']))
1987
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1988
-
1989
- foreach($param['w_choices_checked'] as $key => $choices_checked )
1990
- {
1991
- if($choices_checked=='true')
1992
- $param['w_choices_checked'][$key]='checked="checked"';
1993
- else
1994
- $param['w_choices_checked'][$key]='';
1995
- }
1996
-
1997
- $rep='<div id="wdform_field'.$id.'" type="type_paypal_checkbox" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="wd_form_label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_paypal_checkbox" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_randomize'].'" name="'.$id.'_randomizeform_id_temp" id="'.$id.'_randomizeform_id_temp"><input type="hidden" value="'.$param['w_allow_other'].'" name="'.$id.'_allow_otherform_id_temp" id="'.$id.'_allow_otherform_id_temp"><input type="hidden" value="'.$param['w_allow_other_num'].'" name="'.$id.'_allow_other_numform_id_temp" id="'.$id.'_allow_other_numform_id_temp"><input type="hidden" value="'.$param['w_field_option_pos'].'" id="'.$id.'_option_left_right"><div style="display: table;"><div id="'.$id.'_table_little" style="display: table-row-group;">';
1998
-
1999
- if($param['w_flow']=='hor')
2000
- {
2001
- $rep.= '<div id="'.$id.'_hor" style="display: table-row;">';
2002
- foreach($param['w_choices'] as $key => $choice)
2003
- {
2004
- $where ='';
2005
- $order_by ='';
2006
- $db_info = '';
2007
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2008
- {
2009
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2010
- $where = "where='".$w_choices_params[0]."'";
2011
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2012
- $order_by = "order_by='".$w_choices_params[0]."'";
2013
- $db_info = "db_info='".$w_choices_params[1]."'";
2014
- }
2015
-
2016
- $rep.='<div valign="top" id="'.$id.'_td_little'.$key.'" idi="'.$key.'" style="display: table-cell;"><input type="checkbox" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp'.$key.'" value="'.$param['w_choices_price'][$key].'" onclick="set_checked(&quot;'.$id.'&quot;,&quot;'.$key.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$key].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$key.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$key.'" '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</label></div>';
2017
- }
2018
- $rep.= '</div>';
2019
- }
2020
- else
2021
- {
2022
-
2023
- foreach($param['w_choices'] as $key => $choice)
2024
- {
2025
- $where ='';
2026
- $order_by ='';
2027
- $db_info ='';
2028
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2029
- {
2030
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2031
- $where = "where='".$w_choices_params[0]."'";
2032
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2033
- $order_by = "order_by='".$w_choices_params[0]."'";
2034
- $db_info = "db_info='".$w_choices_params[1]."'";
2035
- }
2036
-
2037
- $rep.='<div id="'.$id.'_element_tr'.$key.'" style="display: table-row;"><div valign="top" id="'.$id.'_td_little'.$key.'" idi="'.$key.'" style="display: table-cell;"><input type="checkbox" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp'.$key.'" value="'.$param['w_choices_price'][$key].'" onclick="set_checked(&quot;'.$id.'&quot;,&quot;'.$key.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$key].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$key.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$key.'" '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</label></div></div>';
2038
- }
2039
-
2040
- }
2041
- $rep.='</div></div>';
2042
-
2043
- $rep.='<div id="'.$id.'_divform_id_temp">';
2044
- if($param['w_quantity']=="yes")
2045
- $rep.='<span id="'.$id.'_element_quantity_spanform_id_temp" style="margin-right: 15px;"><label class="mini_label" id="'.$id.'_element_quantity_label_form_id_temp" style="margin-right: 5px;"><!--repstart-->Quantity<!--repend--></label><input type="text" value="'.$param['w_quantity_value'].'" id="'.$id.'_element_quantityform_id_temp" name="'.$id.'_element_quantityform_id_temp" onkeypress="return check_isnum(event)" onchange="change_value(&quot;'.$id.'_element_quantityform_id_temp&quot;, this.value)" style="width: 30px; margin: 2px 0px;" disabled/></span>';
2046
- if($param['w_property'][0])
2047
- foreach($param['w_property'] as $key => $property)
2048
- {
2049
- $rep.='
2050
- <span id="'.$id.'_property_'.$key.'" style="margin-right: 15px;">
2051
-
2052
- <label class="mini_label" id="'.$id.'_property_label_form_id_temp'.$key.'" style="margin-right: 5px;">'.$property.'</label>
2053
- <select id="'.$id.'_propertyform_id_temp'.$key.'" name="'.$id.'_propertyform_id_temp'.$key.'" style="width: auto; margin: 2px 0px;" disabled>';
2054
- $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
2055
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
2056
- foreach($param['w_property_values'][$key] as $subkey => $property_value)
2057
- {
2058
- $rep.='<option id="'.$id.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'">'.$property_value.'</option>';
2059
- }
2060
- $rep.='</select></span>';
2061
- }
2062
-
2063
- $rep.='</div></div></div>';
2064
- break;
2065
- }
2066
- case 'type_paypal_radio':
2067
- {
2068
-
2069
- $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');
2070
- $temp=$params;
2071
- if(strpos($temp, 'w_field_option_pos') > -1)
2072
- $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');
2073
- if(strpos($temp, 'w_hide_label') > -1)
2074
- $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');
2075
- foreach($params_names as $params_name )
2076
- {
2077
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2078
- $param[$params_name] = $temp[0];
2079
- $temp=$temp[1];
2080
- }
2081
-
2082
- if($temp)
2083
- {
2084
- $temp =explode('*:*w_attr_name*:*',$temp);
2085
- $attrs = array_slice($temp,0, count($temp)-1);
2086
- foreach($attrs as $attr)
2087
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2088
- }
2089
- if(!isset($param['w_field_option_pos']))
2090
- $param['w_field_option_pos'] = 'left';
2091
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2092
-
2093
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2094
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2095
-
2096
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2097
- $param['w_choices'] = explode('***',$param['w_choices']);
2098
-
2099
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
2100
-
2101
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
2102
-
2103
- $param['w_property'] = explode('***',$param['w_property']);
2104
- $param['w_property_values'] = explode('***',$param['w_property_values']);
2105
-
2106
- if(isset($param['w_choices_params']))
2107
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2108
-
2109
- foreach($param['w_choices_checked'] as $key => $choices_checked )
2110
- {
2111
- if($choices_checked=='true')
2112
- $param['w_choices_checked'][$key]='checked="checked"';
2113
- else
2114
- $param['w_choices_checked'][$key]='';
2115
- }
2116
-
2117
- $rep='<div id="wdform_field'.$id.'" type="type_paypal_radio" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="wd_form_label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_paypal_radio" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_randomize'].'" name="'.$id.'_randomizeform_id_temp" id="'.$id.'_randomizeform_id_temp"><input type="hidden" value="'.$param['w_allow_other'].'" name="'.$id.'_allow_otherform_id_temp" id="'.$id.'_allow_otherform_id_temp"><input type="hidden" value="'.$param['w_allow_other_num'].'" name="'.$id.'_allow_other_numform_id_temp" id="'.$id.'_allow_other_numform_id_temp"><input type="hidden" value="'.$param['w_field_option_pos'].'" id="'.$id.'_option_left_right"><div style="display: table;"><div id="'.$id.'_table_little" style="display: table-row-group;">';
2118
-
2119
- if($param['w_flow']=='hor')
2120
- {
2121
- $rep.= '<div id="'.$id.'_hor" style="display: table-row;">';
2122
- foreach($param['w_choices'] as $key => $choice)
2123
- {
2124
- $where ='';
2125
- $order_by ='';
2126
- $db_info ='';
2127
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2128
- {
2129
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2130
- $where = "where='".$w_choices_params[0]."'";
2131
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2132
- $order_by = "order_by='".$w_choices_params[0]."'";
2133
- $db_info = "db_info='".$w_choices_params[1]."'";
2134
- }
2135
-
2136
- $rep.='<div valign="top" id="'.$id.'_td_little'.$key.'" idi="'.$key.'" style="display: table-cell;"><input type="radio" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp" value="'.$param['w_choices_price'][$key].'" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.$key.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$key].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$key.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$key.'" '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</label></div>';
2137
- }
2138
- $rep.= '</div>';
2139
- }
2140
- else
2141
- {
2142
-
2143
- foreach($param['w_choices'] as $key => $choice)
2144
- {
2145
-
2146
- $where ='';
2147
- $order_by ='';
2148
- $db_info ='';
2149
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2150
- {
2151
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2152
- $where = "where='".$w_choices_params[0]."'";
2153
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2154
- $order_by = "order_by='".$w_choices_params[0]."'";
2155
- $db_info = "db_info='".$w_choices_params[1]."'";
2156
- }
2157
-
2158
- $rep.='<div id="'.$id.'_element_tr'.$key.'" style="display: table-row;"><div valign="top" id="'.$id.'_td_little'.$key.'" idi="'.$key.'" style="display: table-cell;"><input type="radio" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp" value="'.$param['w_choices_price'][$key].'" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.$key.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$key].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$key.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$key.'" '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</label></div></div>';
2159
- }
2160
-
2161
- }
2162
- $rep.='</div></div>';
2163
-
2164
- $rep.='<div id="'.$id.'_divform_id_temp">';
2165
- if($param['w_quantity']=="yes")
2166
- $rep.='<span id="'.$id.'_element_quantity_spanform_id_temp" style="margin-right: 15px;"><label class="mini_label" id="'.$id.'_element_quantity_label_form_id_temp" style="margin-right: 5px;"><!--repstart-->Quantity<!--repend--></label><input type="text" value="'.$param['w_quantity_value'].'" id="'.$id.'_element_quantityform_id_temp" name="'.$id.'_element_quantityform_id_temp" onkeypress="return check_isnum(event)" onchange="change_value(&quot;'.$id.'_element_quantityform_id_temp&quot;, this.value)" style="width: 30px; margin: 2px 0px;" disabled/></span>';
2167
- if($param['w_property'][0])
2168
- foreach($param['w_property'] as $key => $property)
2169
- {
2170
- $rep.='
2171
- <span id="'.$id.'_property_'.$key.'" style="margin-right: 15px;">
2172
-
2173
- <label class="mini_label" id="'.$id.'_property_label_form_id_temp'.$key.'" style="margin-right: 5px;">'.$property.'</label>
2174
- <select id="'.$id.'_propertyform_id_temp'.$key.'" name="'.$id.'_propertyform_id_temp'.$key.'" style="width: auto; margin: 2px 0px;" disabled>';
2175
- $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
2176
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
2177
- foreach($param['w_property_values'][$key] as $subkey => $property_value)
2178
- {
2179
- $rep.='<option id="'.$id.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'">'.$property_value.'</option>';
2180
- }
2181
- $rep.='</select></span>';
2182
- }
2183
-
2184
- $rep.='</div></div></div>';
2185
-
2186
- break;
2187
- }
2188
- case 'type_paypal_shipping':
2189
- {
2190
-
2191
- $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');
2192
- $temp=$params;
2193
-
2194
- if(strpos($temp, 'w_field_option_pos') > -1)
2195
- $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');
2196
-
2197
- if(strpos($temp, 'w_hide_label') > -1)
2198
- $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');
2199
-
2200
- foreach($params_names as $params_name )
2201
- {
2202
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2203
- $param[$params_name] = $temp[0];
2204
- $temp=$temp[1];
2205
- }
2206
-
2207
- if($temp)
2208
- {
2209
- $temp =explode('*:*w_attr_name*:*',$temp);
2210
- $attrs = array_slice($temp,0, count($temp)-1);
2211
- foreach($attrs as $attr)
2212
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2213
- }
2214
- if(!isset($param['w_field_option_pos']))
2215
- $param['w_field_option_pos'] = 'left';
2216
-
2217
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2218
-
2219
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2220
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2221
-
2222
-
2223
-
2224
-
2225
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2226
- $param['w_choices'] = explode('***',$param['w_choices']);
2227
-
2228
- $param['w_choices_price'] = explode('***',$param['w_choices_price']);
2229
-
2230
- $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
2231
-
2232
- if(isset($param['w_choices_params']))
2233
- $param['w_choices_params'] = explode('***',$param['w_choices_params']);
2234
-
2235
- foreach($param['w_choices_checked'] as $key => $choices_checked )
2236
- {
2237
- if($choices_checked=='true')
2238
- $param['w_choices_checked'][$key]='checked="checked"';
2239
- else
2240
- $param['w_choices_checked'][$key]='';
2241
- }
2242
-
2243
- $rep='<div id="wdform_field'.$id.'" type="type_paypal_shipping" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="wd_form_label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required" style="vertical-align: top;">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; vertical-align:top;"><input type="hidden" value="type_paypal_shipping" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_randomize'].'" name="'.$id.'_randomizeform_id_temp" id="'.$id.'_randomizeform_id_temp"><input type="hidden" value="'.$param['w_allow_other'].'" name="'.$id.'_allow_otherform_id_temp" id="'.$id.'_allow_otherform_id_temp"><input type="hidden" value="'.$param['w_allow_other_num'].'" name="'.$id.'_allow_other_numform_id_temp" id="'.$id.'_allow_other_numform_id_temp"><input type="hidden" value="'.$param['w_field_option_pos'].'" id="'.$id.'_option_left_right"><div style="display: table;"><div id="'.$id.'_table_little" style="display: table-row-group;">';
2244
-
2245
- if($param['w_flow']=='hor')
2246
- {
2247
- $rep.= '<div id="'.$id.'_hor" style="display: table-row;">';
2248
- foreach($param['w_choices'] as $key => $choice)
2249
- {
2250
- $where ='';
2251
- $order_by ='';
2252
- $db_info ='';
2253
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2254
- {
2255
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2256
- $where = "where='".$w_choices_params[0]."'";
2257
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2258
- $order_by = "order_by='".$w_choices_params[0]."'";
2259
- $db_info = "db_info='".$w_choices_params[1]."'";
2260
- }
2261
-
2262
- $rep.='<div valign="top" id="'.$id.'_td_little'.$key.'" idi="'.$key.'" style="display: table-cell;"><input type="radio" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp" value="'.$param['w_choices_price'][$key].'" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.$key.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$key].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$key.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$key.'" '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</label></div>';
2263
- }
2264
- $rep.= '</div>';
2265
- }
2266
- else
2267
- {
2268
-
2269
- foreach($param['w_choices'] as $key => $choice)
2270
- {
2271
- $where ='';
2272
- $order_by ='';
2273
- $db_info ='';
2274
- if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
2275
- {
2276
- $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
2277
- $where = "where='".$w_choices_params[0]."'";
2278
- $w_choices_params = explode('[db_info]',$w_choices_params[1]);
2279
- $order_by = "order_by='".$w_choices_params[0]."'";
2280
- $db_info = "db_info='".$w_choices_params[1]."'";
2281
- }
2282
-
2283
- $rep.='<div id="'.$id.'_element_tr'.$key.'" style="display: table-row;"><div valign="top" id="'.$id.'_td_little'.$key.'" idi="'.$key.'" style="display: table-cell;"><input type="radio" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp" value="'.$param['w_choices_price'][$key].'" onclick="set_default(&quot;'.$id.'&quot;,&quot;'.$key.'&quot;,&quot;form_id_temp&quot;)" '.$param['w_choices_checked'][$key].' '.$param['attributes'].' '.($param['w_field_option_pos']=='right' ? 'style="float:left !important;"' : "").' disabled/><label id="'.$id.'_label_element'.$key.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$key.'" '.$where.' '.$order_by.' '.$db_info.'>'.$choice.'</label></div></div>';
2284
- }
2285
-
2286
- }
2287
- $rep.='</div></div>';
2288
-
2289
- $rep.='</div></div>';
2290
-
2291
- break;
2292
- }
2293
- case 'type_paypal_total':
2294
- {
2295
- $params_names=array('w_field_label_size','w_field_label_pos','w_class');
2296
- $temp=$params;
2297
- if(strpos($temp, 'w_size') > -1)
2298
- $params_names=array('w_field_label_size','w_field_label_pos','w_class', 'w_size');
2299
-
2300
- if(strpos($temp, 'w_hide_label') > -1)
2301
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_class', 'w_size');
2302
-
2303
- foreach($params_names as $params_name )
2304
- {
2305
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2306
- $param[$params_name] = $temp[0];
2307
- $temp=$temp[1];
2308
- }
2309
-
2310
- if($temp)
2311
- {
2312
- $temp = explode('*:*w_attr_name*:*',$temp);
2313
- $attrs = array_slice($temp,0, count($temp)-1);
2314
- foreach($attrs as $attr)
2315
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2316
- }
2317
-
2318
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2319
-
2320
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2321
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2322
- $param['w_size'] = isset($param['w_size']) ? $param['w_size'] : '300';
2323
-
2324
- $rep='<div id="wdform_field'.$id.'" type="type_paypal_total" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_paypal_total" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><div id="'.$id.'paypal_totalform_id_temp" class="wdform_paypal_total paypal_totalform_id_temp" style="width:'.$param['w_size'].'px;"><input type="hidden" value="" name="'.$id.'_paypal_totalform_id_temp" class="input_paypal_totalform_id_temp"><div id="'.$id.'div_totalform_id_temp" class="div_totalform_id_temp" style="margin-bottom: 10px;"><!--repstart-->$300<!--repend--></div><div id="'.$id.'paypal_productsform_id_temp" class="paypal_productsform_id_temp" style="border-spacing: 2px;"><div style="border-spacing: 2px;"><!--repstart-->product 1 $100<!--repend--></div><div style="border-spacing: 2px;"><!--repstart-->product 2 $200<!--repend--></div></div><div id="'.$id.'paypal_taxform_id_temp" class="paypal_taxform_id_temp" style="border-spacing: 2px; margin-top: 7px;"></div></div></div></div>';
2325
-
2326
- break;
2327
- }
2328
-
2329
-
2330
-
2331
- case 'type_stripe': {
2332
- $params_names=array('w_field_size', 'w_field_label_size','w_field_label_pos','w_class');
2333
- $temp=$params;
2334
- foreach($params_names as $params_name )
2335
- {
2336
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2337
- $param[$params_name] = $temp[0];
2338
- $temp=$temp[1];
2339
- }
2340
-
2341
- if($temp)
2342
- {
2343
- $temp =explode('*:*w_attr_name*:*',$temp);
2344
- $attrs = array_slice($temp,0, count($temp)-1);
2345
- foreach($attrs as $attr)
2346
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2347
- }
2348
-
2349
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2350
- $rep='<div id="wdform_field'.$id.'" type="type_stripe" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="display: none;">stripe</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><div id="'.$id.'_elementform_id_temp" style="width:'.$param['w_field_size'].'px; margin:10px; border: 1px solid #000; min-width:80px;text-align:center;"> Stripe Section</div><input type="hidden" id="is_stripe" /><input type="hidden" value="type_stripe" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"></div></div>';
2351
-
2352
- break;
2353
- }
2354
-
2355
- case 'type_star_rating':
2356
- {
2357
- $params_names=array('w_field_label_size','w_field_label_pos','w_field_label_col','w_star_amount','w_required','w_class');
2358
- $temp=$params;
2359
-
2360
- if(strpos($temp, 'w_hide_label') > -1)
2361
- $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');
2362
-
2363
- foreach($params_names as $params_name )
2364
- {
2365
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2366
- $param[$params_name] = $temp[0];
2367
- $temp=$temp[1];
2368
- }
2369
-
2370
- if($temp)
2371
- {
2372
- $temp =explode('*:*w_attr_name*:*',$temp);
2373
- $attrs = array_slice($temp,0, count($temp)-1);
2374
- foreach($attrs as $attr)
2375
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2376
- }
2377
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2378
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2379
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2380
-
2381
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2382
-
2383
-
2384
- $images = '';
2385
- for($i=0; $i<$param['w_star_amount']; $i++)
2386
- {
2387
- $images .= '<img id="'.$id.'_star_'.$i.'" src="' . WD_FM_URL . '/images/star.png?ver='. WD_FM_VERSION.'" onmouseover="change_src('.$i.','.$id.',&quot;form_id_temp&quot;)" onmouseout="reset_src('.$i.','.$id.')" onclick="select_star_rating('.$i.','.$id.', &quot;form_id_temp&quot;)">';
2388
- }
2389
-
2390
- $rep ='<div id="wdform_field'.$id.'" type="type_star_rating" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_star_rating" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_star_amount'].'" id="'.$id.'_star_amountform_id_temp" name="'.$id.'_star_amountform_id_temp"><input type="hidden" value="'.$param['w_field_label_col'].'" name="'.$id.'_star_colorform_id_temp" id="'.$id.'_star_colorform_id_temp"><div id="'.$id.'_elementform_id_temp" class="wdform_stars" '.$param['attributes'].'>'.$images.'</div></div></div>';
2391
-
2392
-
2393
- break;
2394
- }
2395
- case 'type_scale_rating':
2396
- {
2397
- $params_names=array('w_field_label_size','w_field_label_pos','w_mini_labels','w_scale_amount','w_required','w_class');
2398
- $temp=$params;
2399
-
2400
- if(strpos($temp, 'w_hide_label') > -1)
2401
- $params_names=array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_mini_labels','w_scale_amount','w_required','w_class');
2402
-
2403
- foreach($params_names as $params_name )
2404
- {
2405
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2406
- $param[$params_name] = $temp[0];
2407
- $temp=$temp[1];
2408
- }
2409
-
2410
- if($temp)
2411
- {
2412
- $temp =explode('*:*w_attr_name*:*',$temp);
2413
- $attrs = array_slice($temp,0, count($temp)-1);
2414
- foreach($attrs as $attr)
2415
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2416
- }
2417
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2418
-
2419
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2420
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2421
-
2422
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2423
-
2424
- $w_mini_labels = explode('***',$param['w_mini_labels']);
2425
-
2426
- $numbers = '';
2427
- for($i=1; $i<=$param['w_scale_amount']; $i++)
2428
- {
2429
- $numbers .= '<div id="'.$id.'_scale_td1_'.$i.'form_id_temp" style="text-align: center; display: table-cell;"><span>'.$i.'</span></div>';
2430
- }
2431
-
2432
-
2433
- $radio_buttons = '';
2434
- for($k=1; $k<=$param['w_scale_amount']; $k++)
2435
- {
2436
- $radio_buttons .= '<div id="'.$id.'_scale_td2_'.$k.'form_id_temp" style="display: table-cell;"><input id="'.$id.'_scale_radioform_id_temp_'.$k.'" name="'.$id.'_scale_radioform_id_temp" value="'.$k.'" type="radio"></div>';
2437
- }
2438
-
2439
- $rep ='<div id="wdform_field'.$id.'" type="type_scale_rating" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; vertical-align: top; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_scale_rating" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_scale_amount'].'" id="'.$id.'_scale_amountform_id_temp" name="'.$id.'_scale_amountform_id_temp"><div id="'.$id.'_elementform_id_temp" style="float: left;" '.$param['attributes'].'><label class="mini_label" id="'.$id.'_mini_label_worst" style="position: relative; top: 6px; font-size: 11px; display: inline-table;">'.$w_mini_labels[0].'</label><div id="'.$id.'_scale_tableform_id_temp" style="display: inline-table;"><div id="'.$id.'_scale_tr1form_id_temp" style="display: table-row;">'.$numbers.'</div><div id="'.$id.'_scale_tr2form_id_temp" style="display: table-row;">'.$radio_buttons.'</div></div><label class="mini_label" id="'.$id.'_mini_label_best" style="position: relative; top: 6px; font-size: 11px; display: inline-table;">'.$w_mini_labels[1].'</label></div></div></div>';
2440
-
2441
- break;
2442
- }
2443
- case 'type_spinner':
2444
- {
2445
- $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');
2446
- $temp=$params;
2447
-
2448
- if(strpos($temp, 'w_hide_label') > -1)
2449
- $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');
2450
-
2451
-
2452
- foreach($params_names as $params_name ) {
2453
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2454
- $param[$params_name] = $temp[0];
2455
- $temp=$temp[1];
2456
- }
2457
- if($temp) {
2458
- $temp =explode('*:*w_attr_name*:*',$temp);
2459
- $attrs = array_slice($temp,0, count($temp)-1);
2460
- foreach($attrs as $attr)
2461
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2462
- }
2463
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2464
-
2465
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2466
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2467
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2468
-
2469
- $rep ='<div id="wdform_field'.$id.'" type="type_spinner" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_spinner" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_field_width'].'" name="'.$id.'_spinner_widthform_id_temp" id="'.$id.'_spinner_widthform_id_temp"><input type="hidden" value="'.$param['w_field_min_value'].'" id="'.$id.'_min_valueform_id_temp" name="'.$id.'_min_valueform_id_temp"><input type="hidden" value="'.$param['w_field_max_value'].'" name="'.$id.'_max_valueform_id_temp" id="'.$id.'_max_valueform_id_temp"><input type="hidden" value="'.$param['w_field_step'].'" name="'.$id.'_stepform_id_temp" id="'.$id.'_stepform_id_temp"><input type="" value="'.($param['w_field_value']!= 'null' ? $param['w_field_value'] : '').'" name="'.$id.'_elementform_id_temp" id="'.$id.'_elementform_id_temp" onkeypress="return check_isnum_or_minus(event)" style="width: '.$param['w_field_width'].'px;" '.$param['attributes'].' disabled/></div></div>';
2470
- break;
2471
- }
2472
- case 'type_slider': {
2473
- $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');
2474
- $temp=$params;
2475
-
2476
- if(strpos($temp, 'w_hide_label') > -1)
2477
- $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');
2478
-
2479
- foreach($params_names as $params_name ) {
2480
- $temp = explode('*:*'.$params_name.'*:*',$temp);
2481
- $param[$params_name] = $temp[0];
2482
- $temp=$temp[1];
2483
- }
2484
- if ($temp) {
2485
- $temp = explode('*:*w_attr_name*:*', $temp);
2486
- $attrs = array_slice($temp,0, count($temp)-1);
2487
- foreach($attrs as $attr) {
2488
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2489
- }
2490
- }
2491
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2492
-
2493
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2494
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2495
-
2496
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2497
- $rep ='<div id="wdform_field'.$id.'" type="type_slider" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; vertical-align: top; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_slider" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_field_width'].'" name="'.$id.'_slider_widthform_id_temp" id="'.$id.'_slider_widthform_id_temp"><input type="hidden" value="'.$param['w_field_min_value'].'" id="'.$id.'_slider_min_valueform_id_temp" name="'.$id.'_slider_min_valueform_id_temp"><input type="hidden" value="'.$param['w_field_max_value'].'" id="'.$id.'_slider_max_valueform_id_temp" name="'.$id.'_slider_max_valueform_id_temp"><input type="hidden" value="'.$param['w_field_value'].'" id="'.$id.'_slider_valueform_id_temp" name="'.$id.'_slider_valueform_id_temp"><div id="'.$id.'_slider_tableform_id_temp"><div><div id="'.$id.'_slider_td1form_id_temp"><div name="'.$id.'_elementform_id_temp" id="'.$id.'_elementform_id_temp" style="width: '.$param['w_field_width'].'px;" '.$param['attributes'].'"></div></div></div><div><div align="left" id="'.$id.'_slider_td2form_id_temp" style="display: inline-table; width: 33.3%; text-align: left;"><span id="'.$id.'_element_minform_id_temp" class="label">'.$param['w_field_min_value'].'</span></div><div align="right" id="'.$id.'_slider_td3form_id_temp" style="display: inline-table; width: 33.3%; text-align: center;"><span id="'.$id.'_element_valueform_id_temp" class="label">'.$param['w_field_value'].'</span></div><div align="right" id="'.$id.'_slider_td4form_id_temp" style="display: inline-table; width: 33.3%; text-align: right;"><span id="'.$id.'_element_maxform_id_temp" class="label">'.$param['w_field_max_value'].'</span></div></div></div></div></div>';
2498
- break;
2499
- }
2500
- case 'type_range': {
2501
- $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');
2502
- $temp = $params;
2503
-
2504
- if(strpos($temp, 'w_hide_label') > -1)
2505
- $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');
2506
-
2507
- foreach ($params_names as $params_name ) {
2508
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2509
- $param[$params_name] = $temp[0];
2510
- $temp = $temp[1];
2511
- }
2512
- if ($temp) {
2513
- $temp = explode('*:*w_attr_name*:*', $temp);
2514
- $attrs = array_slice($temp, 0, count($temp) - 1);
2515
- foreach($attrs as $attr) {
2516
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2517
- }
2518
- }
2519
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2520
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2521
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2522
-
2523
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2524
- $w_mini_labels = explode('***',$param['w_mini_labels']);
2525
- $rep ='<div id="wdform_field'.$id.'" type="type_range" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_range" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_field_range_width'].'" name="'.$id.'_range_widthform_id_temp" id="'.$id.'_range_widthform_id_temp"><input type="hidden" value="'.$param['w_field_range_step'].'" name="'.$id.'_range_stepform_id_temp" id="'.$id.'_range_stepform_id_temp"><div id="'.$id.'_elemet_table_littleform_id_temp" style="display: table;"><div style="display: table-row;"><div valign="middle" align="left" style="display: table-cell;"><input type="" value="'.($param['w_field_value1']!= 'null' ? $param['w_field_value1'] : '').'" name="'.$id.'_elementform_id_temp0" id="'.$id.'_elementform_id_temp0" onkeypress="return check_isnum_or_minus(event)" style="width: '.$param['w_field_range_width'].'px;" '.$param['attributes'].' disabled/></div><div valign="middle" align="left" style="display: table-cell; padding-left: 4px;"><input type="" value="'.($param['w_field_value2']!= 'null' ? $param['w_field_value2'] : '').'" name="'.$id.'_elementform_id_temp1" id="'.$id.'_elementform_id_temp1" onkeypress="return check_isnum_or_minus(event)" style="width: '.$param['w_field_range_width'].'px;" '.$param['attributes'].' disabled/></div></div><div style="display: table-row;"><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_from">'.$w_mini_labels[0].'</label></div><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_to">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
2526
- break;
2527
- }
2528
- case 'type_grading': {
2529
- $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_items', 'w_total', 'w_required', 'w_class');
2530
- $temp = $params;
2531
-
2532
- if(strpos($temp, 'w_hide_label') > -1)
2533
- $params_names=array('w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_items', 'w_total', 'w_required', 'w_class');
2534
-
2535
-
2536
- foreach($params_names as $params_name) {
2537
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2538
- $param[$params_name] = $temp[0];
2539
- $temp = $temp[1];
2540
- }
2541
- if ($temp) {
2542
- $temp = explode('*:*w_attr_name*:*', $temp);
2543
- $attrs = array_slice($temp, 0, count($temp) - 1);
2544
- foreach ($attrs as $attr) {
2545
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2546
- }
2547
- }
2548
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2549
-
2550
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2551
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2552
-
2553
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2554
- $w_items = explode('***', $param['w_items']);
2555
- $grading_items = '';
2556
- for($i=0; $i<count($w_items); $i++)
2557
- {
2558
- $grading_items .= '<div id="'.$id.'_element_div'.$i.'" class="grading"><input id="'.$id.'_elementform_id_temp_'.$i.'" name="'.$id.'_elementform_id_temp_'.$i.'" onkeypress="return check_isnum_or_minus(event)" value="" size="5" onkeyup="sum_grading_values('.$id.',&quot;form_id_temp&quot;)" onchange="sum_grading_values('.$id.',&quot;form_id_temp&quot;)" '.$param['attributes'].' disabled/><label id="'.$id.'_label_elementform_id_temp'.$i.'" class="ch-rad-label">'.$w_items[$i].'</label></div>';
2559
- }
2560
-
2561
- $rep ='<div id="wdform_field'.$id.'" type="type_grading" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; vertical-align: top; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_grading" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_total'].'" name="'.$id.'_grading_totalform_id_temp" id="'.$id.'_grading_totalform_id_temp"><div id="'.$id.'_elementform_id_temp">'.$grading_items.'<div id="'.$id.'_element_total_divform_id_temp" class="grading_div">Total:<span id="'.$id.'_sum_elementform_id_temp" name="'.$id.'_sum_elementform_id_temp">0</span>/<span id="'.$id.'_total_elementform_id_temp" name="'.$id.'_total_elementform_id_temp">'.$param['w_total'].'</span><span id="'.$id.'_text_elementform_id_temp" name="'.$id.'_text_elementform_id_temp"></span></div></div></div></div>';
2562
-
2563
- break;
2564
- }
2565
- case 'type_matrix': {
2566
- $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');
2567
- $temp = $params;
2568
-
2569
- if(strpos($temp, 'w_hide_label') > -1)
2570
- $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');
2571
-
2572
-
2573
- foreach ($params_names as $params_name) {
2574
- $temp = explode('*:*'.$params_name.'*:*',$temp);
2575
- $param[$params_name] = $temp[0];
2576
- $temp = $temp[1];
2577
- }
2578
- if ($temp) {
2579
- $temp = explode('*:*w_attr_name*:*', $temp);
2580
- $attrs = array_slice($temp, 0, count($temp) - 1);
2581
- foreach ($attrs as $attr) {
2582
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2583
- }
2584
- }
2585
- $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2586
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2587
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2588
-
2589
- $required_sym = ($param['w_required']=="yes" ? " *" : "");
2590
- $param['w_textbox_size'] = isset($param['w_textbox_size']) ? $param['w_textbox_size'] : '100';
2591
- $w_rows = explode('***',$param['w_rows']);
2592
- $w_columns = explode('***',$param['w_columns']);
2593
- $column_labels = '';
2594
- for ($i = 1; $i < count($w_columns); $i++) {
2595
- $column_labels .= '<div id="'.$id.'_element_td0_'.$i.'" class="matrix_" style="display: table-cell;"><label id="'.$id.'_label_elementform_id_temp0_'.$i.'" name="'.$id.'_label_elementform_id_temp0_'.$i.'" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$i.'" value="'.$w_columns[$i].'">'.$w_columns[$i].'</label></div>';
2596
- }
2597
- $rows_columns = '';
2598
- for($i=1; $i<count($w_rows); $i++)
2599
- {
2600
-
2601
- $rows_columns .= '<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;"><div id="'.$id.'_element_td'.$i.'_0" class="matrix_" style="display: table-cell;"><label id="'.$id.'_label_elementform_id_temp'.$i.'_0" class="ch-rad-label" for="'.$id.'_elementform_id_temp'.$i.'" value="'.$w_rows[$i].'">'.$w_rows[$i].'</label></div>';
2602
-
2603
-
2604
- for($k=1; $k<count($w_columns); $k++)
2605
- {
2606
- if($param['w_field_input_type']=='radio')
2607
- $rows_columns .= '<div id="'.$id.'_element_td'.$i.'_'.$k.'" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><input id="'.$id.'_input_elementform_id_temp'.$i.'_'.$k.'" align="center" size="14" type="radio" name="'.$id.'_input_elementform_id_temp'.$i.'" value="'.$i.'_'.$k.'" disabled/></div>';
2608
- else
2609
- if($param['w_field_input_type']=='checkbox')
2610
- $rows_columns .= '<div id="'.$id.'_element_td'.$i.'_'.$k.'" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><input id="'.$id.'_input_elementform_id_temp'.$i.'_'.$k.'" align="center" size="14" type="checkbox" name="'.$id.'_input_elementform_id_temp'.$i.'_'.$k.'" value="1" disabled/></div>';
2611
- else
2612
- if($param['w_field_input_type']=='text')
2613
- $rows_columns .= '<div id="'.$id.'_element_td'.$i.'_'.$k.'" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><input id="'.$id.'_input_elementform_id_temp'.$i.'_'.$k.'" align="center" type="text" name="'.$id.'_input_elementform_id_temp'.$i.'_'.$k.'" value="" style="width:'.$param['w_textbox_size'].'px" disabled/></div>';
2614
- else
2615
- if($param['w_field_input_type']=='select')
2616
- $rows_columns .= '<div id="'.$id.'_element_td'.$i.'_'.$k.'" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><select id="'.$id.'_select_yes_noform_id_temp'.$i.'_'.$k.'" name="'.$id.'_select_yes_noform_id_temp'.$i.'_'.$k.'" disabled><option value=""> </option><option value="yes">Yes</option><option value="no">No</option></select></div>';
2617
-
2618
- }
2619
-
2620
- $rows_columns .= '</div>';
2621
- }
2622
-
2623
-
2624
-
2625
- $rep ='<div id="wdform_field'.$id.'" type="type_matrix" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_matrix" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"/><input type="hidden" value="'.$param['w_field_input_type'].'" name="'.$id.'_input_typeform_id_temp" id="'.$id.'_input_typeform_id_temp"><input type="hidden" value="'.$param['w_textbox_size'].'" name="'.$id.'_textbox_sizeform_id_temp" id="'.$id.'_textbox_sizeform_id_temp"><div id="'.$id.'_elementform_id_temp" style="display: table;" '.$param['attributes'].'><div id="'.$id.'_table_little" style="display: table-row-group;"><div id="'.$id.'_element_tr0" style="display: table-row;"><div id="'.$id.'_element_td0_0" style="display: table-cell;"></div>'.$column_labels.'</div>'.$rows_columns.'</div></div></div></div>';
2626
-
2627
- break;
2628
- }
2629
- case 'type_submit_reset': {
2630
- $params_names=array('w_submit_title','w_reset_title','w_class','w_act');
2631
- $temp=$params;
2632
- foreach ($params_names as $params_name) {
2633
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2634
- $param[$params_name] = $temp[0];
2635
- $temp=$temp[1];
2636
- }
2637
- if ($temp) {
2638
- $temp = explode('*:*w_attr_name*:*',$temp);
2639
- $attrs = array_slice($temp,0, count($temp)-1);
2640
- foreach ($attrs as $attr) {
2641
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2642
- }
2643
- }
2644
- $param['w_act'] = ($param['w_act']=="false" ? 'style="display: none;"' : "");
2645
- $rep='<div id="wdform_field'.$id.'" type="type_submit_reset" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><span id="'.$id.'_element_labelform_id_temp" style="display: none;">type_submit_reset_'.$id.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><input type="hidden" value="type_submit_reset" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><button type="button" class="button-submit" id="'.$id.'_element_submitform_id_temp" value="'.$param['w_submit_title'].'" disabled '.$param['attributes'].'>'.$param['w_submit_title'].'</button><button type="button" class="button-reset" id="'.$id.'_element_resetform_id_temp" value="'.$param['w_reset_title'].'" disabled '.$param['w_act'].' '.$param['attributes'].'>'.$param['w_reset_title'].'</button></div></div>';
2646
- break;
2647
- }
2648
- case 'type_button': {
2649
- $params_names=array('w_title','w_func','w_class');
2650
- $temp=$params;
2651
- foreach($params_names as $params_name) {
2652
- $temp=explode('*:*'.$params_name.'*:*',$temp);
2653
- $param[$params_name] = $temp[0];
2654
- $temp=$temp[1];
2655
- }
2656
- if ($temp) {
2657
- $temp = explode('*:*w_attr_name*:*',$temp);
2658
- $attrs = array_slice($temp,0, count($temp)-1);
2659
- foreach($attrs as $attr) {
2660
- $param['attributes'] = $param['attributes'].' add_'.$attr;
2661
- }
2662
- }
2663
- $param['w_title'] = explode('***',$param['w_title']);
2664
- $param['w_func'] = explode('***',$param['w_func']);
2665
- $rep.='<div id="wdform_field'.$id.'" type="type_button" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><span id="'.$id.'_element_labelform_id_temp" style="display: none;">button_'.$id.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: table-cell;"><input type="hidden" value="type_button" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp">';
2666
- foreach ($param['w_title'] as $key => $title) {
2667
- $rep.='<button type="button" id="'.$id.'_elementform_id_temp'.$key.'" name="'.$id.'_elementform_id_temp'.$key.'" value="'.$title.'" onclick="'.$param['w_func'][$key].'" '.$param['attributes'].'>'.$title.'</button>';
2668
- }
2669
- $rep .= '</div></div>';
2670
- break;
2671
- }
2672
- }
2673
-
2674
- $form = str_replace('%' . $id . ' - ' . $labels[$ids_key] . '%', $rep, $form);
2675
- $form = str_replace('%' . $id . ' -' . $labels[$ids_key] . '%', $rep, $form);
2676
- $row->form_front = $form;
2677
- }
2678
- }
2679
- }
2680
- else {
2681
- $row = new stdClass();
2682
- $row->id = 0;
2683
- $row->backup_id ='';
2684
- $row->title = '';
2685
- $row->mail = '';
2686
- $row->form = '';
2687
- $row->form_front = '';
2688
- $row->theme = $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
2689
- $row->javascript = '';
2690
- $row->submit_text = '';
2691
- $row->url = '';
2692
- $row->submit_text_type = 0;
2693
- $row->script1 = '';
2694
- $row->script2 = '';
2695
- $row->script_user1 = '';
2696
- $row->script_user2 = '';
2697
- $row->counter = 0;
2698
- $row->label_order = '';
2699
- $row->article_id = '';
2700
- $row->pagination = '';
2701
- $row->show_title = '';
2702
- $row->show_numbers = '';
2703
- $row->public_key = '';
2704
- $row->private_key = '';
2705
- $row->recaptcha_theme = '';
2706
- $row->from_name = '';
2707
- $row->from_mail = '';
2708
- $row->label_order_current = '';
2709
- $row->script_mail_user = '';
2710
- $row->script_mail = '';
2711
- $row->tax = 0;
2712
- $row->payment_currency = '$';
2713
- $row->paypal_email = '';
2714
- $row->checkout_mode = 'testmode';
2715
- $row->paypal_mode = 0;
2716
-
2717
- $row->published = 1;
2718
- $row->form_fields = '';
2719
- $row->savedb = 1;
2720
- $row->sendemail = 1;
2721
- $row->requiredmark = '*';
2722
- $row->reply_to = 0;
2723
- $row->send_to = 0;
2724
- $row->autogen_layout = 1;
2725
- $row->custom_front = '';
2726
- $row->mail_from_user = '';
2727
- $row->mail_from_name_user = '';
2728
- $row->reply_to_user = '';
2729
- $row->save_uploads = 1;
2730
-
2731
- $row->header_title = '';
2732
- $row->header_description = '';
2733
- $row->header_image_url = '';
2734
- $row->header_image_animation = '';
2735
- $row->header_hide_image = '';
2736
-
2737
- $row->condition = '';
2738
- $row->mail_cc = '';
2739
- $row->mail_cc_user = '';
2740
- $row->mail_bcc = '';
2741
- $row->mail_bcc_user = '';
2742
- $row->mail_subject = '';
2743
- $row->mail_subject_user = '';
2744
- $row->mail_mode = 1;
2745
- $row->mail_mode_user = 1;
2746
- $row->mail_attachment = 1;
2747
- $row->mail_attachment_user = 1;
2748
-
2749
- $row->user_id_wd = '';
2750
- $row->sortable = 1;
2751
- $row->frontend_submit_fields = '';
2752
- $row->frontend_submit_stat_fields = '';
2753
- }
2754
- return $row;
2755
- }
2756
-
2757
- public function get_theme_rows_data($old = '') {
2758
- global $wpdb;
2759
- $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_themes ORDER BY `version` DESC, `id` ASC");
2760
- return $rows;
2761
- }
2762
-
2763
- public function get_queries_rows_data($id) {
2764
- global $wpdb;
2765
- $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=" . $id . " ORDER BY id ASC");
2766
- return $rows;
2767
- }
2768
-
2769
- public function get_labels($id) {
2770
- global $wpdb;
2771
- $rows = $wpdb->get_col("SELECT DISTINCT `element_label` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=" . $id);
2772
- return $rows;
2773
- }
2774
-
2775
- public function is_paypal($id) {
2776
- global $wpdb;
2777
- $rows = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_sessions WHERE form_id=" . $id);
2778
- return $rows;
2779
- }
2780
-
2781
- public function page_nav() {
2782
- global $wpdb;
2783
- $where = 'WHERE `id` NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')';
2784
- $where .= ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? ' AND title LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
2785
- $query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker " . $where;
2786
- $total = $wpdb->get_var($query);
2787
- $page_nav['total'] = $total;
2788
- if (isset($_POST['page_number']) && $_POST['page_number']) {
2789
- $limit = ((int) $_POST['page_number'] - 1) * 20;
2790
- }
2791
- else {
2792
- $limit = 0;
2793
- }
2794
- $page_nav['limit'] = (int) ($limit / 20 + 1);
2795
- return $page_nav;
2796
- }
2797
-
2798
- public function get_display_options($id) {
2799
- global $wpdb;
2800
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_display_options WHERE form_id="%d"', $id));
2801
- if (!$row) {
2802
- $row = new stdClass();
2803
- $row->form_id = $id;
2804
- $row->type = 'embedded';
2805
- $row->scrollbox_loading_delay = 0;
2806
- $row->popover_animate_effect = '';
2807
- $row->popover_loading_delay = 0;
2808
- $row->popover_frequency = 0;
2809
- $row->topbar_position = 1;
2810
- $row->topbar_remain_top = 1;
2811
- $row->topbar_closing = 1;
2812
- $row->topbar_hide_duration = 0;
2813
- $row->scrollbox_position = 1;
2814
- $row->scrollbox_trigger_point = 20;
2815
- $row->scrollbox_hide_duration = 0;
2816
- $row->scrollbox_auto_hide = 1;
2817
- $row->hide_mobile = 0;
2818
- $row->scrollbox_closing = 1;
2819
- $row->scrollbox_minimize = 1;
2820
- $row->scrollbox_minimize_text = '';
2821
- $row->display_on = 'everything';
2822
- $row->posts_include = '';
2823
- $row->pages_include = '';
2824
- $row->display_on_categories = '';
2825
- $row->current_categories = '';
2826
- $row->show_for_admin = 0;
2827
- }
2828
- return $row;
2829
- }
2830
-
2831
- public function fm_posts_query() {
2832
- $default_post_types = array( 'post', 'page' );
2833
- $custom_post_types = get_post_types( array(
2834
- 'public' => true,
2835
- '_builtin' => false,
2836
- ) );
2837
-
2838
- $post_types = array_merge($default_post_types, $custom_post_types);
2839
- $pt_names = array_values($post_types);
2840
-
2841
- $query = array(
2842
- 'post_type' => $pt_names,
2843
- 'suppress_filters' => true,
2844
- 'update_post_term_cache' => false,
2845
- 'update_post_meta_cache' => false,
2846
- 'post_status' => 'publish',
2847
- 'posts_per_page' => -1,
2848
- );
2849
-
2850
- $get_posts = new WP_Query;
2851
- $posts = $get_posts->query( $query );
2852
- if ( ! $get_posts->post_count ) {
2853
- return false;
2854
- }
2855
-
2856
- $results = array();
2857
- foreach ($posts as $post) {
2858
- $results[(int)$post->ID] = array(
2859
- 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
2860
- 'post_type' => $post->post_type,
2861
- );
2862
- }
2863
-
2864
- wp_reset_postdata();
2865
- return $results;
2866
- }
2867
-
2868
- public function fm_categories_query() {
2869
- $categories = get_categories( array(
2870
- 'hide_empty' => 0,
2871
- ) );
2872
- $final_categories = array();
2873
- foreach ( $categories as $key => $value ) {
2874
- $final_categories[$value->term_id] = $value->name;
2875
- }
2876
- return $final_categories;
2877
- }
2878
- ////////////////////////////////////////////////////////////////////////////////////////
2879
- // Getters & Setters //
2880
- ////////////////////////////////////////////////////////////////////////////////////////
2881
- ////////////////////////////////////////////////////////////////////////////////////////
2882
- // Private Methods //
2883
- ////////////////////////////////////////////////////////////////////////////////////////
2884
- ////////////////////////////////////////////////////////////////////////////////////////
2885
- // Listeners //
2886
- ////////////////////////////////////////////////////////////////////////////////////////
2887
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelSelect_data_from_db.php DELETED
@@ -1,111 +0,0 @@
1
- <?php
2
-
3
- class FMModelSelect_data_from_db {
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
- function get_labels($form_id) {
23
- global $wpdb;
24
- $rows = $wpdb->get_var("SELECT label_order_current FROM " . $wpdb->prefix . "formmaker where id=" . $form_id);
25
- return $rows;
26
- }
27
- function get_tables() {
28
- global $wpdb;
29
- $con_type = $_POST['con_type'];
30
-
31
- if($con_type == 'local') {
32
- $query = "SHOW TABLES";
33
- $tables = $wpdb->get_col($query);
34
- }
35
- else if($con_type == 'remote') {
36
- $username = isset($_POST['username']) ? $_POST['username'] : '';
37
- $password = isset($_POST['password']) ? $_POST['password'] : '';
38
- $database = isset($_POST['database']) ? $_POST['database'] : '';
39
- $host = isset($_POST['host']) ? $_POST['host'] : '';
40
- $wpdb_temp = new wpdb($username, $password, $database, $host);
41
- $query = "SHOW TABLES";
42
- $tables = $wpdb_temp->get_col($query);
43
- }
44
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
45
- return $tables;
46
- }
47
-
48
- function get_tables_saved($con_type, $username, $password, $database, $host) {
49
- global $wpdb;
50
-
51
- if($con_type == 'local') {
52
- $query = "SHOW TABLES";
53
- $tables = $wpdb->get_col($query);
54
- }
55
- else if($con_type == 'remote') {
56
- $wpdb_temp = new wpdb($username, $password, $database, $host);
57
- $query = "SHOW TABLES";
58
- $tables = $wpdb_temp->get_col($query);
59
- }
60
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
61
- return $tables;
62
- }
63
-
64
- function get_table_struct() {
65
- global $wpdb;
66
- $name = isset($_POST['name']) ? $_POST['name'] : NULL;
67
- if(!$name)
68
- return array();
69
- $con_method = $_POST['con_method'];
70
- $con_type = $_POST['con_type'];
71
- $query = "SHOW COLUMNS FROM " . $name;
72
- if($con_type == 'remote') {
73
- $username = isset($_POST['username']) ? $_POST['username'] : '';
74
- $password = isset($_POST['password']) ? $_POST['password'] : '';
75
- $database = isset($_POST['database']) ? $_POST['database'] : '';
76
- $host = isset($_POST['host']) ? $_POST['host'] : '';
77
- $wpdb_temp = new wpdb($username, $password, $database, $host);
78
- $table_struct = $wpdb_temp->get_results($query);
79
- }
80
- else {
81
- $table_struct = $wpdb->get_results($query);
82
- }
83
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
84
- return $table_struct;
85
- }
86
-
87
- function get_table_struct_saved($con_type, $username, $password, $database, $host, $name, $con_method) {
88
- global $wpdb;
89
- if(!$name)
90
- return array();
91
- $query = "SHOW COLUMNS FROM " . $name;
92
- if($con_type == 'remote') {
93
- $wpdb_temp = new wpdb($username, $password, $database, $host);
94
- $table_struct = $wpdb_temp->get_results($query);
95
- }
96
- else {
97
- $table_struct = $wpdb->get_results($query);
98
- }
99
- //$wpdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
100
- return $table_struct;
101
- }
102
- ////////////////////////////////////////////////////////////////////////////////////////
103
- // Getters & Setters //
104
- ////////////////////////////////////////////////////////////////////////////////////////
105
- ////////////////////////////////////////////////////////////////////////////////////////
106
- // Private Methods //
107
- ////////////////////////////////////////////////////////////////////////////////////////
108
- ////////////////////////////////////////////////////////////////////////////////////////
109
- // Listeners //
110
- ////////////////////////////////////////////////////////////////////////////////////////
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelShow_matrix.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- class FMModelShow_matrix {
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
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Getters & Setters //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Private Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Listeners //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelSubmissions_fm.php DELETED
@@ -1,744 +0,0 @@
1
- <?php
2
- class FMModelSubmissions_fm {
3
- ////////////////////////////////////////////////////////////////////////////////////////
4
- // Events //
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- // Constants //
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- // Variables //
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- // Constructor & Destructor //
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- public function __construct() {
16
- }
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
- // Public Methods //
19
- ////////////////////////////////////////////////////////////////////////////////////////
20
- public function blocked_ips() {
21
- global $wpdb;
22
- $ips = $wpdb->get_col('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked');
23
- return $ips;
24
- }
25
-
26
- public function get_form_titles() {
27
- global $wpdb;
28
- $query = "SELECT id, title FROM " . $wpdb->prefix . "formmaker WHERE `id` NOT IN(" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ") order by title";
29
- $forms = $wpdb->get_results($query);
30
- return $forms;
31
- }
32
-
33
- public function get_statistics($form_id) {
34
- global $wpdb;
35
- $statistics = array();
36
- $query = $wpdb->prepare('SELECT count(distinct group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d"', $form_id);
37
- $statistics["total_entries"] = $wpdb->get_var($query);
38
- $query = $wpdb->prepare('SELECT `views` FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $form_id);
39
- $statistics["total_views"] = $wpdb->get_var($query);
40
- if ($statistics["total_views"]) {
41
- $statistics["conversion_rate"] = round((($statistics["total_entries"] / $statistics["total_views"]) * 100), 2) . '%';
42
- }
43
- else {
44
- $statistics["conversion_rate"] = '0%';
45
- }
46
- return $statistics;
47
- }
48
-
49
- public function get_labels_parameters($form_id) {
50
- global $wpdb;
51
- $labels = array();
52
- $labels_id = array();
53
- $sorted_labels_id = array();
54
- $label_names = array();
55
- $label_types = array();
56
- $sorted_label_types = array();
57
- $label_names_original = array();
58
- $labels_parameters = array();
59
- $join_query = array();
60
- $join_where = array();
61
- $join_verified = array();
62
- $rows_ord = array();
63
- $join = '';
64
-
65
- $query = $wpdb->prepare("SELECT `group_id`,`element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' and `element_label` = 'verifyinfo' ", $form_id);
66
- $ver_emails_data = $wpdb->get_results($query);
67
-
68
- $ver_emails_array = array();
69
- if($ver_emails_data) {
70
- foreach($ver_emails_data as $ver_email) {
71
- $elem_label = str_replace('verified**', '', $ver_email->element_value);
72
- $query = $wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' AND `group_id` = '%d' AND `element_label` = '%s' ", $form_id, (int)$ver_email->group_id, $elem_label);
73
- if(!isset($ver_emails_array[$elem_label]))
74
- $ver_emails_array[$elem_label] = array();
75
-
76
- if(!in_array( $wpdb->get_var($query), $ver_emails_array[$elem_label]))
77
- $ver_emails_array[$elem_label][] = $wpdb->get_var($query);
78
- }
79
- }
80
- for ($i = 0; $i < 9; $i++) {
81
- array_push($labels_parameters, NULL);
82
- }
83
- $sorted_label_names = array();
84
- $sorted_label_names_original = array();
85
- $where_labels = array();
86
- $where2 = array();
87
- $pagination_clicked = (isset($_POST['pagination_clicked']) && $_POST['pagination_clicked'] == '1' ? '1' : '0');
88
- $order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
89
- $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
90
- $limit = ((isset($_POST['page_number'])) ? ((int) $_POST['page_number'] - 1) * 20 : 0);
91
- $lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : '');
92
- $lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : '');
93
- $lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : '');
94
- $lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : '');
95
-
96
- $lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : '');
97
- $lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : '');
98
- $lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : '');
99
-
100
- if ($lists['ip_search']) {
101
- $where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"';
102
- }
103
- if ($lists['startdate'] != '') {
104
- $where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' ";
105
- }
106
- if ($lists['enddate'] != '') {
107
- $where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' ";
108
- }
109
-
110
-
111
- if ($lists['username_search']) {
112
- $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%'.$lists['username_search'].'%")';
113
- }
114
- if ($lists['useremail_search']) {
115
- $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%'.$lists['useremail_search'].'%")';
116
- }
117
-
118
- if ($lists['id_search']) {
119
- $where[] = 'group_id ='.(int)$lists['id_search'];
120
- }
121
-
122
- $where[] = 'form_id=' . $form_id . '';
123
- $where = (count($where) ? ' ' . implode(' AND ', $where) : '');
124
- if ($order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip') {
125
- $orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . '';
126
- }elseif($order_by == 'display_name' or $order_by == 'user_email'){
127
- $orderby = ' ORDER BY (SELECT '.$order_by.' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) '. $asc_or_desc .'';
128
- }
129
- else {
130
- $orderby = "";
131
- }
132
- if ($form_id) {
133
- for($i = 0; $i < 9; $i++) {
134
- array_pop($labels_parameters);
135
- }
136
- $query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE ". $where;
137
- $results = $wpdb->get_results($query);
138
- for ($i = 0; $i < count($results); $i++) {
139
- array_push($labels, $results[$i]->element_label);
140
- }
141
- $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id));
142
- if (strpos($form->label_order, 'type_paypal_')) {
143
- $form->label_order = $form->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
144
- }
145
-
146
- $form_labels = explode('#****#', $form->label_order);
147
- $form_labels = array_slice($form_labels, 0, count($form_labels) - 1);
148
-
149
- foreach ($form_labels as $key => $form_label) {
150
- $label_id = explode('#**id**#', $form_label);
151
- array_push($labels_id, $label_id[0]);
152
- $label_name_type = explode('#**label**#', $label_id[1]);
153
- array_push($label_names_original, $label_name_type[0]);
154
- $ptn = "/[^a-zA-Z0-9_]/";
155
- $rpltxt = "";
156
- $label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]);
157
- array_push($label_names, $label_name);
158
- array_push($label_types, $label_name_type[1]);
159
- }
160
-
161
- foreach ($labels_id as $key => $label_id) {
162
- if (in_array($label_id, $labels)) {
163
- if (!in_array($label_id, $sorted_labels_id)) {
164
- array_push($sorted_labels_id, $label_id);
165
- }
166
- array_push($sorted_label_names, $label_names[$key]);
167
- array_push($sorted_label_types, $label_types[$key]);
168
- array_push($sorted_label_names_original, $label_names_original[$key]);
169
- if (isset($_POST[$form_id . '_' . $label_id . '_search'])) {
170
- $search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']);
171
- }
172
- else {
173
- $search_temp = '';
174
- }
175
- $search_temp = strtolower($search_temp);
176
-
177
- $lists[$form_id . '_' . $label_id . '_search'] = $search_temp;
178
- if ($search_temp) {
179
- $join_query[] = 'search';
180
- $join_where[] = array('label' => $label_id, 'search' => $search_temp);
181
- }
182
-
183
- if (isset($_POST[$form_id . '_' . $label_id . '_search_verified'])) {
184
- $search_verified = $_POST[$form_id . '_' . $label_id . '_search_verified'];
185
- $lists[$form_id . '_' . $label_id . '_search_verified'] = $search_verified;
186
- } else {
187
- $search_verified = '';
188
- }
189
-
190
- if ($search_verified && isset($ver_emails_array[$label_id])) {
191
- $join_query[] = 'search';
192
- $join_where[] = null;
193
- $join_verified[] = array('label' => $label_id, 'ver_search' => implode('|', $ver_emails_array[$label_id]));
194
- }
195
- }
196
- }
197
-
198
- if (strpos($order_by, "_field")) {
199
- if (in_array(str_replace("_field", "", $order_by), $labels)) {
200
- $join_query[] = 'sort';
201
- $join_where[] = array('label'=>str_replace("_field", "", $order_by));
202
- }
203
- }
204
- $cols = 'group_id';
205
- if ($order_by == 'date' or $order_by == 'ip') {
206
- $cols = 'group_id, date, ip';
207
- }
208
-
209
- $ver_where = '';
210
- if( !empty($join_verified) ) {
211
- foreach( $join_verified as $key_ver => $join_ver) {
212
- $ver_where .= '(element_label="' . $join_ver['label'] . '" AND element_value REGEXP "'.$join_ver['ver_search'].'" ) AND' ;
213
- }
214
- }
215
-
216
- switch (count($join_query)) {
217
- case 0:
218
- $join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '. $where;
219
-
220
- break;
221
- case 1:
222
- if ($join_query[0] == 'sort') {
223
- $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" ';
224
- $join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" ';
225
-
226
- $orderby = ' ORDER BY `element_value` ' . $asc_or_desc;
227
- }
228
- else {
229
- if(isset($join_where[0]['search'])) {
230
- $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%") AND ' . $where;
231
- } else {
232
- $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '.$ver_where . $where;
233
- }
234
- }
235
- break;
236
- default:
237
- if( !empty($join_verified) ) {
238
- if( isset( $join_where[0]['search'] ) ) {
239
- $join = 'SELECT t.group_id from (SELECT t1.group_id from (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE (element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%")) AND '. $where.' ) as t1 JOIN (SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '.$ver_where.$where.') as t2 ON t1.group_id = t2.group_id) as t ';
240
-
241
- } else{
242
- $join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where.$where . ') as t ';
243
- }
244
- } else{
245
- $join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%" )) as t ';
246
- }
247
-
248
- for ($key = 1; $key < count($join_query); $key++) {
249
- if ($join_query[$key] == 'sort') {
250
- if(isset($join_where[$key])){
251
- $join .= 'LEFT JOIN (SELECT group_id as group_id' . $key . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '") as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
252
- $orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . '';
253
- }
254
- }
255
- else {
256
- if(isset( $join_where[$key])) {
257
- $join .= 'INNER JOIN (SELECT group_id as group_id' . $key . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '.$where.' AND element_label="' . $join_where[$key]['label'] . '" AND (element_value LIKE "%' . $join_where[$key]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[$key]['search']) . '%")) as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
258
- }
259
- }
260
- }
261
- break;
262
- }
263
- $pos = strpos($join, 'SELECT t.group_id');
264
- if ($pos === FALSE) {
265
- $query = str_replace(array('SELECT group_id','SELECT distinct group_id'), array('SELECT count(distinct group_id)','SELECT count(distinct group_id)'), $join);
266
- }
267
- else {
268
- $query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join);
269
- }
270
- $total = $wpdb->get_var($query);
271
-
272
- $query_sub_count = "SELECT count(distinct group_id) from ".$wpdb->prefix."formmaker_submits";
273
- $sub_count = (int)$wpdb->get_var($query_sub_count);
274
-
275
- $limit1 = (int)$total < $sub_count && !$pagination_clicked ? 0 : $limit;
276
- $query = $join . ' ' . $orderby . ' limit ' . $limit1 . ', 20 ';
277
- $results = $wpdb->get_results($query);
278
- for ($i = 0; $i < count($results); $i++) {
279
- array_push($rows_ord, $results[$i]->group_id);
280
- }
281
-
282
- $query1 = $join . ' ' . $orderby ;
283
- $searched_group_ids = $wpdb->get_results($query1);
284
- $searched_ids = array();
285
- for ($i = 0; $i < count($searched_group_ids); $i++) {
286
- array_push($searched_ids, $searched_group_ids[$i]->group_id);
287
- }
288
-
289
-
290
- $where2 = array();
291
- $where2[] = "group_id='0'";
292
- foreach ($rows_ord as $rows_ordd) {
293
- $where2[] = "group_id='" . $rows_ordd . "'";
294
- }
295
- $where2 = (count($where2) ? ' WHERE ' . implode( ' OR ', $where2 ) . '' : '' );
296
- $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
297
- $rows = $wpdb->get_results($query);
298
- $group_ids = $rows_ord;
299
- $lists['total'] = $total;
300
- $lists['limit'] = (int) ($limit1 / 20 + 1);
301
-
302
- $where_choices = $where;
303
- array_push($labels_parameters, $sorted_labels_id);
304
- array_push($labels_parameters, $sorted_label_types);
305
- array_push($labels_parameters, $lists);
306
- array_push($labels_parameters, $sorted_label_names);
307
- array_push($labels_parameters, $sorted_label_names_original);
308
- array_push($labels_parameters, $rows);
309
- array_push($labels_parameters, $group_ids);
310
- array_push($labels_parameters, $where_choices);
311
- array_push($labels_parameters, $searched_ids);
312
- }
313
- return $labels_parameters;
314
- }
315
-
316
- public function get_type_address($sorted_label_type, $sorted_label_name_original) {
317
- if ($sorted_label_type == 'type_address') {
318
- switch ($sorted_label_name_original) {
319
- case 'Street Line':
320
- $field_title = __('Street Address', 'form_maker');
321
- break;
322
- case 'Street Line2':
323
- $field_title = __('Street Address Line 2', 'form_maker');
324
- break;
325
- case 'City':
326
- $field_title = __('City', 'form_maker');
327
- break;
328
- case 'State':
329
- $field_title = __('State / Province / Region', 'form_maker');
330
- break;
331
- case 'Postal':
332
- $field_title = __('Postal / Zip Code', 'form_maker');
333
- break;
334
- case 'Country':
335
- $field_title = __('Country', 'form_maker');
336
- break;
337
- default :
338
- $field_title = stripslashes($sorted_label_name_original);
339
- break;
340
- }
341
- }
342
- else {
343
- $field_title = stripslashes($sorted_label_name_original);
344
- }
345
- return $field_title;
346
- }
347
-
348
- public function hide_or_not($hide_strings,$hide_string) {
349
- if (strpos($hide_string,'@') === FALSE) {
350
- if (strpos($hide_strings, '@' . $hide_string . '@') === FALSE) {
351
- $style = '';
352
- }
353
- else {
354
- $style = 'style="display:none"';
355
- }
356
- }
357
- else {
358
- if (strpos($hide_strings, $hide_string) === FALSE) {
359
- $style = '';
360
- }
361
- else {
362
- $style = 'style="display:none"';
363
- }
364
- }
365
- return $style;
366
- }
367
-
368
- public function sort_group_ids($sorted_label_names_count, $group_ids) {
369
- $count_labe = $sorted_label_names_count;
370
- $group_id_s = array();
371
- $l = 0;
372
- if (count($group_ids) > 0 and $count_labe) {
373
- for ($i = 0; $i < count($group_ids); $i++) {
374
- if (!in_array($group_ids[$i], $group_id_s)) {
375
- array_push($group_id_s, $group_ids[$i]);
376
- }
377
- }
378
- }
379
- return $group_id_s;
380
- }
381
-
382
- public function array_for_group_id($group, $rows) {
383
- $i = $group;
384
- $count_rows = count($rows);
385
- $temp = array();
386
- for ($j = 0; $j < $count_rows; $j++) {
387
- $row = $rows[$j];
388
- if ($row->group_id == $i) {
389
- array_push($temp, $row);
390
- }
391
- }
392
- return $temp;
393
- }
394
-
395
- public function check_radio_type($sorted_label_type) {
396
- if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
397
- return TRUE;
398
- }
399
- else {
400
- return FALSE;
401
- }
402
- }
403
-
404
- public function statistic_for_radio($where_choices, $sorted_label_id) {
405
- global $wpdb;
406
- $choices_params = array();
407
- $query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where_choices . " AND element_label='" . $sorted_label_id . "'";
408
- $choices = $wpdb->get_results($query);
409
- $colors=array('#5FE2FF','#F9E89C');
410
- $choices_colors=array('#4EC0D9','#DDCC7F');
411
- $choices_labels = array();
412
- $choices_count = array();
413
- $all = count($choices);
414
- $unanswered = 0;
415
- foreach ($choices as $key => $choice) {
416
- if ($choice->element_value == '') {
417
- $unanswered++;
418
- }
419
- else {
420
- if (!in_array($choice->element_value, $choices_labels)) {
421
- array_push($choices_labels, $choice->element_value);
422
- array_push($choices_count, 0);
423
- }
424
- $choices_count[array_search($choice->element_value, $choices_labels)]++;
425
- }
426
- }
427
- array_multisort($choices_count, SORT_DESC, $choices_labels);
428
- array_push($choices_params, $choices_count);
429
- array_push($choices_params, $choices_labels);
430
- array_push($choices_params, $unanswered);
431
- array_push($choices_params, $all);
432
- array_push($choices_params, $colors);
433
- array_push($choices_params, $choices_colors);
434
- return $choices_params;
435
- }
436
-
437
- public function get_data_of_group_id($id) {
438
- global $wpdb;
439
- $query = "SELECT * FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id=" . $id;
440
- $rows = $wpdb->get_results($query);
441
- $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=" . $rows[0]->form_id);
442
- $params = array();
443
- $label_id = array();
444
- $label_order_original = array();
445
- $label_type = array();
446
- $ispaypal = strpos($form->label_order, 'type_paypal_');
447
- if ($form->paypal_mode == 1) {
448
- if ($ispaypal) {
449
- $form->label_order = $form->label_order."0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
450
- }
451
- }
452
- $label_all = explode('#****#', $form->label_order);
453
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
454
- foreach ($label_all as $key => $label_each) {
455
- $label_id_each = explode('#**id**#', $label_each);
456
- array_push($label_id, $label_id_each[0]);
457
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
458
- array_push($label_order_original, $label_oder_each[0]);
459
- array_push($label_type, $label_oder_each[1]);
460
- }
461
- /*$theme_id = $wpdb->get_var("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form->id . "'");*/
462
- $css = $wpdb->get_var("SELECT css FROM " . $wpdb->prefix . "formmaker_themes");
463
- array_push($params, $rows);
464
- array_push($params, $label_id);
465
- array_push($params, $label_order_original);
466
- array_push($params, $label_type);
467
- array_push($params, $ispaypal);
468
- array_push($params, $form);
469
- array_push($params, $css);
470
- return $params;
471
- }
472
-
473
- public function check_type_for_edit_function($label_type) {
474
- if ($label_type != 'type_editor' and $label_type != 'type_submit_reset' and $label_type != 'type_map' and $label_type != 'type_mark_map' and $label_type != 'type_captcha' and $label_type != 'type_recaptcha' and $label_type != 'type_button') {
475
- return TRUE;
476
- }
477
- else {
478
- return FALSE;
479
- }
480
- }
481
-
482
- public function check_for_submited_label($rows, $label_id) {
483
- foreach ($rows as $row) {
484
- if ($row->element_label == $label_id) {
485
- $element_value = $row->element_value;
486
- break;
487
- }
488
- else {
489
- $element_value = 'continue';
490
- }
491
- }
492
- return $element_value;
493
- }
494
-
495
- public function view_for_star_rating($element_value, $element_label) {
496
- $view_star_rating_array = array();
497
- $new_filename = str_replace("***star_rating***", '', $element_value);
498
- $stars = "";
499
- $new_filename=explode('***', $new_filename);
500
- for ($j = 0; $j < $new_filename[1]; $j++) {
501
- $stars .= '<img id="' . $element_label . '_star_' . $j . '" src="' . WD_FM_URL . '/images/star_' . $new_filename[2] . '.png?ver='. WD_FM_VERSION.'" /> ';
502
- }
503
- for ($k = $new_filename[1]; $k < $new_filename[0]; $k++) {
504
- $stars .= '<img id="' . $element_label . '_star_' . $k . '" src="' . WD_FM_URL . '/images/star.png?ver='. WD_FM_VERSION.'" /> ';
505
- }
506
- array_push($view_star_rating_array, $stars);
507
- return $view_star_rating_array;
508
- }
509
-
510
- public function view_for_grading($element_value) {
511
- $view_grading_array = array();
512
- $new_filename = str_replace("***grading***", '', $element_value);
513
- $grading = explode(":", $new_filename);
514
- $items_count = sizeof($grading) - 1;
515
- $items = "";
516
- $total = "";
517
- for ($k = 0; $k < $items_count / 2; $k++) {
518
- $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
519
- $total += $grading[$k];
520
- }
521
- $items .= "Total: " . $total;
522
- array_push($view_grading_array, $items);
523
- return $view_grading_array;
524
- }
525
-
526
- public function images_for_star_rating($element_value, $label_id) {
527
- $edit_stars = "";
528
- $star_rating_array = array();
529
- $element_value1 = str_replace("***star_rating***", '', $element_value);
530
- $stars_value = explode('/', $element_value1);
531
- for ($j = 0; $j < $stars_value[0]; $j++) {
532
- $edit_stars .= '<img id="' . $label_id . '_star_' . $j . '" onclick="edit_star_rating(' . $j . ',' . $label_id . ')" src="' . WD_FM_URL . '/images/star_yellow.png?ver=' . WD_FM_VERSION . '" /> ';
533
- }
534
- for ($k = $stars_value[0]; $k < $stars_value[1]; $k++) {
535
- $edit_stars .= '<img id="' . $label_id . '_star_' . $k . '" onclick="edit_star_rating(' . $k . ',' . $label_id . ')" src="' . WD_FM_URL . '/images/star.png?ver=' . WD_FM_VERSION . '" /> ';
536
- }
537
- array_push($star_rating_array, $edit_stars);
538
- array_push($star_rating_array, $stars_value);
539
- return $star_rating_array;
540
- }
541
-
542
- public function params_for_scale_rating($element_value, $label_id) {
543
- $scale_rating_array = array();
544
- $scale_radio = explode('/', $element_value);
545
- $scale_value = $scale_radio[0];
546
- $scale = '<table><tr>';
547
- for ($k = 1; $k <= $scale_radio[1]; $k++) {
548
- $scale .= '<td style="text-align:center"><span>' . $k . '</span></td>';
549
- }
550
- $scale .= '<tr></tr>';
551
- for ($l = 1; $l <= $scale_radio[1]; $l++) {
552
- if ($l == $scale_radio[0]) {
553
- $checked = "checked";
554
- }
555
- else {
556
- $checked = "";
557
- }
558
- $scale .= '<td><input type="radio" name = "'.$label_id.'_scale_rating_radio" id = "'.$label_id.'_scale_rating_radio_'.$l.'" value="'.$l.'" '.$checked.' onClick="edit_scale_rating(this.value,'.$label_id.')" /></td>';
559
- }
560
- $scale .= '</tr></table>';
561
- array_push($scale_rating_array, $scale);
562
- array_push($scale_rating_array, $scale_radio);
563
- array_push($scale_rating_array, $checked);
564
- return $scale_rating_array;
565
- }
566
-
567
- public function params_for_type_range($element_value, $label_id) {
568
- $range_value = explode('-', $element_value);
569
- $range = '<input name="'.$label_id.'_element0" id="'.$label_id.'_element0" type="text" value="'.$range_value[0].'" onChange="edit_range(this.value,'.$label_id.',0)" size="8"/> - <input name="'.$label_id.'_element1" id="'.$label_id.'_element1" type="text" value="'.$range_value[1].'" onChange="edit_range(this.value,'.$label_id.',1)" size="8"/>';
570
- return $range;
571
- }
572
-
573
- public function params_for_type_grading($element_value, $label_id) {
574
- $type_grading_array = array();
575
- $element_value1 = str_replace("***grading***", '', $element_value);
576
- $garding_value = explode(':', $element_value1);
577
- $items_count = sizeof($garding_value) - 1;
578
- $garding = "";
579
- $sum = "";
580
- for ($k = 0; $k < $items_count/2; $k++) {
581
- $garding .= '<input name="'.$label_id.'_element'.$k.'" id="'.$label_id.'_element'.$k.'" type="text" value="'.$garding_value[$k].'" onKeyUp="edit_grading('.$label_id.','.$items_count.')" size="5"/> '.$garding_value[$items_count/2+$k].'</br>';
582
- $sum += $garding_value[$k];
583
- }
584
- array_push($type_grading_array, $garding);
585
- array_push($type_grading_array, $garding_value);
586
- array_push($type_grading_array, $sum);
587
- array_push($type_grading_array, $items_count);
588
- array_push($type_grading_array, $element_value1);
589
- return $type_grading_array;
590
- }
591
-
592
- public function params_for_type_matrix($element_value, $label_id) {
593
- $type_matrix_array = array();
594
- $new_filename = str_replace("***matrix***", '', $element_value);
595
- $matrix_value = explode('***', $new_filename);
596
- $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
597
- $mat_rows = $matrix_value[0];
598
- $mat_columns = $matrix_value[$mat_rows + 1];
599
- $matrix = "<table>";
600
- $matrix .= '<tr><td></td>';
601
- for ($k = 1; $k <= $mat_columns; $k++) {
602
- $matrix .= '<td style="background-color:#BBBBBB; padding:5px; border:1px; ">'.$matrix_value[$mat_rows+1+$k].'</td>';
603
- }
604
- $matrix .= '</tr>';
605
- $aaa = Array();
606
- $var_checkbox = 1;
607
- $selected_value = "";
608
- $selected_value_yes = "";
609
- $selected_value_no = "";
610
- for ($k = 1; $k <= $mat_rows; $k++) {
611
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px; border:1px;">'.$matrix_value[$k].'</td>';
612
- if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
613
- if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
614
- $checked = "";
615
- $aaa[1] = "";
616
- }
617
- else {
618
- $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
619
- }
620
- for ($l = 1; $l <= $mat_columns; $l++) {
621
- if ($aaa[1] == $l) {
622
- $checked = 'checked';
623
- }
624
- else {
625
- $checked = "";
626
- }
627
- $index = "'" . $k . '_' . $l . "'";
628
- $matrix .= '<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" '.$checked.' onClick="change_radio_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
629
- }
630
- }
631
- else {
632
- if ($matrix_value[$mat_rows+$mat_columns+2] == "checkbox") {
633
- for ($l = 1; $l <= $mat_columns; $l++) {
634
- if ($matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox] == 1) {
635
- $checked = 'checked';
636
- }
637
- else {
638
- $checked = '';
639
- }
640
- $index = "'".$k.'_'.$l."'";
641
- $matrix .='<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" '.$checked.' onClick="change_checkbox_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
642
- $var_checkbox++;
643
- }
644
- }
645
- else {
646
- if ($matrix_value[$mat_rows + $mat_columns + 2] == "text") {
647
- for ($l = 1; $l <= $mat_columns; $l++) {
648
- $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
649
- $index = "'".$k.'_'.$l."'";
650
- $matrix .= '<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" value="'.$text_value.'" onKeyUp="change_text_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
651
- $var_checkbox++;
652
- }
653
- }
654
- else {
655
- for ($l = 1; $l <= $mat_columns; $l++) {
656
- $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
657
- if ($selected_text == 'yes') {
658
- $selected_value_yes = 'selected';
659
- $selected_value_no = '';
660
- $selected_value = '';
661
- }
662
- else {
663
- if ($selected_text=='no') {
664
- $selected_value_yes ='';
665
- $selected_value_no ='selected';
666
- $selected_value ='';
667
- }
668
- else {
669
- $selected_value_yes = '';
670
- $selected_value_no ='';
671
- $selected_value ='selected';
672
- }
673
- }
674
- $index = "'".$k.'_'.$l."'";
675
- $matrix .= '<td style="text-align:center;"><select name="'.$label_id.'_select_yes_noform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_select_yes_noform_id_temp'.$k.'_'.$l.'" onChange="change_option_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"><option value="" '.$selected_value.'></option><option value="yes" '.$selected_value_yes.' >Yes</option><option value="no" '.$selected_value_no.'>No</option></select></td>';
676
- $var_checkbox++;
677
- }
678
- }
679
- }
680
- }
681
- $matrix .= '</tr>';
682
- }
683
- $matrix .= '</table>';
684
- array_push($type_matrix_array, $matrix);
685
- array_push($type_matrix_array, $new_filename);
686
- return $type_matrix_array;
687
- }
688
-
689
- public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
690
- global $wpdb;
691
-
692
- $query = "SELECT `" . $label_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
693
- if($db_info) {
694
- $temp = explode('@@@wdfhostwdf@@@',$db_info);
695
- $host = $temp[0];
696
- $temp = explode('@@@wdfportwdf@@@',$temp[1]);
697
- $port = $temp[0];
698
- $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
699
- $username = $temp[0];
700
- $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
701
- $password = $temp[0];
702
- $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
703
- $database = $temp[0];
704
-
705
- $wpdb_temp = new wpdb($username, $password, $database, $host);
706
- $choices_labels = $wpdb_temp->get_col($query);
707
- }
708
- else {
709
- $choices_labels = $wpdb->get_col($query);
710
- }
711
- return $choices_labels;
712
- }
713
- public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
714
- global $wpdb;
715
- $query = "SELECT `" . $value_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
716
- if($db_info) {
717
- $temp = explode('@@@wdfhostwdf@@@',$db_info);
718
- $host = $temp[0];
719
- $temp = explode('@@@wdfportwdf@@@',$temp[1]);
720
- $port = $temp[0];
721
- $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
722
- $username = $temp[0];
723
- $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
724
- $password = $temp[0];
725
- $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
726
- $database = $temp[0];
727
-
728
- $wpdb_temp = new wpdb($username, $password, $database, $host);
729
- $choices_values = $wpdb_temp->get_col($query);
730
- }
731
- else {
732
- $choices_values = $wpdb->get_col($query);
733
- }
734
- return $choices_values;
735
- }
736
- public function get_subs_count($form_id) {
737
- global $wpdb;
738
- $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
739
- $group_id_s = $wpdb->get_col($query);
740
- return count($group_id_s);
741
- }
742
- }
743
-
744
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelWidget.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- class FMModelWidget {
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_gallery_rows_data() {
23
- global $wpdb;
24
- $query = "SELECT * FROM " . $wpdb->prefix . "formmaker order by `title`";
25
- $rows = $wpdb->get_results($query);
26
- return $rows;
27
- }
28
-
29
- ////////////////////////////////////////////////////////////////////////////////////////
30
- // Getters & Setters //
31
- ////////////////////////////////////////////////////////////////////////////////////////
32
- ////////////////////////////////////////////////////////////////////////////////////////
33
- // Private Methods //
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- ////////////////////////////////////////////////////////////////////////////////////////
36
- // Listeners //
37
- ////////////////////////////////////////////////////////////////////////////////////////
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMPaypalInfo.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelPaypal_info
5
+ */
6
+ class FMModelPaypal_info {
7
+ /**
8
+ * Get form session.
9
+ *
10
+ * @param int $id
11
+ *
12
+ * @return object $row
13
+ */
14
+ public function get_form_session( $id ) {
15
+ global $wpdb;
16
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_sessions WHERE group_id="%d"', $id));
17
+
18
+ return $row;
19
+ }
20
+ }
admin/models/FMPreview.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelFormMakerPreview
5
+ */
6
+ class FMModelFormMakerPreview {
7
+ /**
8
+ * Get form by id.
9
+ *
10
+ * @param $id
11
+ *
12
+ * @return null|string
13
+ */
14
+ public function get_form( $id ) {
15
+ global $wpdb;
16
+ $row = $wpdb->get_var($wpdb->prepare('SELECT form_front FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
17
+
18
+ return $row;
19
+ }
20
+ }
admin/models/FMSelectDataFromDb.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelSelect_data_from_db
5
+ */
6
+ class FMModelSelect_data_from_db {
7
+ /**
8
+ * Get labels by form id.
9
+ *
10
+ * @param int $id
11
+ *
12
+ * @return (string|null) $rows
13
+ */
14
+ function get_labels( $id ) {
15
+ global $wpdb;
16
+ $rows = $wpdb->get_var("SELECT label_order_current FROM " . $wpdb->prefix . "formmaker where id=" . $id);
17
+
18
+ return $rows;
19
+ }
20
+
21
+ /**
22
+ * Get tables.
23
+ *
24
+ * @return object $tables
25
+ */
26
+ function get_tables() {
27
+ global $wpdb;
28
+ $con_type = $_POST['con_type'];
29
+ if ( $con_type == 'local' ) {
30
+ $query = "SHOW TABLES";
31
+ $tables = $wpdb->get_col($query);
32
+ }
33
+ else {
34
+ if ( $con_type == 'remote' ) {
35
+ $username = isset($_POST['username']) ? $_POST['username'] : '';
36
+ $password = isset($_POST['password']) ? $_POST['password'] : '';
37
+ $database = isset($_POST['database']) ? $_POST['database'] : '';
38
+ $host = isset($_POST['host']) ? $_POST['host'] : '';
39
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
40
+ $query = "SHOW TABLES";
41
+ $tables = $wpdb_temp->get_col($query);
42
+ }
43
+ }
44
+
45
+ return $tables;
46
+ }
47
+
48
+ /**
49
+ * Get tables saved.
50
+ *
51
+ * @param string $con_type
52
+ * @param string $username
53
+ * @param string $password
54
+ * @param string $database
55
+ * @param string $host
56
+ *
57
+ * @return object $tables
58
+ */
59
+ function get_tables_saved( $con_type, $username, $password, $database, $host ) {
60
+ global $wpdb;
61
+ if ( $con_type == 'local' ) {
62
+ $query = "SHOW TABLES";
63
+ $tables = $wpdb->get_col($query);
64
+ }
65
+ else {
66
+ if ( $con_type == 'remote' ) {
67
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
68
+ $query = "SHOW TABLES";
69
+ $tables = $wpdb_temp->get_col($query);
70
+ }
71
+ }
72
+
73
+ return $tables;
74
+ }
75
+
76
+ /**
77
+ * Get table struct.
78
+ *
79
+ * @return object $table_struct
80
+ */
81
+ function get_table_struct() {
82
+ global $wpdb;
83
+ $name = isset($_POST['name']) ? $_POST['name'] : NULL;
84
+ if ( !$name ) {
85
+ return array();
86
+ }
87
+ $con_method = $_POST['con_method'];
88
+ $con_type = $_POST['con_type'];
89
+ $query = "SHOW COLUMNS FROM " . $name;
90
+ if ( $con_type == 'remote' ) {
91
+ $username = isset($_POST['username']) ? $_POST['username'] : '';
92
+ $password = isset($_POST['password']) ? $_POST['password'] : '';
93
+ $database = isset($_POST['database']) ? $_POST['database'] : '';
94
+ $host = isset($_POST['host']) ? $_POST['host'] : '';
95
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
96
+ $table_struct = $wpdb_temp->get_results($query);
97
+ }
98
+ else {
99
+ $table_struct = $wpdb->get_results($query);
100
+ }
101
+
102
+ return $table_struct;
103
+ }
104
+
105
+ /**
106
+ * Get table struct.
107
+ *
108
+ * @param string $con_type
109
+ * @param string $username
110
+ * @param string $password
111
+ * @param string $database
112
+ * @param string $host
113
+ * @param string $name
114
+ * @param string $con_method
115
+ *
116
+ * @return object $table_struct
117
+ */
118
+ function get_table_struct_saved( $con_type, $username, $password, $database, $host, $name, $con_method ) {
119
+ global $wpdb;
120
+ if ( !$name ) {
121
+ return array();
122
+ }
123
+ $query = "SHOW COLUMNS FROM " . $name;
124
+ if ( $con_type == 'remote' ) {
125
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
126
+ $table_struct = $wpdb_temp->get_results($query);
127
+ }
128
+ else {
129
+ $table_struct = $wpdb->get_results($query);
130
+ }
131
+
132
+ return $table_struct;
133
+ }
134
+ }
admin/models/FMShortocde.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelFMShortocde
5
+ */
6
+ class FMModelFMShortocde {
7
+ /**
8
+ * Get forms.
9
+ *
10
+ * @return array $rows
11
+ */
12
+ public function get_form_data() {
13
+ global $wpdb;
14
+ $rows = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "formmaker` ORDER BY `title`" . (WDFM()->is_pro ? '' : ' AND id NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')'));
15
+
16
+ return $rows;
17
+ }
18
+ }
admin/models/FMSqlMapping.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelFormMakerSQLMapping
5
+ */
6
+ class FMModelFormMakerSQLMapping {
7
+ /**
8
+ * Get query by id.
9
+ *
10
+ * @param $id
11
+ *
12
+ * @return array|null|object|void
13
+ */
14
+ function get_query( $id ) {
15
+ global $wpdb;
16
+ $rows = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker_query where id=" . $id);
17
+
18
+ return $rows;
19
+ }
20
+
21
+ /**
22
+ * Get labels by id.
23
+ *
24
+ * @param int $id
25
+ *
26
+ * @return (string|null) $rows
27
+ */
28
+ function get_labels( $id ) {
29
+ global $wpdb;
30
+ $rows = $wpdb->get_var("SELECT label_order_current FROM " . $wpdb->prefix . "formmaker where id=" . $id);
31
+
32
+ return $rows;
33
+ }
34
+
35
+ /**
36
+ * Get tables.
37
+ *
38
+ * @return object $tables
39
+ */
40
+ function get_tables() {
41
+ global $wpdb;
42
+ $con_type = $_POST['con_type'];
43
+ if ( $con_type == 'local' ) {
44
+ $query = "SHOW TABLES";
45
+ $tables = $wpdb->get_col($query);
46
+ }
47
+ else {
48
+ if ( $con_type == 'remote' ) {
49
+ $username = isset($_POST['username']) ? $_POST['username'] : '';
50
+ $password = isset($_POST['password']) ? $_POST['password'] : '';
51
+ $database = isset($_POST['database']) ? $_POST['database'] : '';
52
+ $host = isset($_POST['host']) ? $_POST['host'] : '';
53
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
54
+ $query = "SHOW TABLES";
55
+ $tables = $wpdb_temp->get_col($query);
56
+ }
57
+ }
58
+
59
+ return $tables;
60
+ }
61
+
62
+ function get_tables_saved( $con_type, $username, $password, $database, $host ) {
63
+ global $wpdb;
64
+ if ( $con_type == 'local' ) {
65
+ $query = "SHOW TABLES";
66
+ $tables = $wpdb->get_col($query);
67
+ }
68
+ else {
69
+ if ( $con_type == 'remote' ) {
70
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
71
+ $query = "SHOW TABLES";
72
+ $tables = $wpdb_temp->get_col($query);
73
+ }
74
+ }
75
+
76
+ return $tables;
77
+ }
78
+
79
+ function get_table_struct() {
80
+ global $wpdb;
81
+ $name = isset($_POST['name']) ? $_POST['name'] : NULL;
82
+ if ( !$name ) {
83
+ return array();
84
+ }
85
+ $con_method = $_POST['con_method'];
86
+ $con_type = $_POST['con_type'];
87
+ $query = "SHOW COLUMNS FROM " . $name;
88
+ if ( $con_type == 'remote' ) {
89
+ $username = isset($_POST['username']) ? $_POST['username'] : '';
90
+ $password = isset($_POST['password']) ? $_POST['password'] : '';
91
+ $database = isset($_POST['database']) ? $_POST['database'] : '';
92
+ $host = isset($_POST['host']) ? $_POST['host'] : '';
93
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
94
+ $table_struct = $wpdb_temp->get_results($query);
95
+ }
96
+ else {
97
+ $table_struct = $wpdb->get_results($query);
98
+ }
99
+
100
+ return $table_struct;
101
+ }
102
+
103
+ function get_table_struct_saved( $con_type, $username, $password, $database, $host, $name, $con_method ) {
104
+ global $wpdb;
105
+ if ( !$name ) {
106
+ return array();
107
+ }
108
+ $query = "SHOW COLUMNS FROM " . $name;
109
+ if ( $con_type == 'remote' ) {
110
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
111
+ $table_struct = $wpdb_temp->get_results($query);
112
+ }
113
+ else {
114
+ $table_struct = $wpdb->get_results($query);
115
+ }
116
+
117
+ return $table_struct;
118
+ }
119
+ }
admin/models/FormMakerSubmits.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelFormMakerSubmits
5
+ */
6
+ class FMModelFormMakerSubmits {
7
+ public function get_from_label_order( $form_id ) {
8
+ global $wpdb;
9
+ $label_order = $wpdb->get_var($wpdb->prepare('SELECT `label_order` FROM `' . $wpdb->prefix . 'formmaker` WHERE id="%d"', $form_id));
10
+
11
+ return $label_order;
12
+ }
13
+
14
+ public function get_submissions( $group_id ) {
15
+ global $wpdb;
16
+ $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'formmaker_submits` WHERE group_id="%d"', $group_id));
17
+
18
+ return $row;
19
+ }
20
+ }
admin/models/Manage_fm.php ADDED
@@ -0,0 +1,3759 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelManage_fm
5
+ */
6
+ class FMModelManage_fm {
7
+ /**
8
+ * Get forms.
9
+ *
10
+ * @param $params
11
+ *
12
+ * @return array|null|object
13
+ */
14
+ public function get_rows_data($params) {
15
+ $order = $params['order'];
16
+ $orderby = $params['orderby'];
17
+ $items_per_page = $params['items_per_page'];
18
+ $search = WDW_FM_Library::get('s', '');
19
+ $page = (int) WDW_FM_Library::get('paged', 1);
20
+ $limit = $page ? ($page - 1) * $items_per_page : 0;
21
+
22
+ global $wpdb;
23
+ $query = "SELECT t1.*, count(DISTINCT t2.group_id) as submission_count, GROUP_CONCAT(t2.id SEPARATOR ',') FROM " . $wpdb->prefix . "formmaker as t1 ";
24
+ $query .= "LEFT JOIN " . $wpdb->prefix . "formmaker_submits as t2 ";
25
+ $query .= "on t1.id = t2.form_id ";
26
+ $query .= (WDFM()->is_pro ? '' : 'WHERE t1.id NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')');
27
+ if ( $search ) {
28
+ $query .= (WDFM()->is_pro ? 'WHERE' : ' AND') . ' t1.title LIKE "%' . $search . '%"';
29
+ }
30
+ $query .= " GROUP BY t1.id";
31
+ $query .= ' ORDER BY t1.`' . $orderby . '` ' . $order;
32
+ $query .= " LIMIT " . $limit . "," . $items_per_page;
33
+ $rows = $wpdb->get_results($query);
34
+
35
+ return $rows;
36
+ }
37
+
38
+ public function get_row_data( $id ) {
39
+ global $wpdb;
40
+ if ( $id != 0 ) {
41
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
42
+ }
43
+ else {
44
+ // Add "Submit" button to new forms.
45
+ $row = new stdClass();
46
+ $row->id = 0;
47
+ $row->title = '';
48
+ $row->mail = '';
49
+ $row->form = '';
50
+ $row->form_front = '<div class="wdform-page-and-images" style="display:table; border-top:0px solid black;"><div id="form_id_tempform_view1" class="wdform_page" page_title="Untitled page" next_title="Next" next_type="text" next_class="wdform-page-button" next_checkable="false" previous_title="Previous" previous_type="text" previous_class="wdform-page-button" previous_checkable="false"><div class="wdform_section"><div class="wdform_column"><div wdid="1" class="wdform_row ui-sortable-handle">%1 - type_submit_reset_1%</div></div></div><div valign="top" class="wdform_footer" style="width: 100%;"><div style="width: 100%;"><div style="width: 100%; display: table; padding-top:10px;"><div style="display: table-row-group;"><div id="form_id_temppage_nav1" style="display: table-row;"></div></div></div></div></div></div></div>';
51
+ $row->theme = 0;
52
+ $row->javascript = '';
53
+ $row->submit_text = '';
54
+ $row->url = '';
55
+ $row->submit_text_type = 0;
56
+ $row->script1 = '';
57
+ $row->script2 = '';
58
+ $row->script_user1 = '';
59
+ $row->script_user2 = '';
60
+ $row->counter = 2;
61
+ $row->label_order = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****##**id**##**label**##****#';
62
+ $row->article_id = '';
63
+ $row->pagination = '';
64
+ $row->show_title = '';
65
+ $row->show_numbers = '';
66
+ $row->public_key = '';
67
+ $row->private_key = '';
68
+ $row->recaptcha_theme = '';
69
+ $row->from_name = '';
70
+ $row->from_mail = '';
71
+ $row->label_order_current = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****#';
72
+ $row->script_mail_user = '';
73
+ $row->script_mail = '';
74
+ $row->tax = 0;
75
+ $row->payment_currency = '$';
76
+ $row->paypal_email = '';
77
+ $row->checkout_mode = 'testmode';
78
+ $row->paypal_mode = 0;
79
+ $row->published = 1;
80
+ $row->form_fields = '1*:*id*:*type_submit_reset*:*type*:*type_submit_reset_1*:*w_field_label*:*Submit*:*w_submit_title*:*Reset*:*w_reset_title*:**:*w_class*:*false*:*w_act*:**:*new_field*:*';
81
+ $row->savedb = 1;
82
+ $row->sendemail = 1;
83
+ $row->requiredmark = '*';
84
+ $row->reply_to = 0;
85
+ $row->send_to = 0;
86
+ $row->autogen_layout = 1;
87
+ $row->custom_front = '';
88
+ $row->mail_from_user = '';
89
+ $row->mail_from_name_user = '';
90
+ $row->reply_to_user = '';
91
+ $row->save_uploads = 1;
92
+ $row->header_title = '';
93
+ $row->header_description = '';
94
+ $row->header_image_url = '';
95
+ $row->header_image_animation = '';
96
+ $row->header_hide_image = '';
97
+ }
98
+
99
+ return $row;
100
+ }
101
+
102
+ public function get_row_data_new( $id ) {
103
+ global $wpdb;
104
+ if ( $id != 0 ) {
105
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_backup WHERE backup_id="%d"', $id));
106
+ }
107
+ else {
108
+ // Add "Submit" button to new forms.
109
+ $row = new stdClass();
110
+ $row->id = 0;
111
+ $row->backup_id = '';
112
+ $row->title = '';
113
+ $row->mail = '';
114
+ $row->form = '';
115
+ $row->form_front = '<div class="wdform-page-and-images" style="display:table; border-top:0px solid black;"><div id="form_id_tempform_view1" class="wdform_page" page_title="Untitled page" next_title="Next" next_type="text" next_class="wdform-page-button" next_checkable="false" previous_title="Previous" previous_type="text" previous_class="wdform-page-button" previous_checkable="false"><div class="wdform_section"><div class="wdform_column"><div wdid="1" class="wdform_row ui-sortable-handle">%1 - type_submit_reset_1%</div></div></div><div valign="top" class="wdform_footer" style="width: 100%;"><div style="width: 100%;"><div style="width: 100%; display: table; padding-top:10px;"><div style="display: table-row-group;"><div id="form_id_temppage_nav1" style="display: table-row;"></div></div></div></div></div></div></div>';
116
+ $row->theme = $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
117
+ $row->javascript = '';
118
+ $row->submit_text = '';
119
+ $row->url = '';
120
+ $row->submit_text_type = 1;
121
+ $row->script1 = '%all%';
122
+ $row->script2 = '%all%';
123
+ $row->script_user1 = '';
124
+ $row->script_user2 = '';
125
+ $row->counter = 2;
126
+ $row->label_order = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****##**id**##**label**##****#';
127
+ $row->article_id = 0;
128
+ $row->pagination = 'none';
129
+ $row->show_title = false;
130
+ $row->show_numbers = true;
131
+ $row->public_key = '';
132
+ $row->private_key = '';
133
+ $row->recaptcha_theme = '';
134
+ $row->from_name = '';
135
+ $row->from_mail = '';
136
+ $row->label_order_current = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****#';
137
+ $row->script_mail_user = '';
138
+ $row->script_mail = '';
139
+ $row->tax = 0;
140
+ $row->payment_currency = '$';
141
+ $row->paypal_email = '';
142
+ $row->checkout_mode = 'testmode';
143
+ $row->paypal_mode = 0;
144
+ $row->published = 1;
145
+ $row->form_fields = '1*:*id*:*type_submit_reset*:*type*:*type_submit_reset_1*:*w_field_label*:*Submit*:*w_submit_title*:*Reset*:*w_reset_title*:**:*w_class*:*false*:*w_act*:**:*new_field*:*';
146
+ $row->savedb = 1;
147
+ $row->sendemail = 1;
148
+ $row->requiredmark = '*';
149
+ $row->reply_to = 0;
150
+ $row->send_to = 0;
151
+ $row->autogen_layout = 1;
152
+ $row->custom_front = '';
153
+ $row->mail_from_user = '';
154
+ $row->mail_from_name_user = '';
155
+ $row->reply_to_user = '';
156
+ $row->save_uploads = 1;
157
+ $row->header_title = '';
158
+ $row->header_description = '';
159
+ $row->header_image_url = '';
160
+ $row->header_image_animation = 'none';
161
+ $row->header_hide_image = 0;
162
+ $row->condition = '';
163
+ $row->mail_cc = '';
164
+ $row->mail_cc_user = '';
165
+ $row->mail_bcc = '';
166
+ $row->mail_bcc_user = '';
167
+ $row->mail_subject = '';
168
+ $row->mail_subject_user = '';
169
+ $row->mail_mode = 1;
170
+ $row->mail_mode_user = 1;
171
+ $row->mail_attachment = 1;
172
+ $row->mail_attachment_user = 1;
173
+ $row->user_id_wd = '';
174
+ $row->sortable = 1;
175
+ $row->frontend_submit_fields = '';
176
+ $row->frontend_submit_stat_fields = '';
177
+ $row->mail_emptyfields = 0;
178
+ $row->mail_verify = 0;
179
+ $row->mail_verify_expiretime = 0;
180
+ $row->mail_verification_post_id = 0;
181
+ }
182
+
183
+ $labels2 = array();
184
+ $label_id = array();
185
+ $label_order_original = array();
186
+ $label_type = array();
187
+ $label_all = explode('#****#', $row->label_order);
188
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
189
+ foreach ( $label_all as $key => $label_each ) {
190
+ $label_id_each = explode('#**id**#', $label_each);
191
+ array_push($label_id, $label_id_each[0]);
192
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
193
+ array_push($label_order_original, addslashes($label_oder_each[0]));
194
+ array_push($label_type, $label_oder_each[1]);
195
+ }
196
+ $labels2['id'] = '"' . implode('","', $label_id) . '"';
197
+ $labels2['label'] = '"' . implode('","', $label_order_original) . '"';
198
+ $labels2['type'] = '"' . implode('","', $label_type) . '"';
199
+ $ids = array();
200
+ $types = array();
201
+ $labels = array();
202
+ $paramss = array();
203
+ $fields = explode('*:*new_field*:*', $row->form_fields);
204
+ $fields = array_slice($fields, 0, count($fields) - 1);
205
+ foreach ( $fields as $field ) {
206
+ $temp = explode('*:*id*:*', $field);
207
+ array_push($ids, $temp[0]);
208
+ $temp = explode('*:*type*:*', $temp[1]);
209
+ array_push($types, $temp[0]);
210
+ $temp = explode('*:*w_field_label*:*', $temp[1]);
211
+ array_push($labels, $temp[0]);
212
+ array_push($paramss, $temp[1]);
213
+ }
214
+ $form = $row->form_front;
215
+ foreach ( $ids as $ids_key => $id ) {
216
+ $label = $labels[$ids_key];
217
+ $type = $types[$ids_key];
218
+ $params = $paramss[$ids_key];
219
+ if ( strpos($form, '%' . $id . ' - ' . $label . '%') || strpos($form, '%' . $id . ' -' . $label . '%') ) {
220
+ $rep = '';
221
+ $arrows = '';
222
+ $param = array();
223
+ $param['attributes'] = '';
224
+ switch ( $type ) {
225
+ case 'type_section_break': {
226
+ $arrows = $arrows . '<div id="wdform_arrows' . $id . '" class="wdform_arrows" style="display: none;"><div id="X_' . $id . '" class="element_toolbar"><span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_section_break(&quot;' . $id . '&quot;)"></span></div><div id="edit_' . $id . '" class="element_toolbar"><span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></span><span id="' . $id . '_element_labelform_id_temp" style="display: none;">custom_' . $id . '</span></div><div id="duplicate_' . $id . '" class="element_toolbar"><span title="Duplicate the field" class="page_toolbar dashicons dashicons-admin-page" onclick="duplicate(&quot;' . $id . '&quot;)"></span></div></div>';
227
+ break;
228
+ }
229
+ case 'type_editor': {
230
+ $arrows = $arrows . '<div id="wdform_arrows' . $id . '" class="wdform_arrows" type="type_editor" style="margin-top:0px; display: none;"><div id="X_' . $id . '" valign="middle" align="right" class="element_toolbar"><span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_row(&quot;' . $id . '&quot;)"></span></div><div id="left_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;' . $id . '&quot;)"></span></div><div id="up_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;' . $id . '&quot;)"></div><div id="down_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;' . $id . '&quot;)"></div><div id="right_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;' . $id . '&quot;)"></div><div id="edit_' . $id . '" valign="middle" class="element_toolbar"><span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></div><div id="duplicate_' . $id . '" valign="middle" class="element_toolbar"><span title="Duplicate the field" class="page_toolbar dashicons dashicons-admin-page" onclick="duplicate(&quot;' . $id . '&quot;)"></span></div><div id="page_up_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;' . $id . '&quot;)"></span></div><div id="page_down_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;' . $id . '&quot;)"></span></div></div>';
231
+ break;
232
+ }
233
+ case 'type_send_copy':
234
+ case 'type_stripe':
235
+ case 'type_captcha':
236
+ case 'type_arithmetic_captcha':
237
+ case 'type_recaptcha': {
238
+ $arrows = $arrows . '<div id="wdform_arrows' . $id . '" class="wdform_arrows" style="display: none;"><div id="X_' . $id . '" valign="middle" align="right" class="element_toolbar"><span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_row(&quot;' . $id . '&quot;)"></span></div><div id="left_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;' . $id . '&quot;)"></span></div><div id="up_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;' . $id . '&quot;)"></span></div><div id="down_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;' . $id . '&quot;)"></span></div><div id="right_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;' . $id . '&quot;)"></span></div><div id="edit_' . $id . '" valign="middle" class="element_toolbar"><span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></span></div><div id="duplicate_' . $id . '" valign="middle" class="element_toolbar"></div><div id="page_up_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;' . $id . '&quot;)"></span></div><div id="page_down_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;' . $id . '&quot;)"></span></div></div>';
239
+ break;
240
+ }
241
+ default : {
242
+ $arrows = $arrows . '<div id="wdform_arrows' . $id . '" class="wdform_arrows" style="display: none;"><div id="X_' . $id . '" valign="middle" align="right" class="element_toolbar"><span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_row(&quot;' . $id . '&quot;)"></span></div><div id="left_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;' . $id . '&quot;)"></span></div><div id="up_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;' . $id . '&quot;)"></span></div><div id="down_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;' . $id . '&quot;)"></span></div><div id="right_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;' . $id . '&quot;)"></span></div><div id="edit_' . $id . '" valign="middle" class="element_toolbar"><span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></span></div><div id="duplicate_' . $id . '" valign="middle" class="element_toolbar"><span title="Duplicate the field" class="page_toolbar dashicons dashicons-admin-page" onclick="duplicate(&quot;' . $id . '&quot;)"></span></div><div id="page_up_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;' . $id . '&quot;)"></span></div><div id="page_down_' . $id . '" valign="middle" class="element_toolbar"><span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;' . $id . '&quot;)"></span></div></div>';
243
+ break;
244
+ }
245
+ }
246
+ switch ( $type ) {
247
+ case 'type_section_break': {
248
+ $params_names = array( 'w_editor' );
249
+ $temp = $params;
250
+ foreach ( $params_names as $params_name ) {
251
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
252
+ $param[$params_name] = $temp[0];
253
+ $temp = $temp[1];
254
+ }
255
+ $rep = '<div id="wdform_field' . $id . '" type="type_section_break" class="wdform_field_section_break">' . $arrows . '<span id="' . $id . '_element_labelform_id_temp" style="display: none;">custom_' . $id . '</span><div id="' . $id . '_element_sectionform_id_temp" align="left" class="wdform_section_break">' . $param['w_editor'] . '</div></div><div id="' . $id . '_element_labelform_id_temp" style="color:red;">custom_' . $id . '</div>';
256
+ break;
257
+ }
258
+ case 'type_editor': {
259
+ $params_names = array( 'w_editor' );
260
+ $temp = $params;
261
+ foreach ( $params_names as $params_name ) {
262
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
263
+ $param[$params_name] = $temp[0];
264
+ $temp = $temp[1];
265
+ }
266
+ $rep = $arrows . '<div id="wdform_field' . $id . '" type="type_editor" class="wdform_field" >' . $param['w_editor'] . '</div><div id="' . $id . '_element_labelform_id_temp" style="color: red;">custom_' . $id . '</div>';
267
+ break;
268
+ }
269
+ case 'type_send_copy': {
270
+ $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required' );
271
+ $temp = $params;
272
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
273
+ $params_names = array(
274
+ 'w_field_label_size',
275
+ 'w_field_label_pos',
276
+ 'w_hide_label',
277
+ 'w_first_val',
278
+ 'w_required',
279
+ );
280
+ }
281
+ foreach ( $params_names as $params_name ) {
282
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
283
+ $param[$params_name] = $temp[0];
284
+ $temp = $temp[1];
285
+ }
286
+ if ( $temp ) {
287
+ $temp = explode('*:*w_attr_name*:*', $temp);
288
+ $attrs = array_slice($temp, 0, count($temp) - 1);
289
+ foreach ( $attrs as $attr ) {
290
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
291
+ }
292
+ }
293
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
294
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
295
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
296
+ $input_active = ($param['w_first_val'] == 'true' ? "checked='checked'" : "");
297
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
298
+ $rep = '<div id="wdform_field' . $id . '" type="type_send_copy" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" style="display: ' . $param['w_field_label_pos'] . '"><input type="hidden" value="type_send_copy" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp" /><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp" /><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="checkbox" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" onclick="set_checked(&quot;' . $id . '&quot;,&quot;&quot;,&quot;form_id_temp&quot;)" ' . $input_active . ' ' . $param['attributes'] . ' disabled /></div></div>';
299
+ break;
300
+ }
301
+ case 'type_text': {
302
+ $params_names = array(
303
+ 'w_field_label_size',
304
+ 'w_field_label_pos',
305
+ 'w_size',
306
+ 'w_first_val',
307
+ 'w_title',
308
+ 'w_required',
309
+ 'w_unique',
310
+ );
311
+ $temp = $params;
312
+ if ( strpos($temp, 'w_regExp_status') > -1 ) {
313
+ $params_names = array(
314
+ 'w_field_label_size',
315
+ 'w_field_label_pos',
316
+ 'w_size',
317
+ 'w_first_val',
318
+ 'w_title',
319
+ 'w_required',
320
+ 'w_regExp_status',
321
+ 'w_regExp_value',
322
+ 'w_regExp_common',
323
+ 'w_regExp_arg',
324
+ 'w_regExp_alert',
325
+ 'w_unique',
326
+ );
327
+ }
328
+ if ( strpos($temp, 'w_readonly') > -1 ) {
329
+ $params_names = array(
330
+ 'w_field_label_size',
331
+ 'w_field_label_pos',
332
+ 'w_size',
333
+ 'w_first_val',
334
+ 'w_title',
335
+ 'w_required',
336
+ 'w_regExp_status',
337
+ 'w_regExp_value',
338
+ 'w_regExp_common',
339
+ 'w_regExp_arg',
340
+ 'w_regExp_alert',
341
+ 'w_unique',
342
+ 'w_readonly',
343
+ );
344
+ }
345
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
346
+ $params_names = array(
347
+ 'w_field_label_size',
348
+ 'w_field_label_pos',
349
+ 'w_hide_label',
350
+ 'w_size',
351
+ 'w_first_val',
352
+ 'w_title',
353
+ 'w_required',
354
+ 'w_regExp_status',
355
+ 'w_regExp_value',
356
+ 'w_regExp_common',
357
+ 'w_regExp_arg',
358
+ 'w_regExp_alert',
359
+ 'w_unique',
360
+ 'w_readonly',
361
+ );
362
+ }
363
+ foreach ( $params_names as $params_name ) {
364
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
365
+ $param[$params_name] = $temp[0];
366
+ $temp = $temp[1];
367
+ }
368
+ if ( $temp ) {
369
+ $temp = explode('*:*w_attr_name*:*', $temp);
370
+ $attrs = array_slice($temp, 0, count($temp) - 1);
371
+ foreach ( $attrs as $attr ) {
372
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
373
+ }
374
+ }
375
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
376
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
377
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
378
+ $param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no");
379
+ $param['w_regExp_value'] = (isset($param['w_regExp_value']) ? $param['w_regExp_value'] : "");
380
+ $param['w_regExp_common'] = (isset($param['w_regExp_common']) ? $param['w_regExp_common'] : "");
381
+ $param['w_regExp_arg'] = (isset($param['w_regExp_arg']) ? $param['w_regExp_arg'] : "");
382
+ $param['w_regExp_alert'] = (isset($param['w_regExp_alert']) ? $param['w_regExp_alert'] : "Incorrect Value");
383
+ $param['w_readonly'] = (isset($param['w_readonly']) ? $param['w_readonly'] : "no");
384
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
385
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
386
+ $rep = '<div id="wdform_field' . $id . '" type="type_text" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" style="display: ' . $param['w_field_label_pos'] . '"><input type="hidden" value="type_text" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp" /><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp" /><input type="hidden" value="' . $param['w_readonly'] . '" name="' . $id . '_readonlyform_id_temp" id="' . $id . '_readonlyform_id_temp"/><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_regExp_status'] . '" name="' . $id . '_regExpStatusform_id_temp" id="' . $id . '_regExpStatusform_id_temp"><input type="hidden" value="' . $param['w_regExp_value'] . '" name="' . $id . '_regExp_valueform_id_temp" id="' . $id . '_regExp_valueform_id_temp"><input type="hidden" value="' . $param['w_regExp_common'] . '" name="' . $id . '_regExp_commonform_id_temp" id="' . $id . '_regExp_commonform_id_temp"><input type="hidden" value="' . $param['w_regExp_alert'] . '" name="' . $id . '_regExp_alertform_id_temp" id="' . $id . '_regExp_alertform_id_temp"><input type="hidden" value="' . $param['w_regExp_arg'] . '" name="' . $id . '_regArgumentform_id_temp" id="' . $id . '_regArgumentform_id_temp"><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp" /><input type="text" class="' . $input_active . '" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div></div>';
387
+ break;
388
+ }
389
+ case 'type_number': {
390
+ $params_names = array(
391
+ 'w_field_label_size',
392
+ 'w_field_label_pos',
393
+ 'w_size',
394
+ 'w_first_val',
395
+ 'w_title',
396
+ 'w_required',
397
+ 'w_unique',
398
+ 'w_class',
399
+ );
400
+ $temp = $params;
401
+ foreach ( $params_names as $params_name ) {
402
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
403
+ $param[$params_name] = $temp[0];
404
+ $temp = $temp[1];
405
+ }
406
+ if ( $temp ) {
407
+ $temp = explode('*:*w_attr_name*:*', $temp);
408
+ $attrs = array_slice($temp, 0, count($temp) - 1);
409
+ foreach ( $attrs as $attr ) {
410
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
411
+ }
412
+ }
413
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
414
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
415
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
416
+ $rep = '<div id="wdform_field' . $id . '" type="type_number" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '"><input type="hidden" value="type_number" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><input type="text" class="' . $input_active . '" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" onkeypress="return check_isnum(event)" onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div></div>';
417
+ break;
418
+ }
419
+ case 'type_password': {
420
+ $params_names = array(
421
+ 'w_field_label_size',
422
+ 'w_field_label_pos',
423
+ 'w_size',
424
+ 'w_required',
425
+ 'w_unique',
426
+ 'w_class',
427
+ );
428
+ $temp = $params;
429
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
430
+ $params_names = array(
431
+ 'w_field_label_size',
432
+ 'w_field_label_pos',
433
+ 'w_hide_label',
434
+ 'w_size',
435
+ 'w_required',
436
+ 'w_unique',
437
+ 'w_class',
438
+ );
439
+ }
440
+ if ( strpos($temp, 'w_verification') > -1 ) {
441
+ $params_names = array(
442
+ 'w_field_label_size',
443
+ 'w_field_label_pos',
444
+ 'w_hide_label',
445
+ 'w_size',
446
+ 'w_required',
447
+ 'w_unique',
448
+ 'w_class',
449
+ 'w_verification',
450
+ 'w_verification_label',
451
+ );
452
+ }
453
+ if ( strpos($temp, 'w_placeholder') > -1 ) {
454
+ $params_names = array(
455
+ 'w_field_label_size',
456
+ 'w_field_label_pos',
457
+ 'w_hide_label',
458
+ 'w_size',
459
+ 'w_required',
460
+ 'w_unique',
461
+ 'w_class',
462
+ 'w_verification',
463
+ 'w_verification_label',
464
+ 'w_placeholder',
465
+ );
466
+ }
467
+ foreach ( $params_names as $params_name ) {
468
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
469
+ $param[$params_name] = $temp[0];
470
+ $temp = $temp[1];
471
+ }
472
+ if ( $temp ) {
473
+ $temp = explode('*:*w_attr_name*:*', $temp);
474
+ $attrs = array_slice($temp, 0, count($temp) - 1);
475
+ foreach ( $attrs as $attr ) {
476
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
477
+ }
478
+ }
479
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
480
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
481
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
482
+ if ( isset($param['w_verification']) && $param['w_verification'] == "yes" ) {
483
+ $display_label_confirm = $display_label;
484
+ $display_element_confirm = $param['w_field_label_pos'];
485
+ }
486
+ else {
487
+ $display_label_confirm = "none";
488
+ $display_element_confirm = "none";
489
+ }
490
+ $param['w_verification'] = isset($param['w_verification']) ? $param['w_verification'] : "no";
491
+ $param['w_verification_label'] = isset($param['w_verification_label']) ? $param['w_verification_label'] : "Password confirmation:";
492
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
493
+ $confirm_password = '<br><div align="left" id="' . $id . '_1_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label_confirm . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_1_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $param['w_verification_label'] . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_1_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_element_confirm . ';"><input type="hidden" value="' . $param['w_verification'] . '" name="' . $id . '_verification_id_temp" id="' . $id . '_verification_id_temp"><input type="text" class="input_deactive" id="' . $id . '_1_elementform_id_temp" name="' . $id . '_1_elementform_id_temp" placeholder="' . $param['w_placeholder'] . '" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>';
494
+ $rep = '<div id="wdform_field' . $id . '" type="type_password" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '"><input type="hidden" value="type_password" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><input type="password" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" placeholder="' . $param['w_placeholder'] . '" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>' . $confirm_password . '</div>';
495
+ break;
496
+ }
497
+ case 'type_textarea': {
498
+ $params_names = array(
499
+ 'w_field_label_size',
500
+ 'w_field_label_pos',
501
+ 'w_size_w',
502
+ 'w_size_h',
503
+ 'w_first_val',
504
+ 'w_title',
505
+ 'w_required',
506
+ 'w_unique',
507
+ 'w_class',
508
+ );
509
+ $temp = $params;
510
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
511
+ $params_names = array(
512
+ 'w_field_label_size',
513
+ 'w_field_label_pos',
514
+ 'w_hide_label',
515
+ 'w_size_w',
516
+ 'w_size_h',
517
+ 'w_first_val',
518
+ 'w_title',
519
+ 'w_required',
520
+ 'w_unique',
521
+ 'w_class',
522
+ );
523
+ }
524
+ foreach ( $params_names as $params_name ) {
525
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
526
+ $param[$params_name] = $temp[0];
527
+ $temp = $temp[1];
528
+ }
529
+ if ( $temp ) {
530
+ $temp = explode('*:*w_attr_name*:*', $temp);
531
+ $attrs = array_slice($temp, 0, count($temp) - 1);
532
+ foreach ( $attrs as $attr ) {
533
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
534
+ }
535
+ }
536
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
537
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
538
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
539
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
540
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
541
+ $rep = '<div id="wdform_field' . $id . '" type="type_textarea" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display:' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><input type="hidden" value="type_textarea" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><textarea class="' . $input_active . '" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size_w'] . 'px; height: ' . $param['w_size_h'] . 'px;" ' . $param['attributes'] . ' disabled>' . $param['w_first_val'] . '</textarea></div></div>';
542
+ break;
543
+ }
544
+ case 'type_phone': {
545
+ $params_names = array(
546
+ 'w_field_label_size',
547
+ 'w_field_label_pos',
548
+ 'w_size',
549
+ 'w_first_val',
550
+ 'w_title',
551
+ 'w_mini_labels',
552
+ 'w_required',
553
+ 'w_unique',
554
+ 'w_class',
555
+ );
556
+ $temp = $params;
557
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
558
+ $params_names = array(
559
+ 'w_field_label_size',
560
+ 'w_field_label_pos',
561
+ 'w_hide_label',
562
+ 'w_size',
563
+ 'w_first_val',
564
+ 'w_title',
565
+ 'w_mini_labels',
566
+ 'w_required',
567
+ 'w_unique',
568
+ 'w_class',
569
+ );
570
+ }
571
+ foreach ( $params_names as $params_name ) {
572
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
573
+ $param[$params_name] = $temp[0];
574
+ $temp = $temp[1];
575
+ }
576
+ if ( $temp ) {
577
+ $temp = explode('*:*w_attr_name*:*', $temp);
578
+ $attrs = array_slice($temp, 0, count($temp) - 1);
579
+ foreach ( $attrs as $attr ) {
580
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
581
+ }
582
+ }
583
+ $w_first_val = explode('***', $param['w_first_val']);
584
+ $w_title = explode('***', $param['w_title']);
585
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
586
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
587
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
588
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
589
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
590
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
591
+ $rep = '<div id="wdform_field' . $id . '" type="type_phone" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_phone" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><div id="' . $id . '_table_name" style="display: table;"><div id="' . $id . '_tr_name1" style="display: table-row;"><div id="' . $id . '_td_name_input_first" style="display: table-cell;"><input type="text" class="' . $input_active . '" id="' . $id . '_element_firstform_id_temp" name="' . $id . '_element_firstform_id_temp" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" placeholder="' . $w_title[0] . '" onfocus="delete_value(&quot;' . $id . '_element_firstform_id_temp&quot;)"onblur="return_value(&quot;' . $id . '_element_firstform_id_temp&quot;)"onchange="change_value(&quot;' . $id . '_element_firstform_id_temp&quot;)" onkeypress="return check_isnum(event)"style="width: 50px;" ' . $param['attributes'] . ' disabled /><span class="wdform_line" style="margin: 0px 4px; padding: 0px;">-</span></div><div id="' . $id . '_td_name_input_last" style="display: table-cell;"><input type="text" class="' . $input_active . '" id="' . $id . '_element_lastform_id_temp" name="' . $id . '_element_lastform_id_temp" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" placeholder="' . $w_title[1] . '" onfocus="delete_value(&quot;' . $id . '_element_lastform_id_temp&quot;)"onblur="return_value(&quot;' . $id . '_element_lastform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_element_lastform_id_temp&quot;)" onkeypress="return check_isnum(event)"style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div></div><div id="' . $id . '_tr_name2" style="display: table-row;"><div id="' . $id . '_td_name_label_first" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_area_code">' . $w_mini_labels[0] . '</label></div><div id="' . $id . '_td_name_label_last" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_phone_number">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
592
+ break;
593
+ }
594
+ case 'type_phone_new': {
595
+ $temp = $params;
596
+ $params_names = array(
597
+ 'w_field_label_size',
598
+ 'w_field_label_pos',
599
+ 'w_hide_label',
600
+ 'w_size',
601
+ 'w_first_val',
602
+ 'w_top_country',
603
+ 'w_required',
604
+ 'w_unique',
605
+ 'w_class',
606
+ );
607
+ foreach ( $params_names as $params_name ) {
608
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
609
+ $param[$params_name] = $temp[0];
610
+ $temp = $temp[1];
611
+ }
612
+ if ( $temp ) {
613
+ $temp = explode('*:*w_attr_name*:*', $temp);
614
+ $attrs = array_slice($temp, 0, count($temp) - 1);
615
+ foreach ( $attrs as $attr ) {
616
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
617
+ }
618
+ }
619
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
620
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
621
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
622
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
623
+ $rep = '<div id="wdform_field' . $id . '" type="type_phone_new" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_phone_new" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><div id="' . $id . '_table_name" style="display: table;"><div id="' . $id . '_tr_name1" style="display: table-row;"><div id="' . $id . '_td_name_input_first" style="display: table-cell;"><input type="text" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" top-country = "' . $param['w_top_country'] . '" onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" onkeypress="return check_isnum(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled></div></div></div></div></div>';
624
+ break;
625
+ }
626
+ case 'type_name': {
627
+ $params_names = array(
628
+ 'w_field_label_size',
629
+ 'w_field_label_pos',
630
+ 'w_first_val',
631
+ 'w_title',
632
+ 'w_mini_labels',
633
+ 'w_size',
634
+ 'w_name_format',
635
+ 'w_required',
636
+ 'w_unique',
637
+ 'w_class',
638
+ );
639
+ $temp = $params;
640
+ if ( strpos($temp, 'w_name_fields') > -1 ) {
641
+ $params_names = array(
642
+ 'w_field_label_size',
643
+ 'w_field_label_pos',
644
+ 'w_first_val',
645
+ 'w_title',
646
+ 'w_mini_labels',
647
+ 'w_size',
648
+ 'w_name_format',
649
+ 'w_required',
650
+ 'w_unique',
651
+ 'w_class',
652
+ 'w_name_fields',
653
+ );
654
+ }
655
+ if ( strpos($temp, 'w_autofill') > -1 ) {
656
+ $params_names = array(
657
+ 'w_field_label_size',
658
+ 'w_field_label_pos',
659
+ 'w_first_val',
660
+ 'w_title',
661
+ 'w_mini_labels',
662
+ 'w_size',
663
+ 'w_name_format',
664
+ 'w_required',
665
+ 'w_unique',
666
+ 'w_class',
667
+ 'w_name_fields',
668
+ 'w_autofill',
669
+ );
670
+ }
671
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
672
+ $params_names = array(
673
+ 'w_field_label_size',
674
+ 'w_field_label_pos',
675
+ 'w_hide_label',
676
+ 'w_first_val',
677
+ 'w_title',
678
+ 'w_mini_labels',
679
+ 'w_size',
680
+ 'w_name_format',
681
+ 'w_required',
682
+ 'w_unique',
683
+ 'w_class',
684
+ 'w_name_fields',
685
+ 'w_autofill',
686
+ );
687
+ }
688
+ foreach ( $params_names as $params_name ) {
689
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
690
+ $param[$params_name] = $temp[0];
691
+ $temp = $temp[1];
692
+ }
693
+ if ( $temp ) {
694
+ $temp = explode('*:*w_attr_name*:*', $temp);
695
+ $attrs = array_slice($temp, 0, count($temp) - 1);
696
+ foreach ( $attrs as $attr ) {
697
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
698
+ }
699
+ }
700
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
701
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
702
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
703
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
704
+ $w_first_val = explode('***', $param['w_first_val']);
705
+ $w_title = explode('***', $param['w_title']);
706
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
707
+ $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
708
+ $w_name_fields = explode('***', $param['w_name_fields']);
709
+ $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
710
+ $w_name_format = '<div id="' . $id . '_td_name_input_first" style="display: table-cell;"><input type="text" class="' . ($w_first_val[0] == $w_title[0] ? "input_deactive" : "input_active") . '" id="' . $id . '_element_firstform_id_temp" name="' . $id . '_element_firstform_id_temp" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" placeholder="' . $w_title[0] . '" onfocus="delete_value(&quot;' . $id . '_element_firstform_id_temp&quot;)"onblur="return_value(&quot;' . $id . '_element_firstform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_element_firstform_id_temp&quot;)" style="margin-right: 10px; width: ' . $param['w_size'] . 'px;"' . $param['attributes'] . ' disabled /></div><div id="' . $id . '_td_name_input_last" style="display: table-cell;"><input type="text" class="' . ($w_first_val[1] == $w_title[1] ? "input_deactive" : "input_active") . '" id="' . $id . '_element_lastform_id_temp" name="' . $id . '_element_lastform_id_temp" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" placeholder="' . $w_title[1] . '" onfocus="delete_value(&quot;' . $id . '_element_lastform_id_temp&quot;)"onblur="return_value(&quot;' . $id . '_element_lastform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_element_lastform_id_temp&quot;)" style="margin-right: 10px; width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>';
711
+ $w_name_format_mini_labels = '<div id="' . $id . '_td_name_label_first" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_first">' . $w_mini_labels[1] . '</label></div><div id="' . $id . '_td_name_label_last" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_last">' . $w_mini_labels[2] . '</label></div>';
712
+ if ( $w_name_fields[0] == 'yes' ) {
713
+ $w_name_format = '<div id="' . $id . '_td_name_input_title" style="display: table-cell;"><input type="text" class="' . ($w_first_val[2] == $w_title[2] ? "input_deactive" : "input_active") . '" id="' . $id . '_element_titleform_id_temp" name="' . $id . '_element_titleform_id_temp" value="' . $w_first_val[2] . '" title="' . $w_title[2] . '" onfocus="delete_value(&quot;' . $id . '_element_titleform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_element_titleform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_element_titleform_id_temp&quot;)" style="margin: 0px 10px 0px 0px; width: 40px;" disabled /></div>' . $w_name_format;
714
+ $w_name_format_mini_labels = '<div id="' . $id . '_td_name_label_title" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_title">' . $w_mini_labels[0] . '</label></div>' . $w_name_format_mini_labels;
715
+ }
716
+ if ( $w_name_fields[1] == 'yes' ) {
717
+ $w_name_format = $w_name_format . '<div id="' . $id . '_td_name_input_middle" style="display: table-cell;"><input type="text" class="' . ($w_first_val[3] == $w_title[3] ? "input_deactive" : "input_active") . '" id="' . $id . '_element_middleform_id_temp" name="' . $id . '_element_middleform_id_temp" value="' . $w_first_val[3] . '" title="' . $w_title[3] . '" onfocus="delete_value(&quot;' . $id . '_element_middleform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_element_middleform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_element_middleform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" disabled /></div>';
718
+ $w_name_format_mini_labels = $w_name_format_mini_labels . '<div id="' . $id . '_td_name_label_middle" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_middle">' . $w_mini_labels[3] . '</label></div>';
719
+ }
720
+ $rep = '<div id="wdform_field' . $id . '" type="type_name" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_name" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><input type="hidden" value="' . $param['w_autofill'] . '" name="' . $id . '_autofillform_id_temp" id="' . $id . '_autofillform_id_temp"><input type="hidden" name="' . $id . '_enable_fieldsform_id_temp" id="' . $id . '_enable_fieldsform_id_temp" title="' . $w_name_fields[0] . '" first="yes" last="yes" middle="' . $w_name_fields[1] . '"><div id="' . $id . '_table_name" cellpadding="0" cellspacing="0" style="display: table;"><div id="' . $id . '_tr_name1" style="display: table-row;">' . $w_name_format . '</div><div id="' . $id . '_tr_name2" style="display: table-row;">' . $w_name_format_mini_labels . '</div></div></div></div>';
721
+ break;
722
+ }
723
+ case 'type_address': {
724
+ $params_names = array(
725
+ 'w_field_label_size',
726
+ 'w_field_label_pos',
727
+ 'w_size',
728
+ 'w_mini_labels',
729
+ 'w_disabled_fields',
730
+ 'w_required',
731
+ 'w_class',
732
+ );
733
+ $temp = $params;
734
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
735
+ $params_names = array(
736
+ 'w_field_label_size',
737
+ 'w_field_label_pos',
738
+ 'w_hide_label',
739
+ 'w_size',
740
+ 'w_mini_labels',
741
+ 'w_disabled_fields',
742
+ 'w_required',
743
+ 'w_class',
744
+ );
745
+ }
746
+ foreach ( $params_names as $params_name ) {
747
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
748
+ $param[$params_name] = $temp[0];
749
+ $temp = $temp[1];
750
+ }
751
+ if ( $temp ) {
752
+ $temp = explode('*:*w_attr_name*:*', $temp);
753
+ $attrs = array_slice($temp, 0, count($temp) - 1);
754
+ foreach ( $attrs as $attr ) {
755
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
756
+ }
757
+ }
758
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
759
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
760
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
761
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
762
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
763
+ $w_disabled_fields = explode('***', $param['w_disabled_fields']);
764
+ $hidden_inputs = '';
765
+ $labels_for_id = array( 'street1', 'street2', 'city', 'state', 'postal', 'country' );
766
+ foreach ( $w_disabled_fields as $key => $w_disabled_field ) {
767
+ if ( $key != 6 ) {
768
+ if ( $w_disabled_field == 'yes' ) {
769
+ $hidden_inputs .= '<input type="hidden" id="' . $id . '_' . $labels_for_id[$key] . 'form_id_temp" value="' . $w_mini_labels[$key] . '" id_for_label="' . ($id + $key) . '">';
770
+ }
771
+ }
772
+ }
773
+ $address_fields = '';
774
+ $g = 0;
775
+ if ( $w_disabled_fields[0] == 'no' ) {
776
+ $g += 2;
777
+ $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="' . $id . '_street1form_id_temp" name="' . $id . '_street1form_id_temp" onchange="change_value(&quot;' . $id . '_street1form_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled /><label class="mini_label" id="' . $id . '_mini_label_street1" style="display: block;">' . $w_mini_labels[0] . '</label></span>';
778
+ }
779
+ if ( $w_disabled_fields[1] == 'no' ) {
780
+ $g += 2;
781
+ $address_fields .= '<span style="float: left; width: 100%; padding-bottom: 8px; display: block;"><input type="text" id="' . $id . '_street2form_id_temp" name="' . ($id + 1) . '_street2form_id_temp" onchange="change_value(&quot;' . $id . '_street2form_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled /><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_street2">' . $w_mini_labels[1] . '</label></span>';
782
+ }
783
+ if ( $w_disabled_fields[2] == 'no' ) {
784
+ $g++;
785
+ $address_fields .= '<span style="float: left; width: 48%; padding-bottom: 8px;"><input type="text" id="' . $id . '_cityform_id_temp" name="' . ($id + 2) . '_cityform_id_temp" onchange="change_value(&quot;' . $id . '_cityform_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled /><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_city">' . $w_mini_labels[2] . '</label></span>';
786
+ }
787
+ if ( $w_disabled_fields[3] == 'no' ) {
788
+ $g++;
789
+ if ( $w_disabled_fields[5] == 'yes' && $w_disabled_fields[6] == 'yes' ) {
790
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><select type="text" id="' . $id . '_stateform_id_temp" name="' . ($id + 3) . '_stateform_id_temp" onchange="change_value(&quot;' . $id . '_stateform_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled ><option value=""></option><option value="Alabama">Alabama</option><option value="Alaska">Alaska</option><option value="Arizona">Arizona</option><option value="Arkansas">Arkansas</option><option value="California">California</option><option value="Colorado">Colorado</option><option value="Connecticut">Connecticut</option><option value="Delaware">Delaware</option><option value="Florida">Florida</option><option value="Georgia">Georgia</option><option value="Hawaii">Hawaii</option><option value="Idaho">Idaho</option><option value="Illinois">Illinois</option><option value="Indiana">Indiana</option><option value="Iowa">Iowa</option><option value="Kansas">Kansas</option><option value="Kentucky">Kentucky</option><option value="Louisiana">Louisiana</option><option value="Maine">Maine</option><option value="Maryland">Maryland</option><option value="Massachusetts">Massachusetts</option><option value="Michigan">Michigan</option><option value="Minnesota">Minnesota</option><option value="Mississippi">Mississippi</option><option value="Missouri">Missouri</option><option value="Montana">Montana</option><option value="Nebraska">Nebraska</option><option value="Nevada">Nevada</option><option value="New Hampshire">New Hampshire</option><option value="New Jersey">New Jersey</option><option value="New Mexico">New Mexico</option><option value="New York">New York</option><option value="North Carolina">North Carolina</option><option value="North Dakota">North Dakota</option><option value="Ohio">Ohio</option><option value="Oklahoma">Oklahoma</option><option value="Oregon">Oregon</option><option value="Pennsylvania">Pennsylvania</option><option value="Rhode Island">Rhode Island</option><option value="South Carolina">South Carolina</option><option value="South Dakota">South Dakota</option><option value="Tennessee">Tennessee</option><option value="Texas">Texas</option><option value="Utah">Utah</option><option value="Vermont">Vermont</option><option value="Virginia">Virginia</option><option value="Washington">Washington</option><option value="West Virginia">West Virginia</option><option value="Wisconsin">Wisconsin</option><option value="Wyoming">Wyoming</option></select><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
791
+ }
792
+ else {
793
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="' . $id . '_stateform_id_temp" name="' . ($id + 3) . '_stateform_id_temp" onchange="change_value(&quot;' . $id . '_stateform_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
794
+ }
795
+ }
796
+ if ( $w_disabled_fields[4] == 'no' ) {
797
+ $g++;
798
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><input type="text" id="' . $id . '_postalform_id_temp" name="' . ($id + 4) . '_postalform_id_temp" onchange="change_value(&quot;' . $id . '_postalform_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_postal">' . $w_mini_labels[4] . '</label></span>';
799
+ }
800
+ if ( $w_disabled_fields[5] == 'no' ) {
801
+ $g++;
802
+ $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;"><select type="text" id="' . $id . '_countryform_id_temp" name="' . ($id + 5) . '_countryform_id_temp" onchange="change_value(&quot;' . $id . '_countryform_id_temp&quot;)" style="width: 100%;" ' . $param['attributes'] . ' disabled><option value=""></option><option value="Afghanistan">Afghanistan</option><option value="Albania">Albania</option><option value="Algeria">Algeria</option><option value="Andorra">Andorra</option><option value="Angola">Angola</option><option value="Antigua and Barbuda">Antigua and Barbuda</option><option value="Argentina">Argentina</option><option value="Armenia">Armenia</option><option value="Australia">Australia</option><option value="Austria">Austria</option><option value="Azerbaijan">Azerbaijan</option><option value="Bahamas">Bahamas</option><option value="Bahrain">Bahrain</option><option value="Bangladesh">Bangladesh</option><option value="Barbados">Barbados</option><option value="Belarus">Belarus</option><option value="Belgium">Belgium</option><option value="Belize">Belize</option><option value="Benin">Benin</option><option value="Bhutan">Bhutan</option><option value="Bolivia">Bolivia</option><option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option><option value="Botswana">Botswana</option><option value="Brazil">Brazil</option><option value="Brunei">Brunei</option><option value="Bulgaria">Bulgaria</option><option value="Burkina Faso">Burkina Faso</option><option value="Burundi">Burundi</option><option value="Cambodia">Cambodia</option><option value="Cameroon">Cameroon</option><option value="Canada">Canada</option><option value="Cape Verde">Cape Verde</option><option value="Central African Republic">Central African Republic</option><option value="Chad">Chad</option><option value="Chile">Chile</option><option value="China">China</option><option value="Colombia">Colombia</option><option value="Comoros">Comoros</option><option value="Congo (Brazzaville)">Congo (Brazzaville)</option><option value="Congo">Congo</option><option value="Costa Rica">Costa Rica</option><option value="Cote d\'Ivoire">Cote d\'Ivoire</option><option value="Croatia">Croatia</option><option value="Cuba">Cuba</option><option value="Cyprus">Cyprus</option><option value="Czech Republic">Czech Republic</option><option value="Denmark">Denmark</option><option value="Djibouti">Djibouti</option><option value="Dominica">Dominica</option><option value="Dominican Republic">Dominican Republic</option><option value="East Timor (Timor Timur)">East Timor (Timor Timur)</option><option value="Ecuador">Ecuador</option><option value="Egypt">Egypt</option><option value="El Salvador">El Salvador</option><option value="Equatorial Guinea">Equatorial Guinea</option><option value="Eritrea">Eritrea</option><option value="Estonia">Estonia</option><option value="Ethiopia">Ethiopia</option><option value="Fiji">Fiji</option><option value="Finland">Finland</option><option value="France">France</option><option value="Gabon">Gabon</option><option value="Gambia, The">Gambia, The</option><option value="Georgia">Georgia</option><option value="Germany">Germany</option><option value="Ghana">Ghana</option><option value="Greece">Greece</option><option value="Grenada">Grenada</option><option value="Guatemala">Guatemala</option><option value="Guinea">Guinea</option><option value="Guinea-Bissau">Guinea-Bissau</option><option value="Guyana">Guyana</option><option value="Haiti">Haiti</option><option value="Honduras">Honduras</option><option value="Hungary">Hungary</option><option value="Iceland">Iceland</option><option value="India">India</option><option value="Indonesia">Indonesia</option><option value="Iran">Iran</option><option value="Iraq">Iraq</option><option value="Ireland">Ireland</option><option value="Israel">Israel</option><option value="Italy">Italy</option><option value="Jamaica">Jamaica</option><option value="Japan">Japan</option><option value="Jordan">Jordan</option><option value="Kazakhstan">Kazakhstan</option><option value="Kenya">Kenya</option><option value="Kiribati">Kiribati</option><option value="Korea, North">Korea, North</option><option value="Korea, South">Korea, South</option><option value="Kuwait">Kuwait</option><option value="Kyrgyzstan">Kyrgyzstan</option><option value="Laos">Laos</option><option value="Latvia">Latvia</option><option value="Lebanon">Lebanon</option><option value="Lesotho">Lesotho</option><option value="Liberia">Liberia</option><option value="Libya">Libya</option><option value="Liechtenstein">Liechtenstein</option><option value="Lithuania">Lithuania</option><option value="Luxembourg">Luxembourg</option><option value="Macedonia">Macedonia</option><option value="Madagascar">Madagascar</option><option value="Malawi">Malawi</option><option value="Malaysia">Malaysia</option><option value="Maldives">Maldives</option><option value="Mali">Mali</option><option value="Malta">Malta</option><option value="Marshall Islands">Marshall Islands</option><option value="Mauritania">Mauritania</option><option value="Mauritius">Mauritius</option><option value="Mexico">Mexico</option><option value="Micronesia">Micronesia</option><option value="Moldova">Moldova</option><option value="Monaco">Monaco</option><option value="Mongolia">Mongolia</option><option value="Morocco">Morocco</option><option value="Mozambique">Mozambique</option><option value="Myanmar">Myanmar</option><option value="Namibia">Namibia</option><option value="Nauru">Nauru</option><option value="Nepal">Nepal</option><option value="Netherlands">Netherlands</option><option value="New Zealand">New Zealand</option><option value="Nicaragua">Nicaragua</option><option value="Niger">Niger</option><option value="Nigeria">Nigeria</option><option value="Norway">Norway</option><option value="Oman">Oman</option><option value="Pakistan">Pakistan</option><option value="Palau">Palau</option><option value="Panama">Panama</option><option value="Papua New Guinea">Papua New Guinea</option><option value="Paraguay">Paraguay</option><option value="Peru">Peru</option><option value="Philippines">Philippines</option><option value="Poland">Poland</option><option value="Portugal">Portugal</option><option value="Qatar">Qatar</option><option value="Romania">Romania</option><option value="Russia">Russia</option><option value="Rwanda">Rwanda</option><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option><option value="Saint Lucia">Saint Lucia</option><option value="Saint Vincent">Saint Vincent</option><option value="Samoa">Samoa</option><option value="San Marino">San Marino</option><option value="Sao Tome and Principe">Sao Tome and Principe</option><option value="Saudi Arabia">Saudi Arabia</option><option value="Senegal">Senegal</option><option value="Serbia and Montenegro">Serbia and Montenegro</option><option value="Seychelles">Seychelles</option><option value="Sierra Leone">Sierra Leone</option><option value="Singapore">Singapore</option><option value="Slovakia">Slovakia</option><option value="Slovenia">Slovenia</option><option value="Solomon Islands">Solomon Islands</option><option value="Somalia">Somalia</option><option value="South Africa">South Africa</option><option value="Spain">Spain</option><option value="Sri Lanka">Sri Lanka</option><option value="Sudan">Sudan</option><option value="Suriname">Suriname</option><option value="Swaziland">Swaziland</option><option value="Sweden">Sweden</option><option value="Switzerland">Switzerland</option><option value="Syria">Syria</option><option value="Taiwan">Taiwan</option><option value="Tajikistan">Tajikistan</option><option value="Tanzania">Tanzania</option><option value="Thailand">Thailand</option><option value="Togo">Togo</option><option value="Tonga">Tonga</option><option value="Trinidad and Tobago">Trinidad and Tobago</option><option value="Tunisia">Tunisia</option><option value="Turkey">Turkey</option><option value="Turkmenistan">Turkmenistan</option><option value="Tuvalu">Tuvalu</option><option value="Uganda">Uganda</option><option value="Ukraine">Ukraine</option><option value="United Arab Emirates">United Arab Emirates</option><option value="United Kingdom">United Kingdom</option><option value="United States">United States</option><option value="Uruguay">Uruguay</option><option value="Uzbekistan">Uzbekistan</option><option value="Vanuatu">Vanuatu</option><option value="Vatican City">Vatican City</option><option value="Venezuela">Venezuela</option><option value="Vietnam">Vietnam</option><option value="Yemen">Yemen</option><option value="Zambia">Zambia</option><option value="Zimbabwe">Zimbabwe</option></select><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_country">' . $w_mini_labels[5] . '</span>';
803
+ }
804
+ $rep = '<div id="wdform_field' . $id . '" type="type_address" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px; vertical-align:top;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_address" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" name="' . $id . '_disable_fieldsform_id_temp" id="' . $id . '_disable_fieldsform_id_temp" street1="' . $w_disabled_fields[0] . '" street2="' . $w_disabled_fields[1] . '" city="' . $w_disabled_fields[2] . '" state="' . $w_disabled_fields[3] . '" postal="' . $w_disabled_fields[4] . '" country="' . $w_disabled_fields[5] . '" us_states="' . $w_disabled_fields[6] . '"><div id="' . $id . '_div_address" style="width: ' . $param['w_size'] . 'px;">' . $address_fields . $hidden_inputs . '</div></div></div>';
805
+ break;
806
+ }
807
+ case 'type_submitter_mail': {
808
+ $params_names = array(
809
+ 'w_field_label_size',
810
+ 'w_field_label_pos',
811
+ 'w_size',
812
+ 'w_first_val',
813
+ 'w_title',
814
+ 'w_required',
815
+ 'w_unique',
816
+ 'w_class',
817
+ );
818
+ $temp = $params;
819
+ if ( strpos($temp, 'w_autofill') > -1 ) {
820
+ $params_names = array(
821
+ 'w_field_label_size',
822
+ 'w_field_label_pos',
823
+ 'w_size',
824
+ 'w_first_val',
825
+ 'w_title',
826
+ 'w_required',
827
+ 'w_unique',
828
+ 'w_class',
829
+ 'w_autofill',
830
+ );
831
+ }
832
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
833
+ $params_names = array(
834
+ 'w_field_label_size',
835
+ 'w_field_label_pos',
836
+ 'w_hide_label',
837
+ 'w_size',
838
+ 'w_first_val',
839
+ 'w_title',
840
+ 'w_required',
841
+ 'w_unique',
842
+ 'w_class',
843
+ 'w_autofill',
844
+ );
845
+ }
846
+ if ( strpos($temp, 'w_verification') > -1 ) {
847
+ $params_names = array(
848
+ 'w_field_label_size',
849
+ 'w_field_label_pos',
850
+ 'w_hide_label',
851
+ 'w_size',
852
+ 'w_first_val',
853
+ 'w_title',
854
+ 'w_required',
855
+ 'w_unique',
856
+ 'w_class',
857
+ 'w_verification',
858
+ 'w_verification_label',
859
+ 'w_verification_placeholder',
860
+ 'w_autofill',
861
+ );
862
+ }
863
+ foreach ( $params_names as $params_name ) {
864
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
865
+ $param[$params_name] = $temp[0];
866
+ $temp = $temp[1];
867
+ }
868
+ if ( $temp ) {
869
+ $temp = explode('*:*w_attr_name*:*', $temp);
870
+ $attrs = array_slice($temp, 0, count($temp) - 1);
871
+ foreach ( $attrs as $attr ) {
872
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
873
+ }
874
+ }
875
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
876
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
877
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
878
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
879
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
880
+ $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
881
+ if ( isset($param['w_verification']) && $param['w_verification'] == "yes" ) {
882
+ $display_label_confirm = $display_label;
883
+ $display_element_confirm = $param['w_field_label_pos'];
884
+ }
885
+ else {
886
+ $display_label_confirm = "none";
887
+ $display_element_confirm = "none";
888
+ }
889
+ $param['w_verification'] = isset($param['w_verification']) ? $param['w_verification'] : "no";
890
+ $param['w_verification_label'] = isset($param['w_verification_label']) ? $param['w_verification_label'] : "E-mail confirmation:";
891
+ $param['w_verification_placeholder'] = isset($param['w_verification_placeholder']) ? $param['w_verification_placeholder'] : "";
892
+ $confirm_emeil = '<br><div align="left" id="' . $id . '_1_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label_confirm . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_1_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $param['w_verification_label'] . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_1_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_element_confirm . ';"><input type="hidden" value="' . $param['w_verification'] . '" name="' . $id . '_verification_id_temp" id="' . $id . '_verification_id_temp"><input type="text" class="input_deactive" id="' . $id . '_1_elementform_id_temp" name="' . $id . '_1_elementform_id_temp" value="' . $param['w_verification_placeholder'] . '" title="' . $param['w_verification_placeholder'] . '" onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>';
893
+ $rep = '<div id="wdform_field' . $id . '" type="type_submitter_mail" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_submitter_mail" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_unique'] . '" name="' . $id . '_uniqueform_id_temp" id="' . $id . '_uniqueform_id_temp"><input type="hidden" value="' . $param['w_autofill'] . '" name="' . $id . '_autofillform_id_temp" id="' . $id . '_autofillform_id_temp"><input type="hidden" value="' . $param['w_verification'] . '" name="' . $id . '_verification_id_temp" id="' . $id . '_verification_id_temp"><input type="text" class="' . $input_active . '" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>' . $confirm_emeil . '</div>';
894
+ break;
895
+ }
896
+ case 'type_checkbox': {
897
+ $params_names = array(
898
+ 'w_field_label_size',
899
+ 'w_field_label_pos',
900
+ 'w_flow',
901
+ 'w_choices',
902
+ 'w_choices_checked',
903
+ 'w_rowcol',
904
+ 'w_required',
905
+ 'w_randomize',
906
+ 'w_allow_other',
907
+ 'w_allow_other_num',
908
+ 'w_class',
909
+ );
910
+ $temp = $params;
911
+ if ( strpos($temp, 'w_field_option_pos') > -1 ) {
912
+ $params_names = array(
913
+ 'w_field_label_size',
914
+ 'w_field_label_pos',
915
+ 'w_field_option_pos',
916
+ 'w_flow',
917
+ 'w_choices',
918
+ 'w_choices_checked',
919
+ 'w_rowcol',
920
+ 'w_required',
921
+ 'w_randomize',
922
+ 'w_allow_other',
923
+ 'w_allow_other_num',
924
+ 'w_value_disabled',
925
+ 'w_choices_value',
926
+ 'w_choices_params',
927
+ 'w_class',
928
+ );
929
+ }
930
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
931
+ $params_names = array(
932
+ 'w_field_label_size',
933
+ 'w_field_label_pos',
934
+ 'w_field_option_pos',
935
+ 'w_hide_label',
936
+ 'w_flow',
937
+ 'w_choices',
938
+ 'w_choices_checked',
939
+ 'w_rowcol',
940
+ 'w_required',
941
+ 'w_randomize',
942
+ 'w_allow_other',
943
+ 'w_allow_other_num',
944
+ 'w_value_disabled',
945
+ 'w_choices_value',
946
+ 'w_choices_params',
947
+ 'w_class',
948
+ );
949
+ }
950
+ foreach ( $params_names as $params_name ) {
951
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
952
+ $param[$params_name] = $temp[0];
953
+ $temp = $temp[1];
954
+ }
955
+ if ( $temp ) {
956
+ $temp = explode('*:*w_attr_name*:*', $temp);
957
+ $attrs = array_slice($temp, 0, count($temp) - 1);
958
+ foreach ( $attrs as $attr ) {
959
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
960
+ }
961
+ }
962
+ if ( !isset($param['w_value_disabled']) ) {
963
+ $param['w_value_disabled'] = 'no';
964
+ }
965
+ if ( !isset($param['w_field_option_pos']) ) {
966
+ $param['w_field_option_pos'] = 'left';
967
+ }
968
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
969
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
970
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
971
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
972
+ $param['w_choices'] = explode('***', $param['w_choices']);
973
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
974
+ if ( isset($param['w_choices_value']) ) {
975
+ $param['w_choices_value'] = explode('***', $param['w_choices_value']);
976
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
977
+ }
978
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
979
+ if ( $choices_checked == 'true' ) {
980
+ $param['w_choices_checked'][$key] = 'checked="checked"';
981
+ }
982
+ else {
983
+ $param['w_choices_checked'][$key] = '';
984
+ }
985
+ }
986
+ $rep = '<div id="wdform_field' . $id . '" type="type_checkbox" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_checkbox" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_randomize'] . '" name="' . $id . '_randomizeform_id_temp" id="' . $id . '_randomizeform_id_temp"><input type="hidden" value="' . $param['w_allow_other'] . '" name="' . $id . '_allow_otherform_id_temp" id="' . $id . '_allow_otherform_id_temp"><input type="hidden" value="' . $param['w_allow_other_num'] . '" name="' . $id . '_allow_other_numform_id_temp" id="' . $id . '_allow_other_numform_id_temp"><input type="hidden" value="' . $param['w_rowcol'] . '" name="' . $id . '_rowcol_numform_id_temp" id="' . $id . '_rowcol_numform_id_temp"><input type="hidden" value="' . $param['w_field_option_pos'] . '" id="' . $id . '_option_left_right"><input type="hidden" value="' . $param['w_value_disabled'] . '" name="' . $id . '_value_disabledform_id_temp" id="' . $id . '_value_disabledform_id_temp"><div style="display: table;"><div id="' . $id . '_table_little" style="display: table-row-group;" ' . ($param['w_flow'] == 'hor' ? 'for_hor="' . $id . '_hor"' : '') . '>';
987
+ if ( $param['w_flow'] == 'hor' ) {
988
+ $j = 0;
989
+ for ( $i = 0; $i < (int) $param['w_rowcol']; $i++ ) {
990
+ $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
991
+ for ( $l = 0; $l <= (int) (count($param['w_choices']) / $param['w_rowcol']); $l++ ) {
992
+ if ( $j >= count($param['w_choices']) % $param['w_rowcol'] && $l == (int) (count($param['w_choices']) / $param['w_rowcol']) ) {
993
+ continue;
994
+ }
995
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
996
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $l + $i) . '" idi="' . ((int) $param['w_rowcol'] * $l + $i) . '" style="display: table-cell;"><input type="checkbox" value="" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" name="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" other="1" onclick="if(set_checked(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $l + $i) . '&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $l + $i] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled /><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $l + $i) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '">' . $param['w_choices'][(int) $param['w_rowcol'] * $l + $i] . '</label></div>';
997
+ }
998
+ else {
999
+ $where = '';
1000
+ $order_by = '';
1001
+ $db_info = '';
1002
+ if ( isset($param['w_choices_value']) ) {
1003
+ $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $l + $i];
1004
+ }
1005
+ else {
1006
+ $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $l + $i];
1007
+ }
1008
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i] ) {
1009
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i]);
1010
+ $where = 'where="' . $w_choices_params[0] . '"';
1011
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1012
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1013
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1014
+ }
1015
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $l + $i) . '" idi="' . ((int) $param['w_rowcol'] * $l + $i) . '" style="display: table-cell;"><input type="checkbox" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" name="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" onclick="set_checked(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $l + $i) . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $l + $i] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $l + $i) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $l + $i] . '</label></div>';
1016
+ }
1017
+ }
1018
+ $j++;
1019
+ $rep .= '</div>';
1020
+ }
1021
+ }
1022
+ else {
1023
+ for ( $i = 0; $i < (int) (count($param['w_choices']) / $param['w_rowcol']); $i++ ) {
1024
+ $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1025
+ if ( count($param['w_choices']) > (int) $param['w_rowcol'] ) {
1026
+ for ( $l = 0; $l < $param['w_rowcol']; $l++ ) {
1027
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1028
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="checkbox" value="" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" other="1" onclick="if(set_checked(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled /><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '">' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1029
+ }
1030
+ else {
1031
+ $where = '';
1032
+ $order_by = '';
1033
+ $db_info = '';
1034
+ if ( isset($param['w_choices_value']) ) {
1035
+ $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1036
+ }
1037
+ else {
1038
+ $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1039
+ }
1040
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1041
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1042
+ $where = 'where="' . $w_choices_params[0] . '"';
1043
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1044
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1045
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1046
+ }
1047
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="checkbox" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" onclick="set_checked(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '"
1048
+ ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1049
+ }
1050
+ }
1051
+ }
1052
+ else {
1053
+ for ( $l = 0; $l < count($param['w_choices']); $l++ ) {
1054
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1055
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="checkbox" value="" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" other="1" onclick="if(set_checked(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '">' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1056
+ }
1057
+ else {
1058
+ $where = '';
1059
+ $order_by = '';
1060
+ $db_info = '';
1061
+ if ( isset($param['w_choices_value']) ) {
1062
+ $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1063
+ }
1064
+ else {
1065
+ $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1066
+ }
1067
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1068
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1069
+ $where = 'where="' . $w_choices_params[0] . '"';
1070
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1071
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1072
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1073
+ }
1074
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="checkbox" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" onclick="set_checked(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1075
+ }
1076
+ }
1077
+ }
1078
+ $rep .= '</div>';
1079
+ }
1080
+ if ( count($param['w_choices']) % $param['w_rowcol'] != 0 ) {
1081
+ $rep .= '<div id="' . $id . '_element_tr' . ((int) (count($param['w_choices']) / (int) $param['w_rowcol'])) . '" style="display: table-row;">';
1082
+ for ( $k = 0; $k < count($param['w_choices']) % $param['w_rowcol']; $k++ ) {
1083
+ $l = count($param['w_choices']) - count($param['w_choices']) % $param['w_rowcol'] + $k;
1084
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $l ) {
1085
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $l . '" idi="' . $l . '" style="display: table-cell;"><input type="checkbox" value="" id="' . $id . '_elementform_id_temp' . $l . '" name="' . $id . '_elementform_id_temp' . $l . '" other="1" onclick="if(set_checked(&quot;' . $id . '&quot;,&quot;' . $l . '&quot;,&quot;form_id_temp&quot;)) show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][$l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $l . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $l . '">' . $param['w_choices'][$l] . '</label></div>';
1086
+ }
1087
+ else {
1088
+ $where = '';
1089
+ $order_by = '';
1090
+ $db_info = '';
1091
+ if ( isset($param['w_choices_value']) ) {
1092
+ $choise_value = $param['w_choices_value'][$l];
1093
+ }
1094
+ else {
1095
+ $choise_value = $param['w_choices'][$l];
1096
+ }
1097
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$l] ) {
1098
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$l]);
1099
+ $where = 'where="' . $w_choices_params[0] . '"';
1100
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1101
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1102
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1103
+ }
1104
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $l . '" idi="' . $l . '" style="display: table-cell;"><input type="checkbox" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . $l . '" name="' . $id . '_elementform_id_temp' . $l . '" onclick="set_checked(&quot;' . $id . '&quot;,&quot;' . $l . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $l . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $l . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][$l] . '</label></div>';
1105
+ }
1106
+ }
1107
+ $rep .= '</div>';
1108
+ }
1109
+ }
1110
+ $rep .= '</div></div></div></div>';
1111
+ break;
1112
+ }
1113
+ case 'type_radio': {
1114
+ $params_names = array(
1115
+ 'w_field_label_size',
1116
+ 'w_field_label_pos',
1117
+ 'w_flow',
1118
+ 'w_choices',
1119
+ 'w_choices_checked',
1120
+ 'w_rowcol',
1121
+ 'w_required',
1122
+ 'w_randomize',
1123
+ 'w_allow_other',
1124
+ 'w_allow_other_num',
1125
+ 'w_class',
1126
+ );
1127
+ $temp = $params;
1128
+ if ( strpos($temp, 'w_field_option_pos') > -1 ) {
1129
+ $params_names = array(
1130
+ 'w_field_label_size',
1131
+ 'w_field_label_pos',
1132
+ 'w_field_option_pos',
1133
+ 'w_flow',
1134
+ 'w_choices',
1135
+ 'w_choices_checked',
1136
+ 'w_rowcol',
1137
+ 'w_required',
1138
+ 'w_randomize',
1139
+ 'w_allow_other',
1140
+ 'w_allow_other_num',
1141
+ 'w_value_disabled',
1142
+ 'w_choices_value',
1143
+ 'w_choices_params',
1144
+ 'w_class',
1145
+ );
1146
+ }
1147
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1148
+ $params_names = array(
1149
+ 'w_field_label_size',
1150
+ 'w_field_label_pos',
1151
+ 'w_field_option_pos',
1152
+ 'w_hide_label',
1153
+ 'w_flow',
1154
+ 'w_choices',
1155
+ 'w_choices_checked',
1156
+ 'w_rowcol',
1157
+ 'w_required',
1158
+ 'w_randomize',
1159
+ 'w_allow_other',
1160
+ 'w_allow_other_num',
1161
+ 'w_value_disabled',
1162
+ 'w_choices_value',
1163
+ 'w_choices_params',
1164
+ 'w_class',
1165
+ );
1166
+ }
1167
+ foreach ( $params_names as $params_name ) {
1168
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1169
+ $param[$params_name] = $temp[0];
1170
+ $temp = $temp[1];
1171
+ }
1172
+ if ( $temp ) {
1173
+ $temp = explode('*:*w_attr_name*:*', $temp);
1174
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1175
+ foreach ( $attrs as $attr ) {
1176
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1177
+ }
1178
+ }
1179
+ if ( !isset($param['w_value_disabled']) ) {
1180
+ $param['w_value_disabled'] = 'no';
1181
+ }
1182
+ if ( !isset($param['w_field_option_pos']) ) {
1183
+ $param['w_field_option_pos'] = 'left';
1184
+ }
1185
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1186
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1187
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1188
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1189
+ $param['w_choices'] = explode('***', $param['w_choices']);
1190
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1191
+ if ( isset($param['w_choices_value']) ) {
1192
+ $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1193
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1194
+ }
1195
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
1196
+ if ( $choices_checked == 'true' ) {
1197
+ $param['w_choices_checked'][$key] = 'checked="checked"';
1198
+ }
1199
+ else {
1200
+ $param['w_choices_checked'][$key] = '';
1201
+ }
1202
+ }
1203
+ $rep = '<div id="wdform_field' . $id . '" type="type_radio" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_radio" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_randomize'] . '" name="' . $id . '_randomizeform_id_temp" id="' . $id . '_randomizeform_id_temp"><input type="hidden" value="' . $param['w_allow_other'] . '" name="' . $id . '_allow_otherform_id_temp" id="' . $id . '_allow_otherform_id_temp"><input type="hidden" value="' . $param['w_allow_other_num'] . '" name="' . $id . '_allow_other_numform_id_temp" id="' . $id . '_allow_other_numform_id_temp"><input type="hidden" value="' . $param['w_rowcol'] . '" name="' . $id . '_rowcol_numform_id_temp" id="' . $id . '_rowcol_numform_id_temp"><input type="hidden" value="' . $param['w_field_option_pos'] . '" id="' . $id . '_option_left_right"><input type="hidden" value="' . $param['w_value_disabled'] . '" name="' . $id . '_value_disabledform_id_temp" id="' . $id . '_value_disabledform_id_temp"><div style="display: table;"><div id="' . $id . '_table_little" style="display: table-row-group;" ' . ($param['w_flow'] == 'hor' ? 'for_hor="' . $id . '_hor"' : '') . '>';
1204
+ if ( $param['w_flow'] == 'hor' ) {
1205
+ $j = 0;
1206
+ for ( $i = 0; $i < (int) $param['w_rowcol']; $i++ ) {
1207
+ $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1208
+ for ( $l = 0; $l <= (int) (count($param['w_choices']) / $param['w_rowcol']); $l++ ) {
1209
+ if ( $j >= count($param['w_choices']) % $param['w_rowcol'] && $l == (int) (count($param['w_choices']) / $param['w_rowcol']) ) {
1210
+ continue;
1211
+ }
1212
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $l + $i ) {
1213
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $l + $i) . '" idi="' . ((int) $param['w_rowcol'] * $l + $i) . '" style="display: table-cell;"><input type="radio" value="' . $param['w_choices'][(int) $param['w_rowcol'] * $l + $i] . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" name="' . $id . '_elementform_id_temp" other="1" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $l + $i) . '&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $l + $i] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $l + $i) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '">' . $param['w_choices'][(int) $param['w_rowcol'] * $l + $i] . '</label></div>';
1214
+ }
1215
+ else {
1216
+ $where = '';
1217
+ $order_by = '';
1218
+ $db_info = '';
1219
+ if ( isset($param['w_choices_value']) ) {
1220
+ $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $l + $i];
1221
+ }
1222
+ else {
1223
+ $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $l + $i];
1224
+ }
1225
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i] ) {
1226
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i]);
1227
+ $where = 'where="' . $w_choices_params[0] . '"';
1228
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1229
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1230
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1231
+ }
1232
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $l + $i) . '" idi="' . ((int) $param['w_rowcol'] * $l + $i) . '" style="display: table-cell;"><input type="radio" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" name="' . $id . '_elementform_id_temp" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $l + $i) . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $l + $i] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $l + $i) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $l + $i) . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $l + $i] . '</label></div>';
1233
+ }
1234
+ }
1235
+ $j++;
1236
+ $rep .= '</div>';
1237
+ }
1238
+ }
1239
+ else {
1240
+ for ( $i = 0; $i < (int) (count($param['w_choices']) / $param['w_rowcol']); $i++ ) {
1241
+ $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1242
+ if ( count($param['w_choices']) > (int) $param['w_rowcol'] ) {
1243
+ for ( $l = 0; $l < $param['w_rowcol']; $l++ ) {
1244
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1245
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="radio" value="' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp" other="1" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '">' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1246
+ }
1247
+ else {
1248
+ $where = '';
1249
+ $order_by = '';
1250
+ $db_info = '';
1251
+ if ( isset($param['w_choices_value']) ) {
1252
+ $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1253
+ }
1254
+ else {
1255
+ $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1256
+ }
1257
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1258
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1259
+ $where = 'where="' . $w_choices_params[0] . '"';
1260
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1261
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1262
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1263
+ }
1264
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="radio" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1265
+ }
1266
+ }
1267
+ }
1268
+ else {
1269
+ for ( $l = 0; $l < count($param['w_choices']); $l++ ) {
1270
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1271
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="radio" value="' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp" other="1" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '">' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1272
+ }
1273
+ else {
1274
+ $where = '';
1275
+ $order_by = '';
1276
+ $db_info = '';
1277
+ if ( isset($param['w_choices_value']) ) {
1278
+ $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1279
+ }
1280
+ else {
1281
+ $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1282
+ }
1283
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1284
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1285
+ $where = 'where="' . $w_choices_params[0] . '"';
1286
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1287
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1288
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1289
+ }
1290
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . ((int) $param['w_rowcol'] * $i + $l) . '" idi="' . ((int) $param['w_rowcol'] * $i + $l) . '" style="display: table-cell;"><input type="radio" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" name="' . $id . '_elementform_id_temp" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . ((int) $param['w_rowcol'] * $i + $l) . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][(int) $param['w_rowcol'] * $i + $l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . ((int) $param['w_rowcol'] * $i + $l) . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . ((int) $param['w_rowcol'] * $i + $l) . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1291
+ }
1292
+ }
1293
+ }
1294
+ $rep .= '</div>';
1295
+ }
1296
+ if ( count($param['w_choices']) % $param['w_rowcol'] != 0 ) {
1297
+ $rep .= '<div id="' . $id . '_element_tr' . ((int) (count($param['w_choices']) / (int) $param['w_rowcol'])) . '" style="display: table-row;">';
1298
+ for ( $k = 0; $k < count($param['w_choices']) % $param['w_rowcol']; $k++ ) {
1299
+ $l = count($param['w_choices']) - count($param['w_choices']) % $param['w_rowcol'] + $k;
1300
+ if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $l ) {
1301
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $l . '" idi="' . $l . '" style="display: table-cell;"><input type="radio" value="' . $param['w_choices'][$l] . '" id="' . $id . '_elementform_id_temp' . $l . '" name="' . $id . '_elementform_id_temp" other="1" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . $l . '&quot;,&quot;form_id_temp&quot;); show_other_input(&quot;' . $id . '&quot;,&quot;form_id_temp&quot;);" ' . $param['w_choices_checked'][$l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $l . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $l . '">' . $param['w_choices'][$l] . '</label></div>';
1302
+ }
1303
+ else {
1304
+ $where = '';
1305
+ $order_by = '';
1306
+ $db_info = '';
1307
+ if ( isset($param['w_choices_value']) ) {
1308
+ $choise_value = $param['w_choices_value'][$l];
1309
+ }
1310
+ else {
1311
+ $choise_value = $param['w_choices'][$l];
1312
+ }
1313
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$l] ) {
1314
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$l]);
1315
+ $where = 'where="' . $w_choices_params[0] . '"';
1316
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1317
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1318
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1319
+ }
1320
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $l . '" idi="' . $l . '" style="display: table-cell;"><input type="radio" value="' . $choise_value . '" id="' . $id . '_elementform_id_temp' . $l . '" name="' . $id . '_elementform_id_temp" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . $l . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$l] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $l . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $l . '"
1321
+ ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][$l] . '</label></div>';
1322
+ }
1323
+ }
1324
+ $rep .= '</div>';
1325
+ }
1326
+ }
1327
+ $rep .= '</div></div></div></div>';
1328
+ break;
1329
+ }
1330
+ case 'type_own_select': {
1331
+ $params_names = array(
1332
+ 'w_field_label_size',
1333
+ 'w_field_label_pos',
1334
+ 'w_size',
1335
+ 'w_choices',
1336
+ 'w_choices_checked',
1337
+ 'w_choices_disabled',
1338
+ 'w_required',
1339
+ 'w_class',
1340
+ );
1341
+ $temp = $params;
1342
+ if ( strpos($temp, 'w_choices_value') > -1 ) {
1343
+ $params_names = array(
1344
+ 'w_field_label_size',
1345
+ 'w_field_label_pos',
1346
+ 'w_size',
1347
+ 'w_choices',
1348
+ 'w_choices_checked',
1349
+ 'w_choices_disabled',
1350
+ 'w_required',
1351
+ 'w_value_disabled',
1352
+ 'w_choices_value',
1353
+ 'w_choices_params',
1354
+ 'w_class',
1355
+ );
1356
+ }
1357
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1358
+ $params_names = array(
1359
+ 'w_field_label_size',
1360
+ 'w_field_label_pos',
1361
+ 'w_hide_label',
1362
+ 'w_size',
1363
+ 'w_choices',
1364
+ 'w_choices_checked',
1365
+ 'w_choices_disabled',
1366
+ 'w_required',
1367
+ 'w_value_disabled',
1368
+ 'w_choices_value',
1369
+ 'w_choices_params',
1370
+ 'w_class',
1371
+ );
1372
+ }
1373
+ foreach ( $params_names as $params_name ) {
1374
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1375
+ $param[$params_name] = $temp[0];
1376
+ $temp = $temp[1];
1377
+ }
1378
+ if ( $temp ) {
1379
+ $temp = explode('*:*w_attr_name*:*', $temp);
1380
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1381
+ foreach ( $attrs as $attr ) {
1382
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1383
+ }
1384
+ }
1385
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1386
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1387
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1388
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1389
+ $param['w_choices'] = explode('***', $param['w_choices']);
1390
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1391
+ $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
1392
+ if ( isset($param['w_choices_value']) ) {
1393
+ $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1394
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1395
+ }
1396
+ if ( !isset($param['w_value_disabled']) ) {
1397
+ $param['w_value_disabled'] = 'no';
1398
+ }
1399
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
1400
+ if ( $choices_checked == 'true' ) {
1401
+ $param['w_choices_checked'][$key] = 'selected="selected"';
1402
+ }
1403
+ else {
1404
+ $param['w_choices_checked'][$key] = '';
1405
+ }
1406
+ }
1407
+ $rep = '<div id="wdform_field' . $id . '" type="type_own_select" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; "><input type="hidden" value="type_own_select" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_value_disabled'] . '" name="' . $id . '_value_disabledform_id_temp" id="' . $id . '_value_disabledform_id_temp"><select id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" onchange="set_select(this)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled>';
1408
+ foreach ( $param['w_choices'] as $key => $choice ) {
1409
+ $where = '';
1410
+ $order_by = '';
1411
+ $db_info = '';
1412
+ $choice_value = $param['w_choices_disabled'][$key] == 'true' ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
1413
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
1414
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1415
+ $where = 'where="' . $w_choices_params[0] . '"';
1416
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1417
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
1418
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
1419
+ }
1420
+ $rep .= '<option id="' . $id . '_option' . $key . '" value="' . $choice_value . '" onselect="set_select(&quot;' . $id . '_option' . $key . '&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</option>';
1421
+ }
1422
+ $rep .= '</select></div></div>';
1423
+ break;
1424
+ }
1425
+ case 'type_country': {
1426
+ $params_names = array(
1427
+ 'w_field_label_size',
1428
+ 'w_field_label_pos',
1429
+ 'w_size',
1430
+ 'w_countries',
1431
+ 'w_required',
1432
+ 'w_class',
1433
+ );
1434
+ $temp = $params;
1435
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1436
+ $params_names = array(
1437
+ 'w_field_label_size',
1438
+ 'w_field_label_pos',
1439
+ 'w_hide_label',
1440
+ 'w_size',
1441
+ 'w_countries',
1442
+ 'w_required',
1443
+ 'w_class',
1444
+ );
1445
+ }
1446
+ foreach ( $params_names as $params_name ) {
1447
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1448
+ $param[$params_name] = $temp[0];
1449
+ $temp = $temp[1];
1450
+ }
1451
+ if ( $temp ) {
1452
+ $temp = explode('*:*w_attr_name*:*', $temp);
1453
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1454
+ foreach ( $attrs as $attr ) {
1455
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1456
+ }
1457
+ }
1458
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1459
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1460
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1461
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1462
+ $param['w_countries'] = explode('***', $param['w_countries']);
1463
+ $rep = '<div id="wdform_field' . $id . '" type="type_country" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; "><input type="hidden" value="type_country" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><select id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled>';
1464
+ foreach ( $param['w_countries'] as $key => $choice ) {
1465
+ $choice_value = $choice;
1466
+ $rep .= '<option value="' . $choice_value . '">' . $choice . '</option>';
1467
+ }
1468
+ $rep .= '</select></div></div>';
1469
+ break;
1470
+ }
1471
+ case 'type_time': {
1472
+ $params_names = array(
1473
+ 'w_field_label_size',
1474
+ 'w_field_label_pos',
1475
+ 'w_time_type',
1476
+ 'w_am_pm',
1477
+ 'w_sec',
1478
+ 'w_hh',
1479
+ 'w_mm',
1480
+ 'w_ss',
1481
+ 'w_mini_labels',
1482
+ 'w_required',
1483
+ 'w_class',
1484
+ );
1485
+ $temp = $params;
1486
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1487
+ $params_names = array(
1488
+ 'w_field_label_size',
1489
+ 'w_field_label_pos',
1490
+ 'w_hide_label',
1491
+ 'w_time_type',
1492
+ 'w_am_pm',
1493
+ 'w_sec',
1494
+ 'w_hh',
1495
+ 'w_mm',
1496
+ 'w_ss',
1497
+ 'w_mini_labels',
1498
+ 'w_required',
1499
+ 'w_class',
1500
+ );
1501
+ }
1502
+ foreach ( $params_names as $params_name ) {
1503
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1504
+ $param[$params_name] = $temp[0];
1505
+ $temp = $temp[1];
1506
+ }
1507
+ if ( $temp ) {
1508
+ $temp = explode('*:*w_attr_name*:*', $temp);
1509
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1510
+ foreach ( $attrs as $attr ) {
1511
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1512
+ }
1513
+ }
1514
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1515
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1516
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1517
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1518
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
1519
+ if ( $param['w_sec'] == '1' ) {
1520
+ $w_sec = '<div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div id="' . $id . '_td_time_input3" style="width: 32px; display: table-cell;"><input type="text" value="' . $param['w_ss'] . '" class="time_box" id="' . $id . '_ssform_id_temp" name="' . $id . '_ssform_id_temp" onkeypress="return check_second(event, &quot;' . $id . '_ssform_id_temp&quot;)" onkeyup="change_second(&quot;' . $id . '_ssform_id_temp&quot;)" onblur="add_0(&quot;' . $id . '_ssform_id_temp&quot;)" ' . $param['attributes'] . ' disabled /></div>';
1521
+ $w_sec_label = '<div style="display: table-cell;"></div><div id="' . $id . '_td_time_label3" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_ss">' . $w_mini_labels[2] . '</label></div>';
1522
+ }
1523
+ else {
1524
+ $w_sec = '';
1525
+ $w_sec_label = '';
1526
+ }
1527
+ if ( $param['w_time_type'] == '12' ) {
1528
+ if ( $param['w_am_pm'] == 'am' ) {
1529
+ $am_ = "selected=\"selected\"";
1530
+ $pm_ = "";
1531
+ }
1532
+ else {
1533
+ $am_ = "";
1534
+ $pm_ = "selected=\"selected\"";
1535
+ }
1536
+ $w_time_type = '<div id="' . $id . '_am_pm_select" class="td_am_pm_select" style="display: table-cell;"><select class="am_pm_select" name="' . $id . '_am_pmform_id_temp" id="' . $id . '_am_pmform_id_temp" onchange="set_sel_am_pm(this)" ' . $param['attributes'] . '><option value="am" ' . $am_ . '>AM</option><option value="pm" ' . $pm_ . '>PM</option></select></div>';
1537
+ $w_time_type_label = '<div id="' . $id . '_am_pm_label" class="td_am_pm_select" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_am_pm">' . $w_mini_labels[3] . '</label></div>';
1538
+ }
1539
+ else {
1540
+ $w_time_type = '';
1541
+ $w_time_type_label = '';
1542
+ }
1543
+ $rep = '<div id="wdform_field' . $id . '" type="type_time" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_time" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><div id="' . $id . '_table_time" style="display: table;"><div id="' . $id . '_tr_time1" style="display: table-row;"><div id="' . $id . '_td_time_input1" style="width: 32px; display: table-cell;"><input type="text" value="' . $param['w_hh'] . '" class="time_box" id="' . $id . '_hhform_id_temp" name="' . $id . '_hhform_id_temp" onkeypress="return check_hour(event, &quot;' . $id . '_hhform_id_temp&quot;, &quot;23&quot;)" onkeyup="change_hour(event, &quot;' . $id . '_hhform_id_temp&quot;,&quot;23&quot;)" onblur="add_0(&quot;' . $id . '_hhform_id_temp&quot;)" ' . $param['attributes'] . ' disabled/></div><div align="center" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;:&nbsp;</span></div><div id="' . $id . '_td_time_input2" style="width: 32px; display: table-cell;"><input type="text" value="' . $param['w_mm'] . '" class="time_box" id="' . $id . '_mmform_id_temp" name="' . $id . '_mmform_id_temp" onkeypress="return check_minute(event, &quot;' . $id . '_mmform_id_temp&quot;)" onkeyup="change_minute(event, &quot;' . $id . '_mmform_id_temp&quot;)" onblur="add_0(&quot;' . $id . '_mmform_id_temp&quot;)" ' . $param['attributes'] . ' disabled/></div>' . $w_sec . $w_time_type . '</div><div id="' . $id . '_tr_time2" style="display: table-row;"><div id="' . $id . '_td_time_label1" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_hh">' . $w_mini_labels[0] . '</label></div><div style="display: table-cell;"></div><div id="' . $id . '_td_time_label2" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_mm">' . $w_mini_labels[1] . '</label></div>' . $w_sec_label . $w_time_type_label . '</div></div></div></div>';
1544
+ break;
1545
+ }
1546
+ case 'type_date': {
1547
+ $params_names = array(
1548
+ 'w_field_label_size',
1549
+ 'w_field_label_pos',
1550
+ 'w_date',
1551
+ 'w_required',
1552
+ 'w_class',
1553
+ 'w_format',
1554
+ 'w_but_val',
1555
+ );
1556
+ $temp = $params;
1557
+ if ( strpos($temp, 'w_disable_past_days') > -1 ) {
1558
+ $params_names = array(
1559
+ 'w_field_label_size',
1560
+ 'w_field_label_pos',
1561
+ 'w_date',
1562
+ 'w_required',
1563
+ 'w_class',
1564
+ 'w_format',
1565
+ 'w_but_val',
1566
+ 'w_disable_past_days',
1567
+ );
1568
+ }
1569
+ foreach ( $params_names as $params_name ) {
1570
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1571
+ $param[$params_name] = $temp[0];
1572
+ $temp = $temp[1];
1573
+ }
1574
+ if ( $temp ) {
1575
+ $temp = explode('*:*w_attr_name*:*', $temp);
1576
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1577
+ foreach ( $attrs as $attr ) {
1578
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1579
+ }
1580
+ }
1581
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1582
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1583
+ $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1584
+ $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1585
+ $rep = '<div id="wdform_field' . $id . '" type="type_date" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_date" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_disable_past_days'] . '" name="' . $id . '_dis_past_daysform_id_temp" id="' . $id . '_dis_past_daysform_id_temp"><input type="text" value="' . $param['w_date'] . '" class="wdform-date wd-datepicker" data-format="' . $param['w_format'] . '" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" maxlength="10" size="10" onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" ' . $param['attributes'] . ' disabled/></div></div>';
1586
+ break;
1587
+ }
1588
+ ///////////////////////// type_date_new ////////////////////////////
1589
+ case 'type_date_new': {
1590
+ $params_names = array(
1591
+ 'w_field_label_size',
1592
+ 'w_field_label_pos',
1593
+ 'w_size',
1594
+ 'w_date',
1595
+ 'w_required',
1596
+ 'w_show_image',
1597
+ 'w_class',
1598
+ 'w_format',
1599
+ 'w_start_day',
1600
+ 'w_default_date',
1601
+ 'w_min_date',
1602
+ 'w_max_date',
1603
+ 'w_invalid_dates',
1604
+ 'w_show_days',
1605
+ 'w_hide_time',
1606
+ 'w_but_val',
1607
+ 'w_disable_past_days',
1608
+ );
1609
+ $temp = $params;
1610
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1611
+ $params_names = array(
1612
+ 'w_field_label_size',
1613
+ 'w_field_label_pos',
1614
+ 'w_hide_label',
1615
+ 'w_size',
1616
+ 'w_date',
1617
+ 'w_required',
1618
+ 'w_show_image',
1619
+ 'w_class',
1620
+ 'w_format',
1621
+ 'w_start_day',
1622
+ 'w_default_date',
1623
+ 'w_min_date',
1624
+ 'w_max_date',
1625
+ 'w_invalid_dates',
1626
+ 'w_show_days',
1627
+ 'w_hide_time',
1628
+ 'w_but_val',
1629
+ 'w_disable_past_days',
1630
+ );
1631
+ }
1632
+ foreach ( $params_names as $params_name ) {
1633
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1634
+ $param[$params_name] = $temp[0];
1635
+ $temp = $temp[1];
1636
+ }
1637
+ if ( $temp ) {
1638
+ $temp = explode('*:*w_attr_name*:*', $temp);
1639
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1640
+ foreach ( $attrs as $attr ) {
1641
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1642
+ }
1643
+ }
1644
+ $w_show_week_days = explode('***', $param['w_show_days']);
1645
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1646
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1647
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1648
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1649
+ $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1650
+ $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1651
+ $display_image_date = $param['w_show_image'] == 'yes' ? 'inline' : 'none';
1652
+ $rep = '<div id="wdform_field' . $id . '" type="type_date_new" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_date_new" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp">
1653
+ <input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp">
1654
+
1655
+ <input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/>
1656
+
1657
+ <input type="hidden" value="' . $param['w_show_image'] . '" name="' . $id . '_show_imageform_id_temp" id="' . $id . '_show_imageform_id_temp">
1658
+
1659
+ <input type="hidden" value="' . $param['w_disable_past_days'] . '" name="' . $id . '_dis_past_daysform_id_temp" id="' . $id . '_dis_past_daysform_id_temp">
1660
+
1661
+ <input type="hidden" value="' . $param['w_default_date'] . '" name="' . $id . '_default_date_id_temp" id="' . $id . '_default_date_id_temp">
1662
+ <input type="hidden" value="' . $param['w_min_date'] . '" name="' . $id . '_min_date_id_temp" id="' . $id . '_min_date_id_temp">
1663
+ <input type="hidden" value="' . $param['w_max_date'] . '" name="' . $id . '_max_date_id_temp" id="' . $id . '_max_date_id_temp">
1664
+ <input type="hidden" value="' . $param['w_invalid_dates'] . '" name="' . $id . '_invalid_dates_id_temp" id="' . $id . '_invalid_dates_id_temp">
1665
+
1666
+ <input type="hidden" value="' . $param['w_start_day'] . '" name="' . $id . '_start_dayform_id_temp" id="' . $id . '_start_dayform_id_temp">
1667
+
1668
+ <input type="hidden" value="' . $param['w_hide_time'] . '" name="' . $id . '_hide_timeform_id_temp" id="' . $id . '_hide_timeform_id_temp">
1669
+
1670
+ <input type="hidden" name="' . $id . '_show_week_days" id="' . $id . '_show_week_days" sunday="' . $w_show_week_days[0] . '" monday="' . $w_show_week_days[1] . '" tuesday="' . $w_show_week_days[2] . '" wednesday="' . $w_show_week_days[3] . '" thursday="' . $w_show_week_days[4] . '" friday="' . $w_show_week_days[5] . '" saturday="' . $w_show_week_days[6] . '">
1671
+
1672
+
1673
+
1674
+ <input type="text" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled/>
1675
+ <img src="' . WDFM()->plugin_url . '/images/date.png" id="' . $id . '_show_imagedateform_id_temp" name="' . $id . '_show_imagedateform_id_temp" style="vertical-align : text-top; margin-left : 1px; display:' . $display_image_date . '">
1676
+
1677
+ <input id="' . $id . '_buttonform_id_temp" type="hidden" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" ></div></div>';
1678
+ break;
1679
+ }
1680
+ case 'type_date_range': {
1681
+ $params_names = array(
1682
+ 'w_field_label_size',
1683
+ 'w_field_label_pos',
1684
+ 'w_size',
1685
+ 'w_date',
1686
+ 'w_required',
1687
+ 'w_show_image',
1688
+ 'w_class',
1689
+ 'w_format',
1690
+ 'w_start_day',
1691
+ 'w_default_date_start',
1692
+ 'w_default_date_end',
1693
+ 'w_min_date',
1694
+ 'w_max_date',
1695
+ 'w_invalid_dates',
1696
+ 'w_show_days',
1697
+ 'w_hide_time',
1698
+ 'w_but_val',
1699
+ 'w_disable_past_days',
1700
+ );
1701
+ $temp = $params;
1702
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1703
+ $params_names = array(
1704
+ 'w_field_label_size',
1705
+ 'w_field_label_pos',
1706
+ 'w_hide_label',
1707
+ 'w_size',
1708
+ 'w_date',
1709
+ 'w_required',
1710
+ 'w_show_image',
1711
+ 'w_class',
1712
+ 'w_format',
1713
+ 'w_start_day',
1714
+ 'w_default_date_start',
1715
+ 'w_default_date_end',
1716
+ 'w_min_date',
1717
+ 'w_max_date',
1718
+ 'w_invalid_dates',
1719
+ 'w_show_days',
1720
+ 'w_hide_time',
1721
+ 'w_but_val',
1722
+ 'w_disable_past_days',
1723
+ );
1724
+ }
1725
+ foreach ( $params_names as $params_name ) {
1726
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1727
+ $param[$params_name] = $temp[0];
1728
+ $temp = $temp[1];
1729
+ }
1730
+ if ( $temp ) {
1731
+ $temp = explode('*:*w_attr_name*:*', $temp);
1732
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1733
+ foreach ( $attrs as $attr ) {
1734
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1735
+ }
1736
+ }
1737
+ $w_show_week_days = explode('***', $param['w_show_days']);
1738
+ $defaul_day_array = explode(',', $param['w_date']);
1739
+ $defaul_day_start = $defaul_day_array[0];
1740
+ $defaul_day_end = $defaul_day_array[1];
1741
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1742
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1743
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1744
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1745
+ $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1746
+ $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1747
+ $display_image_date = $param['w_show_image'] == 'yes' ? 'inline' : 'none';
1748
+ $rep = '<div id="wdform_field' . $id . '" type="type_date_range" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';">
1749
+
1750
+ <input type="hidden" value="type_date_range" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp">
1751
+
1752
+ <input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp">
1753
+
1754
+ <input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/>
1755
+
1756
+ <input type="hidden" value="' . $param['w_show_image'] . '" name="' . $id . '_show_imageform_id_temp" id="' . $id . '_show_imageform_id_temp">
1757
+
1758
+ <input type="hidden" value="' . $param['w_disable_past_days'] . '" name="' . $id . '_dis_past_daysform_id_temp" id="' . $id . '_dis_past_daysform_id_temp">
1759
+
1760
+ <input type="hidden" value="' . $param['w_default_date_start'] . '" name="' . $id . '_default_date_id_temp_start" id="' . $id . '_default_date_id_temp_start">
1761
+
1762
+ <input type="hidden" value="' . $param['w_default_date_end'] . '" name="' . $id . '_default_date_id_temp_end" id="' . $id . '_default_date_id_temp_end">
1763
+
1764
+ <input type="hidden" value="' . $param['w_min_date'] . '" name="' . $id . '_min_date_id_temp" id="' . $id . '_min_date_id_temp">
1765
+
1766
+ <input type="hidden" value="' . $param['w_max_date'] . '" name="' . $id . '_max_date_id_temp" id="' . $id . '_max_date_id_temp">
1767
+
1768
+ <input type="hidden" value="' . $param['w_invalid_dates'] . '" name="' . $id . '_invalid_dates_id_temp" id="' . $id . '_invalid_dates_id_temp">
1769
+
1770
+ <input type="hidden" value="' . $param['w_start_day'] . '" name="' . $id . '_start_dayform_id_temp" id="' . $id . '_start_dayform_id_temp">
1771
+
1772
+ <input type="hidden" value="' . $param['w_hide_time'] . '" name="' . $id . '_hide_timeform_id_temp" id="' . $id . '_hide_timeform_id_temp">
1773
+
1774
+ <input type="hidden" name="' . $id . '_show_week_days" id="' . $id . '_show_week_days" sunday="' . $w_show_week_days[0] . '" monday="' . $w_show_week_days[1] . '" tuesday="' . $w_show_week_days[2] . '" wednesday="' . $w_show_week_days[3] . '" thursday="' . $w_show_week_days[4] . '" friday="' . $w_show_week_days[5] . '" saturday="' . $w_show_week_days[6] . '">
1775
+
1776
+
1777
+
1778
+
1779
+
1780
+ <input type="text" id="' . $id . '_elementform_id_temp0" name="' . $id . '_elementform_id_temp0" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled/>
1781
+ <img src="' . WDFM()->plugin_url . '/images/date.png" id="' . $id . '_show_imagedateform_id_temp0" name="' . $id . '_show_imagedateform_id_temp0" style="vertical-align : text-top; margin-left : 1px; display:' . $display_image_date . '">
1782
+
1783
+ <span>-</span>
1784
+
1785
+ <input type="text" id="' . $id . '_elementform_id_temp1" name="' . $id . '_elementform_id_temp1" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled/>
1786
+ <img src="' . WDFM()->plugin_url . '/images/date.png" id="' . $id . '_show_imagedateform_id_temp1" name="' . $id . '_show_imagedateform_id_temp1" style="vertical-align : text-top; margin-left : 1px; display:' . $display_image_date . '">
1787
+
1788
+ <input id="' . $id . '_buttonform_id_temp" type="hidden" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" >
1789
+
1790
+ </div></div>';
1791
+ break;
1792
+ }
1793
+ case 'type_date_fields': {
1794
+ $params_names = array(
1795
+ 'w_field_label_size',
1796
+ 'w_field_label_pos',
1797
+ 'w_day',
1798
+ 'w_month',
1799
+ 'w_year',
1800
+ 'w_day_type',
1801
+ 'w_month_type',
1802
+ 'w_year_type',
1803
+ 'w_day_label',
1804
+ 'w_month_label',
1805
+ 'w_year_label',
1806
+ 'w_day_size',
1807
+ 'w_month_size',
1808
+ 'w_year_size',
1809
+ 'w_required',
1810
+ 'w_class',
1811
+ 'w_from',
1812
+ 'w_to',
1813
+ 'w_divider',
1814
+ );
1815
+ $temp = $params;
1816
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1817
+ $params_names = array(
1818
+ 'w_field_label_size',
1819
+ 'w_field_label_pos',
1820
+ 'w_hide_label',
1821
+ 'w_day',
1822
+ 'w_month',
1823
+ 'w_year',
1824
+ 'w_day_type',
1825
+ 'w_month_type',
1826
+ 'w_year_type',
1827
+ 'w_day_label',
1828
+ 'w_month_label',
1829
+ 'w_year_label',
1830
+ 'w_day_size',
1831
+ 'w_month_size',
1832
+ 'w_year_size',
1833
+ 'w_required',
1834
+ 'w_class',
1835
+ 'w_from',
1836
+ 'w_to',
1837
+ 'w_divider',
1838
+ );
1839
+ }
1840
+ foreach ( $params_names as $params_name ) {
1841
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1842
+ $param[$params_name] = $temp[0];
1843
+ $temp = $temp[1];
1844
+ }
1845
+ if ( $temp ) {
1846
+ $temp = explode('*:*w_attr_name*:*', $temp);
1847
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1848
+ foreach ( $attrs as $attr ) {
1849
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1850
+ }
1851
+ }
1852
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1853
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1854
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1855
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1856
+ if ( $param['w_day_type'] == "SELECT" ) {
1857
+ $w_day_type = '<select id="' . $id . '_dayform_id_temp" name="' . $id . '_dayform_id_temp" onchange="set_select(this)" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . ' disabled><option value=""></option>';
1858
+ for ( $k = 0; $k <= 31; $k++ ) {
1859
+ if ( $k < 10 ) {
1860
+ if ( $param['w_day'] == '0' . $k ) {
1861
+ $selected = "selected=\"selected\"";
1862
+ }
1863
+ else {
1864
+ $selected = "";
1865
+ }
1866
+ $w_day_type .= '<option value="0' . $k . '" ' . $selected . '>0' . $k . '</option>';
1867
+ }
1868
+ else {
1869
+ if ( $param['w_day'] == '' . $k ) {
1870
+ $selected = "selected=\"selected\"";
1871
+ }
1872
+ else {
1873
+ $selected = "";
1874
+ }
1875
+ $w_day_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
1876
+ }
1877
+ }
1878
+ $w_day_type .= '</select>';
1879
+ }
1880
+ else {
1881
+ $w_day_type = '<input type="text" value="' . $param['w_day'] . '" id="' . $id . '_dayform_id_temp" name="' . $id . '_dayform_id_temp" onchange="change_value(&quot;' . $id . '_dayform_id_temp&quot;)" onkeypress="return check_day(event, &quot;' . $id . '_dayform_id_temp&quot;)" onblur="if (this.value==&quot;0&quot;) this.value=&quot;&quot;; else add_0(&quot;' . $id . '_dayform_id_temp&quot;)" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . ' disabled/>';
1882
+ }
1883
+ if ( $param['w_month_type'] == "SELECT" ) {
1884
+ $w_month_type = '<select id="' . $id . '_monthform_id_temp" name="' . $id . '_monthform_id_temp" onchange="set_select(this)" style="width: ' . $param['w_month_size'] . 'px;" ' . $param['attributes'] . ' disabled><option value=""></option><option value="01" ' . ($param['w_month'] == "01" ? "selected=\"selected\"" : "") . ' ><!--repstart-->January<!--repend--></option><option value="02" ' . ($param['w_month'] == "02" ? "selected=\"selected\"" : "") . '><!--repstart-->February<!--repend--></option><option value="03" ' . ($param['w_month'] == "03" ? "selected=\"selected\"" : "") . '><!--repstart-->March<!--repend--></option><option value="04" ' . ($param['w_month'] == "04" ? "selected=\"selected\"" : "") . ' ><!--repstart-->April<!--repend--></option><option value="05" ' . ($param['w_month'] == "05" ? "selected=\"selected\"" : "") . ' ><!--repstart-->May<!--repend--></option><option value="06" ' . ($param['w_month'] == "06" ? "selected=\"selected\"" : "") . ' ><!--repstart-->June<!--repend--></option><option value="07" ' . ($param['w_month'] == "07" ? "selected=\"selected\"" : "") . ' ><!--repstart-->July<!--repend--></option><option value="08" ' . ($param['w_month'] == "08" ? "selected=\"selected\"" : "") . ' ><!--repstart-->August<!--repend--></option><option value="09" ' . ($param['w_month'] == "09" ? "selected=\"selected\"" : "") . ' ><!--repstart-->September<!--repend--></option><option value="10" ' . ($param['w_month'] == "10" ? "selected=\"selected\"" : "") . ' ><!--repstart-->October<!--repend--></option><option value="11" ' . ($param['w_month'] == "11" ? "selected=\"selected\"" : "") . '><!--repstart-->November<!--repend--></option><option value="12" ' . ($param['w_month'] == "12" ? "selected=\"selected\"" : "") . ' ><!--repstart-->December<!--repend--></option></select>';
1885
+ }
1886
+ else {
1887
+ $w_month_type = '<input type="text" value="' . $param['w_month'] . '" id="' . $id . '_monthform_id_temp" name="' . $id . '_monthform_id_temp" onkeypress="return check_month(event, &quot;' . $id . '_monthform_id_temp&quot;)" onchange="change_value(&quot;' . $id . '_monthform_id_temp&quot;)" onblur="if (this.value==&quot;0&quot;) this.value=&quot;&quot;; else add_0(&quot;' . $id . '_monthform_id_temp&quot;)" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . ' disabled/>';
1888
+ }
1889
+ $param['w_to'] = isset($param['w_to']) && $param['w_to'] != "NaN" ? $param['w_to'] : date("Y");
1890
+ if ( $param['w_year_type'] == "SELECT" ) {
1891
+ $w_year_type = '<select id="' . $id . '_yearform_id_temp" name="' . $id . '_yearform_id_temp" onchange="set_select(this)" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_year_size'] . 'px;" ' . $param['attributes'] . ' disabled><option value=""></option>';
1892
+ for ( $k = $param['w_to']; $k >= $param['w_from']; $k-- ) {
1893
+ if ( $param['w_year'] == $k ) {
1894
+ $selected = "selected=\"selected\"";
1895
+ }
1896
+ else {
1897
+ $selected = "";
1898
+ }
1899
+ $w_year_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
1900
+ }
1901
+ $w_year_type .= '</select>';
1902
+ }
1903
+ else {
1904
+ $w_year_type = '<input type="text" value="' . $param['w_year'] . '" id="' . $id . '_yearform_id_temp" name="' . $id . '_yearform_id_temp" onchange="change_year(&quot;' . $id . '_yearform_id_temp&quot;)" onkeypress="return check_year1(event, &quot;' . $id . '_yearform_id_temp&quot;)" onblur="check_year2(&quot;' . $id . '_yearform_id_temp&quot;)" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_day_size'] . 'px;" ' . $param['attributes'] . ' disabled/>';
1905
+ }
1906
+ $rep = '<div id="wdform_field' . $id . '" type="type_date_fields" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_date_fields" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><div id="' . $id . '_table_date" style="display: table;"><div id="' . $id . '_tr_date1" style="display: table-row;"><div id="' . $id . '_td_date_input1" style="display: table-cell;">
1907
+ ' . $w_day_type . '
1908
+
1909
+ </div><div id="' . $id . '_td_date_separator1" style="display: table-cell;"><span id="' . $id . '_separator1" class="wdform_separator">' . $param['w_divider'] . '</span></div><div id="' . $id . '_td_date_input2" style="display: table-cell;">' . $w_month_type . '</div><div id="' . $id . '_td_date_separator2" style="display: table-cell;"><span id="' . $id . '_separator2" class="wdform_separator">' . $param['w_divider'] . '</span></div><div id="' . $id . '_td_date_input3" style="display: table-cell;">' . $w_year_type . '</div></div><div id="' . $id . '_tr_date2" style="display: table-row;"><div id="' . $id . '_td_date_label1" style="display: table-cell;"><label class="mini_label" id="' . $id . '_day_label">' . $param['w_day_label'] . '</label></div><div style="display: table-cell;"></div><div id="' . $id . '_td_date_label2" style="display: table-cell;"><label class="mini_label" id="' . $id . '_month_label">' . $param['w_month_label'] . '</label></div><div style="display: table-cell;"></div><div id="' . $id . '_td_date_label3" style="display: table-cell;"><label class="mini_label" id="' . $id . '_year_label">' . $param['w_year_label'] . '</label></div></div></div></div></div>';
1910
+ break;
1911
+ }
1912
+ case 'type_file_upload': {
1913
+ $params_names = array(
1914
+ 'w_field_label_size',
1915
+ 'w_field_label_pos',
1916
+ 'w_destination',
1917
+ 'w_extension',
1918
+ 'w_max_size',
1919
+ 'w_required',
1920
+ 'w_multiple',
1921
+ 'w_class',
1922
+ );
1923
+ $temp = $params;
1924
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1925
+ $params_names = array(
1926
+ 'w_field_label_size',
1927
+ 'w_field_label_pos',
1928
+ 'w_hide_label',
1929
+ 'w_destination',
1930
+ 'w_extension',
1931
+ 'w_max_size',
1932
+ 'w_required',
1933
+ 'w_multiple',
1934
+ 'w_class',
1935
+ );
1936
+ }
1937
+ foreach ( $params_names as $params_name ) {
1938
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1939
+ $param[$params_name] = $temp[0];
1940
+ if ( isset($temp[1]) ) {
1941
+ $temp = $temp[1];
1942
+ }
1943
+ else {
1944
+ $temp = '';
1945
+ }
1946
+ }
1947
+ if ( $temp ) {
1948
+ $temp = explode('*:*w_attr_name*:*', $temp);
1949
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1950
+ foreach ( $attrs as $attr ) {
1951
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1952
+ }
1953
+ }
1954
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1955
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1956
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1957
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1958
+ $multiple = ($param['w_multiple'] == "yes" ? "multiple='multiple'" : "");
1959
+ $rep = '<div id="wdform_field' . $id . '" type="type_file_upload" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_file_upload" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="***max_sizeskizb' . $id . '***' . $param['w_max_size'] . '***max_sizeverj' . $id . '***" id="' . $id . '_max_size" name="' . $id . '_max_size"><input type="hidden" value="***destinationskizb' . $id . '***' . $param['w_destination'] . '***destinationverj' . $id . '***" id="' . $id . '_destination" name="' . $id . '_destination"><input type="hidden" value="***extensionskizb' . $id . '***' . $param['w_extension'] . '***extensionverj' . $id . '***" id="' . $id . '_extension" name="' . $id . '_extension"><input type="file" class="file_upload" id="' . $id . '_elementform_id_temp" name="' . $id . '_fileform_id_temp" ' . $multiple . ' ' . $param['attributes'] . ' disabled/></div></div>';
1960
+ break;
1961
+ }
1962
+ case 'type_captcha': {
1963
+ $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_digit', 'w_class' );
1964
+ $temp = $params;
1965
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
1966
+ $params_names = array(
1967
+ 'w_field_label_size',
1968
+ 'w_field_label_pos',
1969
+ 'w_hide_label',
1970
+ 'w_digit',
1971
+ 'w_class',
1972
+ );
1973
+ }
1974
+ foreach ( $params_names as $params_name ) {
1975
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1976
+ $param[$params_name] = $temp[0];
1977
+ $temp = $temp[1];
1978
+ }
1979
+ if ( $temp ) {
1980
+ $temp = explode('*:*w_attr_name*:*', $temp);
1981
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1982
+ foreach ( $attrs as $attr ) {
1983
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1984
+ }
1985
+ }
1986
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1987
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1988
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1989
+ $rep = '<div id="wdform_field' . $id . '" type="type_captcha" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display:' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_captcha" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><div style="display: table;"><div style="display: table-row;"><div valign="middle" style="display: table-cell;"><img type="captcha" digit="' . $param['w_digit'] . '" src="' . add_query_arg(array(
1990
+ 'action' => 'formmakerwdcaptcha',
1991
+ 'digit' => $param['w_digit'],
1992
+ 'i' => 'form_id_temp',
1993
+ ), admin_url('admin-ajax.php')) . '" id="_wd_captchaform_id_temp" class="captcha_img" onclick="captcha_refresh(&quot;_wd_captcha&quot;,&quot;form_id_temp&quot;)" ' . $param['attributes'] . '></div><div valign="middle" style="display: table-cell;"><div class="captcha_refresh" id="_element_refreshform_id_temp" onclick="captcha_refresh(&quot;_wd_captcha&quot;,&quot;form_id_temp&quot;)" ' . $param['attributes'] . '></div></div></div><div style="display: table-row;"><div style="display: table-cell;"><input type="text" class="captcha_input" id="_wd_captcha_inputform_id_temp" name="captcha_input" style="width: ' . ($param['w_digit'] * 10 + 15) . 'px;" ' . $param['attributes'] . ' disabled/><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/></div></div></div></div></div>';
1994
+ break;
1995
+ }
1996
+ case 'type_arithmetic_captcha': {
1997
+ $params_names = array(
1998
+ 'w_field_label_size',
1999
+ 'w_field_label_pos',
2000
+ 'w_count',
2001
+ 'w_operations',
2002
+ 'w_class',
2003
+ 'w_input_size',
2004
+ );
2005
+ $temp = $params;
2006
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2007
+ $params_names = array(
2008
+ 'w_field_label_size',
2009
+ 'w_field_label_pos',
2010
+ 'w_hide_label',
2011
+ 'w_count',
2012
+ 'w_operations',
2013
+ 'w_class',
2014
+ 'w_input_size',
2015
+ );
2016
+ }
2017
+ foreach ( $params_names as $params_name ) {
2018
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2019
+ $param[$params_name] = $temp[0];
2020
+ $temp = $temp[1];
2021
+ }
2022
+ if ( $temp ) {
2023
+ $temp = explode('*:*w_attr_name*:*', $temp);
2024
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2025
+ foreach ( $attrs as $attr ) {
2026
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2027
+ }
2028
+ }
2029
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2030
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2031
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2032
+ $param['w_count'] = $param['w_count'] ? $param['w_count'] : 1;
2033
+ $param['w_operations'] = $param['w_operations'] ? $param['w_operations'] : '+, -, *, /';
2034
+ $param['w_input_size'] = $param['w_input_size'] ? $param['w_input_size'] : 60;
2035
+ $rep = '<div id="wdform_field' . $id . '" type="type_arithmetic_captcha" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display:' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_captcha" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><div style="display: table;"><div style="display: table-row;"><div style="display: table-cell;"><img type="captcha" operations_count="' . $param['w_count'] . '" operations="' . $param['w_operations'] . '" input_size="' . $param['w_input_size'] . '" src="' . add_query_arg(array(
2036
+ 'action' => 'formmakerwdmathcaptcha',
2037
+ 'operations_count' => $param['w_count'],
2038
+ 'operations' => urlencode($param['w_operations']),
2039
+ 'i' => 'form_id_temp',
2040
+ ), admin_url('admin-ajax.php')) . '" id="_wd_arithmetic_captchaform_id_temp" class="arithmetic_captcha_img" onclick="captcha_refresh(&quot;_wd_arithmetic_captcha&quot;,&quot;form_id_temp&quot;)" ' . $param['attributes'] . '></div><div style="display: table-cell;"><input type="text" class="arithmetic_captcha_input" id="_wd_arithmetic_captcha_inputform_id_temp" name="arithmetic_captcha_input" onkeypress="return check_isnum(event)" style="width: ' . $param['w_input_size'] . 'px;" ' . $param['attributes'] . ' disabled/><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/></div><div style="display: table-cell; vertical-align: middle;"><div class="captcha_refresh" id="_element_refreshform_id_temp" onclick="captcha_refresh(&quot;_wd_arithmetic_captcha&quot;,&quot;form_id_temp&quot;)" ' . $param['attributes'] . '></div></div></div></div></div></div>';
2041
+ break;
2042
+ }
2043
+ case 'type_recaptcha': {
2044
+ $params_names = array(
2045
+ 'w_field_label_size',
2046
+ 'w_field_label_pos',
2047
+ 'w_public',
2048
+ 'w_private',
2049
+ 'w_theme',
2050
+ 'w_class',
2051
+ );
2052
+ $temp = $params;
2053
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2054
+ $params_names = array(
2055
+ 'w_field_label_size',
2056
+ 'w_field_label_pos',
2057
+ 'w_hide_label',
2058
+ 'w_public',
2059
+ 'w_private',
2060
+ 'w_theme',
2061
+ 'w_class',
2062
+ );
2063
+ }
2064
+ foreach ( $params_names as $params_name ) {
2065
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2066
+ $param[$params_name] = $temp[0];
2067
+ $temp = $temp[1];
2068
+ }
2069
+ if ( $temp ) {
2070
+ $temp = explode('*:*w_attr_name*:*', $temp);
2071
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2072
+ foreach ( $attrs as $attr ) {
2073
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2074
+ }
2075
+ }
2076
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2077
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2078
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2079
+ $rep = '<div id="wdform_field' . $id . '" type="type_recaptcha" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_recaptcha" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><div id="wd_recaptchaform_id_temp" public_key="' . $param['w_public'] . '" private_key="' . $param['w_private'] . '" theme="' . $param['w_theme'] . '" ' . $param['attributes'] . '><span style="color: red; font-style: italic;">Recaptcha doesn\'t display in back end</span></div></div></div>';
2080
+ break;
2081
+ }
2082
+ case 'type_hidden': {
2083
+ $params_names = array( 'w_name', 'w_value' );
2084
+ $temp = $params;
2085
+ foreach ( $params_names as $params_name ) {
2086
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2087
+ $param[$params_name] = $temp[0];
2088
+ $temp = $temp[1];
2089
+ }
2090
+ if ( $temp ) {
2091
+ $temp = explode('*:*w_attr_name*:*', $temp);
2092
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2093
+ foreach ( $attrs as $attr ) {
2094
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2095
+ }
2096
+ }
2097
+ $param['w_name'] = str_replace('&nbsp;', '', $param['w_name']);
2098
+ $rep = '<div id="wdform_field' . $id . '" type="type_hidden" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" style="display: table-cell;"><span id="' . $id . '_element_labelform_id_temp" style="display: none;">' . $param['w_name'] . '</span><span style="color: red; font-size: 13px;">Hidden field</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" style="display: table-cell; padding-left:7px;"><input type="hidden" value="' . $param['w_value'] . '" id="' . $id . '_elementform_id_temp" name="' . $param['w_name'] . '" ' . $param['attributes'] . '><input type="hidden" value="type_hidden" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><div><span align="left">Name: </span><span align="left" id="' . $id . '_hidden_nameform_id_temp">' . $param['w_name'] . '</span></div><div><span align="left">Value: </span><span align="left" id="' . $id . '_hidden_valueform_id_temp">' . $param['w_value'] . '</span></div></div></div>';
2099
+ break;
2100
+ }
2101
+ case 'type_mark_map': {
2102
+ $params_names = array(
2103
+ 'w_field_label_size',
2104
+ 'w_field_label_pos',
2105
+ 'w_center_x',
2106
+ 'w_center_y',
2107
+ 'w_long',
2108
+ 'w_lat',
2109
+ 'w_zoom',
2110
+ 'w_width',
2111
+ 'w_height',
2112
+ 'w_info',
2113
+ 'w_class',
2114
+ );
2115
+ $temp = $params;
2116
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2117
+ $params_names = array(
2118
+ 'w_field_label_size',
2119
+ 'w_field_label_pos',
2120
+ 'w_hide_label',
2121
+ 'w_center_x',
2122
+ 'w_center_y',
2123
+ 'w_long',
2124
+ 'w_lat',
2125
+ 'w_zoom',
2126
+ 'w_width',
2127
+ 'w_height',
2128
+ 'w_info',
2129
+ 'w_class',
2130
+ );
2131
+ }
2132
+ foreach ( $params_names as $params_name ) {
2133
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2134
+ $param[$params_name] = $temp[0];
2135
+ $temp = $temp[1];
2136
+ }
2137
+ if ( $temp ) {
2138
+ $temp = explode('*:*w_attr_name*:*', $temp);
2139
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2140
+ foreach ( $attrs as $attr ) {
2141
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2142
+ }
2143
+ }
2144
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2145
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2146
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2147
+ $rep = '<div id="wdform_field' . $id . '" type="type_mark_map" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="type_mark_map" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><div id="' . $id . '_elementform_id_temp" long0="' . $param['w_long'] . '" lat0="' . $param['w_lat'] . '" zoom="' . $param['w_zoom'] . '" info0="' . $param['w_info'] . '" center_x="' . $param['w_center_x'] . '" center_y="' . $param['w_center_y'] . '" style="width: ' . $param['w_width'] . 'px; height: ' . $param['w_height'] . 'px;" ' . $param['attributes'] . '></div></div></div> ';
2148
+ break;
2149
+ }
2150
+ case 'type_map': {
2151
+ $params_names = array(
2152
+ 'w_center_x',
2153
+ 'w_center_y',
2154
+ 'w_long',
2155
+ 'w_lat',
2156
+ 'w_zoom',
2157
+ 'w_width',
2158
+ 'w_height',
2159
+ 'w_info',
2160
+ 'w_class',
2161
+ );
2162
+ $temp = $params;
2163
+ foreach ( $params_names as $params_name ) {
2164
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2165
+ $param[$params_name] = $temp[0];
2166
+ $temp = $temp[1];
2167
+ }
2168
+ if ( $temp ) {
2169
+ $temp = explode('*:*w_attr_name*:*', $temp);
2170
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2171
+ foreach ( $attrs as $attr ) {
2172
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2173
+ }
2174
+ }
2175
+ $marker = '';
2176
+ $param['w_long'] = explode('***', $param['w_long']);
2177
+ $param['w_lat'] = explode('***', $param['w_lat']);
2178
+ $param['w_info'] = explode('***', $param['w_info']);
2179
+ foreach ( $param['w_long'] as $key => $w_long ) {
2180
+ $marker .= 'long' . $key . '="' . $w_long . '" lat' . $key . '="' . $param['w_lat'][$key] . '" info' . $key . '="' . $param['w_info'][$key] . '"';
2181
+ }
2182
+ $rep = '<div id="wdform_field' . $id . '" type="type_map" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><span id="' . $id . '_element_labelform_id_temp" style="display: none;">' . $label . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><input type="hidden" value="type_map" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><div id="' . $id . '_elementform_id_temp" zoom="' . $param['w_zoom'] . '" center_x="' . $param['w_center_x'] . '" center_y="' . $param['w_center_y'] . '" style="width: ' . $param['w_width'] . 'px; height: ' . $param['w_height'] . 'px;" ' . $marker . ' ' . $param['attributes'] . '></div></div></div>';
2183
+ break;
2184
+ }
2185
+ case 'type_paypal_price': {
2186
+ $params_names = array(
2187
+ 'w_field_label_size',
2188
+ 'w_field_label_pos',
2189
+ 'w_first_val',
2190
+ 'w_title',
2191
+ 'w_mini_labels',
2192
+ 'w_size',
2193
+ 'w_required',
2194
+ 'w_hide_cents',
2195
+ 'w_class',
2196
+ 'w_range_min',
2197
+ 'w_range_max',
2198
+ );
2199
+ $temp = $params;
2200
+ foreach ( $params_names as $params_name ) {
2201
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2202
+ $param[$params_name] = $temp[0];
2203
+ $temp = $temp[1];
2204
+ }
2205
+ if ( $temp ) {
2206
+ $temp = explode('*:*w_attr_name*:*', $temp);
2207
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2208
+ foreach ( $attrs as $attr ) {
2209
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2210
+ }
2211
+ }
2212
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2213
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
2214
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2215
+ $hide_cents = ($param['w_hide_cents'] == "yes" ? "none;" : "table-cell;");
2216
+ $w_first_val = explode('***', $param['w_first_val']);
2217
+ $w_title = explode('***', $param['w_title']);
2218
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
2219
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_price" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required"style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_paypal_price" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_range_min'] . '" name="' . $id . '_range_minform_id_temp" id="' . $id . '_range_minform_id_temp"><input type="hidden" value="' . $param['w_range_max'] . '" name="' . $id . '_range_maxform_id_temp" id="' . $id . '_range_maxform_id_temp"><div id="' . $id . '_table_price" style="display: table;"><div id="' . $id . '_tr_price1" style="display: table-row;"><div id="' . $id . '_td_name_currency" style="display: table-cell;"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;$&nbsp;<!--repend--></span></div><div id="' . $id . '_td_name_dollars" style="display: table-cell;"><input type="text" class="' . $input_active . '" id="' . $id . '_element_dollarsform_id_temp" name="' . $id . '_element_dollarsform_id_temp" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '"onfocus="delete_value(&quot;' . $id . '_element_dollarsform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_element_dollarsform_id_temp&quot;)"onchange="change_value(&quot;' . $id . '_element_dollarsform_id_temp&quot;)" onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled/></div><div id="' . $id . '_td_name_divider" style="display: ' . $hide_cents . ';"><span class="wdform_colon" style="vertical-align: middle;">&nbsp;.&nbsp;</span></div><div id="' . $id . '_td_name_cents" style="display: ' . $hide_cents . '"><input type="text" class="' . $input_active . '" id="' . $id . '_element_centsform_id_temp" name="' . $id . '_element_centsform_id_temp" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '"onfocus="delete_value(&quot;' . $id . '_element_centsform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_element_centsform_id_temp&quot;); add_0(&quot;' . $id . '_element_centsform_id_temp&quot;)"onchange="change_value(&quot;' . $id . '_element_centsform_id_temp&quot;)" onkeypress="return check_isnum_interval(event,&quot;' . $id . '_element_centsform_id_temp&quot;,0,99)"style="width: 30px;" ' . $param['attributes'] . ' disabled/></div></div><div id="' . $id . '_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" id="' . $id . '_mini_label_dollars">' . $w_mini_labels[0] . '</label></div><div id="' . $id . '_td_name_label_divider" style="display: ' . $hide_cents . '"><label class="mini_label"></label></div><div align="left" id="' . $id . '_td_name_label_cents" style="display: ' . $hide_cents . '"><label class="mini_label" id="' . $id . '_mini_label_cents">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
2220
+ break;
2221
+ }
2222
+ case 'type_paypal_price_new': {
2223
+ $params_names = array(
2224
+ 'w_field_label_size',
2225
+ 'w_field_label_pos',
2226
+ 'w_first_val',
2227
+ 'w_title',
2228
+ 'w_size',
2229
+ 'w_required',
2230
+ 'w_class',
2231
+ 'w_range_min',
2232
+ 'w_range_max',
2233
+ 'w_readonly',
2234
+ 'w_currency',
2235
+ );
2236
+ $temp = $params;
2237
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2238
+ $params_names = array(
2239
+ 'w_field_label_size',
2240
+ 'w_field_label_pos',
2241
+ 'w_hide_label',
2242
+ 'w_first_val',
2243
+ 'w_title',
2244
+ 'w_size',
2245
+ 'w_required',
2246
+ 'w_class',
2247
+ 'w_range_min',
2248
+ 'w_range_max',
2249
+ 'w_readonly',
2250
+ 'w_currency',
2251
+ );
2252
+ }
2253
+ foreach ( $params_names as $params_name ) {
2254
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2255
+ $param[$params_name] = $temp[0];
2256
+ $temp = $temp[1];
2257
+ }
2258
+ if ( $temp ) {
2259
+ $temp = explode('*:*w_attr_name*:*', $temp);
2260
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2261
+ foreach ( $attrs as $attr ) {
2262
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2263
+ }
2264
+ }
2265
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2266
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2267
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2268
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
2269
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2270
+ $currency_sumbol = ($param['w_currency'] == "yes" ? "display:none;" : "display: table-cell;");
2271
+ $param['w_readonly'] = (isset($param['w_readonly']) ? $param['w_readonly'] : "no");
2272
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_price_new" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required"style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_paypal_price_new" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_readonly'] . '" name="' . $id . '_readonlyform_id_temp" id="' . $id . '_readonlyform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_range_min'] . '" name="' . $id . '_range_minform_id_temp" id="' . $id . '_range_minform_id_temp"><input type="hidden" value="' . $param['w_range_max'] . '" name="' . $id . '_range_maxform_id_temp" id="' . $id . '_range_maxform_id_temp"><div id="' . $id . '_table_price" style="display: table;"><div id="' . $id . '_tr_price1" style="display: table-row;"><div id="' . $id . '_td_name_currency" style="' . $currency_sumbol . '"><span class="wdform_colon" style="vertical-align: middle;"><!--repstart-->&nbsp;$&nbsp;<!--repend--></span></div><div id="' . $id . '_td_name_dollars" style="display: table-cell;"><input type="text" class="' . $input_active . '" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '"onfocus="delete_value(&quot;' . $id . '_elementform_id_temp&quot;)" onblur="return_value(&quot;' . $id . '_elementform_id_temp&quot;)"onchange="change_value(&quot;' . $id . '_elementform_id_temp&quot;)" onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled/></div></div></div></div></div>';
2273
+ break;
2274
+ }
2275
+ case 'type_paypal_select': {
2276
+ $params_names = array(
2277
+ 'w_field_label_size',
2278
+ 'w_field_label_pos',
2279
+ 'w_size',
2280
+ 'w_choices',
2281
+ 'w_choices_price',
2282
+ 'w_choices_checked',
2283
+ 'w_choices_disabled',
2284
+ 'w_required',
2285
+ 'w_quantity',
2286
+ 'w_quantity_value',
2287
+ 'w_class',
2288
+ 'w_property',
2289
+ 'w_property_values',
2290
+ );
2291
+ $temp = $params;
2292
+ if ( strpos($temp, 'w_choices_params') > -1 ) {
2293
+ $params_names = array(
2294
+ 'w_field_label_size',
2295
+ 'w_field_label_pos',
2296
+ 'w_size',
2297
+ 'w_choices',
2298
+ 'w_choices_price',
2299
+ 'w_choices_checked',
2300
+ 'w_choices_disabled',
2301
+ 'w_required',
2302
+ 'w_quantity',
2303
+ 'w_quantity_value',
2304
+ 'w_choices_params',
2305
+ 'w_class',
2306
+ 'w_property',
2307
+ 'w_property_values',
2308
+ );
2309
+ }
2310
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2311
+ $params_names = array(
2312
+ 'w_field_label_size',
2313
+ 'w_field_label_pos',
2314
+ 'w_hide_label',
2315
+ 'w_size',
2316
+ 'w_choices',
2317
+ 'w_choices_price',
2318
+ 'w_choices_checked',
2319
+ 'w_choices_disabled',
2320
+ 'w_required',
2321
+ 'w_quantity',
2322
+ 'w_quantity_value',
2323
+ 'w_choices_params',
2324
+ 'w_class',
2325
+ 'w_property',
2326
+ 'w_property_values',
2327
+ );
2328
+ }
2329
+ foreach ( $params_names as $params_name ) {
2330
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2331
+ $param[$params_name] = $temp[0];
2332
+ $temp = $temp[1];
2333
+ }
2334
+ if ( $temp ) {
2335
+ $temp = explode('*:*w_attr_name*:*', $temp);
2336
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2337
+ foreach ( $attrs as $attr ) {
2338
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2339
+ }
2340
+ }
2341
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2342
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2343
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2344
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2345
+ $param['w_choices'] = explode('***', $param['w_choices']);
2346
+ $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2347
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2348
+ $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
2349
+ $param['w_property'] = explode('***', $param['w_property']);
2350
+ $param['w_property_values'] = explode('***', $param['w_property_values']);
2351
+ if ( isset($param['w_choices_params']) ) {
2352
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2353
+ }
2354
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2355
+ if ( $choices_checked == 'true' ) {
2356
+ $param['w_choices_checked'][$key] = 'selected="selected"';
2357
+ }
2358
+ else {
2359
+ $param['w_choices_checked'][$key] = '';
2360
+ }
2361
+ }
2362
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_select" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; "><input type="hidden" value="type_paypal_select" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><select id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" onchange="set_select(this)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled>';
2363
+ foreach ( $param['w_choices'] as $key => $choice ) {
2364
+ $where = '';
2365
+ $order_by = '';
2366
+ $db_info = '';
2367
+ $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : $param['w_choices_price'][$key];
2368
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2369
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2370
+ $where = 'where="' . $w_choices_params[0] . '"';
2371
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2372
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2373
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2374
+ }
2375
+ $rep .= '<option id="' . $id . '_option' . $key . '" value="' . $choice_value . '" onselect="set_select(&quot;' . $id . '_option' . $key . '&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</option>';
2376
+ }
2377
+ $rep .= '</select><div id="' . $id . '_divform_id_temp">';
2378
+ if ( $param['w_quantity'] == "yes" ) {
2379
+ $rep .= '<span id="' . $id . '_element_quantity_spanform_id_temp" style="margin-right: 15px;"><label class="mini_label" id="' . $id . '_element_quantity_label_form_id_temp" style="margin-right: 5px;"><!--repstart-->Quantity<!--repend--></label><input type="text" value="' . $param['w_quantity_value'] . '" id="' . $id . '_element_quantityform_id_temp" name="' . $id . '_element_quantityform_id_temp" onkeypress="return check_isnum(event)" onchange="change_value(&quot;' . $id . '_element_quantityform_id_temp&quot;, this.value)" style="width: 30px; margin: 2px 0px;" disabled /></span>';
2380
+ }
2381
+ if ( $param['w_property'][0] ) {
2382
+ foreach ( $param['w_property'] as $key => $property ) {
2383
+ $rep .= '
2384
+ <span id="' . $id . '_property_' . $key . '" style="margin-right: 15px;">
2385
+
2386
+ <label class="mini_label" id="' . $id . '_property_label_form_id_temp' . $key . '" style="margin-right: 5px;">' . $property . '</label>
2387
+ <select id="' . $id . '_propertyform_id_temp' . $key . '" name="' . $id . '_propertyform_id_temp' . $key . '" style="width: auto; margin: 2px 0px;" disabled>';
2388
+ $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
2389
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
2390
+ foreach ( $param['w_property_values'][$key] as $subkey => $property_value ) {
2391
+ $rep .= '<option id="' . $id . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '">' . $property_value . '</option>';
2392
+ }
2393
+ $rep .= '</select></span>';
2394
+ }
2395
+ }
2396
+ $rep .= '</div></div></div>';
2397
+ break;
2398
+ }
2399
+ case 'type_paypal_checkbox': {
2400
+ $params_names = array(
2401
+ 'w_field_label_size',
2402
+ 'w_field_label_pos',
2403
+ 'w_flow',
2404
+ 'w_choices',
2405
+ 'w_choices_price',
2406
+ 'w_choices_checked',
2407
+ 'w_required',
2408
+ 'w_randomize',
2409
+ 'w_allow_other',
2410
+ 'w_allow_other_num',
2411
+ 'w_class',
2412
+ 'w_property',
2413
+ 'w_property_values',
2414
+ 'w_quantity',
2415
+ 'w_quantity_value',
2416
+ );
2417
+ $temp = $params;
2418
+ if ( strpos($temp, 'w_field_option_pos') > -1 ) {
2419
+ $params_names = array(
2420
+ 'w_field_label_size',
2421
+ 'w_field_label_pos',
2422
+ 'w_field_option_pos',
2423
+ 'w_flow',
2424
+ 'w_choices',
2425
+ 'w_choices_price',
2426
+ 'w_choices_checked',
2427
+ 'w_required',
2428
+ 'w_randomize',
2429
+ 'w_allow_other',
2430
+ 'w_allow_other_num',
2431
+ 'w_choices_params',
2432
+ 'w_class',
2433
+ 'w_property',
2434
+ 'w_property_values',
2435
+ 'w_quantity',
2436
+ 'w_quantity_value',
2437
+ );
2438
+ }
2439
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2440
+ $params_names = array(
2441
+ 'w_field_label_size',
2442
+ 'w_field_label_pos',
2443
+ 'w_field_option_pos',
2444
+ 'w_hide_label',
2445
+ 'w_flow',
2446
+ 'w_choices',
2447
+ 'w_choices_price',
2448
+ 'w_choices_checked',
2449
+ 'w_required',
2450
+ 'w_randomize',
2451
+ 'w_allow_other',
2452
+ 'w_allow_other_num',
2453
+ 'w_choices_params',
2454
+ 'w_class',
2455
+ 'w_property',
2456
+ 'w_property_values',
2457
+ 'w_quantity',
2458
+ 'w_quantity_value',
2459
+ );
2460
+ }
2461
+ foreach ( $params_names as $params_name ) {
2462
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2463
+ $param[$params_name] = $temp[0];
2464
+ $temp = $temp[1];
2465
+ }
2466
+ if ( $temp ) {
2467
+ $temp = explode('*:*w_attr_name*:*', $temp);
2468
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2469
+ foreach ( $attrs as $attr ) {
2470
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2471
+ }
2472
+ }
2473
+ if ( !isset($param['w_field_option_pos']) ) {
2474
+ $param['w_field_option_pos'] = 'left';
2475
+ }
2476
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2477
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2478
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2479
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2480
+ $param['w_choices'] = explode('***', $param['w_choices']);
2481
+ $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2482
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2483
+ $param['w_property'] = explode('***', $param['w_property']);
2484
+ $param['w_property_values'] = explode('***', $param['w_property_values']);
2485
+ if ( isset($param['w_choices_params']) ) {
2486
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2487
+ }
2488
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2489
+ if ( $choices_checked == 'true' ) {
2490
+ $param['w_choices_checked'][$key] = 'checked="checked"';
2491
+ }
2492
+ else {
2493
+ $param['w_choices_checked'][$key] = '';
2494
+ }
2495
+ }
2496
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_checkbox" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="wd_form_label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_paypal_checkbox" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_randomize'] . '" name="' . $id . '_randomizeform_id_temp" id="' . $id . '_randomizeform_id_temp"><input type="hidden" value="' . $param['w_allow_other'] . '" name="' . $id . '_allow_otherform_id_temp" id="' . $id . '_allow_otherform_id_temp"><input type="hidden" value="' . $param['w_allow_other_num'] . '" name="' . $id . '_allow_other_numform_id_temp" id="' . $id . '_allow_other_numform_id_temp"><input type="hidden" value="' . $param['w_field_option_pos'] . '" id="' . $id . '_option_left_right"><div style="display: table;"><div id="' . $id . '_table_little" style="display: table-row-group;">';
2497
+ if ( $param['w_flow'] == 'hor' ) {
2498
+ $rep .= '<div id="' . $id . '_hor" style="display: table-row;">';
2499
+ foreach ( $param['w_choices'] as $key => $choice ) {
2500
+ $where = '';
2501
+ $order_by = '';
2502
+ $db_info = '';
2503
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2504
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2505
+ $where = 'where="' . $w_choices_params[0] . '"';
2506
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2507
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2508
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2509
+ }
2510
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $key . '" idi="' . $key . '" style="display: table-cell;"><input type="checkbox" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp' . $key . '" value="' . $param['w_choices_price'][$key] . '" onclick="set_checked(&quot;' . $id . '&quot;,&quot;' . $key . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $key . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $key . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</label></div>';
2511
+ }
2512
+ $rep .= '</div>';
2513
+ }
2514
+ else {
2515
+ foreach ( $param['w_choices'] as $key => $choice ) {
2516
+ $where = '';
2517
+ $order_by = '';
2518
+ $db_info = '';
2519
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2520
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2521
+ $where = 'where="' . $w_choices_params[0] . '"';
2522
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2523
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2524
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2525
+ }
2526
+ $rep .= '<div id="' . $id . '_element_tr' . $key . '" style="display: table-row;"><div valign="top" id="' . $id . '_td_little' . $key . '" idi="' . $key . '" style="display: table-cell;"><input type="checkbox" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp' . $key . '" value="' . $param['w_choices_price'][$key] . '" onclick="set_checked(&quot;' . $id . '&quot;,&quot;' . $key . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $key . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $key . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</label></div></div>';
2527
+ }
2528
+ }
2529
+ $rep .= '</div></div>';
2530
+ $rep .= '<div id="' . $id . '_divform_id_temp">';
2531
+ if ( $param['w_quantity'] == "yes" ) {
2532
+ $rep .= '<span id="' . $id . '_element_quantity_spanform_id_temp" style="margin-right: 15px;"><label class="mini_label" id="' . $id . '_element_quantity_label_form_id_temp" style="margin-right: 5px;"><!--repstart-->Quantity<!--repend--></label><input type="text" value="' . $param['w_quantity_value'] . '" id="' . $id . '_element_quantityform_id_temp" name="' . $id . '_element_quantityform_id_temp" onkeypress="return check_isnum(event)" onchange="change_value(&quot;' . $id . '_element_quantityform_id_temp&quot;, this.value)" style="width: 30px; margin: 2px 0px;" disabled/></span>';
2533
+ }
2534
+ if ( $param['w_property'][0] ) {
2535
+ foreach ( $param['w_property'] as $key => $property ) {
2536
+ $rep .= '
2537
+ <span id="' . $id . '_property_' . $key . '" style="margin-right: 15px;">
2538
+
2539
+ <label class="mini_label" id="' . $id . '_property_label_form_id_temp' . $key . '" style="margin-right: 5px;">' . $property . '</label>
2540
+ <select id="' . $id . '_propertyform_id_temp' . $key . '" name="' . $id . '_propertyform_id_temp' . $key . '" style="width: auto; margin: 2px 0px;" disabled>';
2541
+ $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
2542
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
2543
+ foreach ( $param['w_property_values'][$key] as $subkey => $property_value ) {
2544
+ $rep .= '<option id="' . $id . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '">' . $property_value . '</option>';
2545
+ }
2546
+ $rep .= '</select></span>';
2547
+ }
2548
+ }
2549
+ $rep .= '</div></div></div>';
2550
+ break;
2551
+ }
2552
+ case 'type_paypal_radio': {
2553
+ $params_names = array(
2554
+ 'w_field_label_size',
2555
+ 'w_field_label_pos',
2556
+ 'w_flow',
2557
+ 'w_choices',
2558
+ 'w_choices_price',
2559
+ 'w_choices_checked',
2560
+ 'w_required',
2561
+ 'w_randomize',
2562
+ 'w_allow_other',
2563
+ 'w_allow_other_num',
2564
+ 'w_class',
2565
+ 'w_property',
2566
+ 'w_property_values',
2567
+ 'w_quantity',
2568
+ 'w_quantity_value',
2569
+ );
2570
+ $temp = $params;
2571
+ if ( strpos($temp, 'w_field_option_pos') > -1 ) {
2572
+ $params_names = array(
2573
+ 'w_field_label_size',
2574
+ 'w_field_label_pos',
2575
+ 'w_field_option_pos',
2576
+ 'w_flow',
2577
+ 'w_choices',
2578
+ 'w_choices_price',
2579
+ 'w_choices_checked',
2580
+ 'w_required',
2581
+ 'w_randomize',
2582
+ 'w_allow_other',
2583
+ 'w_allow_other_num',
2584
+ 'w_choices_params',
2585
+ 'w_class',
2586
+ 'w_property',
2587
+ 'w_property_values',
2588
+ 'w_quantity',
2589
+ 'w_quantity_value',
2590
+ );
2591
+ }
2592
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2593
+ $params_names = array(
2594
+ 'w_field_label_size',
2595
+ 'w_field_label_pos',
2596
+ 'w_field_option_pos',
2597
+ 'w_hide_label',
2598
+ 'w_flow',
2599
+ 'w_choices',
2600
+ 'w_choices_price',
2601
+ 'w_choices_checked',
2602
+ 'w_required',
2603
+ 'w_randomize',
2604
+ 'w_allow_other',
2605
+ 'w_allow_other_num',
2606
+ 'w_choices_params',
2607
+ 'w_class',
2608
+ 'w_property',
2609
+ 'w_property_values',
2610
+ 'w_quantity',
2611
+ 'w_quantity_value',
2612
+ );
2613
+ }
2614
+ foreach ( $params_names as $params_name ) {
2615
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2616
+ $param[$params_name] = $temp[0];
2617
+ $temp = $temp[1];
2618
+ }
2619
+ if ( $temp ) {
2620
+ $temp = explode('*:*w_attr_name*:*', $temp);
2621
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2622
+ foreach ( $attrs as $attr ) {
2623
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2624
+ }
2625
+ }
2626
+ if ( !isset($param['w_field_option_pos']) ) {
2627
+ $param['w_field_option_pos'] = 'left';
2628
+ }
2629
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2630
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2631
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2632
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2633
+ $param['w_choices'] = explode('***', $param['w_choices']);
2634
+ $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2635
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2636
+ $param['w_property'] = explode('***', $param['w_property']);
2637
+ $param['w_property_values'] = explode('***', $param['w_property_values']);
2638
+ if ( isset($param['w_choices_params']) ) {
2639
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2640
+ }
2641
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2642
+ if ( $choices_checked == 'true' ) {
2643
+ $param['w_choices_checked'][$key] = 'checked="checked"';
2644
+ }
2645
+ else {
2646
+ $param['w_choices_checked'][$key] = '';
2647
+ }
2648
+ }
2649
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_radio" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="wd_form_label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_paypal_radio" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_randomize'] . '" name="' . $id . '_randomizeform_id_temp" id="' . $id . '_randomizeform_id_temp"><input type="hidden" value="' . $param['w_allow_other'] . '" name="' . $id . '_allow_otherform_id_temp" id="' . $id . '_allow_otherform_id_temp"><input type="hidden" value="' . $param['w_allow_other_num'] . '" name="' . $id . '_allow_other_numform_id_temp" id="' . $id . '_allow_other_numform_id_temp"><input type="hidden" value="' . $param['w_field_option_pos'] . '" id="' . $id . '_option_left_right"><div style="display: table;"><div id="' . $id . '_table_little" style="display: table-row-group;">';
2650
+ if ( $param['w_flow'] == 'hor' ) {
2651
+ $rep .= '<div id="' . $id . '_hor" style="display: table-row;">';
2652
+ foreach ( $param['w_choices'] as $key => $choice ) {
2653
+ $where = '';
2654
+ $order_by = '';
2655
+ $db_info = '';
2656
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2657
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2658
+ $where = 'where="' . $w_choices_params[0] . '"';
2659
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2660
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2661
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2662
+ }
2663
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $key . '" idi="' . $key . '" style="display: table-cell;"><input type="radio" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp" value="' . $param['w_choices_price'][$key] . '" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . $key . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $key . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $key . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</label></div>';
2664
+ }
2665
+ $rep .= '</div>';
2666
+ }
2667
+ else {
2668
+ foreach ( $param['w_choices'] as $key => $choice ) {
2669
+ $where = '';
2670
+ $order_by = '';
2671
+ $db_info = '';
2672
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2673
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2674
+ $where = 'where="' . $w_choices_params[0] . '"';
2675
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2676
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2677
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2678
+ }
2679
+ $rep .= '<div id="' . $id . '_element_tr' . $key . '" style="display: table-row;"><div valign="top" id="' . $id . '_td_little' . $key . '" idi="' . $key . '" style="display: table-cell;"><input type="radio" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp" value="' . $param['w_choices_price'][$key] . '" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . $key . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $key . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $key . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</label></div></div>';
2680
+ }
2681
+ }
2682
+ $rep .= '</div></div>';
2683
+ $rep .= '<div id="' . $id . '_divform_id_temp">';
2684
+ if ( $param['w_quantity'] == "yes" ) {
2685
+ $rep .= '<span id="' . $id . '_element_quantity_spanform_id_temp" style="margin-right: 15px;"><label class="mini_label" id="' . $id . '_element_quantity_label_form_id_temp" style="margin-right: 5px;"><!--repstart-->Quantity<!--repend--></label><input type="text" value="' . $param['w_quantity_value'] . '" id="' . $id . '_element_quantityform_id_temp" name="' . $id . '_element_quantityform_id_temp" onkeypress="return check_isnum(event)" onchange="change_value(&quot;' . $id . '_element_quantityform_id_temp&quot;, this.value)" style="width: 30px; margin: 2px 0px;" disabled/></span>';
2686
+ }
2687
+ if ( $param['w_property'][0] ) {
2688
+ foreach ( $param['w_property'] as $key => $property ) {
2689
+ $rep .= '
2690
+ <span id="' . $id . '_property_' . $key . '" style="margin-right: 15px;">
2691
+
2692
+ <label class="mini_label" id="' . $id . '_property_label_form_id_temp' . $key . '" style="margin-right: 5px;">' . $property . '</label>
2693
+ <select id="' . $id . '_propertyform_id_temp' . $key . '" name="' . $id . '_propertyform_id_temp' . $key . '" style="width: auto; margin: 2px 0px;" disabled>';
2694
+ $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
2695
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
2696
+ foreach ( $param['w_property_values'][$key] as $subkey => $property_value ) {
2697
+ $rep .= '<option id="' . $id . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '">' . $property_value . '</option>';
2698
+ }
2699
+ $rep .= '</select></span>';
2700
+ }
2701
+ }
2702
+ $rep .= '</div></div></div>';
2703
+ break;
2704
+ }
2705
+ case 'type_paypal_shipping': {
2706
+ $params_names = array(
2707
+ 'w_field_label_size',
2708
+ 'w_field_label_pos',
2709
+ 'w_flow',
2710
+ 'w_choices',
2711
+ 'w_choices_price',
2712
+ 'w_choices_checked',
2713
+ 'w_required',
2714
+ 'w_randomize',
2715
+ 'w_allow_other',
2716
+ 'w_allow_other_num',
2717
+ 'w_class',
2718
+ );
2719
+ $temp = $params;
2720
+ if ( strpos($temp, 'w_field_option_pos') > -1 ) {
2721
+ $params_names = array(
2722
+ 'w_field_label_size',
2723
+ 'w_field_label_pos',
2724
+ 'w_field_option_pos',
2725
+ 'w_flow',
2726
+ 'w_choices',
2727
+ 'w_choices_price',
2728
+ 'w_choices_checked',
2729
+ 'w_required',
2730
+ 'w_randomize',
2731
+ 'w_allow_other',
2732
+ 'w_allow_other_num',
2733
+ 'w_choices_params',
2734
+ 'w_class',
2735
+ );
2736
+ }
2737
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2738
+ $params_names = array(
2739
+ 'w_field_label_size',
2740
+ 'w_field_label_pos',
2741
+ 'w_field_option_pos',
2742
+ 'w_hide_label',
2743
+ 'w_flow',
2744
+ 'w_choices',
2745
+ 'w_choices_price',
2746
+ 'w_choices_checked',
2747
+ 'w_required',
2748
+ 'w_randomize',
2749
+ 'w_allow_other',
2750
+ 'w_allow_other_num',
2751
+ 'w_choices_params',
2752
+ 'w_class',
2753
+ );
2754
+ }
2755
+ foreach ( $params_names as $params_name ) {
2756
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2757
+ $param[$params_name] = $temp[0];
2758
+ $temp = $temp[1];
2759
+ }
2760
+ if ( $temp ) {
2761
+ $temp = explode('*:*w_attr_name*:*', $temp);
2762
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2763
+ foreach ( $attrs as $attr ) {
2764
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2765
+ }
2766
+ }
2767
+ if ( !isset($param['w_field_option_pos']) ) {
2768
+ $param['w_field_option_pos'] = 'left';
2769
+ }
2770
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2771
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2772
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2773
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2774
+ $param['w_choices'] = explode('***', $param['w_choices']);
2775
+ $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2776
+ $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2777
+ if ( isset($param['w_choices_params']) ) {
2778
+ $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2779
+ }
2780
+ foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2781
+ if ( $choices_checked == 'true' ) {
2782
+ $param['w_choices_checked'][$key] = 'checked="checked"';
2783
+ }
2784
+ else {
2785
+ $param['w_choices_checked'][$key] = '';
2786
+ }
2787
+ }
2788
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_shipping" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="wd_form_label" style="vertical-align: top;">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required" style="vertical-align: top;">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; vertical-align:top;"><input type="hidden" value="type_paypal_shipping" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_randomize'] . '" name="' . $id . '_randomizeform_id_temp" id="' . $id . '_randomizeform_id_temp"><input type="hidden" value="' . $param['w_allow_other'] . '" name="' . $id . '_allow_otherform_id_temp" id="' . $id . '_allow_otherform_id_temp"><input type="hidden" value="' . $param['w_allow_other_num'] . '" name="' . $id . '_allow_other_numform_id_temp" id="' . $id . '_allow_other_numform_id_temp"><input type="hidden" value="' . $param['w_field_option_pos'] . '" id="' . $id . '_option_left_right"><div style="display: table;"><div id="' . $id . '_table_little" style="display: table-row-group;">';
2789
+ if ( $param['w_flow'] == 'hor' ) {
2790
+ $rep .= '<div id="' . $id . '_hor" style="display: table-row;">';
2791
+ foreach ( $param['w_choices'] as $key => $choice ) {
2792
+ $where = '';
2793
+ $order_by = '';
2794
+ $db_info = '';
2795
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2796
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2797
+ $where = 'where="' . $w_choices_params[0] . '"';
2798
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2799
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2800
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2801
+ }
2802
+ $rep .= '<div valign="top" id="' . $id . '_td_little' . $key . '" idi="' . $key . '" style="display: table-cell;"><input type="radio" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp" value="' . $param['w_choices_price'][$key] . '" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . $key . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $key . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $key . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</label></div>';
2803
+ }
2804
+ $rep .= '</div>';
2805
+ }
2806
+ else {
2807
+ foreach ( $param['w_choices'] as $key => $choice ) {
2808
+ $where = '';
2809
+ $order_by = '';
2810
+ $db_info = '';
2811
+ if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2812
+ $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2813
+ $where = 'where="' . $w_choices_params[0] . '"';
2814
+ $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2815
+ $order_by = "order_by='" . $w_choices_params[0] . "'";
2816
+ $db_info = "db_info='" . $w_choices_params[1] . "'";
2817
+ }
2818
+ $rep .= '<div id="' . $id . '_element_tr' . $key . '" style="display: table-row;"><div valign="top" id="' . $id . '_td_little' . $key . '" idi="' . $key . '" style="display: table-cell;"><input type="radio" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp" value="' . $param['w_choices_price'][$key] . '" onclick="set_default(&quot;' . $id . '&quot;,&quot;' . $key . '&quot;,&quot;form_id_temp&quot;)" ' . $param['w_choices_checked'][$key] . ' ' . $param['attributes'] . ' ' . ($param['w_field_option_pos'] == 'right' ? 'style="float:left !important;"' : "") . ' disabled/><label id="' . $id . '_label_element' . $key . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $key . '" ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $choice . '</label></div></div>';
2819
+ }
2820
+ }
2821
+ $rep .= '</div></div>';
2822
+ $rep .= '</div></div>';
2823
+ break;
2824
+ }
2825
+ case 'type_paypal_total': {
2826
+ $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_class' );
2827
+ $temp = $params;
2828
+ if ( strpos($temp, 'w_size') > -1 ) {
2829
+ $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_class', 'w_size' );
2830
+ }
2831
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2832
+ $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_class', 'w_size' );
2833
+ }
2834
+ foreach ( $params_names as $params_name ) {
2835
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2836
+ $param[$params_name] = $temp[0];
2837
+ $temp = $temp[1];
2838
+ }
2839
+ if ( $temp ) {
2840
+ $temp = explode('*:*w_attr_name*:*', $temp);
2841
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2842
+ foreach ( $attrs as $attr ) {
2843
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2844
+ }
2845
+ }
2846
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2847
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2848
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2849
+ $param['w_size'] = isset($param['w_size']) ? $param['w_size'] : '300';
2850
+ $rep = '<div id="wdform_field' . $id . '" type="type_paypal_total" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_paypal_total" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><div id="' . $id . 'paypal_totalform_id_temp" class="wdform_paypal_total paypal_totalform_id_temp" style="width:' . $param['w_size'] . 'px;"><input type="hidden" value="" name="' . $id . '_paypal_totalform_id_temp" class="input_paypal_totalform_id_temp"><div id="' . $id . 'div_totalform_id_temp" class="div_totalform_id_temp" style="margin-bottom: 10px;"><!--repstart-->$300<!--repend--></div><div id="' . $id . 'paypal_productsform_id_temp" class="paypal_productsform_id_temp" style="border-spacing: 2px;"><div style="border-spacing: 2px;"><!--repstart-->product 1 $100<!--repend--></div><div style="border-spacing: 2px;"><!--repstart-->product 2 $200<!--repend--></div></div><div id="' . $id . 'paypal_taxform_id_temp" class="paypal_taxform_id_temp" style="border-spacing: 2px; margin-top: 7px;"></div></div></div></div>';
2851
+ break;
2852
+ }
2853
+ case 'type_stripe': {
2854
+ $params_names = array( 'w_field_size', 'w_field_label_size', 'w_field_label_pos', 'w_class' );
2855
+ $temp = $params;
2856
+ foreach ( $params_names as $params_name ) {
2857
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2858
+ $param[$params_name] = $temp[0];
2859
+ $temp = $temp[1];
2860
+ }
2861
+ if ( $temp ) {
2862
+ $temp = explode('*:*w_attr_name*:*', $temp);
2863
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2864
+ foreach ( $attrs as $attr ) {
2865
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2866
+ }
2867
+ }
2868
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2869
+ $rep = '<div id="wdform_field' . $id . '" type="type_stripe" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label" style="display: none;">stripe</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><div id="' . $id . '_elementform_id_temp" style="width:' . $param['w_field_size'] . 'px; margin:10px; border: 1px solid #000; min-width:80px;text-align:center;"> Stripe Section</div><input type="hidden" id="is_stripe" /><input type="hidden" value="type_stripe" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"></div></div>';
2870
+ break;
2871
+ }
2872
+ case 'type_star_rating': {
2873
+ $params_names = array(
2874
+ 'w_field_label_size',
2875
+ 'w_field_label_pos',
2876
+ 'w_field_label_col',
2877
+ 'w_star_amount',
2878
+ 'w_required',
2879
+ 'w_class',
2880
+ );
2881
+ $temp = $params;
2882
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2883
+ $params_names = array(
2884
+ 'w_field_label_size',
2885
+ 'w_field_label_pos',
2886
+ 'w_hide_label',
2887
+ 'w_field_label_col',
2888
+ 'w_star_amount',
2889
+ 'w_required',
2890
+ 'w_class',
2891
+ );
2892
+ }
2893
+ foreach ( $params_names as $params_name ) {
2894
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2895
+ $param[$params_name] = $temp[0];
2896
+ $temp = $temp[1];
2897
+ }
2898
+ if ( $temp ) {
2899
+ $temp = explode('*:*w_attr_name*:*', $temp);
2900
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2901
+ foreach ( $attrs as $attr ) {
2902
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2903
+ }
2904
+ }
2905
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2906
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2907
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2908
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2909
+ $images = '';
2910
+ for ( $i = 0; $i < $param['w_star_amount']; $i++ ) {
2911
+ $images .= '<img id="' . $id . '_star_' . $i . '" src="' . WDFM()->plugin_url . '/images/star.png?ver=' . WDFM()->plugin_version . '" onmouseover="change_src(' . $i . ',' . $id . ',&quot;form_id_temp&quot;)" onmouseout="reset_src(' . $i . ',' . $id . ')" onclick="select_star_rating(' . $i . ',' . $id . ', &quot;form_id_temp&quot;)">';
2912
+ }
2913
+ $rep = '<div id="wdform_field' . $id . '" type="type_star_rating" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_star_rating" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_star_amount'] . '" id="' . $id . '_star_amountform_id_temp" name="' . $id . '_star_amountform_id_temp"><input type="hidden" value="' . $param['w_field_label_col'] . '" name="' . $id . '_star_colorform_id_temp" id="' . $id . '_star_colorform_id_temp"><div id="' . $id . '_elementform_id_temp" class="wdform_stars" ' . $param['attributes'] . '>' . $images . '</div></div></div>';
2914
+ break;
2915
+ }
2916
+ case 'type_scale_rating': {
2917
+ $params_names = array(
2918
+ 'w_field_label_size',
2919
+ 'w_field_label_pos',
2920
+ 'w_mini_labels',
2921
+ 'w_scale_amount',
2922
+ 'w_required',
2923
+ 'w_class',
2924
+ );
2925
+ $temp = $params;
2926
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2927
+ $params_names = array(
2928
+ 'w_field_label_size',
2929
+ 'w_field_label_pos',
2930
+ 'w_hide_label',
2931
+ 'w_mini_labels',
2932
+ 'w_scale_amount',
2933
+ 'w_required',
2934
+ 'w_class',
2935
+ );
2936
+ }
2937
+ foreach ( $params_names as $params_name ) {
2938
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2939
+ $param[$params_name] = $temp[0];
2940
+ $temp = $temp[1];
2941
+ }
2942
+ if ( $temp ) {
2943
+ $temp = explode('*:*w_attr_name*:*', $temp);
2944
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2945
+ foreach ( $attrs as $attr ) {
2946
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2947
+ }
2948
+ }
2949
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2950
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2951
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2952
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2953
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
2954
+ $numbers = '';
2955
+ for ( $i = 1; $i <= $param['w_scale_amount']; $i++ ) {
2956
+ $numbers .= '<div id="' . $id . '_scale_td1_' . $i . 'form_id_temp" style="text-align: center; display: table-cell;"><span>' . $i . '</span></div>';
2957
+ }
2958
+ $radio_buttons = '';
2959
+ for ( $k = 1; $k <= $param['w_scale_amount']; $k++ ) {
2960
+ $radio_buttons .= '<div id="' . $id . '_scale_td2_' . $k . 'form_id_temp" style="display: table-cell;"><input id="' . $id . '_scale_radioform_id_temp_' . $k . '" name="' . $id . '_scale_radioform_id_temp" value="' . $k . '" type="radio"></div>';
2961
+ }
2962
+ $rep = '<div id="wdform_field' . $id . '" type="type_scale_rating" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; vertical-align: top; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_scale_rating" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_scale_amount'] . '" id="' . $id . '_scale_amountform_id_temp" name="' . $id . '_scale_amountform_id_temp"><div id="' . $id . '_elementform_id_temp" style="float: left;" ' . $param['attributes'] . '><label class="mini_label" id="' . $id . '_mini_label_worst" style="position: relative; top: 6px; font-size: 11px; display: inline-table;">' . $w_mini_labels[0] . '</label><div id="' . $id . '_scale_tableform_id_temp" style="display: inline-table;"><div id="' . $id . '_scale_tr1form_id_temp" style="display: table-row;">' . $numbers . '</div><div id="' . $id . '_scale_tr2form_id_temp" style="display: table-row;">' . $radio_buttons . '</div></div><label class="mini_label" id="' . $id . '_mini_label_best" style="position: relative; top: 6px; font-size: 11px; display: inline-table;">' . $w_mini_labels[1] . '</label></div></div></div>';
2963
+ break;
2964
+ }
2965
+ case 'type_spinner': {
2966
+ $params_names = array(
2967
+ 'w_field_label_size',
2968
+ 'w_field_label_pos',
2969
+ 'w_field_width',
2970
+ 'w_field_min_value',
2971
+ 'w_field_max_value',
2972
+ 'w_field_step',
2973
+ 'w_field_value',
2974
+ 'w_required',
2975
+ 'w_class',
2976
+ );
2977
+ $temp = $params;
2978
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
2979
+ $params_names = array(
2980
+ 'w_field_label_size',
2981
+ 'w_field_label_pos',
2982
+ 'w_hide_label',
2983
+ 'w_field_width',
2984
+ 'w_field_min_value',
2985
+ 'w_field_max_value',
2986
+ 'w_field_step',
2987
+ 'w_field_value',
2988
+ 'w_required',
2989
+ 'w_class',
2990
+ );
2991
+ }
2992
+ foreach ( $params_names as $params_name ) {
2993
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
2994
+ $param[$params_name] = $temp[0];
2995
+ $temp = $temp[1];
2996
+ }
2997
+ if ( $temp ) {
2998
+ $temp = explode('*:*w_attr_name*:*', $temp);
2999
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3000
+ foreach ( $attrs as $attr ) {
3001
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3002
+ }
3003
+ }
3004
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3005
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3006
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3007
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3008
+ $rep = '<div id="wdform_field' . $id . '" type="type_spinner" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_spinner" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_field_width'] . '" name="' . $id . '_spinner_widthform_id_temp" id="' . $id . '_spinner_widthform_id_temp"><input type="hidden" value="' . $param['w_field_min_value'] . '" id="' . $id . '_min_valueform_id_temp" name="' . $id . '_min_valueform_id_temp"><input type="hidden" value="' . $param['w_field_max_value'] . '" name="' . $id . '_max_valueform_id_temp" id="' . $id . '_max_valueform_id_temp"><input type="hidden" value="' . $param['w_field_step'] . '" name="' . $id . '_stepform_id_temp" id="' . $id . '_stepform_id_temp"><input type="" value="' . ($param['w_field_value'] != 'null' ? $param['w_field_value'] : '') . '" name="' . $id . '_elementform_id_temp" id="' . $id . '_elementform_id_temp" onkeypress="return check_isnum_or_minus(event)" style="width: ' . $param['w_field_width'] . 'px;" ' . $param['attributes'] . ' disabled/></div></div>';
3009
+ break;
3010
+ }
3011
+ case 'type_slider': {
3012
+ $params_names = array(
3013
+ 'w_field_label_size',
3014
+ 'w_field_label_pos',
3015
+ 'w_field_width',
3016
+ 'w_field_min_value',
3017
+ 'w_field_max_value',
3018
+ 'w_field_value',
3019
+ 'w_required',
3020
+ 'w_class',
3021
+ );
3022
+ $temp = $params;
3023
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
3024
+ $params_names = array(
3025
+ 'w_field_label_size',
3026
+ 'w_field_label_pos',
3027
+ 'w_hide_label',
3028
+ 'w_field_width',
3029
+ 'w_field_min_value',
3030
+ 'w_field_max_value',
3031
+ 'w_field_value',
3032
+ 'w_required',
3033
+ 'w_class',
3034
+ );
3035
+ }
3036
+ foreach ( $params_names as $params_name ) {
3037
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
3038
+ $param[$params_name] = $temp[0];
3039
+ $temp = $temp[1];
3040
+ }
3041
+ if ( $temp ) {
3042
+ $temp = explode('*:*w_attr_name*:*', $temp);
3043
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3044
+ foreach ( $attrs as $attr ) {
3045
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3046
+ }
3047
+ }
3048
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3049
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3050
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3051
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3052
+ $rep = '<div id="wdform_field' . $id . '" type="type_slider" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; vertical-align: top; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_slider" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_field_width'] . '" name="' . $id . '_slider_widthform_id_temp" id="' . $id . '_slider_widthform_id_temp"><input type="hidden" value="' . $param['w_field_min_value'] . '" id="' . $id . '_slider_min_valueform_id_temp" name="' . $id . '_slider_min_valueform_id_temp"><input type="hidden" value="' . $param['w_field_max_value'] . '" id="' . $id . '_slider_max_valueform_id_temp" name="' . $id . '_slider_max_valueform_id_temp"><input type="hidden" value="' . $param['w_field_value'] . '" id="' . $id . '_slider_valueform_id_temp" name="' . $id . '_slider_valueform_id_temp"><div id="' . $id . '_slider_tableform_id_temp"><div><div id="' . $id . '_slider_td1form_id_temp"><div name="' . $id . '_elementform_id_temp" id="' . $id . '_elementform_id_temp" style="width: ' . $param['w_field_width'] . 'px;" ' . $param['attributes'] . '"></div></div></div><div><div align="left" id="' . $id . '_slider_td2form_id_temp" style="display: inline-table; width: 33.3%; text-align: left;"><span id="' . $id . '_element_minform_id_temp" class="label">' . $param['w_field_min_value'] . '</span></div><div align="right" id="' . $id . '_slider_td3form_id_temp" style="display: inline-table; width: 33.3%; text-align: center;"><span id="' . $id . '_element_valueform_id_temp" class="label">' . $param['w_field_value'] . '</span></div><div align="right" id="' . $id . '_slider_td4form_id_temp" style="display: inline-table; width: 33.3%; text-align: right;"><span id="' . $id . '_element_maxform_id_temp" class="label">' . $param['w_field_max_value'] . '</span></div></div></div></div></div>';
3053
+ break;
3054
+ }
3055
+ case 'type_range': {
3056
+ $params_names = array(
3057
+ 'w_field_label_size',
3058
+ 'w_field_label_pos',
3059
+ 'w_field_range_width',
3060
+ 'w_field_range_step',
3061
+ 'w_field_value1',
3062
+ 'w_field_value2',
3063
+ 'w_mini_labels',
3064
+ 'w_required',
3065
+ 'w_class',
3066
+ );
3067
+ $temp = $params;
3068
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
3069
+ $params_names = array(
3070
+ 'w_field_label_size',
3071
+ 'w_field_label_pos',
3072
+ 'w_hide_label',
3073
+ 'w_field_range_width',
3074
+ 'w_field_range_step',
3075
+ 'w_field_value1',
3076
+ 'w_field_value2',
3077
+ 'w_mini_labels',
3078
+ 'w_required',
3079
+ 'w_class',
3080
+ );
3081
+ }
3082
+ foreach ( $params_names as $params_name ) {
3083
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
3084
+ $param[$params_name] = $temp[0];
3085
+ $temp = $temp[1];
3086
+ }
3087
+ if ( $temp ) {
3088
+ $temp = explode('*:*w_attr_name*:*', $temp);
3089
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3090
+ foreach ( $attrs as $attr ) {
3091
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3092
+ }
3093
+ }
3094
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3095
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3096
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3097
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3098
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
3099
+ $rep = '<div id="wdform_field' . $id . '" type="type_range" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_range" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_field_range_width'] . '" name="' . $id . '_range_widthform_id_temp" id="' . $id . '_range_widthform_id_temp"><input type="hidden" value="' . $param['w_field_range_step'] . '" name="' . $id . '_range_stepform_id_temp" id="' . $id . '_range_stepform_id_temp"><div id="' . $id . '_elemet_table_littleform_id_temp" style="display: table;"><div style="display: table-row;"><div valign="middle" align="left" style="display: table-cell;"><input type="" value="' . ($param['w_field_value1'] != 'null' ? $param['w_field_value1'] : '') . '" name="' . $id . '_elementform_id_temp0" id="' . $id . '_elementform_id_temp0" onkeypress="return check_isnum_or_minus(event)" style="width: ' . $param['w_field_range_width'] . 'px;" ' . $param['attributes'] . ' disabled/></div><div valign="middle" align="left" style="display: table-cell; padding-left: 4px;"><input type="" value="' . ($param['w_field_value2'] != 'null' ? $param['w_field_value2'] : '') . '" name="' . $id . '_elementform_id_temp1" id="' . $id . '_elementform_id_temp1" onkeypress="return check_isnum_or_minus(event)" style="width: ' . $param['w_field_range_width'] . 'px;" ' . $param['attributes'] . ' disabled/></div></div><div style="display: table-row;"><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_from">' . $w_mini_labels[0] . '</label></div><div valign="top" align="left" style="display: table-cell;"><label class="mini_label" id="' . $id . '_mini_label_to">' . $w_mini_labels[1] . '</label></div></div></div></div></div>';
3100
+ break;
3101
+ }
3102
+ case 'type_grading': {
3103
+ $params_names = array(
3104
+ 'w_field_label_size',
3105
+ 'w_field_label_pos',
3106
+ 'w_items',
3107
+ 'w_total',
3108
+ 'w_required',
3109
+ 'w_class',
3110
+ );
3111
+ $temp = $params;
3112
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
3113
+ $params_names = array(
3114
+ 'w_field_label_size',
3115
+ 'w_field_label_pos',
3116
+ 'w_hide_label',
3117
+ 'w_items',
3118
+ 'w_total',
3119
+ 'w_required',
3120
+ 'w_class',
3121
+ );
3122
+ }
3123
+ foreach ( $params_names as $params_name ) {
3124
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
3125
+ $param[$params_name] = $temp[0];
3126
+ $temp = $temp[1];
3127
+ }
3128
+ if ( $temp ) {
3129
+ $temp = explode('*:*w_attr_name*:*', $temp);
3130
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3131
+ foreach ( $attrs as $attr ) {
3132
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3133
+ }
3134
+ }
3135
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3136
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3137
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3138
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3139
+ $w_items = explode('***', $param['w_items']);
3140
+ $grading_items = '';
3141
+ for ( $i = 0; $i < count($w_items); $i++ ) {
3142
+ $grading_items .= '<div id="' . $id . '_element_div' . $i . '" class="grading"><input id="' . $id . '_elementform_id_temp_' . $i . '" name="' . $id . '_elementform_id_temp_' . $i . '" onkeypress="return check_isnum_or_minus(event)" value="" type="text" size="5" onkeyup="sum_grading_values(' . $id . ',&quot;form_id_temp&quot;)" onchange="sum_grading_values(' . $id . ',&quot;form_id_temp&quot;)" ' . $param['attributes'] . ' disabled/><label id="' . $id . '_label_elementform_id_temp' . $i . '" class="ch-rad-label">' . $w_items[$i] . '</label></div>';
3143
+ }
3144
+ $rep = '<div id="wdform_field' . $id . '" type="type_grading" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; vertical-align: top; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_grading" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_total'] . '" name="' . $id . '_grading_totalform_id_temp" id="' . $id . '_grading_totalform_id_temp"><div id="' . $id . '_elementform_id_temp">' . $grading_items . '<div id="' . $id . '_element_total_divform_id_temp" class="grading_div">Total:<span id="' . $id . '_sum_elementform_id_temp" name="' . $id . '_sum_elementform_id_temp">0</span>/<span id="' . $id . '_total_elementform_id_temp" name="' . $id . '_total_elementform_id_temp">' . $param['w_total'] . '</span><span id="' . $id . '_text_elementform_id_temp" name="' . $id . '_text_elementform_id_temp"></span></div></div></div></div>';
3145
+ break;
3146
+ }
3147
+ case 'type_matrix': {
3148
+ $params_names = array(
3149
+ 'w_field_label_size',
3150
+ 'w_field_label_pos',
3151
+ 'w_field_input_type',
3152
+ 'w_rows',
3153
+ 'w_columns',
3154
+ 'w_required',
3155
+ 'w_class',
3156
+ 'w_textbox_size',
3157
+ );
3158
+ $temp = $params;
3159
+ if ( strpos($temp, 'w_hide_label') > -1 ) {
3160
+ $params_names = array(
3161
+ 'w_field_label_size',
3162
+ 'w_field_label_pos',
3163
+ 'w_hide_label',
3164
+ 'w_field_input_type',
3165
+ 'w_rows',
3166
+ 'w_columns',
3167
+ 'w_required',
3168
+ 'w_class',
3169
+ 'w_textbox_size',
3170
+ );
3171
+ }
3172
+ foreach ( $params_names as $params_name ) {
3173
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
3174
+ $param[$params_name] = $temp[0];
3175
+ $temp = $temp[1];
3176
+ }
3177
+ if ( $temp ) {
3178
+ $temp = explode('*:*w_attr_name*:*', $temp);
3179
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3180
+ foreach ( $attrs as $attr ) {
3181
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3182
+ }
3183
+ }
3184
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3185
+ $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3186
+ $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3187
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3188
+ $param['w_textbox_size'] = isset($param['w_textbox_size']) ? $param['w_textbox_size'] : '100';
3189
+ $w_rows = explode('***', $param['w_rows']);
3190
+ $w_columns = explode('***', $param['w_columns']);
3191
+ $column_labels = '';
3192
+ for ( $i = 1; $i < count($w_columns); $i++ ) {
3193
+ $column_labels .= '<div id="' . $id . '_element_td0_' . $i . '" class="matrix_" style="display: table-cell;"><label id="' . $id . '_label_elementform_id_temp0_' . $i . '" name="' . $id . '_label_elementform_id_temp0_' . $i . '" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $i . '" value="' . $w_columns[$i] . '">' . $w_columns[$i] . '</label></div>';
3194
+ }
3195
+ $rows_columns = '';
3196
+ for ( $i = 1; $i < count($w_rows); $i++ ) {
3197
+ $rows_columns .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;"><div id="' . $id . '_element_td' . $i . '_0" class="matrix_" style="display: table-cell;"><label id="' . $id . '_label_elementform_id_temp' . $i . '_0" class="ch-rad-label" for="' . $id . '_elementform_id_temp' . $i . '" value="' . $w_rows[$i] . '">' . $w_rows[$i] . '</label></div>';
3198
+ for ( $k = 1; $k < count($w_columns); $k++ ) {
3199
+ if ( $param['w_field_input_type'] == 'radio' ) {
3200
+ $rows_columns .= '<div id="' . $id . '_element_td' . $i . '_' . $k . '" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><input id="' . $id . '_input_elementform_id_temp' . $i . '_' . $k . '" align="center" size="14" type="radio" name="' . $id . '_input_elementform_id_temp' . $i . '" value="' . $i . '_' . $k . '" disabled/></div>';
3201
+ }
3202
+ else {
3203
+ if ( $param['w_field_input_type'] == 'checkbox' ) {
3204
+ $rows_columns .= '<div id="' . $id . '_element_td' . $i . '_' . $k . '" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><input id="' . $id . '_input_elementform_id_temp' . $i . '_' . $k . '" align="center" size="14" type="checkbox" name="' . $id . '_input_elementform_id_temp' . $i . '_' . $k . '" value="1" disabled/></div>';
3205
+ }
3206
+ else {
3207
+ if ( $param['w_field_input_type'] == 'text' ) {
3208
+ $rows_columns .= '<div id="' . $id . '_element_td' . $i . '_' . $k . '" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><input id="' . $id . '_input_elementform_id_temp' . $i . '_' . $k . '" align="center" type="text" name="' . $id . '_input_elementform_id_temp' . $i . '_' . $k . '" value="" style="width:' . $param['w_textbox_size'] . 'px" disabled/></div>';
3209
+ }
3210
+ else {
3211
+ if ( $param['w_field_input_type'] == 'select' ) {
3212
+ $rows_columns .= '<div id="' . $id . '_element_td' . $i . '_' . $k . '" style="text-align: center; display: table-cell; padding: 5px 0 0 5px;"><select id="' . $id . '_select_yes_noform_id_temp' . $i . '_' . $k . '" name="' . $id . '_select_yes_noform_id_temp' . $i . '_' . $k . '" disabled><option value=""> </option><option value="yes">Yes</option><option value="no">No</option></select></div>';
3213
+ }
3214
+ }
3215
+ }
3216
+ }
3217
+ }
3218
+ $rows_columns .= '</div>';
3219
+ }
3220
+ $rep = '<div id="wdform_field' . $id . '" type="type_matrix" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $display_label . '; width: ' . $param['w_field_label_size'] . 'px;"><span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span><span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';"><input type="hidden" value="type_matrix" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp"><input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/><input type="hidden" value="' . $param['w_field_input_type'] . '" name="' . $id . '_input_typeform_id_temp" id="' . $id . '_input_typeform_id_temp"><input type="hidden" value="' . $param['w_textbox_size'] . '" name="' . $id . '_textbox_sizeform_id_temp" id="' . $id . '_textbox_sizeform_id_temp"><div id="' . $id . '_elementform_id_temp" style="display: table;" ' . $param['attributes'] . '><div id="' . $id . '_table_little" style="display: table-row-group;"><div id="' . $id . '_element_tr0" style="display: table-row;"><div id="' . $id . '_element_td0_0" style="display: table-cell;"></div>' . $column_labels . '</div>' . $rows_columns . '</div></div></div></div>';
3221
+ break;
3222
+ }
3223
+ case 'type_submit_reset': {
3224
+ $params_names = array( 'w_submit_title', 'w_reset_title', 'w_class', 'w_act' );
3225
+ $temp = $params;
3226
+ foreach ( $params_names as $params_name ) {
3227
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
3228
+ $param[$params_name] = $temp[0];
3229
+ $temp = $temp[1];
3230
+ }
3231
+ if ( $temp ) {
3232
+ $temp = explode('*:*w_attr_name*:*', $temp);
3233
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3234
+ foreach ( $attrs as $attr ) {
3235
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3236
+ }
3237
+ }
3238
+ $param['w_act'] = ($param['w_act'] == "false" ? 'style="display: none;"' : "");
3239
+ $rep = '<div id="wdform_field' . $id . '" type="type_submit_reset" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><span id="' . $id . '_element_labelform_id_temp" style="display: none;">type_submit_reset_' . $id . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><input type="hidden" value="type_submit_reset" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp"><button type="button" class="button-submit" id="' . $id . '_element_submitform_id_temp" value="' . $param['w_submit_title'] . '" disabled ' . $param['attributes'] . '>' . $param['w_submit_title'] . '</button><button type="button" class="button-reset" id="' . $id . '_element_resetform_id_temp" value="' . $param['w_reset_title'] . '" disabled ' . $param['w_act'] . ' ' . $param['attributes'] . '>' . $param['w_reset_title'] . '</button></div></div>';
3240
+ break;
3241
+ }
3242
+ case 'type_button': {
3243
+ $params_names = array( 'w_title', 'w_func', 'w_class' );
3244
+ $temp = $params;
3245
+ foreach ( $params_names as $params_name ) {
3246
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
3247
+ $param[$params_name] = $temp[0];
3248
+ $temp = $temp[1];
3249
+ }
3250
+ if ( $temp ) {
3251
+ $temp = explode('*:*w_attr_name*:*', $temp);
3252
+ $attrs = array_slice($temp, 0, count($temp) - 1);
3253
+ foreach ( $attrs as $attr ) {
3254
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3255
+ }
3256
+ }
3257
+ $param['w_title'] = explode('***', $param['w_title']);
3258
+ $param['w_func'] = explode('***', $param['w_func']);
3259
+ $rep .= '<div id="wdform_field' . $id . '" type="type_button" class="wdform_field" style="display: table-cell;">' . $arrows . '<div align="left" id="' . $id . '_label_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><span id="' . $id . '_element_labelform_id_temp" style="display: none;">button_' . $id . '</span></div><div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: table-cell;"><input type="hidden" value="type_button" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp">';
3260
+ foreach ( $param['w_title'] as $key => $title ) {
3261
+ $rep .= '<button type="button" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp' . $key . '" value="' . $title . '" onclick="' . $param['w_func'][$key] . '" ' . $param['attributes'] . '>' . $title . '</button>';
3262
+ }
3263
+ $rep .= '</div></div>';
3264
+ break;
3265
+ }
3266
+ }
3267
+ $form = str_replace('%' . $id . ' - ' . $labels[$ids_key] . '%', $rep, $form);
3268
+ $form = str_replace('%' . $id . ' -' . $labels[$ids_key] . '%', $rep, $form);
3269
+ $row->form_front = $form;
3270
+ }
3271
+ }
3272
+
3273
+ return $row;
3274
+ }
3275
+
3276
+ public function get_theme_rows_data( $old = '' ) {
3277
+ global $wpdb;
3278
+ $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_themes ORDER BY `version` DESC, `id` ASC");
3279
+
3280
+ return $rows;
3281
+ }
3282
+
3283
+ public function get_queries_rows_data( $id ) {
3284
+ global $wpdb;
3285
+ $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=" . $id . " ORDER BY id ASC");
3286
+
3287
+ return $rows;
3288
+ }
3289
+
3290
+ public function get_labels( $id ) {
3291
+ global $wpdb;
3292
+ $rows = $wpdb->get_col("SELECT DISTINCT `element_label` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=" . $id);
3293
+
3294
+ return $rows;
3295
+ }
3296
+
3297
+ public function is_paypal( $id ) {
3298
+ global $wpdb;
3299
+ $rows = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_sessions WHERE form_id=" . $id);
3300
+
3301
+ return $rows;
3302
+ }
3303
+
3304
+ /**
3305
+ * Return total count of forms.
3306
+ *
3307
+ * @return null|string
3308
+ */
3309
+ public function total() {
3310
+ global $wpdb;
3311
+ $query = "SELECT COUNT(*) FROM `" . $wpdb->prefix . "formmaker`";
3312
+
3313
+ $search = WDW_FM_Library::get('s', '');
3314
+ if ( $search ) {
3315
+ $query .= ' WHERE `title` LIKE "%' . $search . '%"';
3316
+ }
3317
+
3318
+ $total = $wpdb->get_var($query);
3319
+
3320
+ return $total;
3321
+ }
3322
+
3323
+ /**
3324
+ * Get display options.
3325
+ *
3326
+ * @param int $id
3327
+ *
3328
+ * @return string
3329
+ */
3330
+ public function get_display_options( $id ) {
3331
+ global $wpdb;
3332
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_display_options WHERE form_id="%d"', $id));
3333
+ if ( !$row ) {
3334
+ $row = new stdClass();
3335
+ $row->form_id = $id;
3336
+ $row->type = 'embedded';
3337
+ $row->scrollbox_loading_delay = 0;
3338
+ $row->popover_animate_effect = '';
3339
+ $row->popover_loading_delay = 0;
3340
+ $row->popover_frequency = 0;
3341
+ $row->topbar_position = 1;
3342
+ $row->topbar_remain_top = 1;
3343
+ $row->topbar_closing = 1;
3344
+ $row->topbar_hide_duration = 0;
3345
+ $row->scrollbox_position = 1;
3346
+ $row->scrollbox_trigger_point = 20;
3347
+ $row->scrollbox_hide_duration = 0;
3348
+ $row->scrollbox_auto_hide = 1;
3349
+ $row->hide_mobile = 0;
3350
+ $row->scrollbox_closing = 1;
3351
+ $row->scrollbox_minimize = 1;
3352
+ $row->scrollbox_minimize_text = '';
3353
+ $row->display_on = 'everything';
3354
+ $row->posts_include = '';
3355
+ $row->pages_include = '';
3356
+ $row->display_on_categories = '';
3357
+ $row->current_categories = '';
3358
+ $row->show_for_admin = 0;
3359
+ }
3360
+
3361
+ return $row;
3362
+ }
3363
+
3364
+ public function fm_posts_query() {
3365
+ $default_post_types = array( 'post', 'page' );
3366
+ $custom_post_types = get_post_types(array(
3367
+ 'public' => TRUE,
3368
+ '_builtin' => FALSE,
3369
+ ));
3370
+ $post_types = array_merge($default_post_types, $custom_post_types);
3371
+ $pt_names = array_values($post_types);
3372
+ $query = array(
3373
+ 'post_type' => $pt_names,
3374
+ 'suppress_filters' => TRUE,
3375
+ 'update_post_term_cache' => FALSE,
3376
+ 'update_post_meta_cache' => FALSE,
3377
+ 'post_status' => 'publish',
3378
+ 'posts_per_page' => -1,
3379
+ );
3380
+ $get_posts = new WP_Query;
3381
+ $posts = $get_posts->query($query);
3382
+ if ( !$get_posts->post_count ) {
3383
+ return FALSE;
3384
+ }
3385
+ $results = array();
3386
+ foreach ( $posts as $post ) {
3387
+ $results[(int) $post->ID] = array(
3388
+ 'title' => trim(esc_html(strip_tags(get_the_title($post)))),
3389
+ 'post_type' => $post->post_type,
3390
+ );
3391
+ }
3392
+ wp_reset_postdata();
3393
+
3394
+ return $results;
3395
+ }
3396
+
3397
+ public function fm_categories_query() {
3398
+ $categories = get_categories(array(
3399
+ 'hide_empty' => 0,
3400
+ ));
3401
+ $final_categories = array();
3402
+ foreach ( $categories as $key => $value ) {
3403
+ $final_categories[$value->term_id] = $value->name;
3404
+ }
3405
+
3406
+ return $final_categories;
3407
+ }
3408
+
3409
+ /**
3410
+ * Get previous or next id.
3411
+ *
3412
+ * @param int $backup_id
3413
+ * @param int $id
3414
+ * @param string $type (undo,redo)
3415
+ * type 0 = undo, 1 = redo
3416
+ *
3417
+ * @return int
3418
+ */
3419
+ public function get_undo_redo_id( $backup_id, $id, $type ) {
3420
+ global $wpdb;
3421
+ if ( $type == 1 ) {
3422
+ $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id > $backup_id AND id = $id ORDER BY backup_id ASC LIMIT 0 , 1 ";
3423
+ }
3424
+ elseif ( $type == 0 ) {
3425
+ $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id < $backup_id AND id = $id ORDER BY backup_id DESC LIMIT 0 , 1 ";
3426
+ }
3427
+
3428
+ return $wpdb->get_var($query);
3429
+ }
3430
+
3431
+ /**
3432
+ * Get max row.
3433
+ *
3434
+ * @param string $table
3435
+ * @param string $column
3436
+ *
3437
+ * @return int
3438
+ */
3439
+ public function get_max_row( $table, $column ) {
3440
+ global $wpdb;
3441
+ $query = "SELECT max(" . $column . ") FROM " . $wpdb->prefix . $table;
3442
+
3443
+ return $wpdb->get_var($query);
3444
+ }
3445
+
3446
+ /**
3447
+ * Delete row.
3448
+ *
3449
+ * @param int $id
3450
+ *
3451
+ * @return bool
3452
+ */
3453
+ public function delete_formmaker_query( $id ) {
3454
+ global $wpdb;
3455
+ $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_query WHERE id =' . $id;
3456
+ return $wpdb->query($query);
3457
+ }
3458
+
3459
+ public function get_mail_verification_post_id() {
3460
+ global $wpdb;
3461
+ $query = 'SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!=0';
3462
+
3463
+ return $wpdb->get_var($query);
3464
+ }
3465
+
3466
+ /**
3467
+ * Update row(s) in db.
3468
+ *
3469
+ * @param string $table
3470
+ * @param array $data_params
3471
+ * @param array $where_data_params
3472
+ * params = [where]
3473
+ *
3474
+ * @return bool
3475
+ */
3476
+ public function update_data( $table, $data_params = array(), $where_data_params = array() ) {
3477
+ global $wpdb;
3478
+ return $wpdb->update($wpdb->prefix . $table, $data_params, $where_data_params);
3479
+ }
3480
+
3481
+ /**
3482
+ * Get request value.
3483
+ *
3484
+ * @param string $table
3485
+ * @param array $data
3486
+ *
3487
+ * @return array
3488
+ */
3489
+ public function insert_data_to_db( $table, $data ) {
3490
+ global $wpdb;
3491
+ $query = $wpdb->insert($wpdb->prefix . $table, $data);
3492
+ $wpdb->show_errors();
3493
+
3494
+ return $query;
3495
+ }
3496
+
3497
+ /**
3498
+ * Get id of default theme.
3499
+ *
3500
+ * @return int (id)
3501
+ */
3502
+ public function get_default_theme_id() {
3503
+ global $wpdb;
3504
+
3505
+ return $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
3506
+ }
3507
+
3508
+ /**
3509
+ * Replace data.
3510
+ *
3511
+ * @param array $data
3512
+ *
3513
+ * @return bool
3514
+ */
3515
+ public function replace_display_options( $data ) {
3516
+ global $wpdb;
3517
+
3518
+ return $wpdb->replace($wpdb->prefix . 'formmaker_display_options', $data);
3519
+ }
3520
+
3521
+ /**
3522
+ * Get previous backup_id.
3523
+ *
3524
+ * @param int $backup_id
3525
+ * @param int $id
3526
+ *
3527
+ * @return int
3528
+ */
3529
+ public function get_prev_backup_id( $backup_id, $id ) {
3530
+ global $wpdb;
3531
+ $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id < " . $backup_id . " AND id = " . $id . " ORDER BY backup_id DESC LIMIT 0 , 1 ";
3532
+
3533
+ return $wpdb->get_var($query);
3534
+ }
3535
+
3536
+ /**
3537
+ * Get next backup_id.
3538
+ *
3539
+ * @param int $backup_id
3540
+ * @param int $id
3541
+ *
3542
+ * @return int
3543
+ */
3544
+ public function get_backup_id( $backup_id, $id ) {
3545
+ global $wpdb;
3546
+ $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id > " . $backup_id . " AND id = " . $id . " ORDER BY backup_id ASC LIMIT 0 , 1 ";
3547
+
3548
+ return $wpdb->get_var($query);
3549
+ }
3550
+
3551
+ public function get_autogen_layout( $id ) {
3552
+ global $wpdb;
3553
+ $autogen_layout = $wpdb->get_var($wpdb->prepare('SELECT autogen_layout FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
3554
+ return $autogen_layout == '1';
3555
+ }
3556
+
3557
+ /**
3558
+ * Get count of rows from table.
3559
+ *
3560
+ * @param array $params
3561
+ * params = [selection, table, where]
3562
+ *
3563
+ * @return int
3564
+ */
3565
+ public function get_count( $params ) {
3566
+ global $wpdb;
3567
+ $query = "SELECT count(" . $params['selection'] . ") FROM " . $wpdb->prefix . $params['table'];
3568
+ if ( isset($params['where']) ) {
3569
+ $query .= " WHERE " . $params['where'];
3570
+ }
3571
+
3572
+ return $wpdb->get_var($query);
3573
+ }
3574
+
3575
+ /**
3576
+ * Delete row(s) from db.
3577
+ *
3578
+ * @param array $params
3579
+ * params = [selection, table, where, order_by, limit]
3580
+ *
3581
+ * @return array
3582
+ */
3583
+ public function delete_rows( $params ) {
3584
+ global $wpdb;
3585
+ $query = "DELETE FROM " . $wpdb->prefix . $params['table'];
3586
+ if ( isset($params['where']) ) {
3587
+ $query .= " WHERE " . $params['where'];
3588
+ }
3589
+ if ( isset($params['order_by']) ) {
3590
+ $query .= " " . $params['order_by'];
3591
+ }
3592
+ if ( isset($params['limit']) ) {
3593
+ $query .= " " . $params['limit'];
3594
+ }
3595
+
3596
+ return $wpdb->query($query);
3597
+ }
3598
+
3599
+ /**
3600
+ * Get row(s) from db.
3601
+ *
3602
+ * @param string $get_type
3603
+ * @param array $params
3604
+ * params = [selection, table, where, order_by, limit]
3605
+ *
3606
+ * @return array
3607
+ */
3608
+ public function select_rows( $get_type, $params ) {
3609
+ global $wpdb;
3610
+ $query = "SELECT " . $params['selection'] . " FROM " . $wpdb->prefix . $params['table'];
3611
+ if ( isset($params['where']) ) {
3612
+ $query .= " WHERE " . $params['where'];
3613
+ }
3614
+ if ( isset($params['order_by']) ) {
3615
+ $query .= " " . $params['order_by'];
3616
+ }
3617
+ if ( isset($params['limit']) ) {
3618
+ $query .= " " . $params['limit'];
3619
+ }
3620
+ if ( $get_type == "get_col" ) {
3621
+ return $wpdb->get_col($query);
3622
+ }
3623
+ elseif ( $get_type == "get_var" ) {
3624
+ return $wpdb->get_var($query);
3625
+ }
3626
+
3627
+ return $wpdb->get_row($query);
3628
+ }
3629
+
3630
+ public function create_js( $form_id ) {
3631
+ WDW_FM_Library::create_js($form_id, true);
3632
+ $jsversion = rand();
3633
+ global $wpdb;
3634
+ $wpdb->update($wpdb->prefix . 'formmaker', array(
3635
+ 'jsversion' => $jsversion,
3636
+ ), array( 'id' => $form_id ));
3637
+ }
3638
+
3639
+ /**
3640
+ * Insert to DB.
3641
+ *
3642
+ * @param int $backup_id
3643
+ * @param int $id
3644
+ *
3645
+ * @return bool
3646
+ */
3647
+ public function insert_formmaker_backup( $backup_id, $id ) {
3648
+ global $wpdb;
3649
+ $query = "INSERT INTO " . $wpdb->prefix . "formmaker_backup SELECT " . $backup_id . " AS backup_id, 1 AS cur, formmakerbkup.id, formmakerbkup.title, formmakerbkup.type, formmakerbkup.mail, formmakerbkup.form_front, formmakerbkup.theme, formmakerbkup.javascript, formmakerbkup.submit_text, formmakerbkup.url, formmakerbkup.submit_text_type, formmakerbkup.script_mail, formmakerbkup.script_mail_user, formmakerbkup.counter, formmakerbkup.published, formmakerbkup.label_order, formmakerbkup.label_order_current, formmakerbkup.article_id, formmakerbkup.pagination, formmakerbkup.show_title, formmakerbkup.show_numbers, formmakerbkup.public_key, formmakerbkup.private_key, formmakerbkup.recaptcha_theme, formmakerbkup.paypal_mode, formmakerbkup.checkout_mode, formmakerbkup.paypal_email, formmakerbkup.payment_currency, formmakerbkup.tax, formmakerbkup.form_fields, formmakerbkup.savedb, formmakerbkup.sendemail, formmakerbkup.requiredmark, formmakerbkup.from_mail, formmakerbkup.from_name, formmakerbkup.reply_to, formmakerbkup.send_to, formmakerbkup.autogen_layout, formmakerbkup.custom_front, formmakerbkup.mail_from_user, formmakerbkup.mail_from_name_user, formmakerbkup.reply_to_user, formmakerbkup.condition, formmakerbkup.mail_cc, formmakerbkup.mail_cc_user, formmakerbkup.mail_bcc, formmakerbkup.mail_bcc_user, formmakerbkup.mail_subject, formmakerbkup.mail_subject_user, formmakerbkup.mail_mode, formmakerbkup.mail_mode_user, formmakerbkup.mail_attachment, formmakerbkup.mail_attachment_user, formmakerbkup.user_id_wd, formmakerbkup.sortable, formmakerbkup.frontend_submit_fields, formmakerbkup.frontend_submit_stat_fields, formmakerbkup.mail_emptyfields, formmakerbkup.mail_verify, formmakerbkup.mail_verify_expiretime, formmakerbkup.mail_verification_post_id, formmakerbkup.save_uploads, formmakerbkup.header_title, formmakerbkup.header_description, formmakerbkup.header_image_url, formmakerbkup.header_image_animation, formmakerbkup.header_hide_image FROM " . $wpdb->prefix . "formmaker as formmakerbkup WHERE id=" . $id;
3650
+
3651
+ return $wpdb->query($query);
3652
+ }
3653
+
3654
+ /**
3655
+ * Update mail_verification_post_id in formmaker table
3656
+ *
3657
+ * @param int $id
3658
+ *
3659
+ * @return bool
3660
+ */
3661
+ public function update_emailverification_id( $id ) {
3662
+ global $wpdb;
3663
+ $sql = "UPDATE " . $wpdb->prefix . "formmaker SET mail_verification_post_id = " . $id . " WHERE mail_verification_post_id != 0";
3664
+
3665
+ return $wpdb->query($sql);
3666
+ }
3667
+
3668
+ /**
3669
+ * Check if mail_verification_post_id the same in table posts and formmaker
3670
+ *
3671
+ * @param int $id
3672
+ *
3673
+ * @return bool
3674
+ */
3675
+ public function check_mailverification_id_posts_vs_fm( $id ) {
3676
+ global $wpdb;
3677
+ $rows = $wpdb->get_results('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id = ' . $id);
3678
+ if ( $rows ) {
3679
+ return TRUE;
3680
+ }
3681
+
3682
+ return FALSE;
3683
+ }
3684
+
3685
+ /**
3686
+ * Get email verification post id
3687
+ *
3688
+ * @return int
3689
+ */
3690
+ public function get_emailverification_post_id() {
3691
+ global $wpdb;
3692
+ $post_type = 'fmemailverification';
3693
+ $row = get_posts(array('post_type' => $post_type));
3694
+ if ( !empty($row[0]) ) {
3695
+ $id = $row[0]->ID;
3696
+ if ( !$this->check_mailverification_id_posts_vs_fm($id) ) {
3697
+ $this->update_emailverification_id($id);
3698
+ }
3699
+ return $id;
3700
+ }
3701
+ else {
3702
+ $post_params = array(
3703
+ 'post_author' => 1,
3704
+ 'post_content' => '[email_verification]',
3705
+ 'post_title' => 'Email Verification',
3706
+ 'post_status' => 'publish',
3707
+ 'post_type' => $post_type,
3708
+ 'comment_status' => 'closed',
3709
+ 'ping_status' => 'closed',
3710
+ 'post_parent' => 0,
3711
+ 'menu_order' => 0,
3712
+ 'import_id' => 0,
3713
+ );
3714
+ if ( wp_insert_post($post_params) ) { // create new post by fmemailverification type
3715
+ $inserted_id = $wpdb->insert_id;
3716
+ $this->update_emailverification_id($inserted_id);
3717
+
3718
+ return $wpdb->insert_id;
3719
+ }
3720
+ }
3721
+ }
3722
+
3723
+ /**
3724
+ * Create Preview Form post.
3725
+ *
3726
+ * @return string $guid
3727
+ */
3728
+ public function get_form_preview_post() {
3729
+ global $wpdb;
3730
+ $post_type = 'form-maker';
3731
+ $row = get_posts(array( 'post_type' => $post_type ));
3732
+ if ( !empty($row[0]) ) {
3733
+ return $row[0]->guid;
3734
+ }
3735
+ else {
3736
+ $post_params = array(
3737
+ 'post_author' => 1,
3738
+ 'post_status' => 'publish',
3739
+ 'post_content' => '[FormPreview]',
3740
+ 'post_title' => 'Preview',
3741
+ 'post_type' => 'form-maker',
3742
+ 'comment_status' => 'closed',
3743
+ 'ping_status' => 'closed',
3744
+ 'post_parent' => 0,
3745
+ 'menu_order' => 0,
3746
+ 'import_id' => 0,
3747
+ );
3748
+ // Create new post by fmformpreview type.
3749
+ if ( wp_insert_post($post_params) ) {
3750
+ flush_rewrite_rules();
3751
+
3752
+ return get_the_guid($wpdb->insert_id);
3753
+ }
3754
+ else {
3755
+ return "";
3756
+ }
3757
+ }
3758
+ }
3759
+ }
admin/models/Options_fm.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelOptions_fm
5
+ */
6
+ class FMModelOptions_fm {
7
+ /**
8
+ * Save data to DB.
9
+ */
10
+ public function save_db() {
11
+ $public_key = WDW_FM_Library::get('public_key', '');
12
+ $private_key = WDW_FM_Library::get('private_key', '');
13
+ $csv_delimiter = (isset($_POST['csv_delimiter']) && $_POST['csv_delimiter'] != '' ? esc_html(stripslashes($_POST['csv_delimiter'])) : ',');
14
+ $fm_shortcode = (isset($_POST['fm_shortcode']) ? "old" : '');
15
+ $fm_advanced_layout = WDW_FM_Library::get('fm_advanced_layout', '0');
16
+ $map_key = WDW_FM_Library::get('map_key', '');
17
+ update_option('fm_settings', array(
18
+ 'public_key' => $public_key,
19
+ 'private_key' => $private_key,
20
+ 'csv_delimiter' => $csv_delimiter,
21
+ 'map_key' => $map_key,
22
+ 'fm_shortcode' => $fm_shortcode,
23
+ 'fm_advanced_layout' => $fm_advanced_layout,
24
+ ));
25
+ return 8;
26
+ }
27
+ }
admin/models/Submissions_fm.php ADDED
@@ -0,0 +1,931 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FMModelSubmissions_fm
5
+ */
6
+ class FMModelSubmissions_fm {
7
+ public function blocked_ips() {
8
+ global $wpdb;
9
+ $ips = $wpdb->get_col('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked');
10
+
11
+ return $ips;
12
+ }
13
+
14
+ /**
15
+ * Get all forms.
16
+ *
17
+ * @return object $forms
18
+ */
19
+ public function get_forms() {
20
+ global $wpdb;
21
+ $query = "SELECT `id`, `title`, `published` FROM " . $wpdb->prefix . "formmaker " . (WDFM()->is_pro ? '' : ' WHERE id NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')') . " ORDER BY `title`";
22
+ $results = $wpdb->get_results($query);
23
+ $forms = array();
24
+ if( !empty($results) ) {
25
+ foreach($results as $row) {
26
+ $forms[$row->id] = $row;
27
+ }
28
+ }
29
+ return $forms;
30
+ }
31
+
32
+ /**
33
+ * Get form.
34
+ *
35
+ * @param int $id
36
+ *
37
+ * @return object $form
38
+ */
39
+ public function get_form( $id ) {
40
+ global $wpdb;
41
+ $query = 'SELECT `id`, `title` FROM ' . $wpdb->prefix .'formmaker WHERE id = ' . $id ;
42
+ $form = $wpdb->get_row( $query );
43
+ return $form;
44
+ }
45
+
46
+ /**
47
+ * Get subs count.
48
+ *
49
+ * @param int $id
50
+ *
51
+ * @return int $count
52
+ */
53
+ public function get_subs_count( $id ) {
54
+ global $wpdb;
55
+ $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $id);
56
+ $group_id_s = $wpdb->get_col($query);
57
+ $count = count($group_id_s);
58
+ return $count;
59
+ }
60
+
61
+ /**
62
+ * Get statistics.
63
+ *
64
+ * @param int $id
65
+ *
66
+ * @return object $statistics
67
+ */
68
+ public function get_statistics( $id ) {
69
+ global $wpdb;
70
+ $statistics = array();
71
+ $query = $wpdb->prepare('SELECT count(distinct group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d"', $id);
72
+ $statistics["total_entries"] = $wpdb->get_var($query);
73
+
74
+ $query = $wpdb->prepare('SELECT `views` FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $id);
75
+ $statistics["total_views"] = $wpdb->get_var($query);
76
+ if ( $statistics["total_views"] ) {
77
+ $statistics["conversion_rate"] = round((($statistics["total_entries"] / $statistics["total_views"]) * 100), 2) . '%';
78
+ }
79
+ else {
80
+ $statistics["conversion_rate"] = '0%';
81
+ }
82
+ return $statistics;
83
+ }
84
+ /*
85
+ * Get labels parameters.
86
+ *
87
+ * @param int $form_id
88
+ * @param int $page_num
89
+ * @param int $per_num
90
+ *
91
+ * @return array $labels_parameters
92
+ */
93
+ public function get_labels_parameters( $form_id, $page_num=0, $per_num=0) {
94
+ global $wpdb;
95
+ $labels = array();
96
+ $labels_id = array();
97
+ $sorted_labels_id = array();
98
+ $label_names = array();
99
+ $label_types = array();
100
+ $sorted_label_types = array();
101
+ $label_names_original = array();
102
+ $labels_parameters = array();
103
+ $join_query = array();
104
+ $join_where = array();
105
+ $join_verified = array();
106
+ $rows_ord = array();
107
+ $join = '';
108
+ $query = $wpdb->prepare("SELECT `group_id`,`element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' and `element_label` = 'verifyinfo' ", $form_id);
109
+ $ver_emails_data = $wpdb->get_results($query);
110
+ $ver_emails_array = array();
111
+ if ( $ver_emails_data ) {
112
+ foreach ( $ver_emails_data as $ver_email ) {
113
+ $elem_label = str_replace('verified**', '', $ver_email->element_value);
114
+ $query = $wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' AND `group_id` = '%d' AND `element_label` = '%s' ", $form_id, (int) $ver_email->group_id, $elem_label);
115
+ if ( !isset($ver_emails_array[$elem_label]) ) {
116
+ $ver_emails_array[$elem_label] = array();
117
+ }
118
+ if ( !in_array($wpdb->get_var($query), $ver_emails_array[$elem_label]) ) {
119
+ $ver_emails_array[$elem_label][] = $wpdb->get_var($query);
120
+ }
121
+ }
122
+ }
123
+ for ( $i = 0; $i < 9; $i++ ) {
124
+ array_push($labels_parameters, NULL);
125
+ }
126
+ $sorted_label_names = array();
127
+ $sorted_label_names_original = array();
128
+ $where_labels = array();
129
+ $where2 = array();
130
+ $order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
131
+ $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
132
+
133
+ $lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : '');
134
+ $lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : '');
135
+ $lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : '');
136
+ $lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : '');
137
+ $lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : '');
138
+ $lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : '');
139
+ $lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : '');
140
+ if ( $lists['ip_search'] ) {
141
+ $where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"';
142
+ }
143
+ if ( $lists['startdate'] != '' ) {
144
+ $where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' ";
145
+ }
146
+ if ( $lists['enddate'] != '' ) {
147
+ $where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' ";
148
+ }
149
+ if ( $lists['username_search'] ) {
150
+ $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%' . $lists['username_search'] . '%")';
151
+ }
152
+ if ( $lists['useremail_search'] ) {
153
+ $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%' . $lists['useremail_search'] . '%")';
154
+ }
155
+ if ( $lists['id_search'] ) {
156
+ $where[] = 'group_id =' . (int) $lists['id_search'];
157
+ }
158
+ $where[] = 'form_id=' . $form_id . '';
159
+ $where = (count($where) ? ' ' . implode(' AND ', $where) : '');
160
+ if ( $order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip' ) {
161
+ $orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . '';
162
+ }
163
+ elseif ( $order_by == 'display_name' or $order_by == 'user_email' ) {
164
+ $orderby = ' ORDER BY (SELECT ' . $order_by . ' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) ' . $asc_or_desc . '';
165
+ }
166
+ else {
167
+ $orderby = "";
168
+ }
169
+ if ( $form_id ) {
170
+ for ( $i = 0; $i < 9; $i++ ) {
171
+ array_pop($labels_parameters);
172
+ }
173
+ $query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where;
174
+ $results = $wpdb->get_results($query);
175
+ for ( $i = 0; $i < count($results); $i++ ) {
176
+ array_push($labels, $results[$i]->element_label);
177
+ }
178
+ $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id));
179
+ if ( strpos($form->label_order, 'type_paypal_') ) {
180
+ $form->label_order = $form->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
181
+ }
182
+ $form_labels = explode('#****#', $form->label_order);
183
+ $form_labels = array_slice($form_labels, 0, count($form_labels) - 1);
184
+ foreach ( $form_labels as $key => $form_label ) {
185
+ $label_id = explode('#**id**#', $form_label);
186
+ array_push($labels_id, $label_id[0]);
187
+ $label_name_type = explode('#**label**#', $label_id[1]);
188
+ array_push($label_names_original, $label_name_type[0]);
189
+ $ptn = "/[^a-zA-Z0-9_]/";
190
+ $rpltxt = "";
191
+ $label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]);
192
+ array_push($label_names, $label_name);
193
+ array_push($label_types, $label_name_type[1]);
194
+ }
195
+ foreach ( $labels_id as $key => $label_id ) {
196
+ if ( in_array($label_id, $labels) ) {
197
+ if ( !in_array($label_id, $sorted_labels_id) ) {
198
+ array_push($sorted_labels_id, $label_id);
199
+ }
200
+ array_push($sorted_label_names, $label_names[$key]);
201
+ array_push($sorted_label_types, $label_types[$key]);
202
+ array_push($sorted_label_names_original, $label_names_original[$key]);
203
+ if ( isset($_POST[$form_id . '_' . $label_id . '_search']) ) {
204
+ $search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']);
205
+ }
206
+ else {
207
+ $search_temp = '';
208
+ }
209
+ $search_temp = strtolower($search_temp);
210
+ $lists[$form_id . '_' . $label_id . '_search'] = $search_temp;
211
+ if ( $search_temp ) {
212
+ $join_query[] = 'search';
213
+ $join_where[] = array( 'label' => $label_id, 'search' => $search_temp );
214
+ }
215
+ if ( isset($_POST[$form_id . '_' . $label_id . '_search_verified']) ) {
216
+ $search_verified = $_POST[$form_id . '_' . $label_id . '_search_verified'];
217
+ $lists[$form_id . '_' . $label_id . '_search_verified'] = $search_verified;
218
+ }
219
+ else {
220
+ $search_verified = '';
221
+ }
222
+ if ( $search_verified && isset($ver_emails_array[$label_id]) ) {
223
+ $join_query[] = 'search';
224
+ $join_where[] = NULL;
225
+ $join_verified[] = array(
226
+ 'label' => $label_id,
227
+ 'ver_search' => implode('|', $ver_emails_array[$label_id]),
228
+ );
229
+ }
230
+ }
231
+ }
232
+ if ( strpos($order_by, "_field") ) {
233
+ if ( in_array(str_replace("_field", "", $order_by), $labels) ) {
234
+ $join_query[] = 'sort';
235
+ $join_where[] = array( 'label' => str_replace("_field", "", $order_by) );
236
+ }
237
+ }
238
+ $cols = 'group_id';
239
+ if ( $order_by == 'date' or $order_by == 'ip' ) {
240
+ $cols = 'group_id, date, ip';
241
+ }
242
+ $ver_where = '';
243
+ if ( !empty($join_verified) ) {
244
+ foreach ( $join_verified as $key_ver => $join_ver ) {
245
+ $ver_where .= '(element_label="' . $join_ver['label'] . '" AND element_value REGEXP "' . $join_ver['ver_search'] . '" ) AND';
246
+ }
247
+ }
248
+ switch ( count($join_query) ) {
249
+ case 0:
250
+ $join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where;
251
+ break;
252
+ case 1:
253
+ if ( $join_query[0] == 'sort' ) {
254
+ $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" ';
255
+ $join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" ';
256
+ $orderby = ' ORDER BY `element_value` ' . $asc_or_desc;
257
+ }
258
+ else {
259
+ if ( isset($join_where[0]['search']) ) {
260
+ $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%") AND ' . $where;
261
+ }
262
+ else {
263
+ $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where;
264
+ }
265
+ }
266
+ break;
267
+ default:
268
+ if ( !empty($join_verified) ) {
269
+ if ( isset($join_where[0]['search']) ) {
270
+ $join = 'SELECT t.group_id from (SELECT t1.group_id from (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE (element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%")) AND ' . $where . ' ) as t1 JOIN (SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t2 ON t1.group_id = t2.group_id) as t ';
271
+ }
272
+ else {
273
+ $join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t ';
274
+ }
275
+ }
276
+ else {
277
+ $join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" AND (element_value LIKE "%' . $join_where[0]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[0]['search']) . '%" )) as t ';
278
+ }
279
+ for ( $key = 1; $key < count($join_query); $key++ ) {
280
+ if ( $join_query[$key] == 'sort' ) {
281
+ if ( isset($join_where[$key]) ) {
282
+ $join .= 'LEFT JOIN (SELECT group_id as group_id' . $key . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '") as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
283
+ $orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . '';
284
+ }
285
+ }
286
+ else {
287
+ if ( isset($join_where[$key]) ) {
288
+ $join .= 'INNER JOIN (SELECT group_id as group_id' . $key . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '" AND (element_value LIKE "%' . $join_where[$key]['search'] . '%" OR element_value LIKE "%' . str_replace(' ', '@@@', $join_where[$key]['search']) . '%")) as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
289
+ }
290
+ }
291
+ }
292
+ break;
293
+ }
294
+ $pos = strpos($join, 'SELECT t.group_id');
295
+ if ( $pos === FALSE ) {
296
+ $query = str_replace(array(
297
+ 'SELECT group_id',
298
+ 'SELECT distinct group_id',
299
+ ), array( 'SELECT count(distinct group_id)', 'SELECT count(distinct group_id)' ), $join);
300
+ }
301
+ else {
302
+ $query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join);
303
+ }
304
+ $total = $wpdb->get_var($query);
305
+ $query_sub_count = "SELECT count(distinct group_id) from " . $wpdb->prefix . "formmaker_submits";
306
+ $sub_count = (int) $wpdb->get_var($query_sub_count);
307
+ $query = $join . ' ' . $orderby . ' LIMIT ' . $page_num . ', '.$per_num;
308
+ $results = $wpdb->get_results($query);
309
+ for ( $i = 0; $i < count($results); $i++ ) {
310
+ array_push($rows_ord, $results[$i]->group_id);
311
+ }
312
+ $query1 = $join . ' ' . $orderby;
313
+ $searched_group_ids = $wpdb->get_results($query1);
314
+ $searched_ids = array();
315
+ for ( $i = 0; $i < count($searched_group_ids); $i++ ) {
316
+ array_push($searched_ids, $searched_group_ids[$i]->group_id);
317
+ }
318
+ $where2 = array();
319
+ $where2[] = "group_id='0'";
320
+ foreach ( $rows_ord as $rows_ordd ) {
321
+ $where2[] = "group_id='" . $rows_ordd . "'";
322
+ }
323
+ $where2 = (count($where2) ? ' WHERE ' . implode(' OR ', $where2) . '' : '');
324
+ $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
325
+ $rows = $wpdb->get_results($query);
326
+ $group_ids = $rows_ord;
327
+ $lists['total'] = $total;
328
+ $lists['limit'] = $per_num;
329
+ $where_choices = $where;
330
+ array_push($labels_parameters, $sorted_labels_id);
331
+ array_push($labels_parameters, $sorted_label_types);
332
+ array_push($labels_parameters, $lists);
333
+ array_push($labels_parameters, $sorted_label_names);
334
+ array_push($labels_parameters, $sorted_label_names_original);
335
+ array_push($labels_parameters, $rows);
336
+ array_push($labels_parameters, $group_ids);
337
+ array_push($labels_parameters, $where_choices);
338
+ array_push($labels_parameters, $searched_ids);
339
+ }
340
+
341
+ return $labels_parameters;
342
+ }
343
+
344
+ public function get_type_address( $sorted_label_type, $sorted_label_name_original ) {
345
+ if ( $sorted_label_type == 'type_address' ) {
346
+ switch ( $sorted_label_name_original ) {
347
+ case 'Street Line':
348
+ $field_title = __('Street Address', 'form_maker');
349
+ break;
350
+ case 'Street Line2':
351
+ $field_title = __('Street Address Line 2', 'form_maker');
352
+ break;
353
+ case 'City':
354
+ $field_title = __('City', 'form_maker');
355
+ break;
356
+ case 'State':
357
+ $field_title = __('State / Province / Region', 'form_maker');
358
+ break;
359
+ case 'Postal':
360
+ $field_title = __('Postal / Zip Code', 'form_maker');
361
+ break;
362
+ case 'Country':
363
+ $field_title = __('Country', 'form_maker');
364
+ break;
365
+ default :
366
+ $field_title = stripslashes($sorted_label_name_original);
367
+ break;
368
+ }
369
+ }
370
+ else {
371
+ $field_title = stripslashes($sorted_label_name_original);
372
+ }
373
+
374
+ return $field_title;
375
+ }
376
+
377
+ public function hide_or_not( $hide_strings, $hide_string ) {
378
+ if ( strpos($hide_string, '@') === FALSE ) {
379
+ if ( strpos($hide_strings, '@' . $hide_string . '@') === FALSE ) {
380
+ $style = '';
381
+ }
382
+ else {
383
+ $style = 'style="display:none"';
384
+ }
385
+ }
386
+ else {
387
+ if ( strpos($hide_strings, $hide_string) === FALSE ) {
388
+ $style = '';
389
+ }
390
+ else {
391
+ $style = 'style="display:none"';
392
+ }
393
+ }
394
+
395
+ return $style;
396
+ }
397
+
398
+ public function sort_group_ids( $sorted_label_names_count, $group_ids ) {
399
+ $count_labe = $sorted_label_names_count;
400
+ $group_id_s = array();
401
+ $l = 0;
402
+ if ( count($group_ids) > 0 and $count_labe ) {
403
+ for ( $i = 0; $i < count($group_ids); $i++ ) {
404
+ if ( !in_array($group_ids[$i], $group_id_s) ) {
405
+ array_push($group_id_s, $group_ids[$i]);
406
+ }
407
+ }
408
+ }
409
+
410
+ return $group_id_s;
411
+ }
412
+
413
+ public function array_for_group_id( $group, $rows ) {
414
+ $i = $group;
415
+ $count_rows = count($rows);
416
+ $temp = array();
417
+ for ( $j = 0; $j < $count_rows; $j++ ) {
418
+ $row = $rows[$j];
419
+ if ( $row->group_id == $i ) {
420
+ array_push($temp, $row);
421
+ }
422
+ }
423
+
424
+ return $temp;
425
+ }
426
+
427
+ public function check_radio_type( $sorted_label_type ) {
428
+ if ( $sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping" ) {
429
+ return TRUE;
430
+ }
431
+ else {
432
+ return FALSE;
433
+ }
434
+ }
435
+
436
+ public function statistic_for_radio( $where_choices, $sorted_label_id ) {
437
+ global $wpdb;
438
+ $choices_params = array();
439
+ $query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where_choices . " AND element_label='" . $sorted_label_id . "'";
440
+ $choices = $wpdb->get_results($query);
441
+ $colors = array( '#5FE2FF', '#F9E89C' );
442
+ $choices_colors = array( '#4EC0D9', '#DDCC7F' );
443
+ $choices_labels = array();
444
+ $choices_count = array();
445
+ $all = count($choices);
446
+ $unanswered = 0;
447
+ foreach ( $choices as $key => $choice ) {
448
+ if ( $choice->element_value == '' ) {
449
+ $unanswered++;
450
+ }
451
+ else {
452
+ if ( !in_array($choice->element_value, $choices_labels) ) {
453
+ array_push($choices_labels, $choice->element_value);
454
+ array_push($choices_count, 0);
455
+ }
456
+ $choices_count[array_search($choice->element_value, $choices_labels)]++;
457
+ }
458
+ }
459
+ array_multisort($choices_count, SORT_DESC, $choices_labels);
460
+ array_push($choices_params, $choices_count);
461
+ array_push($choices_params, $choices_labels);
462
+ array_push($choices_params, $unanswered);
463
+ array_push($choices_params, $all);
464
+ array_push($choices_params, $colors);
465
+ array_push($choices_params, $choices_colors);
466
+ return $choices_params;
467
+ }
468
+
469
+ public function get_data_of_group_id( $id ) {
470
+ global $wpdb;
471
+ $query = "SELECT * FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id=" . $id;
472
+ $rows = $wpdb->get_results($query);
473
+ $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=" . $rows[0]->form_id);
474
+ $params = array();
475
+ $label_id = array();
476
+ $label_order_original = array();
477
+ $label_type = array();
478
+ $ispaypal = strpos($form->label_order, 'type_paypal_');
479
+ if ( $form->paypal_mode == 1 ) {
480
+ if ( $ispaypal ) {
481
+ $form->label_order = $form->label_order . "0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
482
+ }
483
+ }
484
+ $label_all = explode('#****#', $form->label_order);
485
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
486
+ foreach ( $label_all as $key => $label_each ) {
487
+ $label_id_each = explode('#**id**#', $label_each);
488
+ array_push($label_id, $label_id_each[0]);
489
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
490
+ array_push($label_order_original, $label_oder_each[0]);
491
+ array_push($label_type, $label_oder_each[1]);
492
+ }
493
+ /*$theme_id = $wpdb->get_var("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form->id . "'");*/
494
+ $css = $wpdb->get_var("SELECT css FROM " . $wpdb->prefix . "formmaker_themes");
495
+ array_push($params, $rows);
496
+ array_push($params, $label_id);
497
+ array_push($params, $label_order_original);
498
+ array_push($params, $label_type);
499
+ array_push($params, $ispaypal);
500
+ array_push($params, $form);
501
+ array_push($params, $css);
502
+
503
+ return $params;
504
+ }
505
+
506
+ public function check_type_for_edit_function( $label_type ) {
507
+ if ( $label_type != 'type_editor' and $label_type != 'type_submit_reset' and $label_type != 'type_map' and $label_type != 'type_mark_map' and $label_type != 'type_captcha' and $label_type != 'type_recaptcha' and $label_type != 'type_button' ) {
508
+ return TRUE;
509
+ }
510
+ else {
511
+ return FALSE;
512
+ }
513
+ }
514
+
515
+ public function check_for_submited_label( $rows, $label_id ) {
516
+ foreach ( $rows as $row ) {
517
+ if ( $row->element_label == $label_id ) {
518
+ $element_value = $row->element_value;
519
+ break;
520
+ }
521
+ else {
522
+ $element_value = 'continue';
523
+ }
524
+ }
525
+
526
+ return $element_value;
527
+ }
528
+
529
+ /*
530
+ * Create array of group by key.
531
+ *
532
+ * @param array $array
533
+ * @param string $key
534
+ *
535
+ * @return array $data
536
+ */
537
+ public function _group_by($array, $key) {
538
+ $data = array();
539
+ foreach($array as $val) {
540
+ $by_key = '';
541
+ if( is_object($val) ) {
542
+ $by_key = $val->$key;
543
+ }
544
+ if( is_array($val) ) {
545
+ $by_key = $val[$key];
546
+ }
547
+
548
+ if( $by_key ){
549
+ $data[$by_key][] = $val;
550
+ }
551
+ }
552
+ return $data;
553
+ }
554
+
555
+ public function view_for_star_rating( $element_value, $element_label ) {
556
+ $view_star_rating_array = array();
557
+ $new_filename = str_replace("***star_rating***", '', $element_value);
558
+ $stars = "";
559
+ $new_filename = explode('***', $new_filename);
560
+ for ( $j = 0; $j < $new_filename[1]; $j++ ) {
561
+ $stars .= '<img id="' . $element_label . '_star_' . $j . '" src="' . WDFM()->plugin_url . '/images/star_' . $new_filename[2] . '.png?ver=' . WDFM()->plugin_version . '" /> ';
562
+ }
563
+ for ( $k = $new_filename[1]; $k < $new_filename[0]; $k++ ) {
564
+ $stars .= '<img id="' . $element_label . '_star_' . $k . '" src="' . WDFM()->plugin_url . '/images/star.png?ver=' . WDFM()->plugin_version . '" /> ';
565
+ }
566
+ array_push($view_star_rating_array, $stars);
567
+
568
+ return $view_star_rating_array;
569
+ }
570
+
571
+ public function view_for_grading( $element_value ) {
572
+ $view_grading_array = array();
573
+ $new_filename = str_replace("***grading***", '', $element_value);
574
+ $grading = explode(":", $new_filename);
575
+ $items_count = sizeof($grading) - 1;
576
+ $items = "";
577
+ $total = 0;
578
+ for ( $k = 0; $k