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

Version Description

Changed: Submissions default ordering Changed: Featured Plugins page

Download this release

Release Info

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

Code changes from version 1.12.13 to 1.7.75

Files changed (78) hide show
  1. .gitignore +0 -4
  2. admin/controllers/Blocked_ips_fm.php +0 -270
  3. admin/controllers/Checkpaypal.php +0 -177
  4. admin/controllers/FMControllerBlocked_ips_fm.php +148 -0
  5. admin/controllers/FMControllerExtensions_fm.php +1 -0
  6. admin/controllers/FMControllerFeatured_plugins_fm.php +49 -0
  7. admin/controllers/FMControllerFormMakerEditCSS.php +98 -0
  8. admin/controllers/FMControllerFormMakerPreview.php +43 -0
  9. admin/controllers/FMControllerFormMakerSQLMapping.php +112 -0
  10. admin/controllers/FMControllerFormmakerwdcaptcha.php +43 -0
  11. admin/controllers/FMControllerFormmakerwdmathcaptcha.php +43 -0
  12. admin/controllers/FMControllerFormmakerwindow.php +43 -0
  13. admin/controllers/FMControllerFromeditcountryinpopup.php +43 -0
  14. admin/controllers/FMControllerFromipinfoinpopup.php +43 -0
  15. admin/controllers/FMControllerFrommapeditinpopup.php +43 -0
  16. admin/controllers/FMControllerGenerete_csv.php +43 -0
  17. admin/controllers/FMControllerGenerete_xml.php +43 -0
  18. admin/controllers/FMControllerLicensing_fm.php +49 -0
  19. admin/controllers/FMControllerManage_fm.php +1254 -0
  20. admin/controllers/FMControllerSelect_data_from_db.php +71 -0
  21. admin/controllers/FMControllerShow_matrix.php +43 -0
  22. admin/controllers/FMControllerSubmissions_fm.php +792 -0
  23. admin/controllers/FMControllerThemes_fm.php +189 -0
  24. admin/controllers/FMControllerUninstall_fm.php +58 -0
  25. admin/controllers/FMControllerWidget.php +61 -0
  26. admin/controllers/FMShortocde.php +0 -43
  27. admin/controllers/FormMakerEditCountryinPopup.php +0 -31
  28. admin/controllers/FormMakerIpinfoinPopup.php +0 -58
  29. admin/controllers/FormMakerMapEditinPopup.php +0 -35
  30. admin/controllers/FormMakerSQLMapping.php +0 -167
  31. admin/controllers/FormMakerSubmits.php +0 -44
  32. admin/controllers/Formmakerwdcaptcha.php +0 -29
  33. admin/controllers/Formmakerwdmathcaptcha.php +0 -30
  34. admin/controllers/Generete_csv.php +0 -71
  35. admin/controllers/Generete_xml.php +0 -61
  36. admin/controllers/Licensing_fm.php +0 -26
  37. admin/controllers/Manage_fm.php +0 -1415
  38. admin/controllers/Options_fm.php +0 -43
  39. admin/controllers/Paypal_info.php +0 -38
  40. admin/controllers/Product_option.php +0 -36
  41. admin/controllers/Select_data_from_db.php +0 -93
  42. admin/controllers/Show_matrix.php +0 -27
  43. admin/controllers/Submissions_fm.php +0 -557
  44. admin/controllers/Themes_fm.php +0 -3012
  45. admin/controllers/Uninstall_fm.php +0 -66
  46. admin/controllers/Widget.php +0 -65
  47. admin/models/Blocked_ips_fm.php +0 -113
  48. admin/models/Checkpaypal.php +0 -108
  49. admin/models/FMModelBlocked_ips_fm.php +76 -0
  50. admin/models/FMModelExtensions_fm.php +30 -0
  51. admin/models/FMModelFeatured_plugins_fm.php +30 -0
  52. admin/models/FMModelFormMakerEditCSS.php +42 -0
  53. admin/models/FMModelFormMakerPreview.php +42 -0
  54. admin/models/FMModelFormMakerSQLMapping.php +121 -0
  55. admin/models/FMModelFormmakerwdcaptcha.php +31 -0
  56. admin/models/FMModelFormmakerwdmathcaptcha.php +31 -0
  57. admin/models/FMModelFormmakerwindow.php +36 -0
  58. admin/models/FMModelFromeditcountryinpopup.php +31 -0
  59. admin/models/FMModelFromipinfoinpopup.php +31 -0
  60. admin/models/FMModelFrommapeditinpopup.php +31 -0
  61. admin/models/FMModelGenerete_csv.php +276 -0
  62. admin/models/FMModelGenerete_xml.php +298 -0
  63. admin/models/FMModelLicensing_fm.php +30 -0
  64. admin/models/FMModelManage_fm.php +2217 -0
  65. admin/models/FMModelSelect_data_from_db.php +111 -0
  66. admin/models/FMModelShow_matrix.php +31 -0
  67. admin/models/FMModelSubmissions_fm.php +659 -0
  68. admin/models/FMModelThemes_fm.php +91 -0
  69. admin/models/FMModelUninstall_fm.php +54 -0
  70. admin/models/FMModelWidget.php +38 -0
  71. admin/models/FMPaypalInfo.php +0 -20
  72. admin/models/FMSelectDataFromDb.php +0 -134
  73. admin/models/FMShortocde.php +0 -18
  74. admin/models/FMSqlMapping.php +0 -119
  75. admin/models/FormMakerSubmits.php +0 -20
  76. admin/models/Manage_fm.php +0 -3850
  77. admin/models/Options_fm.php +0 -27
  78. admin/models/Submissions_fm.php +0 -691
.gitignore DELETED
@@ -1,4 +0,0 @@
1
- .idea
2
- css/frontend/*
3
- js/frontend/*
4
- !.gitignore
 
 
 
 
admin/controllers/Blocked_ips_fm.php DELETED
@@ -1,270 +0,0 @@
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 DELETED
@@ -1,177 +0,0 @@
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/views/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
- $paypal_params = array( 'checkout_mode' => $form->checkout_mode, 'post_fields' => $post_fields );
54
- $response = $this->model->connect_to_paypal($paypal_params);
55
- $tax = WDW_FM_Library::get('tax', 0);
56
- $total = WDW_FM_Library::get('mc_gross', 0);
57
- $shipping = WDW_FM_Library::get('mc_shipping', 0);
58
- $payment_status = WDW_FM_Library::get('payment_status', 0);
59
- // Update payment status for formmaker_submits table.
60
- $this->model->update_submission_status($payment_status, $group_id);
61
- $form_currency = '$';
62
- $currency_code = array(
63
- 'USD',
64
- 'EUR',
65
- 'GBP',
66
- 'JPY',
67
- 'CAD',
68
- 'MXN',
69
- 'HKD',
70
- 'HUF',
71
- 'NOK',
72
- 'NZD',
73
- 'SGD',
74
- 'SEK',
75
- 'PLN',
76
- 'AUD',
77
- 'DKK',
78
- 'CHF',
79
- 'CZK',
80
- 'ILS',
81
- 'BRL',
82
- 'TWD',
83
- 'MYR',
84
- 'PHP',
85
- 'THB',
86
- );
87
- $currency_sign = array(
88
- '$',
89
- '&#8364;',
90
- '&#163;',
91
- '&#165;',
92
- 'C$',
93
- 'Mex$',
94
- 'HK$',
95
- 'Ft',
96
- 'kr',
97
- 'NZ$',
98
- 'S$',
99
- 'kr',
100
- 'zl',
101
- 'A$',
102
- 'kr',
103
- 'CHF',
104
- 'Kc',
105
- '&#8362;',
106
- 'R$',
107
- 'NT$',
108
- 'RM',
109
- '&#8369;',
110
- '&#xe3f;',
111
- );
112
- // Checking payment currency and set new value fo currency.
113
- $payment_currency = !empty($form->payment_currency) ? $form->payment_currency : $form_currency;
114
- if ( !empty($payment_currency) ) {
115
- $form_currency = $currency_sign[array_search($payment_currency, $currency_code)];
116
- }
117
- $currency = $payment_currency . $form_currency;
118
- $email = WDW_FM_Library::get('payer_email', '');
119
- $first_name = WDW_FM_Library::get('first_name', '');
120
- $last_name = WDW_FM_Library::get('last_name', '');
121
- $full_name = (($first_name != '') ? $first_name : '') . (($last_name != '') ? ' ' . $last_name : '');
122
- $phone_a = WDW_FM_Library::get('night_phone_a', '');
123
- $phone_b = WDW_FM_Library::get('night_phone_b', '');
124
- $phone_c = WDW_FM_Library::get('night_phone_c', '');
125
- $phone = (($phone_a != '') ? $phone_a : '') . (($phone_b != '') ? ' - ' . $phone_b : '') . (($phone_c != '') ? ' - ' . $phone_c : '');
126
- $address = '';
127
- $address .= (WDW_FM_Library::get('address_country', '') != '') ? "Country: " . WDW_FM_Library::get('address_country', '') : '';
128
- $address .= (WDW_FM_Library::get('address_state', '') != '') ? "<br>State: " . WDW_FM_Library::get('address_state', '') : '';
129
- $address .= (WDW_FM_Library::get('address_city', '') != '') ? "<br>City: " . WDW_FM_Library::get('address_city', '') : '';
130
- $address .= (WDW_FM_Library::get('address_street', '') != '') ? "<br>Street: " . WDW_FM_Library::get('address_street', '') : '';
131
- $address .= (WDW_FM_Library::get('address_zip', '') != '') ? "<br>Zip Code: " . WDW_FM_Library::get('address_zip', '') : '';
132
- $address .= (WDW_FM_Library::get('address_status', '') != '') ? "<br>Address Status: " . WDW_FM_Library::get('address_status', '') : '';
133
- $address .= (WDW_FM_Library::get('address_name', '') != '') ? "<br>Name: " . WDW_FM_Library::get('address_name', '') : '';
134
- $paypal_info = "";
135
- $paypal_info .= (WDW_FM_Library::get('payer_status', '') != '') ? "<br>Payer Status - " . WDW_FM_Library::get('payer_status', '') : '';
136
- $paypal_info .= (WDW_FM_Library::get('payer_email', '') != '') ? "<br>Payer Email - " . WDW_FM_Library::get('payer_email', '') : '';
137
- $paypal_info .= (WDW_FM_Library::get('txn_id', '') != '') ? "<br>Transaction - " . WDW_FM_Library::get('txn_id', '') : '';
138
- $paypal_info .= (WDW_FM_Library::get('payment_type', '') != '') ? "<br>Payment Type - " . WDW_FM_Library::get('payment_type', '') : '';
139
- $paypal_info .= (WDW_FM_Library::get('residence_country', '') != '') ? "<br>Residence Country - " . WDW_FM_Library::get('residence_country', '') : '';
140
- $post = array(
141
- 'form_id' => $form_id,
142
- 'group_id' => $group_id,
143
- 'full_name' => $full_name,
144
- 'email' => $email,
145
- 'phone' => $phone,
146
- 'address' => $address,
147
- 'status' => $payment_status,
148
- 'ipn' => $response,
149
- 'currency' => $currency,
150
- 'paypal_info' => $paypal_info,
151
- 'tax' => $tax,
152
- 'total' => $total,
153
- 'shipping' => $shipping,
154
- 'ord_last_modified' => date('Y-m-d H:i:s'),
155
- );
156
- if ( !$form_session ) {
157
- $this->model->add_formmaker_sessions($post);
158
- }
159
- else {
160
- $this->model->update_formmaker_sessions_by_group_id($group_id, $post);
161
- }
162
- // Get form session by group id.
163
- $form_session = $this->model->get_form_session_by_group_id($group_id);
164
- // Send mail to payer
165
- if ( $form->mail && !empty($form_session) ) {
166
- $to = $form->mail;
167
- $subject = "Payment information";
168
- // Get template for payment information.
169
- $template_params = array( 'form_session' => $form_session, 'data' => $post );
170
- $message = $this->view->payment_information_template($template_params);
171
- add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
172
- wp_mail($to, $subject, $message);
173
- }
174
-
175
- return 0;
176
- }
177
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/FMControllerBlocked_ips_fm.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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::spider_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::spider_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::spider_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::spider_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/FMControllerExtensions_fm.php ADDED
@@ -0,0 +1 @@
 
0
  ////////////////////////////////////////////////////////////////////////////////////////
1
  // Events //
2
  ////////////////////////////////////////////////////////////////////////////////////////
3
  ////////////////////////////////////////////////////////////////////////////////////////
4
  // Constants //
5
  ////////////////////////////////////////////////////////////////////////////////////////
6
  ////////////////////////////////////////////////////////////////////////////////////////
7
  // Variables //
8
  ////////////////////////////////////////////////////////////////////////////////////////
9
  ////////////////////////////////////////////////////////////////////////////////////////
10
  // Constructor & Destructor //
11
  ////////////////////////////////////////////////////////////////////////////////////////
12
  public function __construct() {
13
  }
14
  ////////////////////////////////////////////////////////////////////////////////////////
15
  // Public Methods //
16
  ////////////////////////////////////////////////////////////////////////////////////////
17
  public function execute() {
18
  $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
19
  if (method_exists($this, $task)) {
20
  $this->$task($id);
21
  }
22
  else {
23
  $this->display();
24
  }
25
  }
26
  public function display() {
27
  require_once WD_FM_DIR . "/admin/models/FMModelExtensions_fm.php";
28
  $model = new FMModelExtensions_fm();
29
  require_once WD_FM_DIR . "/admin/views/FMViewExtensions_fm.php";
30
  $view = new FMViewExtensions_fm($model);
31
  $view->display();
32
  }
33
  ////////////////////////////////////////////////////////////////////////////////////////
34
  // Getters & Setters //
35
  ////////////////////////////////////////////////////////////////////////////////////////
36
  ////////////////////////////////////////////////////////////////////////////////////////
37
  // Private Methods //
38
  ////////////////////////////////////////////////////////////////////////////////////////
39
  ////////////////////////////////////////////////////////////////////////////////////////
40
  // Listeners //
41
  ////////////////////////////////////////////////////////////////////////////////////////
1
+ <?php
2
  ////////////////////////////////////////////////////////////////////////////////////////
3
  // Events //
4
  ////////////////////////////////////////////////////////////////////////////////////////
5
  ////////////////////////////////////////////////////////////////////////////////////////
6
  // Constants //
7
  ////////////////////////////////////////////////////////////////////////////////////////
8
  ////////////////////////////////////////////////////////////////////////////////////////
9
  // Variables //
10
  ////////////////////////////////////////////////////////////////////////////////////////
11
  ////////////////////////////////////////////////////////////////////////////////////////
12
  // Constructor & Destructor //
13
  ////////////////////////////////////////////////////////////////////////////////////////
14
  public function __construct() {
15
  }
16
  ////////////////////////////////////////////////////////////////////////////////////////
17
  // Public Methods //
18
  ////////////////////////////////////////////////////////////////////////////////////////
19
  public function execute() {
20
  $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
21
  if (method_exists($this, $task)) {
22
  $this->$task($id);
23
  }
24
  else {
25
  $this->display();
26
  }
27
  }
28
  public function display() {
29
  require_once WD_FM_DIR . "/admin/models/FMModelExtensions_fm.php";
30
  $model = new FMModelExtensions_fm();
31
  require_once WD_FM_DIR . "/admin/views/FMViewExtensions_fm.php";
32
  $view = new FMViewExtensions_fm($model);
33
  $view->display();
34
  }
35
  ////////////////////////////////////////////////////////////////////////////////////////
36
  // Getters & Setters //
37
  ////////////////////////////////////////////////////////////////////////////////////////
38
  ////////////////////////////////////////////////////////////////////////////////////////
39
  // Private Methods //
40
  ////////////////////////////////////////////////////////////////////////////////////////
41
  ////////////////////////////////////////////////////////////////////////////////////////
42
  // Listeners //
43
  ////////////////////////////////////////////////////////////////////////////////////////
admin/controllers/FMControllerFeatured_plugins_fm.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerFeatured_plugins_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/FMModelFeatured_plugins_fm.php";
33
+ $model = new FMModelFeatured_plugins_fm();
34
+
35
+ require_once WD_FM_DIR . "/admin/views/FMViewFeatured_plugins_fm.php";
36
+ $view = new FMViewFeatured_plugins_fm($model);
37
+ $view->display();
38
+ }
39
+
40
+ ////////////////////////////////////////////////////////////////////////////////////////
41
+ // Getters & Setters //
42
+ ////////////////////////////////////////////////////////////////////////////////////////
43
+ ////////////////////////////////////////////////////////////////////////////////////////
44
+ // Private Methods //
45
+ ////////////////////////////////////////////////////////////////////////////////////////
46
+ ////////////////////////////////////////////////////////////////////////////////////////
47
+ // Listeners //
48
+ ////////////////////////////////////////////////////////////////////////////////////////
49
+ }
admin/controllers/FMControllerFormMakerEditCSS.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerFormMakerEditCSS {
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($_POST['task']) : '');
23
+ $id = ((isset($_POST['current_id'])) ? (int)esc_html($_POST['current_id']) : 0);
24
+ if (method_exists($this, $task)) {
25
+ $this->$task($id);
26
+ }
27
+ else {
28
+ $this->display();
29
+ }
30
+ }
31
+
32
+ public function display() {
33
+ require_once WD_FM_DIR . "/admin/models/FMModelFormMakerEditCSS.php";
34
+ $model = new FMModelFormMakerEditCSS();
35
+
36
+ require_once WD_FM_DIR . "/admin/views/FMViewFormMakerEditCSS.php";
37
+ $view = new FMViewFormMakerEditCSS($model);
38
+ $view->display();
39
+ }
40
+
41
+ public function save() {
42
+ $this->update_db();
43
+ }
44
+
45
+ public function apply() {
46
+ $this->update_db();
47
+ $this->display();
48
+ }
49
+
50
+ public function save_as_new() {
51
+ $this->insert_db();
52
+ }
53
+
54
+ public function insert_db() {
55
+ global $wpdb;
56
+ $title = (isset($_POST['title']) ? esc_html(stripslashes( $_POST['title'])) : '');
57
+ $css = (isset($_POST['css']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['css'])) : '');
58
+ $default = (isset($_POST['default']) ? esc_html(stripslashes( $_POST['default'])) : 0);
59
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker_themes', array(
60
+ 'title' => $title,
61
+ 'css' => $css,
62
+ 'default' => $default,
63
+ ), array(
64
+ '%s',
65
+ '%s',
66
+ '%d',
67
+ ));
68
+ }
69
+
70
+ public function update_db() {
71
+ global $wpdb;
72
+ $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes( $_POST['current_id'])) : 0);
73
+ $title = (isset($_POST['title']) ? esc_html(stripslashes( $_POST['title'])) : '');
74
+ $css = (isset($_POST['css']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['css'])) : '');
75
+ $default = (isset($_POST['default']) ? esc_html(stripslashes( $_POST['default'])) : 0);
76
+ $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array(
77
+ 'title' => $title,
78
+ 'css' => $css,
79
+ 'default' => $default,
80
+ ), array('id' => $id));
81
+ if ($save !== FALSE) {
82
+ echo WDW_FM_Library::message('Item Succesfully Saved.', 'updated');
83
+ }
84
+ else {
85
+ echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
86
+ }
87
+ }
88
+
89
+ ////////////////////////////////////////////////////////////////////////////////////////
90
+ // Getters & Setters //
91
+ ////////////////////////////////////////////////////////////////////////////////////////
92
+ ////////////////////////////////////////////////////////////////////////////////////////
93
+ // Private Methods //
94
+ ////////////////////////////////////////////////////////////////////////////////////////
95
+ ////////////////////////////////////////////////////////////////////////////////////////
96
+ // Listeners //
97
+ ////////////////////////////////////////////////////////////////////////////////////////
98
+ }
admin/controllers/FMControllerFormMakerPreview.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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((int)$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((int)$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/FMControllerFormmakerwdcaptcha.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/FMControllerLicensing_fm.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,1254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ public function undo()
35
+ {
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
+ {
54
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
55
+ $model = new FMModelManage_fm();
56
+
57
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
58
+ global $wpdb;
59
+ $backup_id = (int)WDW_FM_Library::get('backup_id');
60
+ $id = (int)WDW_FM_Library::get('id');
61
+
62
+ $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 ";
63
+ $backup_id = $wpdb->get_var($query);
64
+
65
+ $view = new FMViewManage_fm($model);
66
+ $view->edit($backup_id);
67
+
68
+ }
69
+
70
+
71
+ public function display() {
72
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
73
+ $model = new FMModelManage_fm();
74
+
75
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
76
+ $view = new FMViewManage_fm($model);
77
+ $view->display();
78
+ }
79
+
80
+ public function add() {
81
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
82
+ $model = new FMModelManage_fm();
83
+
84
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
85
+ $view = new FMViewManage_fm($model);
86
+ $view->edit(0);
87
+ }
88
+
89
+ public function edit() {
90
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
91
+ $model = new FMModelManage_fm();
92
+
93
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
94
+ $view = new FMViewManage_fm($model);
95
+ $id = WDW_FM_Library::get('current_id', 0);
96
+
97
+ global $wpdb;
98
+ $query = "SELECT backup_id FROM ".$wpdb->prefix."formmaker_backup WHERE cur=1 and id=".$id;
99
+ $backup_id = (int)$wpdb->get_var($query);
100
+
101
+ if(!$backup_id)
102
+ {
103
+ $query = "SELECT max(backup_id) FROM ".$wpdb->prefix."formmaker_backup";
104
+ $backup_id = $wpdb->get_var($query);
105
+ if($backup_id)
106
+ $backup_id++;
107
+ else
108
+ $backup_id=1;
109
+ $query = "INSERT INTO ".$wpdb->prefix."formmaker_backup SELECT ".$backup_id." AS backup_id, 1 AS cur, formmakerjan.id, formmakerjan.title, formmakerjan.mail, formmakerjan.form_front, formmakerjan.theme, formmakerjan.javascript, formmakerjan.submit_text, formmakerjan.url, formmakerjan.submit_text_type, formmakerjan.script_mail, formmakerjan.script_mail_user, formmakerjan.counter, formmakerjan.published, formmakerjan.label_order, formmakerjan.label_order_current, formmakerjan.article_id, formmakerjan.pagination, formmakerjan.show_title, formmakerjan.show_numbers, formmakerjan.public_key, formmakerjan.private_key, formmakerjan.recaptcha_theme, formmakerjan.paypal_mode, formmakerjan.checkout_mode, formmakerjan.paypal_email, formmakerjan.payment_currency, formmakerjan.tax, formmakerjan.form_fields, formmakerjan.savedb, formmakerjan.sendemail, formmakerjan.requiredmark, formmakerjan.from_mail, formmakerjan.from_name, formmakerjan.reply_to, formmakerjan.send_to, formmakerjan.autogen_layout, formmakerjan.custom_front, formmakerjan.mail_from_user, formmakerjan.mail_from_name_user, formmakerjan.reply_to_user, formmakerjan.condition, formmakerjan.mail_cc, formmakerjan.mail_cc_user, formmakerjan.mail_bcc, formmakerjan.mail_bcc_user, formmakerjan.mail_subject, formmakerjan.mail_subject_user, formmakerjan.mail_mode, formmakerjan.mail_mode_user, formmakerjan.mail_attachment, formmakerjan.mail_attachment_user, formmakerjan.user_id_wd, formmakerjan.sortable, formmakerjan.frontend_submit_fields, formmakerjan.frontend_submit_stat_fields, formmakerjan.mail_emptyfields, formmakerjan.mail_verify, formmakerjan.mail_verify_expiretime, formmakerjan.mail_verification_post_id FROM ".$wpdb->prefix."formmaker as formmakerjan WHERE id=".$id;
110
+
111
+ $wpdb->query($query);
112
+ }
113
+
114
+ $view->edit($backup_id);
115
+ }
116
+
117
+ public function edit_old() {
118
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
119
+ $model = new FMModelManage_fm();
120
+
121
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
122
+ $view = new FMViewManage_fm($model);
123
+ $id = (int)WDW_FM_Library::get('current_id', 0);
124
+ $view->edit_old($id);
125
+ }
126
+
127
+ public function form_options_old() {
128
+ if (!isset($_GET['task'])) {
129
+ $this->save_db();
130
+ }
131
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
132
+ $model = new FMModelManage_fm();
133
+
134
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
135
+ $view = new FMViewManage_fm($model);
136
+ global $wpdb;
137
+ $id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
138
+ $view->form_options_old($id);
139
+ }
140
+
141
+ public function save_options_old() {
142
+ $message = $this->save_db_options_old();
143
+ // $this->edit_old();
144
+ $page = WDW_FM_Library::get('page');
145
+ $current_id = (int)WDW_FM_Library::get('current_id', 0);
146
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'edit_old', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
147
+ }
148
+
149
+ public function apply_options_old() {
150
+ $message = $this->save_db_options_old();
151
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
152
+ $model = new FMModelManage_fm();
153
+
154
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
155
+ $view = new FMViewManage_fm($model);
156
+ // $id = ((isset($_POST['current_id']) && esc_html($_POST['current_id']) != '') ? esc_html($_POST['current_id']) : 0);
157
+ // $view->form_options_old($id);
158
+ $page = WDW_FM_Library::get('page');
159
+ $current_id = (int)WDW_FM_Library::get('current_id', 0);
160
+ $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
161
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'form_options_old', 'current_id' => $current_id, 'message' => $message, 'fieldset_id' => $fieldset_id), admin_url('admin.php')));
162
+ }
163
+
164
+ public function save_db_options_old() {
165
+ $javascript = "// Before the form is loaded.
166
+ function before_load() {
167
+
168
+ }
169
+ // Before form submit.
170
+ function before_submit() {
171
+
172
+ }
173
+ // Before form reset.
174
+ function before_reset() {
175
+
176
+ }";
177
+ global $wpdb;
178
+ $id = (int)WDW_FM_Library::get('current_id', 0);
179
+ $mail = (isset($_POST['mail']) ? esc_html(stripslashes($_POST['mail'])) : '');
180
+ $theme = (isset($_POST['theme']) ? (int)esc_html(stripslashes($_POST['theme'])) : 1);
181
+ $javascript = (isset($_POST['javascript']) ? stripslashes($_POST['javascript']) : $javascript);
182
+ $script1 = (isset($_POST['script1']) ? esc_html(stripslashes($_POST['script1'])) : '');
183
+ $script2 = (isset($_POST['script2']) ? esc_html(stripslashes($_POST['script2'])) : '');
184
+ $script_user1 = (isset($_POST['script_user1']) ? esc_html(stripslashes($_POST['script_user1'])) : '');
185
+ $script_user2 = (isset($_POST['script_user2']) ? esc_html(stripslashes($_POST['script_user2'])) : '');
186
+ $submit_text = (isset($_POST['submit_text']) ? stripslashes($_POST['submit_text']) : '');
187
+ $url = (isset($_POST['url']) ? esc_html(stripslashes($_POST['url'])) : '');
188
+ $script_mail = (isset($_POST['script_mail']) ? stripslashes($_POST['script_mail']) : '%all%');
189
+ $script_mail_user = (isset($_POST['script_mail_user']) ? stripslashes($_POST['script_mail_user']) : '%all%');
190
+ $label_order_current = (isset($_POST['label_order_current']) ? esc_html(stripslashes($_POST['label_order_current'])) : '');
191
+ $tax = (isset($_POST['tax']) ? esc_html(stripslashes($_POST['tax'])) : 0);
192
+ $payment_currency = (isset($_POST['payment_currency']) ? stripslashes($_POST['payment_currency']) : '');
193
+ $paypal_email = (isset($_POST['paypal_email']) ? esc_html(stripslashes($_POST['paypal_email'])) : '');
194
+ $checkout_mode = (isset($_POST['checkout_mode']) ? esc_html(stripslashes($_POST['checkout_mode'])) : 'testmode');
195
+ $paypal_mode = (isset($_POST['paypal_mode']) ? esc_html(stripslashes($_POST['paypal_mode'])) : 0);
196
+ $from_mail = (isset($_POST['from_mail']) ? esc_html(stripslashes($_POST['from_mail'])) : '');
197
+ $from_name = (isset($_POST['from_name']) ? esc_html(stripslashes($_POST['from_name'])) : '');
198
+ if (isset($_POST['submit_text_type'])) {
199
+ $submit_text_type = esc_html(stripslashes($_POST['submit_text_type']));
200
+ if ($submit_text_type == 5) {
201
+ $article_id = (isset($_POST['page_name']) ? esc_html(stripslashes($_POST['page_name'])) : 0);
202
+ }
203
+ else {
204
+ $article_id = (isset($_POST['post_name']) ? esc_html(stripslashes($_POST['post_name'])) : 0);
205
+ }
206
+ }
207
+ else {
208
+ $submit_text_type = 0;
209
+ $article_id = 0;
210
+ }
211
+ $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
212
+ 'mail' => $mail,
213
+ 'theme' => $theme,
214
+ 'javascript' => $javascript,
215
+ 'submit_text' => $submit_text,
216
+ 'url' => $url,
217
+ 'submit_text_type' => $submit_text_type,
218
+ 'script_mail' => $script_mail,
219
+ 'script_mail_user' => $script_mail_user,
220
+ 'article_id' => $article_id,
221
+ 'paypal_mode' => $paypal_mode,
222
+ 'checkout_mode' => $checkout_mode,
223
+ 'paypal_email' => $paypal_email,
224
+ 'payment_currency' => $payment_currency,
225
+ 'tax' => $tax,
226
+ 'from_mail' => $from_mail,
227
+ 'from_name' => $from_name,
228
+ ), array('id' => $id));
229
+ if ($save !== FALSE) {
230
+ return 8;
231
+ }
232
+ else {
233
+ return 2;
234
+ }
235
+ }
236
+
237
+ public function cancel_options_old() {
238
+ $this->edit_old();
239
+ }
240
+
241
+ public function form_layout() {
242
+ if (!isset($_GET['task'])) {
243
+ $this->save_db();
244
+ }
245
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
246
+ $model = new FMModelManage_fm();
247
+
248
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
249
+ $view = new FMViewManage_fm($model);
250
+ global $wpdb;
251
+ $id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
252
+ $view->form_layout($id);
253
+ }
254
+
255
+ public function save_layout() {
256
+ $message = $this->save_db_layout();
257
+ // $this->edit();
258
+ $page = WDW_FM_Library::get('page');
259
+ $current_id = (int)WDW_FM_Library::get('current_id', 0);
260
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
261
+ }
262
+
263
+ public function apply_layout() {
264
+ $message = $this->save_db_layout();
265
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
266
+ $model = new FMModelManage_fm();
267
+
268
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
269
+ $view = new FMViewManage_fm($model);
270
+ $page = WDW_FM_Library::get('page');
271
+ $current_id = (int)WDW_FM_Library::get('current_id', 0);
272
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'form_layout', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
273
+ // $view->form_layout($id);
274
+ }
275
+
276
+ public function save_db_layout() {
277
+ global $wpdb;
278
+ $id = (int)WDW_FM_Library::get('current_id', 0);
279
+ $custom_front = (isset($_POST['custom_front']) ? stripslashes($_POST['custom_front']) : '');
280
+ $autogen_layout = (isset($_POST['autogen_layout']) ? 1 : 0);
281
+ $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
282
+ 'custom_front' => $custom_front,
283
+ 'autogen_layout' => $autogen_layout
284
+ ), array('id' => $id));
285
+ if ($save !== FALSE) {
286
+ return 1;
287
+ }
288
+ else {
289
+ return 2;
290
+ }
291
+ }
292
+
293
+ public function form_options() {
294
+ if (!isset($_GET['task'])) {
295
+ $this->save_db();
296
+ }
297
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
298
+ $model = new FMModelManage_fm();
299
+
300
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
301
+ $view = new FMViewManage_fm($model);
302
+ // $id = ((isset($_POST['current_id']) && esc_html($_POST['current_id']) != '') ? esc_html($_POST['current_id']) : 0);
303
+ global $wpdb;
304
+ $id = (int)WDW_FM_Library::get('current_id', $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"));
305
+ $view->form_options($id);
306
+ }
307
+
308
+ public function save_options() {
309
+ $message = $this->save_db_options();
310
+ // $this->edit();
311
+ $page = WDW_FM_Library::get('page');
312
+ $current_id = (int)WDW_FM_Library::get('current_id', 0);
313
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
314
+ }
315
+
316
+ public function apply_options() {
317
+ $message = $this->save_db_options();
318
+ require_once WD_FM_DIR . "/admin/models/FMModelManage_fm.php";
319
+ $model = new FMModelManage_fm();
320
+
321
+ require_once WD_FM_DIR . "/admin/views/FMViewManage_fm.php";
322
+ $view = new FMViewManage_fm($model);
323
+ // $id = ((isset($_POST['current_id']) && esc_html($_POST['current_id']) != '') ? esc_html($_POST['current_id']) : 0);
324
+ // $view->form_options($id);
325
+ $page = WDW_FM_Library::get('page');
326
+ $current_id =(int) WDW_FM_Library::get('current_id', 0);
327
+ $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
328
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'form_options', 'current_id' => $current_id, 'message' => $message, 'fieldset_id' => $fieldset_id), admin_url('admin.php')));
329
+ }
330
+
331
+ public function remove_query() {
332
+ global $wpdb;
333
+ $cid = ((isset($_POST['cid']) && $_POST['cid'] != '') ? $_POST['cid'] : NULL);
334
+ if (count($cid)) {
335
+ array_walk($cid, create_function('&$value', '$value = (int)$value;'));
336
+ $cids = implode(',', $cid);
337
+ $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_query WHERE id IN ( ' . $cids . ' )';
338
+ if ($wpdb->query($query)) {
339
+ echo WDW_FM_Library::message('Items Succesfully Deleted.', 'updated');
340
+ }
341
+ else {
342
+ echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
343
+ }
344
+ }
345
+ else {
346
+ echo WDW_FM_Library::message('You must select at least one item.', 'error');
347
+ }
348
+ $this->apply_options();
349
+ }
350
+
351
+ public function cancel_options() {
352
+ $this->edit();
353
+ }
354
+
355
+ public function save_db_options() {
356
+ $javascript = "// Before the form is loaded.
357
+ function before_load() {
358
+
359
+ }
360
+ // Before form submit.
361
+ function before_submit() {
362
+
363
+ }
364
+ // Before form reset.
365
+ function before_reset() {
366
+
367
+ }";
368
+ global $wpdb;
369
+ // $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
370
+ $id = (int)WDW_FM_Library::get('current_id', 0);
371
+ $published = (isset($_POST['published']) ? esc_html(stripslashes($_POST['published'])) : 1);
372
+ $savedb = (isset($_POST['savedb']) ? esc_html(stripslashes($_POST['savedb'])) : 1);
373
+ $theme = ((isset($_POST['theme']) && (esc_html($_POST['theme']) != 0)) ? (int)esc_html(stripslashes($_POST['theme'])) : $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker_themes"));
374
+ $requiredmark = (isset($_POST['requiredmark']) ? esc_html(stripslashes($_POST['requiredmark'])) : '*');
375
+ $sendemail = (isset($_POST['sendemail']) ? esc_html(stripslashes($_POST['sendemail'])) : 1);
376
+ $mail = (isset($_POST['mail']) ? esc_html(stripslashes($_POST['mail'])) : '');
377
+ if (isset($_POST['mailToAdd']) && esc_html(stripslashes($_POST['mailToAdd'])) != '') {
378
+ $mail .= esc_html(stripslashes($_POST['mailToAdd'])) . ',';
379
+ }
380
+ $from_mail = (isset($_POST['from_mail']) ? esc_html(stripslashes($_POST['from_mail'])) : '');
381
+ $from_name = (isset($_POST['from_name']) ? esc_html(stripslashes($_POST['from_name'])) : '');
382
+ $reply_to = (isset($_POST['reply_to']) ? esc_html(stripslashes($_POST['reply_to'])) : '');
383
+ if ($from_mail == "other") {
384
+ $from_mail = (isset($_POST['mail_from_other']) ? esc_html(stripslashes($_POST['mail_from_other'])) : '');
385
+ }
386
+ if ($reply_to == "other") {
387
+ $reply_to = (isset($_POST['reply_to_other']) ? esc_html(stripslashes($_POST['reply_to_other'])) : '');
388
+ }
389
+ $script_mail = (isset($_POST['script_mail']) ? stripslashes($_POST['script_mail']) : '%all%');
390
+ $mail_from_user = (isset($_POST['mail_from_user']) ? esc_html(stripslashes($_POST['mail_from_user'])) : '');
391
+ $mail_from_name_user = (isset($_POST['mail_from_name_user']) ? esc_html(stripslashes($_POST['mail_from_name_user'])) : '');
392
+ $reply_to_user = (isset($_POST['reply_to_user']) ? esc_html(stripslashes($_POST['reply_to_user'])) : '');
393
+ $condition = (isset($_POST['condition']) ? esc_html(stripslashes($_POST['condition'])) : '');
394
+ $mail_cc = (isset($_POST['mail_cc']) ? esc_html(stripslashes($_POST['mail_cc'])) : '');
395
+ $mail_cc_user = (isset($_POST['mail_cc_user']) ? esc_html(stripslashes($_POST['mail_cc_user'])) : '');
396
+ $mail_bcc = (isset($_POST['mail_bcc']) ? esc_html(stripslashes($_POST['mail_bcc'])) : '');
397
+ $mail_bcc_user = (isset($_POST['mail_bcc_user']) ? esc_html(stripslashes($_POST['mail_bcc_user'])) : '');
398
+ $mail_subject = (isset($_POST['mail_subject']) ? esc_html(stripslashes($_POST['mail_subject'])) : '');
399
+ $mail_subject_user = (isset($_POST['mail_subject_user']) ? esc_html(stripslashes($_POST['mail_subject_user'])) : '');
400
+ $mail_mode = (isset($_POST['mail_mode']) ? esc_html(stripslashes($_POST['mail_mode'])) : 1);
401
+ $mail_mode_user = (isset($_POST['mail_mode_user']) ? esc_html(stripslashes($_POST['mail_mode_user'])) : 1);
402
+ $mail_attachment = (isset($_POST['mail_attachment']) ? esc_html(stripslashes($_POST['mail_attachment'])) : 1);
403
+ $mail_attachment_user = (isset($_POST['mail_attachment_user']) ? esc_html(stripslashes($_POST['mail_attachment_user'])) : 1);
404
+ $script_mail_user = (isset($_POST['script_mail_user']) ? stripslashes($_POST['script_mail_user']) : '%all%');
405
+ $submit_text = (isset($_POST['submit_text']) ? stripslashes($_POST['submit_text']) : '');
406
+ $url = (isset($_POST['url']) ? esc_html(stripslashes($_POST['url'])) : '');
407
+ $tax = (isset($_POST['tax']) ? esc_html(stripslashes($_POST['tax'])) : 0);
408
+ $payment_currency = (isset($_POST['payment_currency']) ? stripslashes($_POST['payment_currency']) : '');
409
+ $paypal_email = (isset($_POST['paypal_email']) ? esc_html(stripslashes($_POST['paypal_email'])) : '');
410
+ $checkout_mode = (isset($_POST['checkout_mode']) ? esc_html(stripslashes($_POST['checkout_mode'])) : 'testmode');
411
+ $paypal_mode = (isset($_POST['paypal_mode']) ? esc_html(stripslashes($_POST['paypal_mode'])) : 0);
412
+ $javascript = (isset($_POST['javascript']) ? stripslashes($_POST['javascript']) : $javascript);
413
+ $user_id_wd = (isset($_POST['user_id_wd']) ? stripslashes($_POST['user_id_wd']) : 'administrator,');
414
+ $frontend_submit_fields = (isset($_POST['frontend_submit_fields']) ? stripslashes($_POST['frontend_submit_fields']) : '');
415
+ $frontend_submit_stat_fields = (isset($_POST['frontend_submit_stat_fields']) ? stripslashes($_POST['frontend_submit_stat_fields']) : '');
416
+ $mail_emptyfields = (isset($_POST['mail_emptyfields']) ? esc_html(stripslashes($_POST['mail_emptyfields'])) : 0);
417
+ $mail_verify = (isset($_POST['mail_verify']) ? esc_html(stripslashes($_POST['mail_verify'])) : 0);
418
+ $mail_verify_expiretime = (isset($_POST['mail_verify_expiretime']) ? esc_html(stripslashes($_POST['mail_verify_expiretime'])) : '');
419
+ $send_to = '';
420
+ for ($i = 0; $i < 20; $i++) {
421
+ if (isset($_POST['send_to' . $i])) {
422
+ $send_to .= '*' . esc_html(stripslashes($_POST['send_to' . $i])) . '*';
423
+ }
424
+ }
425
+ if (isset($_POST['submit_text_type'])) {
426
+ $submit_text_type = esc_html(stripslashes($_POST['submit_text_type']));
427
+ if ($submit_text_type == 5) {
428
+ $article_id = (isset($_POST['page_name']) ? esc_html(stripslashes($_POST['page_name'])) : 0);
429
+ }
430
+ else {
431
+ $article_id = (isset($_POST['post_name']) ? esc_html(stripslashes($_POST['post_name'])) : 0);
432
+ }
433
+ }
434
+ else {
435
+ $submit_text_type = 0;
436
+ $article_id = 0;
437
+ }
438
+
439
+ $mail_verification_post_id = (int)$wpdb->get_var('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!=0');
440
+ if($mail_verify) {
441
+ $email_verification_post = array(
442
+ 'post_title' => 'Email Verification',
443
+ 'post_content' => '[email_verification]',
444
+ 'post_status' => 'publish',
445
+ 'post_author' => 1,
446
+ 'post_type' => 'fmemailverification',
447
+ );
448
+
449
+ if(!$mail_verification_post_id || get_post( $mail_verification_post_id )===NULL)
450
+ $mail_verification_post_id = wp_insert_post( $email_verification_post );
451
+ }
452
+
453
+ $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
454
+ 'published' => $published,
455
+ 'savedb' => $savedb,
456
+ 'theme' => $theme,
457
+ 'requiredmark' => $requiredmark,
458
+ 'sendemail' => $sendemail,
459
+ 'mail' => $mail,
460
+ 'from_mail' => $from_mail,
461
+ 'from_name' => $from_name,
462
+ 'reply_to' => $reply_to,
463
+ 'script_mail' => $script_mail,
464
+ 'mail_from_user' => $mail_from_user,
465
+ 'mail_from_name_user' => $mail_from_name_user,
466
+ 'reply_to_user' => $reply_to_user,
467
+ 'condition' => $condition,
468
+ 'mail_cc' => $mail_cc,
469
+ 'mail_cc_user' => $mail_cc_user,
470
+ 'mail_bcc' => $mail_bcc,
471
+ 'mail_bcc_user' => $mail_bcc_user,
472
+ 'mail_subject' => $mail_subject,
473
+ 'mail_subject_user' => $mail_subject_user,
474
+ 'mail_mode' => $mail_mode,
475
+ 'mail_mode_user' => $mail_mode_user,
476
+ 'mail_attachment' => $mail_attachment,
477
+ 'mail_attachment_user' => $mail_attachment_user,
478
+ 'script_mail_user' => $script_mail_user,
479
+ 'submit_text' => $submit_text,
480
+ 'url' => $url,
481
+ 'submit_text_type' => $submit_text_type,
482
+ 'article_id' => $article_id,
483
+ 'tax' => $tax,
484
+ 'payment_currency' => $payment_currency,
485
+ 'paypal_email' => $paypal_email,
486
+ 'checkout_mode' => $checkout_mode,
487
+ 'paypal_mode' => $paypal_mode,
488
+ 'javascript' => $javascript,
489
+ 'user_id_wd' => $user_id_wd,
490
+ 'send_to' => $send_to,
491
+ 'frontend_submit_fields' => $frontend_submit_fields,
492
+ 'frontend_submit_stat_fields' => $frontend_submit_stat_fields,
493
+ 'mail_emptyfields' => $mail_emptyfields,
494
+ 'mail_verify' => $mail_verify,
495
+ 'mail_verify_expiretime' => $mail_verify_expiretime,
496
+ 'mail_verification_post_id' => $mail_verification_post_id,
497
+ ), array('id' => $id));
498
+ if ($save !== FALSE) {
499
+ return 8;
500
+ }
501
+ else {
502
+ return 2;
503
+ }
504
+ }
505
+
506
+ public function save_as_copy_old() {
507
+ $message = $this->save_db_as_copy_old();
508
+ // $this->display();
509
+ $page = WDW_FM_Library::get('page');
510
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
511
+ }
512
+
513
+ public function save_old() {
514
+ $message = $this->save_db_old();
515
+ // $this->display();
516
+ $page = WDW_FM_Library::get('page');
517
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
518
+ }
519
+
520
+ public function apply_old() {
521
+ global $wpdb;
522
+ $message = $this->save_db_old();
523
+ // $this->edit_old();
524
+ $id = (int) $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
525
+ $current_id =(int) WDW_FM_Library::get('current_id', $id);
526
+ $page = WDW_FM_Library::get('page');
527
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'edit_old', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
528
+ }
529
+
530
+ public function save_db_old() {
531
+ global $wpdb;
532
+ // $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
533
+ $id = (int)WDW_FM_Library::get('current_id', 0);
534
+ $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
535
+ $form = (isset($_POST['form']) ? stripslashes($_POST['form']) : '');
536
+ $form_front = (isset($_POST['form_front']) ? stripslashes($_POST['form_front']) : '');
537
+ $counter = (isset($_POST['counter']) ? esc_html(stripslashes($_POST['counter'])) : 0);
538
+ $label_order = (isset($_POST['label_order']) ? esc_html(stripslashes($_POST['label_order'])) : '');
539
+ $label_order_current = (isset($_POST['label_order_current']) ? esc_html(stripslashes($_POST['label_order_current'])) : '');
540
+ $pagination = (isset($_POST['pagination']) ? esc_html(stripslashes($_POST['pagination'])) : '');
541
+ $show_title = (isset($_POST['show_title']) ? esc_html(stripslashes($_POST['show_title'])) : '');
542
+ $show_numbers = (isset($_POST['show_numbers']) ? esc_html(stripslashes($_POST['show_numbers'])) : '');
543
+ $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
544
+ $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
545
+ $recaptcha_theme = (isset($_POST['recaptcha_theme']) ? esc_html(stripslashes($_POST['recaptcha_theme'])) : '');
546
+
547
+ $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
548
+ 'title' => $title,
549
+ 'form' => $form,
550
+ 'form_front' => $form_front,
551
+ 'counter' => $counter,
552
+ 'label_order' => $label_order,
553
+ 'label_order_current' => $label_order_current,
554
+ 'pagination' => $pagination,
555
+ 'show_title' => $show_title,
556
+ 'show_numbers' => $show_numbers,
557
+ 'public_key' => $public_key,
558
+ 'private_key' => $private_key,
559
+ 'recaptcha_theme' => $recaptcha_theme,
560
+ ), array('id' => $id));
561
+ if ($save !== FALSE) {
562
+ return 1;
563
+ }
564
+ else {
565
+ return 2;
566
+ }
567
+ }
568
+
569
+ public function save_db_as_copy_old() {
570
+ global $wpdb;
571
+ // $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
572
+ $id = (int)WDW_FM_Library::get('current_id', 0);
573
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
574
+ $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
575
+ $form = (isset($_POST['form']) ? stripslashes($_POST['form']) : '');
576
+ $form_front = (isset($_POST['form_front']) ? stripslashes($_POST['form_front']) : '');
577
+ $counter = (isset($_POST['counter']) ? esc_html(stripslashes($_POST['counter'])) : 0);
578
+ $label_order = (isset($_POST['label_order']) ? esc_html(stripslashes($_POST['label_order'])) : '');
579
+ $pagination = (isset($_POST['pagination']) ? esc_html(stripslashes($_POST['pagination'])) : '');
580
+ $show_title = (isset($_POST['show_title']) ? esc_html(stripslashes($_POST['show_title'])) : '');
581
+ $show_numbers = (isset($_POST['show_numbers']) ? esc_html(stripslashes($_POST['show_numbers'])) : '');
582
+ $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
583
+ $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
584
+ $recaptcha_theme = (isset($_POST['recaptcha_theme']) ? esc_html(stripslashes($_POST['recaptcha_theme'])) : '');
585
+
586
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker', array(
587
+ 'title' => $title,
588
+ 'mail' => $row->mail,
589
+ 'form' => $form,
590
+ 'form_front' => $form_front,
591
+ 'theme' => $row->theme,
592
+ 'counter' => $counter,
593
+ 'label_order' => $label_order,
594
+ 'pagination' => $pagination,
595
+ 'show_title' => $show_title,
596
+ 'show_numbers' => $show_numbers,
597
+ 'public_key' => $public_key,
598
+ 'private_key' => $private_key,
599
+ 'recaptcha_theme' => $recaptcha_theme,
600
+ 'javascript' => $row->javascript,
601
+ 'script1' => $row->script1,
602
+ 'script2' => $row->script2,
603
+ 'script_user1' => $row->script_user1,
604
+ 'script_user2' => $row->script_user2,
605
+ 'submit_text' => $row->submit_text,
606
+ 'url' => $row->url,
607
+ 'article_id' => $row->article_id,
608
+ 'submit_text_type' => $row->submit_text_type,
609
+ 'script_mail' => $row->script_mail,
610
+ 'script_mail_user' => $row->script_mail_user,
611
+ 'paypal_mode' => $row->paypal_mode,
612
+ 'checkout_mode' => $row->checkout_mode,
613
+ 'paypal_email' => $row->paypal_email,
614
+ 'payment_currency' => $row->payment_currency,
615
+ 'tax' => $row->tax,
616
+ 'label_order_current' => $row->label_order_current,
617
+ 'from_mail' => $row->from_mail,
618
+ 'from_name' => $row->from_name,
619
+ 'reply_to_user' => $row->reply_to_user,
620
+ 'mail_from_name_user' => $row->mail_from_name_user,
621
+ 'mail_from_user' => $row->mail_from_user,
622
+ 'custom_front' => $row->custom_front,
623
+ 'autogen_layout' => $row->autogen_layout,
624
+ 'send_to' => $row->send_to,
625
+ 'reply_to' => $row->reply_to,
626
+ 'requiredmark' => $row->requiredmark,
627
+ 'sendemail' => $row->sendemail,
628
+ 'savedb' => $row->savedb,
629
+ 'form_fields' => $row->form_fields,
630
+ 'published' => $row->published
631
+ ), array(
632
+ '%s',
633
+ '%s',
634
+ '%s',
635
+ '%s',
636
+ '%d',
637
+ '%d',
638
+ '%s',
639
+ '%s',
640
+ '%s',
641
+ '%s',
642
+ '%s',
643
+ '%s',
644
+ '%s',
645
+ '%s',
646
+ '%s',
647
+ '%s',
648
+ '%s',
649
+ '%s',
650
+ '%s',
651
+ '%s',
652
+ '%s',
653
+ '%d',
654
+ '%s',
655
+ '%s',
656
+ '%d',
657
+ '%s',
658
+ '%s',
659
+ '%s',
660
+ '%s',
661
+ '%s',
662
+ '%s',
663
+ '%s',
664
+ '%s',
665
+ '%s',
666
+ '%s',
667
+ '%s',
668
+ '%d',
669
+ '%s',
670
+ '%s',
671
+ '%s',
672
+ '%d',
673
+ '%d',
674
+ '%s',
675
+ '%d'
676
+ ));
677
+ $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
678
+ $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
679
+ 'form_id' => $id,
680
+ 'views' => 0
681
+ ), array(
682
+ '%d',
683
+ '%d'
684
+ ));
685
+ if ($save !== FALSE) {
686
+ return 1;
687
+ }
688
+ else {
689
+ return 2;
690
+ }
691
+ }
692
+
693
+ public function save_as_copy() {
694
+ $message = $this->save_db_as_copy();
695
+ // $this->display();
696
+ $page = WDW_FM_Library::get('page');
697
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
698
+ }
699
+
700
+ public function save() {
701
+ $message = $this->save_db();
702
+ // $this->display();
703
+ $page = WDW_FM_Library::get('page');
704
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
705
+ }
706
+
707
+ public function apply() {
708
+ $message = $this->save_db();
709
+ // $this->edit();
710
+ global $wpdb;
711
+ $id = (int) $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
712
+ $current_id = (int)WDW_FM_Library::get('current_id', $id);
713
+ $page = WDW_FM_Library::get('page');
714
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
715
+ }
716
+
717
+ public function save_db() {
718
+ global $wpdb;
719
+ $javascript = "// before form is load
720
+ function before_load() {
721
+ }
722
+ // before form submit
723
+ function before_submit() {
724
+ }
725
+ // before form reset
726
+ function before_reset() {
727
+ }";
728
+ $id = (int)WDW_FM_Library::get('current_id', 0);
729
+ $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
730
+ $form_front = (isset($_POST['form_front']) ? stripslashes($_POST['form_front']) : '');
731
+ $sortable = (isset($_POST['sortable']) ? 1 : 0);
732
+ $counter = (isset($_POST['counter']) ? esc_html(stripslashes($_POST['counter'])) : 0);
733
+ $label_order = (isset($_POST['label_order']) ? esc_html(stripslashes($_POST['label_order'])) : '');
734
+ $pagination = (isset($_POST['pagination']) ? esc_html(stripslashes($_POST['pagination'])) : '');
735
+ $show_title = (isset($_POST['show_title']) ? esc_html(stripslashes($_POST['show_title'])) : '');
736
+ $show_numbers = (isset($_POST['show_numbers']) ? esc_html(stripslashes($_POST['show_numbers'])) : '');
737
+ $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
738
+ $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
739
+ $recaptcha_theme = (isset($_POST['recaptcha_theme']) ? esc_html(stripslashes($_POST['recaptcha_theme'])) : '');
740
+ $label_order_current = (isset($_POST['label_order_current']) ? esc_html(stripslashes($_POST['label_order_current'])) : '');
741
+ $form_fields = (isset($_POST['form_fields']) ? stripslashes($_POST['form_fields']) : '');
742
+ if ($id != 0) {
743
+ $save = $wpdb->update($wpdb->prefix . 'formmaker', array(
744
+ 'title' => $title,
745
+ 'form_front' => $form_front,
746
+ 'sortable' => $sortable,
747
+ 'counter' => $counter,
748
+ 'label_order' => $label_order,
749
+ 'label_order_current' => $label_order_current,
750
+ 'pagination' => $pagination,
751
+ 'show_title' => $show_title,
752
+ 'show_numbers' => $show_numbers,
753
+ 'public_key' => $public_key,
754
+ 'private_key' => $private_key,
755
+ 'recaptcha_theme' => $recaptcha_theme,
756
+ 'form_fields' => $form_fields,
757
+ ), array('id' => $id));
758
+ }
759
+ else {
760
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker', array(
761
+ 'title' => $title,
762
+ 'mail' => '',
763
+ 'form_front' => $form_front,
764
+ 'theme' => $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE css LIKE '%.wdform_section%'"),
765
+ 'counter' => $counter,
766
+ 'label_order' => $label_order,
767
+ 'pagination' => $pagination,
768
+ 'show_title' => $show_title,
769
+ 'show_numbers' => $show_numbers,
770
+ 'public_key' => $public_key,
771
+ 'private_key' => $private_key,
772
+ 'recaptcha_theme' => $recaptcha_theme,
773
+ 'javascript' => $javascript,
774
+ 'submit_text' => '',
775
+ 'url' => '',
776
+ 'article_id' => 0,
777
+ 'submit_text_type' => 0,
778
+ 'script_mail' => '%all%',
779
+ 'script_mail_user' => '%all%',
780
+ 'label_order_current' => $label_order_current,
781
+ 'tax' => 0,
782
+ 'payment_currency' => '',
783
+ 'paypal_email' => '',
784
+ 'checkout_mode' => 'testmode',
785
+ 'paypal_mode' => 0,
786
+ 'published' => 1,
787
+ 'form_fields' => $form_fields,
788
+ 'savedb' => 1,
789
+ 'sendemail' => 1,
790
+ 'requiredmark' => '*',
791
+ 'from_mail' => '',
792
+ 'from_name' => '',
793
+ 'reply_to' => '',
794
+ 'send_to' => '',
795
+ 'autogen_layout' => 1,
796
+ 'custom_front' => '',
797
+ 'mail_from_user' => '',
798
+ 'mail_from_name_user' => '',
799
+ 'reply_to_user' => '',
800
+ 'condition' => '',
801
+ 'mail_cc' => '',
802
+ 'mail_cc_user' => '',
803
+ 'mail_bcc' => '',
804
+ 'mail_bcc_user' => '',
805
+ 'mail_subject' => '',
806
+ 'mail_subject_user' => '',
807
+ 'mail_mode' => 1,
808
+ 'mail_mode_user' => 1,
809
+ 'mail_attachment' => 1,
810
+ 'mail_attachment_user' => 1,
811
+ 'sortable' => $sortable,
812
+ 'user_id_wd' => 'administrator,',
813
+ 'frontend_submit_fields' => '',
814
+ 'frontend_submit_stat_fields' => '',
815
+ ), array(
816
+ '%s',
817
+ '%s',
818
+ '%s',
819
+ '%d',
820
+ '%d',
821
+ '%s',
822
+ '%s',
823
+ '%s',
824
+ '%s',
825
+ '%s',
826
+ '%s',
827
+ '%s',
828
+ '%s',
829
+ '%s',
830
+ '%s',
831
+ '%d',
832
+ '%d',
833
+ '%s',
834
+ '%s',
835
+ '%s',
836
+ '%s',
837
+ '%s',
838
+ '%s',
839
+ '%s',
840
+ '%d',
841
+ '%d',
842
+ '%s',
843
+ '%d',
844
+ '%d',
845
+ '%s',
846
+ '%s',
847
+ '%s',
848
+ '%s',
849
+ '%s',
850
+ '%d',
851
+ '%s',
852
+ '%s',
853
+ '%s',
854
+ '%s',
855
+ '%s',
856
+ '%s',
857
+ '%s',
858
+ '%s',
859
+ '%s',
860
+ '%s',
861
+ '%s',
862
+ '%d',
863
+ '%d',
864
+ '%d',
865
+ '%d',
866
+ '%d',
867
+ '%s',
868
+ '%s',
869
+ '%s',
870
+ ));
871
+ $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
872
+ // $_POST['current_id'] = $id;
873
+ $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
874
+ 'form_id' => $id,
875
+ 'views' => 0
876
+ ), array(
877
+ '%d',
878
+ '%d'
879
+ ));
880
+ }
881
+
882
+ $backup_id = (isset($_POST['backup_id']) ? (int)esc_html(stripslashes($_POST['backup_id'])) : '');
883
+
884
+ if($backup_id)
885
+ {
886
+ $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 ";
887
+
888
+ if($wpdb->get_var($query))
889
+ {
890
+ $query = "DELETE FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id > ".$backup_id." AND id = ".$id;
891
+ $wpdb->query($query);
892
+ }
893
+
894
+ $row = $wpdb->get_row($wpdb->prepare("SELECT form_fields, form_front FROM ".$wpdb->prefix."formmaker_backup WHERE backup_id = '%d'", $backup_id));
895
+
896
+ if($row->form_fields==$form_fields and $row->form_front==$form_front)
897
+ {
898
+ $save = $wpdb->update($wpdb->prefix . 'formmaker_backup', array(
899
+ 'cur' => 1,
900
+ 'title' => $title,
901
+ 'form_front' => $form_front,
902
+ 'sortable' => $sortable,
903
+ 'counter' => $counter,
904
+ 'label_order' => $label_order,
905
+ 'label_order_current' => $label_order_current,
906
+ 'pagination' => $pagination,
907
+ 'show_title' => $show_title,
908
+ 'show_numbers' => $show_numbers,
909
+ 'public_key' => $public_key,
910
+ 'private_key' => $private_key,
911
+ 'recaptcha_theme' => $recaptcha_theme,
912
+ 'form_fields' => $form_fields,
913
+ ), array('backup_id' => $backup_id));
914
+
915
+
916
+ if ($save !== FALSE) {
917
+ return 1;
918
+ }
919
+ else {
920
+ return 2;
921
+ }
922
+ }
923
+ }
924
+
925
+ $wpdb->query("UPDATE ".$wpdb->prefix."formmaker_backup SET cur=0 WHERE id=".$id );
926
+
927
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker_backup', array(
928
+ 'cur' => 1,
929
+ 'id' => $id,
930
+ 'title' => $title,
931
+ 'mail' => '',
932
+ 'form_front' => $form_front,
933
+ 'theme' => $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE css LIKE '%.wdform_section%'"),
934
+ 'counter' => $counter,
935
+ 'label_order' => $label_order,
936
+ 'pagination' => $pagination,
937
+ 'show_title' => $show_title,
938
+ 'show_numbers' => $show_numbers,
939
+ 'public_key' => $public_key,
940
+ 'private_key' => $private_key,
941
+ 'recaptcha_theme' => $recaptcha_theme,
942
+ 'javascript' => $javascript,
943
+ 'submit_text' => '',
944
+ 'url' => '',
945
+ 'article_id' => 0,
946
+ 'submit_text_type' => 0,
947
+ 'script_mail' => '%all%',
948
+ 'script_mail_user' => '%all%',
949
+ 'label_order_current' => $label_order_current,
950
+ 'tax' => 0,
951
+ 'payment_currency' => '',
952
+ 'paypal_email' => '',
953
+ 'checkout_mode' => 'testmode',
954
+ 'paypal_mode' => 0,
955
+ 'published' => 1,
956
+ 'form_fields' => $form_fields,
957
+ 'savedb' => 1,
958
+ 'sendemail' => 1,
959
+ 'requiredmark' => '*',
960
+ 'from_mail' => '',
961
+ 'from_name' => '',
962
+ 'reply_to' => '',
963
+ 'send_to' => '',
964
+ 'autogen_layout' => 1,
965
+ 'custom_front' => '',
966
+ 'mail_from_user' => '',
967
+ 'mail_from_name_user' => '',
968
+ 'reply_to_user' => '',
969
+ 'condition' => '',
970
+ 'mail_cc' => '',
971
+ 'mail_cc_user' => '',
972
+ 'mail_bcc' => '',
973
+ 'mail_bcc_user' => '',
974
+ 'mail_subject' => '',
975
+ 'mail_subject_user' => '',
976
+ 'mail_mode' => 1,
977
+ 'mail_mode_user' => 1,
978
+ 'mail_attachment' => 1,
979
+ 'mail_attachment_user' => 1,
980
+ 'sortable' => $sortable,
981
+ 'user_id_wd' => 'administrator,',
982
+ 'frontend_submit_fields' => '',
983
+ 'frontend_submit_stat_fields' => '',
984
+ ), array(
985
+ '%d',
986
+ '%d',
987
+ '%s',
988
+ '%s',
989
+ '%s',
990
+ '%d',
991
+ '%d',
992
+ '%s',
993
+ '%s',
994
+ '%s',
995
+ '%s',
996
+ '%s',
997
+ '%s',
998
+ '%s',
999
+ '%s',
1000
+ '%s',
1001
+ '%s',
1002
+ '%d',
1003
+ '%d',
1004
+ '%s',
1005
+ '%s',
1006
+ '%s',
1007
+ '%s',
1008
+ '%s',
1009
+ '%s',
1010
+ '%s',
1011
+ '%d',
1012
+ '%d',
1013
+ '%s',
1014
+ '%d',
1015
+ '%d',
1016
+ '%s',
1017
+ '%s',
1018
+ '%s',
1019
+ '%s',
1020
+ '%s',
1021
+ '%d',
1022
+ '%s',
1023
+ '%s',
1024
+ '%s',
1025
+ '%s',
1026
+ '%s',
1027
+ '%s',
1028
+ '%s',
1029
+ '%s',
1030
+ '%s',
1031
+ '%s',
1032
+ '%s',
1033
+ '%d',
1034
+ '%d',
1035
+ '%d',
1036
+ '%d',
1037
+ '%d',
1038
+ '%s',
1039
+ '%s',
1040
+ '%s',
1041
+ )) ;
1042
+
1043
+ $query = "SELECT count(backup_id) FROM ".$wpdb->prefix."formmaker_backup WHERE id = ".$id;
1044
+ $wpdb->get_var($query);
1045
+ if($wpdb->get_var($query)>10)
1046
+ {
1047
+ $query = "DELETE FROM ".$wpdb->prefix."formmaker_backup WHERE id = ".$id." ORDER BY backup_id ASC LIMIT 1 ";
1048
+ $wpdb->query($query);
1049
+ }
1050
+
1051
+ if ($save !== FALSE) {
1052
+ return 1;
1053
+ }
1054
+ else {
1055
+ return 2;
1056
+ }
1057
+ }
1058
+
1059
+ public function save_db_as_copy() {
1060
+ global $wpdb;
1061
+ // $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
1062
+ $id = (int)WDW_FM_Library::get('current_id', 0);
1063
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
1064
+ $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
1065
+ $form_front = (isset($_POST['form_front']) ? stripslashes($_POST['form_front']) : '');
1066
+ $sortable = (isset($_POST['sortable']) ? stripslashes($_POST['sortable']) : 1);
1067
+ $counter = (isset($_POST['counter']) ? esc_html(stripslashes($_POST['counter'])) : 0);
1068
+ $label_order = (isset($_POST['label_order']) ? esc_html(stripslashes($_POST['label_order'])) : '');
1069
+ $label_order_current = (isset($_POST['label_order_current']) ? esc_html(stripslashes($_POST['label_order_current'])) : '');
1070
+ $pagination = (isset($_POST['pagination']) ? esc_html(stripslashes($_POST['pagination'])) : '');
1071
+ $show_title = (isset($_POST['show_title']) ? esc_html(stripslashes($_POST['show_title'])) : '');
1072
+ $show_numbers = (isset($_POST['show_numbers']) ? esc_html(stripslashes($_POST['show_numbers'])) : '');
1073
+ $public_key = (isset($_POST['public_key']) ? esc_html(stripslashes($_POST['public_key'])) : '');
1074
+ $private_key = (isset($_POST['private_key']) ? esc_html(stripslashes($_POST['private_key'])) : '');
1075
+ $recaptcha_theme = (isset($_POST['recaptcha_theme']) ? esc_html(stripslashes($_POST['recaptcha_theme'])) : '');
1076
+ $form_fields = (isset($_POST['form_fields']) ? stripslashes($_POST['form_fields']) : '');
1077
+
1078
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker', array(
1079
+ 'title' => $title,
1080
+ 'mail' => $row->mail,
1081
+ 'form_front' => $form_front,
1082
+ 'theme' => $row->theme,
1083
+ 'counter' => $counter,
1084
+ 'label_order' => $label_order,
1085
+ 'pagination' => $pagination,
1086
+ 'show_title' => $show_title,
1087
+ 'show_numbers' => $show_numbers,
1088
+ 'public_key' => $public_key,
1089
+ 'private_key' => $private_key,
1090
+ 'recaptcha_theme' => $recaptcha_theme,
1091
+ 'javascript' => $row->javascript,
1092
+ 'submit_text' => $row->submit_text,
1093
+ 'url' => $row->url,
1094
+ 'article_id' => $row->article_id,
1095
+ 'submit_text_type' => $row->submit_text_type,
1096
+ 'script_mail' => $row->script_mail,
1097
+ 'script_mail_user' => $row->script_mail_user,
1098
+ 'label_order_current' => $label_order_current,
1099
+ 'tax' => $row->tax,
1100
+ 'payment_currency' => $row->payment_currency,
1101
+ 'paypal_email' => $row->paypal_email,
1102
+ 'checkout_mode' => $row->checkout_mode,
1103
+ 'paypal_mode' => $row->paypal_mode,
1104
+ 'published' => $row->published,
1105
+ 'form_fields' => $form_fields,
1106
+ 'savedb' => $row->savedb,
1107
+ 'sendemail' => $row->sendemail,
1108
+ 'requiredmark' => $row->requiredmark,
1109
+ 'from_mail' => $row->from_mail,
1110
+ 'from_name' => $row->from_name,
1111
+ 'reply_to' => $row->reply_to,
1112
+ 'send_to' => $row->send_to,
1113
+ 'autogen_layout' => $row->autogen_layout,
1114
+ 'custom_front' => $row->custom_front,
1115
+ 'mail_from_user' => $row->mail_from_user,
1116
+ 'mail_from_name_user' => $row->mail_from_name_user,
1117
+ 'reply_to_user' => $row->reply_to_user,
1118
+ 'condition' => $row->condition,
1119
+ 'mail_cc' => $row->mail_cc,
1120
+ 'mail_cc_user' => $row->mail_cc_user,
1121
+ 'mail_bcc' => $row->mail_bcc,
1122
+ 'mail_bcc_user' => $row->mail_bcc_user,
1123
+ 'mail_subject' => $row->mail_subject,
1124
+ 'mail_subject_user' => $row->mail_subject_user,
1125
+ 'mail_mode' => $row->mail_mode,
1126
+ 'mail_mode_user' => $row->mail_mode_user,
1127
+ 'mail_attachment' => $row->mail_attachment,
1128
+ 'mail_attachment_user' => $row->mail_attachment_user,
1129
+ 'sortable' => $sortable,
1130
+ 'user_id_wd' => $row->user_id_wd,
1131
+ 'frontend_submit_fields' => $row->frontend_submit_fields,
1132
+ 'frontend_submit_stat_fields' => $row->frontend_submit_stat_fields,
1133
+ ), array(
1134
+ '%s',
1135
+ '%s',
1136
+ '%s',
1137
+ '%d',
1138
+ '%d',
1139
+ '%s',
1140
+ '%s',
1141
+ '%s',
1142
+ '%s',
1143
+ '%s',
1144
+ '%s',
1145
+ '%s',
1146
+ '%s',
1147
+ '%s',
1148
+ '%s',
1149
+ '%d',
1150
+ '%d',
1151
+ '%s',
1152
+ '%s',
1153
+ '%s',
1154
+ '%s',
1155
+ '%s',
1156
+ '%s',
1157
+ '%s',
1158
+ '%d',
1159
+ '%d',
1160
+ '%s',
1161
+ '%d',
1162
+ '%d',
1163
+ '%s',
1164
+ '%s',
1165
+ '%s',
1166
+ '%s',
1167
+ '%s',
1168
+ '%d',
1169
+ '%s',
1170
+ '%s',
1171
+ '%s',
1172
+ '%s',
1173
+ '%s',
1174
+ '%s',
1175
+ '%s',
1176
+ '%s',
1177
+ '%s',
1178
+ '%s',
1179
+ '%s',
1180
+ '%d',
1181
+ '%d',
1182
+ '%d',
1183
+ '%d',
1184
+ '%d',
1185
+ '%s',
1186
+ '%s',
1187
+ '%s',
1188
+ ));
1189
+ $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker");
1190
+ $wpdb->insert($wpdb->prefix . 'formmaker_views', array(
1191
+ 'form_id' => $id,
1192
+ 'views' => 0
1193
+ ), array(
1194
+ '%d',
1195
+ '%d'
1196
+ ));
1197
+ if ($save !== FALSE) {
1198
+ return 1;
1199
+ }
1200
+ else {
1201
+ return 2;
1202
+ }
1203
+ }
1204
+
1205
+ public function delete($id) {
1206
+ global $wpdb;
1207
+ $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id);
1208
+ if ($wpdb->query($query)) {
1209
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $id));
1210
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="%d"', $id));
1211
+ $message = 3;
1212
+ }
1213
+ else {
1214
+ $message = 2;
1215
+ }
1216
+ // $this->display();
1217
+ $page = WDW_FM_Library::get('page');
1218
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
1219
+ }
1220
+
1221
+ public function delete_all() {
1222
+ global $wpdb;
1223
+ $flag = FALSE;
1224
+ $isDefault = FALSE;
1225
+ $form_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker');
1226
+ foreach ($form_ids_col as $form_id) {
1227
+ if (isset($_POST['check_' . $form_id])) {
1228
+ $flag = TRUE;
1229
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $form_id));
1230
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $form_id));
1231
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="%d"', $form_id));
1232
+ }
1233
+ }
1234
+ if ($flag) {
1235
+ $message = 5;
1236
+ }
1237
+ else {
1238
+ $message = 6;
1239
+ }
1240
+ // $this->display();
1241
+ $page = WDW_FM_Library::get('page');
1242
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
1243
+ }
1244
+
1245
+ ////////////////////////////////////////////////////////////////////////////////////////
1246
+ // Getters & Setters //
1247
+ ////////////////////////////////////////////////////////////////////////////////////////
1248
+ ////////////////////////////////////////////////////////////////////////////////////////
1249
+ // Private Methods //
1250
+ ////////////////////////////////////////////////////////////////////////////////////////
1251
+ ////////////////////////////////////////////////////////////////////////////////////////
1252
+ // Listeners //
1253
+ ////////////////////////////////////////////////////////////////////////////////////////
1254
+ }
admin/controllers/FMControllerSelect_data_from_db.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ //var_dump($form_id);
27
+ $field_type = ((isset($_GET['field_type'])) ? esc_html($_GET['field_type']) : 0);
28
+ $value_disabled = ((isset($_GET['value_disabled'])) ? esc_html($_GET['value_disabled']) : 0);
29
+ if ($task && method_exists($this, $task)) {
30
+ $this->$task($form_id,$field_type="");
31
+ }
32
+ else
33
+ $this->display($id, $field_id, $field_type, $value_disabled,$form_id);
34
+ }
35
+
36
+ public function display($id, $field_id, $field_type, $value_disabled,$form_id) {
37
+ require_once WD_FM_DIR . "/admin/models/FMModelSelect_data_from_db.php";
38
+ $model = new FMModelSelect_data_from_db();
39
+
40
+ require_once WD_FM_DIR . "/admin/views/FMViewSelect_data_from_db.php";
41
+ $view = new FMViewSelect_data_from_db($model);
42
+ $view->display($id, $field_id, $field_type, $value_disabled,$form_id);
43
+ }
44
+
45
+ public function db_tables($form_id,$field_type) {
46
+ require_once WD_FM_DIR . "/admin/models/FMModelSelect_data_from_db.php";
47
+ $model = new FMModelSelect_data_from_db();
48
+
49
+ require_once WD_FM_DIR . "/admin/views/FMViewSelect_data_from_db.php";
50
+ $view = new FMViewSelect_data_from_db($model);
51
+ $view->db_tables((int)$form_id,$field_type);
52
+ }
53
+ public function db_table_struct_select($form_id,$field_type) {
54
+ require_once WD_FM_DIR . "/admin/models/FMModelSelect_data_from_db.php";
55
+ $model = new FMModelSelect_data_from_db();
56
+
57
+ require_once WD_FM_DIR . "/admin/views/FMViewSelect_data_from_db.php";
58
+ $view = new FMViewSelect_data_from_db($model);
59
+ $view->db_table_struct_select((int)$form_id,$field_type);
60
+ }
61
+
62
+ ////////////////////////////////////////////////////////////////////////////////////////
63
+ // Getters & Setters //
64
+ ////////////////////////////////////////////////////////////////////////////////////////
65
+ ////////////////////////////////////////////////////////////////////////////////////////
66
+ // Private Methods //
67
+ ////////////////////////////////////////////////////////////////////////////////////////
68
+ ////////////////////////////////////////////////////////////////////////////////////////
69
+ // Listeners //
70
+ ////////////////////////////////////////////////////////////////////////////////////////
71
+ }
admin/controllers/FMControllerShow_matrix.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,792 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerSubmissions_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($_POST['task']) : '');
23
+ $id = ((isset($_POST['current_id'])) ? (int)esc_html($_POST['current_id']) : 0);
24
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
25
+ if (method_exists($this, $task)) {
26
+ if($task != 'show_stats')
27
+ check_admin_referer('nonce_fm', 'nonce_fm');
28
+ else
29
+ check_ajax_referer('nonce_fm_ajax', 'nonce_fm_ajax');
30
+ $this->$task($id);
31
+ }
32
+ else {
33
+ $this->display($form_id);
34
+ }
35
+ }
36
+
37
+ public function display($form_id) {
38
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
39
+ require_once WD_FM_DIR . "/admin/models/FMModelSubmissions_fm.php";
40
+ $model = new FMModelSubmissions_fm();
41
+
42
+ require_once WD_FM_DIR . "/admin/views/FMViewSubmissions_fm.php";
43
+ $view = new FMViewSubmissions_fm($model);
44
+ $view->display($form_id);
45
+ }
46
+
47
+ public function show_stats() {
48
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
49
+ require_once WD_FM_DIR . "/admin/models/FMModelSubmissions_fm.php";
50
+ $model = new FMModelSubmissions_fm();
51
+
52
+ require_once WD_FM_DIR . "/admin/views/FMViewSubmissions_fm.php";
53
+ $view = new FMViewSubmissions_fm($model);
54
+ $view->show_stats($form_id);
55
+ }
56
+
57
+ public function edit() {
58
+ global $wpdb;
59
+ require_once WD_FM_DIR . "/admin/models/FMModelSubmissions_fm.php";
60
+ $model = new FMModelSubmissions_fm();
61
+
62
+ require_once WD_FM_DIR . "/admin/views/FMViewSubmissions_fm.php";
63
+ $view = new FMViewSubmissions_fm($model);
64
+ $id = ((isset($_POST['current_id']) && esc_html($_POST['current_id']) != '') ? (int) $_POST['current_id'] : 0);
65
+
66
+ $form_id = (int)$wpdb->get_var("SELECT form_id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "'");
67
+ $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
68
+
69
+ if (isset($form->form)) {
70
+ $old = TRUE;
71
+ }
72
+ else {
73
+ $old = FALSE;
74
+ }
75
+
76
+ if ($old == FALSE || ($old == TRUE && $form->form == '')) {
77
+ $view->new_edit($id);
78
+ }
79
+ else {
80
+ $view->edit($id);
81
+ }
82
+ }
83
+
84
+ public function save() {
85
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
86
+ $this->save_db();
87
+ $this->display($form_id);
88
+ }
89
+
90
+ public function apply() {
91
+ $this->save_db();
92
+ $this->edit();
93
+ }
94
+
95
+ public function save_db() {
96
+ global $wpdb;
97
+ $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes( $_POST['current_id'])) : 0);
98
+ $group_id = $id;
99
+ $date = esc_html($_POST['date']);
100
+ $ip = esc_html($_POST['ip']);
101
+ $form_id = (int)$wpdb->get_var("SELECT form_id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "'");
102
+ $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form_id . "'");
103
+ $label_id = array();
104
+ $label_order_original = array();
105
+ $label_type = array();
106
+ $old = false;
107
+ $form_currency = '$';
108
+
109
+ if (strpos($form->label_order, 'type_paypal_')) {
110
+ $form->label_order = $form->label_order."0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
111
+ }
112
+ $label_all = explode('#****#', $form->label_order);
113
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
114
+ foreach ($label_all as $key => $label_each) {
115
+ $label_id_each = explode('#**id**#', $label_each);
116
+ array_push($label_id, $label_id_each[0]);
117
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
118
+ array_push($label_order_original, $label_oder_each[0]);
119
+ array_push($label_type, $label_oder_each[1]);
120
+ }
121
+
122
+ if(isset($form->form))
123
+ $old = true;
124
+
125
+ if($old == false || ($old == true && $form->form=='')) {
126
+
127
+ foreach($label_type as $key => $type) {
128
+
129
+ $value='';
130
+ if($type=="type_submit_reset" or $type=="type_map" or $type=="type_editor" or $type=="type_captcha" or $type=="type_recaptcha" or $type=="type_button" or $type=="type_paypal_total")
131
+ continue;
132
+
133
+ $i=$label_id[$key];
134
+ $id = 'form_id_temp';
135
+ switch ($type) {
136
+
137
+ case 'type_text':
138
+ case 'type_password':
139
+ case 'type_textarea':
140
+ case "type_submitter_mail":
141
+ case "type_date":
142
+ case "type_own_select":
143
+ case "type_country":
144
+ case "type_number": {
145
+ $value = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
146
+ break;
147
+ }
148
+ case "type_wdeditor": {
149
+ $value = (isset($_POST['wdform_'.$i.'_wd_editor'.$id]) ? $_POST['wdform_'.$i.'_wd_editor'.$id] : NULL);
150
+ break;
151
+ }
152
+ case "type_mark_map": {
153
+ $long = (isset($_POST['wdform_'.$i."_long".$id]) ? $_POST['wdform_'.$i."_long".$id] : NULL);
154
+ $lat = (isset($_POST['wdform_'.$i."_lat".$id]) ? $_POST['wdform_'.$i."_lat".$id] : NULL);
155
+ if($long and $lat)
156
+ $value = $long . '***map***' . $lat;
157
+
158
+ break;
159
+ }
160
+
161
+ case "type_date_fields": {
162
+ $day = (isset($_POST['wdform_'.$i."_day".$id]) ? $_POST['wdform_'.$i."_day".$id] : NULL);
163
+ $month = (isset($_POST['wdform_'.$i."_month".$id]) ? $_POST['wdform_'.$i."_month".$id] : NULL);
164
+ $year = (isset($_POST['wdform_'.$i."_year".$id]) ? $_POST['wdform_'.$i."_year".$id] : NULL);
165
+ if($day or $month or $year)
166
+ $value = $day . '-' . $month . '-' . $year;
167
+ break;
168
+ }
169
+
170
+ case "type_time": {
171
+ $ss = (isset($_POST['wdform_'.$i."_ss".$id]) ? $_POST['wdform_'.$i."_ss".$id] : NULL);
172
+ $hh = (isset($_POST['wdform_'.$i."_hh".$id]) ? $_POST['wdform_'.$i."_hh".$id] : NULL);
173
+ $mm = (isset($_POST['wdform_'.$i."_mm".$id]) ? $_POST['wdform_'.$i."_mm".$id] : NULL);
174
+
175
+ if(isset($ss))
176
+ $value = $hh .':'. $mm .':' . $ss;
177
+ else
178
+ $value = $hh .':' . $mm;
179
+
180
+ $am_pm = (isset($_POST['wdform_'.$i."_am_pm".$id]) ? $_POST['wdform_'.$i."_am_pm".$id] : NULL);
181
+ if(isset($am_pm))
182
+ $value = $value . ' ' . $am_pm;
183
+
184
+ break;
185
+ }
186
+
187
+ case "type_phone": {
188
+ $first = (isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL);
189
+ $last = (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : NULL);
190
+ if($first or $last)
191
+ $value = $first . ' ' . $last;
192
+
193
+ break;
194
+ }
195
+
196
+ case "type_name": {
197
+
198
+ $element_title = (isset($_POST['wdform_'.$i."_element_title".$id]) ? $_POST['wdform_'.$i."_element_title".$id] : NULL);
199
+ $element_first = (isset($_POST['wdform_'.$i."_element_first".$id]) ? $_POST['wdform_'.$i."_element_first".$id] : NULL);
200
+ $element_last = (isset($_POST['wdform_'.$i."_element_last".$id]) ? $_POST['wdform_'.$i."_element_last".$id] : NULL);
201
+ $element_middle = (isset($_POST['wdform_'.$i."_element_middle".$id]) ? $_POST['wdform_'.$i."_element_middle".$id] : NULL);
202
+
203
+ if(isset($element_title))
204
+ $value = $element_title . '@@@' . $element_first . '@@@' . $element_last . '@@@' . $element_middle;
205
+ else
206
+ $value = $element_first . '@@@' . $element_last;
207
+
208
+ break;
209
+ }
210
+
211
+ case "type_file_upload": {
212
+ break;
213
+ }
214
+
215
+ case 'type_address': {
216
+ $value='*#*#*#';
217
+ $element = (isset($_POST['wdform_'.$i."_street1".$id]) ? $_POST['wdform_'.$i."_street1".$id] : NULL);
218
+ if($element) {
219
+ $value = $element;
220
+ break;
221
+ }
222
+
223
+ $element = (isset($_POST['wdform_'.$i."_street2".$id]) ? $_POST['wdform_'.$i."_street2".$id] : NULL);
224
+ if($element) {
225
+ $value = $element;
226
+ break;
227
+ }
228
+
229
+ $element = (isset($_POST['wdform_'.$i."_city".$id]) ? $_POST['wdform_'.$i."_city".$id] : NULL);
230
+ if(isset($element)) {
231
+ $value = $element;
232
+ break;
233
+ }
234
+
235
+ $element = (isset($_POST['wdform_'.$i."_state".$id]) ? $_POST['wdform_'.$i."_state".$id] : NULL);
236
+ if(isset($element)) {
237
+ $value = $element;
238
+ break;
239
+ }
240
+
241
+ $element = (isset($_POST['wdform_'.$i."_postal".$id]) ? $_POST['wdform_'.$i."_postal".$id] : NULL);
242
+ if(isset($element)) {
243
+ $value = $element;
244
+ break;
245
+ }
246
+
247
+ $element = (isset($_POST['wdform_'.$i."_country".$id]) ? $_POST['wdform_'.$i."_country".$id] : NULL);
248
+ if(isset($element)) {
249
+ $value = $element;
250
+ break;
251
+ }
252
+
253
+ break;
254
+ }
255
+
256
+ case "type_hidden": {
257
+ $value = (isset($_POST[$label_order_original[$key]]) ? $_POST[$label_order_original[$key]] : NULL);
258
+ break;
259
+ }
260
+
261
+ case "type_radio": {
262
+ $element = (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL);
263
+ if(isset($element)) {
264
+ $value = $element;
265
+ break;
266
+ }
267
+
268
+ $value = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
269
+ break;
270
+ }
271
+
272
+ case "type_checkbox": {
273
+ $start=-1;
274
+ $value='';
275
+ for($j=0; $j<100; $j++) {
276
+
277
+ $element = (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL);
278
+
279
+ if(isset($element)) {
280
+ $start = $j;
281
+ break;
282
+ }
283
+ }
284
+
285
+ $other_element_id=-1;
286
+ $is_other = (isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : NULL);
287
+ if($is_other == "yes") {
288
+ $other_element_id = (isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : NULL);
289
+ }
290
+
291
+ if($start!=-1) {
292
+ for($j=$start; $j<100; $j++) {
293
+ $element = (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL);
294
+ if(isset($element))
295
+ if($j == $other_element_id) {
296
+ $value = $value . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL) . '***br***';
297
+ }
298
+ else
299
+ $value = $value . (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL) . '***br***';
300
+ }
301
+ }
302
+
303
+ break;
304
+ }
305
+
306
+ case "type_paypal_price": {
307
+ $value=0;
308
+ if((isset($_POST['wdform_'.$i."_element_dollars".$id]) ? $_POST['wdform_'.$i."_element_dollars".$id] : NULL))
309
+ $value = (isset($_POST['wdform_'.$i."_element_dollars".$id]) ? $_POST['wdform_'.$i."_element_dollars".$id] : NULL);
310
+
311
+ $value = (int) preg_replace('/\D/', '', $value);
312
+
313
+ if((isset($_POST['wdform_'.$i."_element_cents".$id]) ? $_POST['wdform_'.$i."_element_cents".$id] : NULL))
314
+ $value = $value . '.' . ( preg_replace('/\D/', '', (isset($_POST['wdform_'.$i."_element_cents".$id]) ? $_POST['wdform_'.$i."_element_cents".$id] : NULL)));
315
+
316
+
317
+ $value = $value;
318
+ break;
319
+ }
320
+
321
+ case "type_paypal_select": {
322
+
323
+ if((isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : NULL))
324
+ $value = (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : NULL) . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL) . $form_currency;
325
+ else
326
+ $value = '';
327
+
328
+ $element_quantity = (isset($_POST['wdform_'.$i."element_quantity".$id]) ? $_POST['wdform_'.$i."element_quantity".$id] : NULL);
329
+ if(isset($element_quantity) && $value!='')
330
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL) . ': ' . (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL);
331
+
332
+
333
+ for($k=0; $k<50; $k++) {
334
+ $temp_val = (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL);
335
+ if(isset($temp_val) && $value!='') {
336
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id]) ? $_POST['wdform_'.$i."_element_property_label".$id] : NULL) . ': ' . (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL) . '***property***';
337
+ }
338
+ }
339
+
340
+ break;
341
+ }
342
+
343
+ case "type_paypal_radio": {
344
+
345
+ if((isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : NULL))
346
+ $value = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL) . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL) . $form_currency;
347
+ else
348
+ $value='';
349
+
350
+
351
+ $element_quantity = (isset($_POST['wdform_'.$i."element_quantity".$id]) ? $_POST['wdform_'.$i."element_quantity".$id] : NULL);
352
+ if(isset($element_quantity) && $value!='')
353
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL) . ': ' . (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL) . '***quantity***';
354
+
355
+
356
+ for($k=0; $k<50; $k++) {
357
+ $temp_val = (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL);
358
+ if(isset($temp_val) && $value!='') {
359
+
360
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id]) ? $_POST['wdform_'.$i."_element_property_label".$id] : NULL) . ': ' . (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL) . '***property***';
361
+ }
362
+ }
363
+
364
+ break;
365
+ }
366
+
367
+ case "type_paypal_shipping": {
368
+
369
+ if((isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : NULL))
370
+ $value = (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : NULL) . ' : ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL) . $form_currency;
371
+ else
372
+ $value='';
373
+ $value = (isset($_POST['wdform_'.$i."_element_label".$id]) ? $_POST['wdform_'.$i."_element_label".$id] : NULL) . ' - ' . (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
374
+
375
+ $paypal['shipping'] = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
376
+
377
+ break;
378
+ }
379
+
380
+ case "type_paypal_checkbox": {
381
+ $start=-1;
382
+ $value='';
383
+ for($j=0; $j<100; $j++) {
384
+
385
+ $element = (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL);
386
+
387
+ if(isset($element)) {
388
+ $start=$j;
389
+ break;
390
+ }
391
+ }
392
+
393
+ $other_element_id = -1;
394
+ $is_other = (isset($_POST['wdform_'.$i."_allow_other".$id]) ? $_POST['wdform_'.$i."_allow_other".$id] : NULL);
395
+ if($is_other=="yes") {
396
+ $other_element_id = (isset($_POST['wdform_'.$i."_allow_other_num".$id]) ? $_POST['wdform_'.$i."_allow_other_num".$id] : NULL);
397
+ }
398
+
399
+ if($start!=-1) {
400
+ for($j=$start; $j<100; $j++) {
401
+ $element = (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL);
402
+ if(isset($element))
403
+ if($j==$other_element_id) {
404
+ $value = $value . (isset($_POST['wdform_'.$i."_other_input".$id]) ? $_POST['wdform_'.$i."_other_input".$id] : NULL) . '***br***';
405
+
406
+ }
407
+ else {
408
+
409
+ $value = $value . (isset($_POST['wdform_'.$i."_element".$id.$j."_label"]) ? $_POST['wdform_'.$i."_element".$id.$j."_label"] : NULL) . ' - ' . ((isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL) == '' ? '0' : (isset($_POST['wdform_'.$i."_element".$id.$j]) ? $_POST['wdform_'.$i."_element".$id.$j] : NULL)) . $form_currency . '***br***';
410
+
411
+ }
412
+ }
413
+
414
+ $element_quantity = (isset($_POST['wdform_'.$i."element_quantity".$id]) ? $_POST['wdform_'.$i."element_quantity".$id] : NULL);
415
+ if(isset($element_quantity))
416
+ $value .= (isset($_POST['wdform_'.$i."_element_quantity_label".$id]) ? $_POST['wdform_'.$i."_element_quantity_label".$id] : NULL) . ': '. (isset($_POST['wdform_'.$i."_element_quantity".$id]) ? $_POST['wdform_'.$i."_element_quantity".$id] : NULL) . '***quantity***';
417
+
418
+ for($k=0; $k<50; $k++) {
419
+ $temp_val = (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL);
420
+ if(isset($temp_val)) {
421
+
422
+ $value .= '***br***' . (isset($_POST['wdform_'.$i."_element_property_label".$id]) ? $_POST['wdform_'.$i."_element_property_label".$id] : NULL) . ': ' . (isset($_POST['wdform_'.$i."_property".$id.$k]) ? $_POST['wdform_'.$i."_property".$id.$k] : NULL) . '***property***';
423
+ }
424
+ }
425
+
426
+ }
427
+
428
+
429
+ break;
430
+ }
431
+
432
+ case "type_star_rating": {
433
+
434
+ if((isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : NULL) == "")
435
+ $selected_star_amount = 0;
436
+ else {
437
+ $selected_star_amount = (isset($_POST['wdform_'.$i."_selected_star_amount".$id]) ? $_POST['wdform_'.$i."_selected_star_amount".$id] : NULL);
438
+ }
439
+ $value = $selected_star_amount . '/' . (isset($_POST['wdform_'.$i."_star_amount".$id]) ? $_POST['wdform_'.$i."_star_amount".$id] : NULL);
440
+ break;
441
+ }
442
+
443
+ case "type_scale_rating": {
444
+
445
+ $value = (isset($_POST['wdform_'.$i."_scale_radio".$id]) ? $_POST['wdform_'.$i."_scale_radio".$id] : 0) . '/' . (isset($_POST['wdform_'.$i."_scale_amount".$id]) ? $_POST['wdform_'.$i."_scale_amount".$id] : NULL);
446
+ break;
447
+ }
448
+
449
+ case "type_spinner": {
450
+ $value = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
451
+
452
+ break;
453
+ }
454
+
455
+ case "type_slider": {
456
+ $value = (isset($_POST['wdform_'.$i."_slider_value".$id]) ? $_POST['wdform_'.$i."_slider_value".$id] : NULL);
457
+
458
+ break;
459
+ }
460
+ case "type_range": {
461
+ $value = (isset($_POST['wdform_'.$i."_element".$id.'0']) ? $_POST['wdform_'.$i."_element".$id.'0'] : NULL) . '-' . (isset($_POST['wdform_'.$i."_element".$id.'1']) ? $_POST['wdform_'.$i."_element".$id.'1'] : NULL);
462
+
463
+ break;
464
+ }
465
+ case "type_grading": {
466
+ $value ="";
467
+ $items = explode(":",(isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : NULL));
468
+ for($k=0; $k<sizeof($items)-1; $k++)
469
+ $value .= (isset($_POST['wdform_'.$i."_element".$id.'_'.$k]) ? $_POST['wdform_'.$i."_element".$id.'_'.$k] : NULL) . ':';
470
+
471
+ $value .= (isset($_POST['wdform_'.$i."_hidden_item".$id]) ? $_POST['wdform_'.$i."_hidden_item".$id] : NULL) . '***grading***';
472
+
473
+ break;
474
+ }
475
+
476
+ case "type_matrix": {
477
+
478
+ $rows_of_matrix = explode("***",(isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : NULL));
479
+ $rows_count = sizeof($rows_of_matrix)-1;
480
+ $column_of_matrix = explode("***",(isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : NULL));
481
+ $columns_count = sizeof($column_of_matrix)-1;
482
+
483
+
484
+ if((isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : NULL) == "radio") {
485
+ $input_value="";
486
+
487
+ for($k=1; $k<=$rows_count; $k++)
488
+ $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k]) ? $_POST['wdform_'.$i."_input_element".$id.$k] : 0) ."***";
489
+
490
+ }
491
+ if((isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : NULL) == "checkbox") {
492
+ $input_value="";
493
+
494
+ for($k=1; $k<=$rows_count; $k++)
495
+ for($j=1; $j<=$columns_count; $j++)
496
+ $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : 0) . "***";
497
+ }
498
+
499
+ if((isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : NULL) == "text") {
500
+ $input_value="";
501
+ for($k=1; $k<=$rows_count; $k++)
502
+ for($j=1; $j<=$columns_count; $j++)
503
+ $input_value .= (isset($_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_input_element".$id.$k.'_'.$j] : NULL) . "***";
504
+ }
505
+
506
+ if((isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : NULL) == "select") {
507
+ $input_value="";
508
+ for($k=1; $k<=$rows_count; $k++)
509
+ for($j=1; $j<=$columns_count; $j++)
510
+ $input_value .= (isset($_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j]) ? $_POST['wdform_'.$i."_select_yes_no".$id.$k.'_'.$j] : NULL) . "***";
511
+ }
512
+
513
+ $value = $rows_count . (isset($_POST['wdform_'.$i."_hidden_row".$id]) ? $_POST['wdform_'.$i."_hidden_row".$id] : NULL) . '***' . $columns_count . (isset($_POST['wdform_'.$i."_hidden_column".$id]) ? $_POST['wdform_'.$i."_hidden_column".$id] : NULL) . '***' . (isset($_POST['wdform_'.$i."_input_type".$id]) ? $_POST['wdform_'.$i."_input_type".$id] : NULL) . '***' . $input_value . '***matrix***';
514
+
515
+ break;
516
+ }
517
+
518
+ }
519
+
520
+ if($type == "type_address")
521
+ if($value == '*#*#*#')
522
+ continue;
523
+
524
+
525
+ if($value) {
526
+ $query = "SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $group_id . "' AND element_label='" . $i . "'";
527
+ $result = $wpdb->get_var($query);
528
+
529
+ if($result) {
530
+ $save = $wpdb->update($wpdb->prefix . "formmaker_submits", array(
531
+ 'element_value' => stripslashes($value),
532
+ ), array(
533
+ 'group_id' => $group_id,
534
+ 'element_label' => $i
535
+ ), array(
536
+ '%s',
537
+ ), array(
538
+ '%d',
539
+ '%s'
540
+ ));
541
+ }
542
+ else {
543
+
544
+ $save = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
545
+ 'form_id' => $form_id,
546
+ 'element_label' => $i,
547
+ 'element_value' => stripslashes($value),
548
+ 'group_id' => $group_id,
549
+ 'date' => $date,
550
+ 'ip' => $ip
551
+ ), array(
552
+ '%d',
553
+ '%s',
554
+ '%s',
555
+ '%d',
556
+ '%s',
557
+ '%s'
558
+ )
559
+ );
560
+
561
+
562
+ }
563
+ }
564
+
565
+
566
+
567
+ }
568
+ }
569
+
570
+ else {
571
+
572
+ foreach ($label_id as $key => $label_id_1) {
573
+ $element_value = (isset($_POST["submission_" . $label_id_1]) ? esc_html(stripslashes($_POST["submission_" . $label_id_1])) : " ");
574
+ if (isset($_POST["submission_" . $label_id_1])) {
575
+ $query = "SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "' AND element_label='" . $label_id_1 . "'";
576
+ $result = $wpdb->get_var($query);
577
+ if ($label_type[$key] == 'type_file_upload')
578
+ if ($element_value)
579
+ $element_value = $element_value . "*@@url@@*";
580
+ if ($result) {
581
+ $save = $wpdb->update($wpdb->prefix . "formmaker_submits", array(
582
+ 'element_value' => stripslashes($element_value),
583
+ ), array(
584
+ 'group_id' => $id,
585
+ 'element_label' => $label_id_1
586
+ ), array(
587
+ '%s',
588
+ ), array(
589
+ '%d',
590
+ '%s'
591
+ ));
592
+ }
593
+ else {
594
+ $save = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
595
+ 'form_id' => $form_id,
596
+ 'element_label' => $label_id_1,
597
+ 'element_value' => stripslashes($element_value),
598
+ 'group_id' => $id,
599
+ 'date' => $date,
600
+ 'ip' => $ip
601
+ ), array(
602
+ '%d',
603
+ '%s',
604
+ '%s',
605
+ '%d',
606
+ '%s',
607
+ '%s'
608
+ )
609
+ );
610
+ }
611
+ }
612
+ else {
613
+ $element_value_ch = (isset($_POST["submission_" . $label_id_1 . '_0']) ? esc_html(stripslashes($_POST["submission_" . $label_id_1 . '_0'])) : " ");
614
+ if (isset($_POST["submission_" . $label_id_1 . '_0'])) {
615
+ for ($z = 0; $z < 21; $z++) {
616
+ $element_value_ch = $_POST["submission_" . $label_id_1 . '_' . $z];
617
+ if (isset($element_value_ch))
618
+ $element_value = $element_value . $element_value_ch . '***br***';
619
+ else
620
+ break;
621
+ }
622
+ $query = "SELECT id FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id='" . $id . "' AND element_label='" . $label_id_1 . "'";
623
+ $result = $wpdb->get_var($query);
624
+ if ($result) {
625
+ $query = "UPDATE " . $wpdb->prefix . "formmaker_submits SET `element_value`='" . stripslashes($element_value) . "' WHERE group_id='" . $id . "' AND element_label='" . $label_id_1 . "'";
626
+ $save = $wpdb->update($wpdb->prefix . "formmaker_submits", array(
627
+ 'element_value' => stripslashes($element_value),
628
+ ), array(
629
+ 'group_id' => $id,
630
+ 'element_label' => $label_id_1
631
+ ), array(
632
+ '%s',
633
+ ), array(
634
+ '%d',
635
+ '%s'
636
+ ));
637
+ }
638
+ else {
639
+ $query = "INSERT INTO " . $wpdb->prefix . "formmaker_submits (form_id, element_label, element_value, group_id, date, ip) VALUES('" . $form_id . "', '" . $label_id_1 . "', '" . stripslashes($element_value) . "','" . $id . "', '" . $date . "', '" . $ip . "')";
640
+ $save = $wpdb->insert($wpdb->prefix . "formmaker_submits", array(
641
+ 'form_id' => $form_id,
642
+ 'element_label' => $label_id_1,
643
+ 'element_value' => stripslashes($element_value),
644
+ 'group_id' => $id,
645
+ 'date' => $date,
646
+ 'ip' => $ip
647
+ ), array(
648
+ '%d',
649
+ '%s',
650
+ '%s',
651
+ '%d',
652
+ '%s',
653
+ '%s'
654
+ )
655
+ );
656
+ }
657
+ }
658
+ }
659
+ }
660
+ }
661
+ if ($save !== FALSE) {
662
+ echo WDW_FM_Library::message('Submission Succesfully Saved.', 'updated');
663
+ }
664
+ else {
665
+ echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
666
+ }
667
+ }
668
+
669
+ public function delete($id) {
670
+ global $wpdb;
671
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
672
+ $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id="%d"', $id);
673
+ // $elements_col = $wpdb->get_col($wpdb->prepare('SELECT element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id="%d"', $id));
674
+ if ($wpdb->query($query)) {
675
+ // foreach ($elements_col as $element_value) {
676
+ // $destination = str_replace(site_url() . '/', '', $element_value);
677
+ // $destination = str_replace('*@@url@@*', '', $destination);
678
+ // if ($destination) {
679
+ // $destination = ABSPATH . $destination;
680
+ // if (file_exists($destination)) {
681
+ // unlink($destination);
682
+ // }
683
+ // }
684
+ // }
685
+ echo WDW_FM_Library::message('Item Succesfully Deleted.', 'updated');
686
+ }
687
+ else {
688
+ echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
689
+ }
690
+ $this->display($form_id);
691
+ }
692
+
693
+ public function delete_all() {
694
+ global $wpdb;
695
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
696
+ $cid = ((isset($_POST['post']) && $_POST['post'] != '') ? $_POST['post'] : NULL);
697
+ if (count($cid)) {
698
+ array_walk($cid, create_function('&$value', '$value = (int)$value;'));
699
+ $cids = implode(',', $cid);
700
+ $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( ' . $cids . ' )';
701
+ // $elements_col = $wpdb->get_col('SELECT element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( ' . $cids . ' )');
702
+ if ($wpdb->query($query)) {
703
+ // foreach ($elements_col as $element_value) {
704
+ // $destination = str_replace(site_url() . '/', '', $element_value);
705
+ // $destination = str_replace('*@@url@@*', '', $destination);
706
+ // if ($destination) {
707
+ // $destination = ABSPATH . $destination;
708
+ // if (file_exists($destination)) {
709
+ // unlink($destination);
710
+ // }
711
+ // }
712
+ // }
713
+ echo WDW_FM_Library::message('Items Succesfully Deleted.', 'updated');
714
+ }
715
+ else {
716
+ echo WDW_FM_Library::message('Error. Please install plugin again.', 'error');
717
+ }
718
+ }
719
+ else {
720
+ echo WDW_FM_Library::message('You must select at least one item.', 'error');
721
+ }
722
+ $this->display($form_id);
723
+ }
724
+
725
+ public function block_ip() {
726
+ global $wpdb;
727
+ $flag = FALSE;
728
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
729
+ $cid = ((isset($_POST['post']) && $_POST['post'] != '') ? $_POST['post'] : NULL);
730
+ if (count($cid)) {
731
+ array_walk($cid, create_function('&$value', '$value = (int)$value;'));
732
+ $cids = implode(',', $cid);
733
+ $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( '. $cids .' )';
734
+ $rows = $wpdb->get_results($query);
735
+ foreach ($rows as $row) {
736
+ $ips = $wpdb->get_var($wpdb->prepare('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $row->ip));
737
+ $flag = TRUE;
738
+ if (!$ips) {
739
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker_blocked', array(
740
+ 'ip' => $row->ip,
741
+ ), array(
742
+ '%s',
743
+ ));
744
+ }
745
+ }
746
+ }
747
+ if ($flag) {
748
+ echo WDW_FM_Library::message('IPs Succesfully Blocked.', 'updated');
749
+ }
750
+ else {
751
+ echo WDW_FM_Library::message('You must select at least one item.', 'error');
752
+ }
753
+ $this->display($form_id);
754
+ }
755
+
756
+ public function unblock_ip() {
757
+ global $wpdb;
758
+ $flag = FALSE;
759
+ $form_id = ((isset($_POST['form_id']) && esc_html($_POST['form_id']) != '') ? (int)esc_html($_POST['form_id']) : 0);
760
+ $cid = ((isset($_POST['post']) && $_POST['post'] != '') ? $_POST['post'] : NULL);
761
+ if (count($cid)) {
762
+ array_walk($cid, create_function('&$value', '$value = (int)$value;'));
763
+ $cids = implode(',', $cid);
764
+ $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id IN ( '. $cids .' )';
765
+ $rows = $wpdb->get_results($query);
766
+ foreach ($rows as $row) {
767
+ $flag = TRUE;
768
+ $ips = $wpdb->get_var($wpdb->prepare('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $row->ip));
769
+ if ($ips) {
770
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE ip="%s"', $ips));
771
+ }
772
+ }
773
+ }
774
+ if ($flag) {
775
+ echo WDW_FM_Library::message('IPs Succesfully Unblocked.', 'updated');
776
+ }
777
+ else {
778
+ echo WDW_FM_Library::message('You must select at least one item.', 'error');
779
+ }
780
+ $this->display($form_id);
781
+ }
782
+
783
+ ////////////////////////////////////////////////////////////////////////////////////////
784
+ // Getters & Setters //
785
+ ////////////////////////////////////////////////////////////////////////////////////////
786
+ ////////////////////////////////////////////////////////////////////////////////////////
787
+ // Private Methods //
788
+ ////////////////////////////////////////////////////////////////////////////////////////
789
+ ////////////////////////////////////////////////////////////////////////////////////////
790
+ // Listeners //
791
+ ////////////////////////////////////////////////////////////////////////////////////////
792
+ }
admin/controllers/FMControllerThemes_fm.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMControllerThemes_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/FMModelThemes_fm.php";
37
+ $model = new FMModelThemes_fm();
38
+
39
+ require_once WD_FM_DIR . "/admin/views/FMViewThemes_fm.php";
40
+ $view = new FMViewThemes_fm($model);
41
+ $view->display();
42
+ }
43
+
44
+ public function add() {
45
+ require_once WD_FM_DIR . "/admin/models/FMModelThemes_fm.php";
46
+ $model = new FMModelThemes_fm();
47
+
48
+ require_once WD_FM_DIR . "/admin/views/FMViewThemes_fm.php";
49
+ $view = new FMViewThemes_fm($model);
50
+ $view->edit(0, FALSE);
51
+ }
52
+
53
+ public function edit() {
54
+ require_once WD_FM_DIR . "/admin/models/FMModelThemes_fm.php";
55
+ $model = new FMModelThemes_fm();
56
+
57
+ require_once WD_FM_DIR . "/admin/views/FMViewThemes_fm.php";
58
+ $view = new FMViewThemes_fm($model);
59
+ // $id = ((isset($_POST['current_id']) && esc_html($_POST['current_id']) != '') ? esc_html($_POST['current_id']) : 0);
60
+ $id = (int)WDW_FM_Library::get('current_id', 0);
61
+ $view->edit($id, FALSE);
62
+ }
63
+
64
+ public function save() {
65
+ $message = $this->save_db();
66
+ // $this->display();
67
+ $page = WDW_FM_Library::get('page');
68
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
69
+ }
70
+
71
+ public function apply() {
72
+ $message = $this->save_db();
73
+ global $wpdb;
74
+ // if (!isset($_POST['current_id']) || (esc_html($_POST['current_id']) == 0) || (esc_html($_POST['current_id']) == '')) {
75
+
76
+ // }
77
+ $id = (int) $wpdb->get_var('SELECT MAX(`id`) FROM ' . $wpdb->prefix . 'formmaker_themes');
78
+ $current_id = (int)WDW_FM_Library::get('current_id', $id);
79
+ $page = WDW_FM_Library::get('page');
80
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'edit', 'current_id' => $current_id, 'message' => $message), admin_url('admin.php')));
81
+ // $this->edit();
82
+ }
83
+
84
+ public function save_db() {
85
+ global $wpdb;
86
+ // $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes( $_POST['current_id'])) : 0);
87
+ $id = (int) WDW_FM_Library::get('current_id', 0);
88
+ $title = (isset($_POST['title']) ? esc_html(stripslashes( $_POST['title'])) : '');
89
+ $css = (isset($_POST['css']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['css'])) : '');
90
+ $default = (isset($_POST['default']) ? esc_html(stripslashes( $_POST['default'])) : 0);
91
+ if ($id != 0) {
92
+ $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array(
93
+ 'title' => $title,
94
+ 'css' => $css,
95
+ 'default' => $default,
96
+ ), array('id' => $id));
97
+ }
98
+ else {
99
+ $save = $wpdb->insert($wpdb->prefix . 'formmaker_themes', array(
100
+ 'title' => $title,
101
+ 'css' => $css,
102
+ 'default' => $default,
103
+ ), array(
104
+ '%s',
105
+ '%s',
106
+ '%d',
107
+ ));
108
+ }
109
+ if ($save !== FALSE) {
110
+ return 1;
111
+ }
112
+ else {
113
+ return 2;
114
+ }
115
+ }
116
+
117
+ public function delete($id) {
118
+ global $wpdb;
119
+ $isDefault = $wpdb->get_var($wpdb->prepare('SELECT `default` FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id));
120
+ if ($isDefault) {
121
+ $message = 4;
122
+ }
123
+ else {
124
+ $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id);
125
+ if ($wpdb->query($query)) {
126
+ $message = 3;
127
+ }
128
+ else {
129
+ $message = 2;
130
+ }
131
+ }
132
+ // $this->display();
133
+ $page = WDW_FM_Library::get('page');
134
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
135
+ }
136
+
137
+ public function delete_all() {
138
+ global $wpdb;
139
+ $flag = FALSE;
140
+ $isDefault = FALSE;
141
+ $theme_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes');
142
+ foreach ($theme_ids_col as $theme_id) {
143
+ if (isset($_POST['check_' . $theme_id])) {
144
+ $isDefault = $wpdb->get_var($wpdb->prepare('SELECT `default` FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
145
+ if ($isDefault) {
146
+ $message = 4;
147
+ }
148
+ else {
149
+ $flag = TRUE;
150
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $theme_id));
151
+ }
152
+ }
153
+ }
154
+ if ($flag) {
155
+ $message = 5;
156
+ }
157
+ else {
158
+ $message = 6;
159
+ }
160
+ // $this->display();
161
+ $page = WDW_FM_Library::get('page');
162
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
163
+ }
164
+
165
+ public function setdefault($id) {
166
+ global $wpdb;
167
+ $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 0), array('default' => 1));
168
+ $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 1), array('id' => $id));
169
+ if ($save !== FALSE) {
170
+ $message = 7;
171
+ }
172
+ else {
173
+ $message = 2;
174
+ }
175
+ // $this->display();
176
+ $page = WDW_FM_Library::get('page');
177
+ WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
178
+ }
179
+
180
+ ////////////////////////////////////////////////////////////////////////////////////////
181
+ // Getters & Setters //
182
+ ////////////////////////////////////////////////////////////////////////////////////////
183
+ ////////////////////////////////////////////////////////////////////////////////////////
184
+ // Private Methods //
185
+ ////////////////////////////////////////////////////////////////////////////////////////
186
+ ////////////////////////////////////////////////////////////////////////////////////////
187
+ // Listeners //
188
+ ////////////////////////////////////////////////////////////////////////////////////////
189
+ }
admin/controllers/FMControllerUninstall_fm.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
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
+ check_admin_referer('nonce_fm', 'nonce_fm');
25
+ $this->$task();
26
+ }
27
+ else {
28
+ $this->display();
29
+ }
30
+ }
31
+
32
+ public function display() {
33
+ require_once WD_FM_DIR . "/admin/models/FMModelUninstall_fm.php";
34
+ $model = new FMModelUninstall_fm();
35
+
36
+ require_once WD_FM_DIR . "/admin/views/FMViewUninstall_fm.php";
37
+ $view = new FMViewUninstall_fm($model);
38
+ $view->display();
39
+ }
40
+
41
+ public function uninstall() {
42
+ require_once WD_FM_DIR . "/admin/models/FMModelUninstall_fm.php";
43
+ $model = new FMModelUninstall_fm();
44
+
45
+ require_once WD_FM_DIR . "/admin/views/FMViewUninstall_fm.php";
46
+ $view = new FMViewUninstall_fm($model);
47
+ $view->uninstall();
48
+ }
49
+ ////////////////////////////////////////////////////////////////////////////////////////
50
+ // Getters & Setters //
51
+ ////////////////////////////////////////////////////////////////////////////////////////
52
+ ////////////////////////////////////////////////////////////////////////////////////////
53
+ // Private Methods //
54
+ ////////////////////////////////////////////////////////////////////////////////////////
55
+ ////////////////////////////////////////////////////////////////////////////////////////
56
+ // Listeners //
57
+ ////////////////////////////////////////////////////////////////////////////////////////
58
+ }
admin/controllers/FMControllerWidget.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 DELETED
@@ -1,43 +0,0 @@
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 DELETED
@@ -1,31 +0,0 @@
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 DELETED
@@ -1,58 +0,0 @@
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 DELETED
@@ -1,35 +0,0 @@
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/FormMakerSQLMapping.php DELETED
@@ -1,167 +0,0 @@
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 DELETED
@@ -1,44 +0,0 @@
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 DELETED
@@ -1,29 +0,0 @@
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 DELETED
@@ -1,30 +0,0 @@
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 DELETED
@@ -1,71 +0,0 @@
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 DELETED
@@ -1,61 +0,0 @@
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 DELETED
@@ -1,26 +0,0 @@
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 DELETED
@@ -1,1415 +0,0 @@
1
- <?php
2
- class FMControllerManage_fm {
3
- private $model;
4
- private $view;
5
- private $page;
6
- private $page_url;
7
- private $bulk_action_name = '';
8
- private $items_per_page = 20;
9
- private $animation_effects = array();
10
- private $actions = array();
11
-
12
- function __construct() {
13
- require_once WDFM()->plugin_dir . "/admin/models/Manage_fm.php";
14
- require_once WDFM()->plugin_dir . "/admin/views/Manage_fm.php";
15
- $this->model = new FMModelManage_fm();
16
- $this->view = new FMViewManage_fm();
17
-
18
- $this->page = WDW_FM_Library::get('page');
19
- $this->page_url = add_query_arg(array(
20
- 'page' => $this->page,
21
- WDFM()->nonce => wp_create_nonce(WDFM()->nonce),
22
- ), admin_url('admin.php')
23
- );
24
- $this->bulk_action_name = 'bulk_action';
25
-
26
- $this->actions = array(
27
- 'publish' => array(
28
- 'title' => __('Publish', WDFM()->prefix),
29
- $this->bulk_action_name => __('published', WDFM()->prefix),
30
- ),
31
- 'unpublish' => array(
32
- 'title' => __('Unpublish', WDFM()->prefix),
33
- $this->bulk_action_name => __('unpublished', WDFM()->prefix),
34
- ),
35
- 'duplicate' => array(
36
- 'title' => __('Duplicate', WDFM()->prefix),
37
- $this->bulk_action_name => __('duplicated', WDFM()->prefix),
38
- ),
39
- 'delete' => array(
40
- 'title' => __('Delete', WDFM()->prefix),
41
- $this->bulk_action_name => __('deleted', WDFM()->prefix),
42
- ),
43
- );
44
-
45
- $this->animation_effects = array(
46
- 'none' => 'None',
47
- 'bounce' => 'Bounce',
48
- 'tada' => 'Tada',
49
- 'bounceInDown' => 'BounceInDown',
50
- 'fadeInLeft' => 'FadeInLeft',
51
- 'flash' => 'Flash',
52
- 'pulse' => 'Pulse',
53
- 'rubberBand' => 'RubberBand',
54
- 'shake' => 'Shake',
55
- 'swing' => 'Swing',
56
- 'wobble' => 'Wobble',
57
- 'hinge' => 'Hinge',
58
- 'lightSpeedIn' => 'LightSpeedIn',
59
- 'rollIn' => 'RollIn',
60
- 'bounceIn' => 'BounceIn',
61
- 'bounceInLeft' => 'BounceInLeft',
62
- 'bounceInRight' => 'BounceInRight',
63
- 'bounceInUp' => 'BounceInUp',
64
- 'fadeIn' => 'FadeIn',
65
- 'fadeInDown' => 'FadeInDown',
66
- 'fadeInDownBig' => 'FadeInDownBig',
67
- 'fadeInLeftBig' => 'FadeInLeftBig',
68
- 'fadeInRight' => 'FadeInRight',
69
- 'fadeInRightBig' => 'FadeInRightBig',
70
- 'fadeInUp' => 'FadeInUp',
71
- 'fadeInUpBig' => 'FadeInUpBig',
72
- 'flip' => 'Flip',
73
- 'flipInX' => 'FlipInX',
74
- 'flipInY' => 'FlipInY',
75
- 'rotateIn' => 'RotateIn',
76
- 'rotateInDownLeft' => 'RotateInDownLeft',
77
- 'rotateInDownRight' => 'RotateInDownRight',
78
- 'rotateInUpLeft' => 'RotateInUpLeft',
79
- 'rotateInUpRight' => 'RotateInUpRight',
80
- 'zoomIn' => 'ZoomIn',
81
- 'zoomInDown' => 'ZoomInDown',
82
- 'zoomInLeft' => 'ZoomInLeft',
83
- 'zoomInRight' => 'ZoomInRight',
84
- 'zoomInUp' => 'ZoomInUp',
85
- );
86
- }
87
-
88
- public function execute() {
89
- $task = WDW_FM_Library::get('task');
90
- $id = (int) WDW_FM_Library::get('current_id', 0);
91
- if ( method_exists($this, $task) ) {
92
- if ( $task != 'add' && $task != 'edit' && $task != 'display' ) {
93
- check_admin_referer(WDFM()->nonce, WDFM()->nonce);
94
- }
95
- $block_action = $this->bulk_action_name;
96
- $action = WDW_FM_Library::get( $block_action, -1 );
97
- if ( $action != -1 ) {
98
- $this->$block_action($action);
99
- }
100
- else {
101
- $this->$task($id);
102
- }
103
- }
104
- else {
105
- $this->display();
106
- }
107
- }
108
-
109
- public function display() {
110
- $params = array();
111
- $params['order'] = WDW_FM_Library::get('order', 'asc');
112
- $params['orderby'] = WDW_FM_Library::get('orderby', 'id');
113
- // To prevent SQL injections.
114
- if ( !in_array($params['orderby'], array( 'id', 'title', 'type' )) ) {
115
- $params['orderby'] = 'id';
116
- }
117
- $params['order'] = $params['order'] == 'desc' ? 'desc' : 'asc';
118
-
119
- $params['items_per_page'] = $this->items_per_page;
120
-
121
- $params['rows_data'] = $this->model->get_rows_data($params);
122
-
123
- $params['total'] = $this->model->total();
124
-
125
- $params['actions'] = $this->actions;
126
- $params['page'] = $this->page;
127
- $params['form_preview_link'] = $this->model->get_form_preview_post();
128
-
129
- $this->view->display($params);
130
- }
131
-
132
- /**
133
- * Bulk actions.
134
- *
135
- * @param $task
136
- */
137
- public function bulk_action($task) {
138
- $message = 0;
139
- $successfully_updated = 0;
140
-
141
- $check = WDW_FM_Library::get('check', '');
142
-
143
- if ( $check ) {
144
- foreach ( $check as $id => $item ) {
145
- if ( method_exists($this, $task) ) {
146
- $message = $this->$task($id, TRUE);
147
- if ( $message != 2 ) {
148
- // Increase successfully updated items count, if action doesn't failed.
149
- $successfully_updated++;
150
- }
151
- }
152
- }
153
- if ( $successfully_updated ) {
154
- $block_action = $this->bulk_action_name;
155
- $message = sprintf(_n('%s item successfully %s.', '%s items successfully %s.', $successfully_updated, WDFM()->prefix), $successfully_updated, $this->actions[$task][$block_action]);
156
- }
157
- }
158
-
159
- WDW_FM_Library::fm_redirect(add_query_arg(array(
160
- 'page' => $this->page,
161
- 'task' => 'display',
162
- ($message === 2 ? 'message' : 'msg') => $message,
163
- ), admin_url('admin.php')));
164
-
165
- }
166
-
167
- /**
168
- * Delete form by id.
169
- *
170
- * @param $id
171
- * @param bool $bulk
172
- *
173
- * @return int
174
- */
175
- public function delete( $id, $bulk = FALSE ) {
176
- if ( $this->model->delete_rows(array( "table" => "formmaker", "where" => "id = " . $id )) ) {
177
- $this->model->delete_rows(array( "table" => "formmaker_views", "where" => "form_id = " . $id ));
178
- $this->model->delete_rows(array( "table" => "formmaker_submits", "where" => "form_id = " . $id ));
179
- $this->model->delete_rows(array( "table" => "formmaker_sessions", "where" => "form_id = " . $id ));
180
- $this->model->delete_rows(array( "table" => "formmaker_backup", "where" => "id = " . $id ));
181
- $this->model->delete_rows(array( "table" => "formmaker_display_options", "where" => "form_id = " . $id ));
182
- if (WDFM()->is_free == 2) {
183
- $arr = explode(',', get_option('contact_form_forms'));
184
- $arr = array_diff($arr, array($id));
185
- $arr = implode(',', $arr);
186
- update_option('contact_form_forms', $arr);
187
- }
188
- // To delete DB rows with form ids from add-ons.
189
- if (WDFM()->is_free != 2) {
190
- do_action('fm_delete_addon_init', $id);
191
- }
192
- $message = 3;
193
- }
194
- else {
195
- $message = 2;
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
- * Publish by id.
212
- *
213
- * @param $id
214
- * @param bool $bulk
215
- *
216
- * @return int
217
- */
218
- public function publish( $id, $bulk = FALSE ) {
219
- $updated = $this->model->update_data("formmaker", array('published' => 1), array('id' => $id));
220
- if ( $updated !== FALSE ) {
221
- $message = 9;
222
- }
223
- else {
224
- $message = 2;
225
- }
226
-
227
- if ( $bulk ) {
228
- return $message;
229
- }
230
- else {
231
- WDW_FM_Library::fm_redirect(add_query_arg(array(
232
- 'page' => $this->page,
233
- 'task' => 'display',
234
- 'message' => $message,
235
- ), admin_url('admin.php')));
236
- }
237
- }
238
-
239
- /**
240
- * Unpublish by id.
241
- *
242
- * @param $id
243
- * @param bool $bulk
244
- *
245
- * @return int
246
- */
247
- public function unpublish( $id, $bulk = FALSE ) {
248
- $updated = $this->model->update_data("formmaker", array('published' => 0), array('id' => $id));
249
- if ( $updated !== FALSE ) {
250
- $message = 10;
251
- }
252
- else {
253
- $message = 2;
254
- }
255
-
256
- if ( $bulk ) {
257
- return $message;
258
- }
259
- else {
260
- WDW_FM_Library::fm_redirect(add_query_arg(array(
261
- 'page' => $this->page,
262
- 'task' => 'display',
263
- 'message' => $message,
264
- ), admin_url('admin.php')));
265
- }
266
- }
267
-
268
- /**
269
- * Duplicate by id.
270
- *
271
- * @param $id
272
- * @param bool $bulk
273
- *
274
- * @return int
275
- */
276
- public function duplicate( $id, $bulk = FALSE ) {
277
- $message = 2;
278
- $row = $this->model->select_rows("get_row", array(
279
- "selection" => "*",
280
- "table" => "formmaker",
281
- "where" => "id=" . (int) $id,
282
- ));
283
-
284
- if ( $row ) {
285
- $row = (array) $row;
286
- unset($row['id']);
287
- $inserted = $this->model->insert_data_to_db("formmaker", (array) $row);
288
- $id = (int) $this->model->get_max_row('formmaker', 'id');
289
- if (WDFM()->is_free == 2) {
290
- update_option('contact_form_forms', ((get_option('contact_form_forms')) ? (get_option('contact_form_forms')) . ',' . $id : $id));
291
- }
292
- if ( $inserted !== FALSE ) {
293
- $message = 11;
294
- }
295
- }
296
-
297
- if ( $bulk ) {
298
- return $message;
299
- }
300
- else {
301
- WDW_FM_Library::fm_redirect(add_query_arg(array(
302
- 'page' => $this->page,
303
- 'task' => 'display',
304
- 'message' => $message,
305
- ), admin_url('admin.php')));
306
- }
307
- }
308
-
309
- public function add() {
310
- $backup_id = 0;
311
- $params = array();
312
- $params['id'] = $backup_id;
313
- $params['row'] = $this->model->get_row_data_new($backup_id);
314
- $params['page_url'] = $this->page_url;
315
- // Check if Stripe add-on is active.
316
- $stripe_addon = array('enable' => 0);
317
- $addon_stripe = $this->get_stripe_addon(0);
318
- if( !empty($addon_stripe['html']) ) {
319
- $stripe_addon = $addon_stripe;
320
- }
321
- $params['stripe_addon'] = $stripe_addon;
322
-
323
- $params['themes'] = $this->model->get_theme_rows_data();
324
- $params['default_theme'] = $this->model->get_default_theme_id();
325
- $params['form_preview_link'] = "";
326
-
327
- $params['autogen_layout'] = 1;
328
- $labels = array();
329
- $label_id = array();
330
- $label_order_original = array();
331
- $label_type = array();
332
- $label_all = explode('#****#', $params['row']->label_order);
333
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
334
- foreach ( $label_all as $key => $label_each ) {
335
- $label_id_each = explode('#**id**#', $label_each);
336
- array_push($label_id, $label_id_each[0]);
337
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
338
- array_push($label_order_original, addslashes($label_oder_each[0]));
339
- array_push($label_type, $label_oder_each[1]);
340
- }
341
-
342
- $labels['id'] = '"' . implode('","', $label_id) . '"';
343
- $labels['label'] = '"' . implode('","', $label_order_original) . '"';
344
- $labels['type'] = '"' . implode('","', $label_type) . '"';
345
- $params['labels'] = $labels;
346
-
347
- $params['page_title'] = __('Create new form', WDFM()->prefix);
348
- $params['animation_effects'] = $this->animation_effects;
349
-
350
- $this->view->edit($params);
351
- }
352
-
353
- public function edit($id = 0, $backup_id = 0) {
354
- $fm_settings = get_option('fm_settings');
355
- $fm_advanced_layout = isset($fm_settings['fm_advanced_layout']) && $fm_settings['fm_advanced_layout'] == '1' ? 1 : 0;
356
- if ( $id && !$fm_advanced_layout ) {
357
- $fm_advanced_layout = !$this->model->get_autogen_layout($id);
358
- }
359
- if ( !$backup_id ) {
360
- $backup_id = $this->model->select_rows("get_var", array(
361
- "selection" => "backup_id",
362
- "table" => "formmaker_backup",
363
- "where" => "cur=1 and id=" . $id,
364
- ));
365
-
366
- if ( !$backup_id ) {
367
- $backup_id = $this->model->get_max_row("formmaker_backup", "backup_id");
368
- if ( $backup_id ) {
369
- $backup_id++;
370
- }
371
- else {
372
- $backup_id = 1;
373
- }
374
- $this->model->insert_formmaker_backup($backup_id, $id);
375
- }
376
- }
377
-
378
- $params = array();
379
- $params['id'] = $id;
380
- $params['row'] = $this->model->get_row_data_new($backup_id);
381
- if ( empty($params['row']) ) {
382
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'display'), admin_url('admin.php') ) );
383
- }
384
-
385
- // Check stripe add-on is active.
386
- $stripe_addon = array( 'enable' => 0 );
387
- $addon_stripe = $this->get_stripe_addon($id);
388
- if ( !empty($addon_stripe['html']) ) {
389
- $stripe_addon = $addon_stripe;
390
- }
391
- $params['stripe_addon'] = $stripe_addon;
392
- $params['page_url'] = $this->page_url;
393
- $params['themes'] = $this->model->get_theme_rows_data();
394
- $params['default_theme'] = $this->model->get_default_theme_id();
395
-
396
- $params['form_preview_link'] = $this->model->get_form_preview_post();
397
-
398
- if ( $id ) {
399
- $params['form_options_url'] = add_query_arg( array( 'page' => $this->page , 'task' => 'form_options', 'current_id' => $id ), $this->page_url );
400
- $params['display_options_url'] = add_query_arg( array( 'page' => $this->page , 'task' => 'display_options', 'current_id' => $id ), $this->page_url );
401
- $params['advanced_layout_url'] = $fm_advanced_layout ? add_query_arg( array( 'page' => $this->page , 'task' => 'form_layout', 'current_id' => $id ), $this->page_url ) : '';
402
- }
403
-
404
- if ( isset($params['row']->backup_id) ) {
405
- if ( $params['row']->backup_id != "" ) {
406
- $params['next_backup_id'] = $this->model->get_backup_id($params['row']->backup_id, $params['row']->id);
407
- $params['prev_backup_id'] = $this->model->get_prev_backup_id($params['row']->backup_id, $params['row']->id);
408
- }
409
- }
410
-
411
- $labels = array();
412
- $label_id = array();
413
- $label_order_original = array();
414
- $label_type = array();
415
- $label_all = explode('#****#', $params['row']->label_order);
416
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
417
- foreach ( $label_all as $key => $label_each ) {
418
- $label_id_each = explode('#**id**#', $label_each);
419
- array_push($label_id, $label_id_each[0]);
420
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
421
- array_push($label_order_original, addslashes($label_oder_each[0]));
422
- array_push($label_type, $label_oder_each[1]);
423
- }
424
-
425
- $labels['id'] = '"' . implode('","', $label_id) . '"';
426
- $labels['label'] = '"' . implode('","', $label_order_original) . '"';
427
- $labels['type'] = '"' . implode('","', $label_type) . '"';
428
- $params['labels'] = $labels;
429
-
430
- $params['page_title'] = (($params['id'] != 0) ? 'Edit form ' . $params['row']->title : 'Create new form');
431
-
432
- $params['animation_effects'] = $this->animation_effects;
433
-
434
- $this->view->edit($params);
435
- }
436
-
437
- public function undo() {
438
- $backup_id = (int) WDW_FM_Library::get('backup_id');
439
- $id = (int) WDW_FM_Library::get('id');
440
- $backup_id = $this->model->get_undo_redo_id($backup_id, $id, 0);
441
- $this->edit($id, $backup_id);
442
- }
443
-
444
- public function redo() {
445
- $backup_id = (int) WDW_FM_Library::get('backup_id');
446
- $id = (int) WDW_FM_Library::get('id');
447
- $backup_id = $this->model->get_undo_redo_id($backup_id, $id, 1);
448
- $this->edit($id, $backup_id);
449
- }
450
-
451
- /**
452
- * Form options.
453
- *
454
- * @param int $id
455
- */
456
- public function form_options( $id ) {
457
- // Set params for view.
458
- $params = array();
459
- $params['id'] = $id;
460
- $params['page'] = $this->page;
461
- $params['page_url'] = $this->page_url;
462
-
463
- $params['back_url'] = add_query_arg( array (
464
- 'page' => 'manage' . WDFM()->menu_postfix,
465
- 'task' => 'edit',
466
- 'current_id' => $id,
467
-
468
- ), admin_url('admin.php')
469
- );
470
-
471
- $params['fieldset_id'] = WDW_FM_Library::get('fieldset_id', 'general');
472
-
473
- $params['row'] = $this->model->get_row_data($id);
474
- if ( empty($params['row']) ) {
475
- WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $this->page), admin_url('admin.php')));
476
- }
477
-
478
- $params['themes'] = $this->model->get_theme_rows_data();
479
- $params['default_theme'] = $this->model->get_default_theme_id();
480
- $params['queries'] = $this->model->get_queries_rows_data($id);
481
- $params['userGroups'] = get_editable_roles();
482
- $params['page_title'] = '"' . $params['row']->title . '" ' . __('options', WDFM()->prefix);
483
-
484
- $label_id = array();
485
- $label_label = array();
486
- $label_type = array();
487
- $label_all = explode('#****#', $params['row']->label_order_current);
488
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
489
- foreach ( $label_all as $key => $label_each ) {
490
- $label_id_each = explode('#**id**#', $label_each);
491
- array_push($label_id, $label_id_each[0]);
492
- $label_order_each = explode('#**label**#', $label_id_each[1]);
493
- array_push($label_label, $label_order_each[0]);
494
- array_push($label_type, $label_order_each[1]);
495
- }
496
- $params['fields'] = explode('*:*id*:*type_submitter_mail*:*type*:*', $params['row']->form_fields);
497
- $params['fields_count'] = count($params['fields']);
498
-
499
- // chechk stripe addon is active.
500
- $stripe_addon = array('enable' => 0);
501
- $addon_stripe = $this->get_stripe_addon($id);
502
- if( !empty($addon_stripe['html']) ) {
503
- $stripe_addon = $addon_stripe;
504
- }
505
- $params['stripe_addon'] = $stripe_addon;
506
-
507
- /*
508
- TODO.
509
- Remember. 0 => none, 1 => paypal, 2 => stripe
510
- Change. rename paypal_mode name to payment_method of wp_formmaker table.
511
- */
512
- $paypal_mode = $params['row']->paypal_mode;
513
- $payment_method = 'none';
514
- if($paypal_mode == 1){
515
- $payment_method = 'paypal';
516
- }
517
- if($paypal_mode == 2 && isset($stripe_addon['stripe_enable']) && $stripe_addon['stripe_enable'] == 1 ){
518
- $payment_method = 'stripe';
519
- }
520
-
521
- $params['payment_method'] = $payment_method;
522
- $params['label_label'] = $label_label;
523
- $params['label_type'] = $label_type;
524
- $params['labels_for_submissions'] = $this->model->get_labels($id);
525
- $params['payment_info'] = $this->model->is_paypal($id);
526
-
527
- $labels_id_for_submissions = array();
528
- $label_titles_for_submissions = array();
529
- $labels_type_for_submissions = array();
530
- if ( $params['labels_for_submissions'] ) {
531
- $label_id_for_submissions = array();
532
- $label_order_original_for_submissions = array();
533
- $label_type_for_submissions = array();
534
- if ( strpos($params['row']->label_order, 'type_paypal_') ) {
535
- $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#****#";
536
- }
537
- $label_all_for_submissions = explode('#****#', $params['row']->label_order);
538
- $label_all_for_submissions = array_slice($label_all_for_submissions, 0, count($label_all_for_submissions) - 1);
539
- foreach ( $label_all_for_submissions as $key => $label_each ) {
540
- $label_id_each = explode('#**id**#', $label_each);
541
- array_push($label_id_for_submissions, $label_id_each[0]);
542
- $label_order_each = explode('#**label**#', $label_id_each[1]);
543
- array_push($label_order_original_for_submissions, $label_order_each[0]);
544
- array_push($label_type_for_submissions, $label_order_each[1]);
545
- }
546
- foreach ( $label_id_for_submissions as $key => $label ) {
547
- if ( in_array($label, $params['labels_for_submissions']) ) {
548
- array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
549
- array_push($labels_id_for_submissions, $label);
550
- array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
551
- }
552
- }
553
- $params['labels_id_for_submissions'] = $labels_id_for_submissions;
554
- $params['label_titles_for_submissions'] = $label_titles_for_submissions;
555
- }
556
-
557
- $stats_labels = array();
558
- $stats_labels_ids = array();
559
- foreach ( $labels_type_for_submissions as $key => $label_type_cur ) {
560
- 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" ) {
561
- $stats_labels_ids[] = $labels_id_for_submissions[$key];
562
- $stats_labels[] = $label_titles_for_submissions[$key];
563
- }
564
- }
565
-
566
- $params['stats_labels_ids'] = $stats_labels_ids;
567
- $params['stats_labels'] = $stats_labels;
568
- $params['mail_ver_id'] = $this->model->get_emailverification_post_id();
569
-
570
- $params['addons'] = $this->get_addon_tabs( array('form_id' => $id) );
571
-
572
- $this->view->form_options($params);
573
- }
574
-
575
- /**
576
- * Get active addons.
577
- *
578
- * @param $params
579
- *
580
- * @return mixed|void
581
- */
582
- private function get_addon_tabs( $params ) {
583
- $addons = array('tabs' => array(), 'html' => array());
584
- if (WDFM()->is_free != 2) {
585
- $addons = apply_filters('fm_get_addon_init', $addons, $params);
586
- }
587
- return $addons;
588
- }
589
-
590
- /**
591
- * Apply form options.
592
- *
593
- * @param int $id
594
- */
595
- public function apply_form_options( $id ) {
596
- $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
597
- $message = $this->save_db_form_options( $id );
598
- WDW_FM_Library::fm_redirect(add_query_arg(array(
599
- 'page' => $this->page,
600
- 'task' => 'form_options',
601
- 'current_id' => $id,
602
- 'fieldset_id' => $fieldset_id,
603
- 'message' => $message,
604
- ), admin_url('admin.php')));
605
- }
606
-
607
- /**
608
- * Save db Form options.
609
- *
610
- * @param int $id
611
- *
612
- * @return int $id_message
613
- */
614
- public function save_db_form_options( $id ) {
615
- $javascript = "// Occurs before the form is loaded
616
- function before_load() {
617
-
618
- }
619
- // Occurs just before submitting the form
620
- function before_submit() {
621
- // 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.
622
- }
623
- // Occurs just before resetting the form
624
- function before_reset() {
625
-
626
- }";
627
-
628
- $published = stripslashes(WDW_FM_Library::get('published', ''));
629
- $savedb = stripslashes(WDW_FM_Library::get('savedb', ''));
630
- $theme = (int) WDW_FM_Library::get('theme', 0);
631
- $theme = ($theme) ? $theme : $this->model->get_default_theme_id();
632
- $requiredmark = stripslashes(WDW_FM_Library::get('requiredmark', '*'));
633
- $sendemail = stripslashes(WDW_FM_Library::get('sendemail', ''));
634
- $save_uploads = stripslashes(WDW_FM_Library::get('save_uploads', ''));
635
- $mail = stripslashes(WDW_FM_Library::get('mail', ''));
636
- if ( isset($_POST['mailToAdd']) && esc_html(stripslashes($_POST['mailToAdd'])) != '' ) {
637
- $mail .= esc_html(stripslashes($_POST['mailToAdd'])) . ',';
638
- }
639
- $from_mail = stripslashes(WDW_FM_Library::get('from_mail', ''));
640
- $from_name = stripslashes(WDW_FM_Library::get('from_name', ''));
641
- $reply_to = stripslashes(WDW_FM_Library::get('reply_to', ''));
642
- if ( $from_mail == "other" ) {
643
- $from_mail = stripslashes(WDW_FM_Library::get('mail_from_other', ''));
644
- }
645
- if ( $reply_to == "other" ) {
646
- $reply_to = stripslashes(WDW_FM_Library::get('reply_to_other', ''));
647
- }
648
- $script_mail = WDW_FM_Library::get('script_mail', '%all%', FALSE);
649
- $mail_from_user = WDW_FM_Library::get('mail_from_user', '');
650
- $mail_from_name_user = WDW_FM_Library::get('mail_from_name_user', '');
651
- $reply_to_user = WDW_FM_Library::get('reply_to_user', '');
652
- $condition = WDW_FM_Library::get('condition', '');
653
- $mail_cc = WDW_FM_Library::get('mail_cc', '');
654
- $mail_cc_user = WDW_FM_Library::get('mail_cc_user', '');
655
- $mail_bcc = WDW_FM_Library::get('mail_bcc', '');
656
- $mail_bcc_user = WDW_FM_Library::get('mail_bcc_user', '');
657
- $mail_subject = WDW_FM_Library::get('mail_subject', '');
658
- $mail_subject_user = WDW_FM_Library::get('mail_subject_user', '');
659
- $mail_mode = WDW_FM_Library::get('mail_mode', '');
660
- $mail_mode_user = WDW_FM_Library::get('mail_mode_user', '');
661
- $mail_attachment = WDW_FM_Library::get('mail_attachment', '');
662
- $mail_attachment_user = WDW_FM_Library::get('mail_attachment_user', '');
663
- $script_mail_user = WDW_FM_Library::get('script_mail_user', '%all%', FALSE);
664
- $submit_text = WDW_FM_Library::get('submit_text', '', FALSE);
665
- $url = WDW_FM_Library::get('url', '');
666
- $tax = WDW_FM_Library::get('tax', 0);
667
- $payment_currency = WDW_FM_Library::get('payment_currency', '');
668
- $paypal_email = WDW_FM_Library::get('paypal_email', '');
669
- $checkout_mode = WDW_FM_Library::get('checkout_mode', 'testmode');
670
- $paypal_mode = WDW_FM_Library::get('paypal_mode', 0);
671
-
672
- // TODO Seclude payment method and payment status.
673
- if ( $paypal_mode == 'paypal' ) {
674
- $paypal_mode = 1;
675
- }
676
- if ( $paypal_mode == 'stripe' ) {
677
- $paypal_mode = 2;
678
- }
679
-
680
- $javascript = stripslashes(WDW_FM_Library::get('javascript', $javascript, false));
681
- $user_id_wd = stripslashes(WDW_FM_Library::get('user_id_wd', 'administrator,'));
682
- $frontend_submit_fields = stripslashes(WDW_FM_Library::get('frontend_submit_fields', ''));
683
- $frontend_submit_stat_fields = stripslashes(WDW_FM_Library::get('frontend_submit_stat_fields', ''));
684
- $mail_emptyfields = stripslashes(WDW_FM_Library::get('mail_emptyfields', 0));
685
- $mail_verify = stripslashes(WDW_FM_Library::get('mail_verify', 0));
686
- $mail_verify_expiretime = stripslashes(WDW_FM_Library::get('mail_verify_expiretime', ''));
687
- $send_to = '';
688
- for ( $i = 0; $i < 20; $i++ ) {
689
- if ( WDW_FM_Library::get('send_to' . $i, 0) ) {
690
- $send_to .= '*' . WDW_FM_Library::get('send_to' . $i, 0) . '*';
691
- }
692
- }
693
- if ( WDW_FM_Library::get('submit_text_type', 0) ) {
694
- $submit_text_type = WDW_FM_Library::get('submit_text_type', 0);
695
- if ( $submit_text_type == 5 ) {
696
- $article_id = WDW_FM_Library::get('page_name', 0);
697
- }
698
- else {
699
- $article_id = WDW_FM_Library::get('post_name', 0);
700
- }
701
- }
702
- else {
703
- $submit_text_type = 1;
704
- $article_id = 0;
705
- }
706
- $mail_verification_post_id = (int) $this->model->get_mail_verification_post_id();
707
- if ( $mail_verify ) {
708
- $email_verification_post = array(
709
- 'post_title' => 'Email Verification',
710
- 'post_content' => '[email_verification]',
711
- 'post_status' => 'publish',
712
- 'post_author' => 1,
713
- 'post_type' => 'fmemailverification',
714
- );
715
- if ( !$mail_verification_post_id || get_post($mail_verification_post_id) === NULL ) {
716
- $mail_verification_post_id = wp_insert_post($email_verification_post);
717
- }
718
- }
719
-
720
- $data = array(
721
- 'published' => $published,
722
- 'savedb' => $savedb,
723
- 'theme' => $theme,
724
- 'requiredmark' => $requiredmark,
725
- 'sendemail' => $sendemail,
726
- 'save_uploads' => $save_uploads,
727
- 'mail' => $mail,
728
- 'from_mail' => $from_mail,
729
- 'from_name' => $from_name,
730
- 'reply_to' => $reply_to,
731
- 'script_mail' => $script_mail,
732
- 'mail_from_user' => $mail_from_user,
733
- 'mail_from_name_user' => $mail_from_name_user,
734
- 'reply_to_user' => $reply_to_user,
735
- 'condition' => $condition,
736
- 'mail_cc' => $mail_cc,
737
- 'mail_cc_user' => $mail_cc_user,
738
- 'mail_bcc' => $mail_bcc,
739
- 'mail_bcc_user' => $mail_bcc_user,
740
- 'mail_subject' => $mail_subject,
741
- 'mail_subject_user' => $mail_subject_user,
742
- 'mail_mode' => $mail_mode,
743
- 'mail_mode_user' => $mail_mode_user,
744
- 'mail_attachment' => $mail_attachment,
745
- 'mail_attachment_user' => $mail_attachment_user,
746
- 'script_mail_user' => $script_mail_user,
747
- 'submit_text' => $submit_text,
748
- 'url' => $url,
749
- 'submit_text_type' => $submit_text_type,
750
- 'article_id' => $article_id,
751
- 'tax' => $tax,
752
- 'payment_currency' => $payment_currency,
753
- 'paypal_email' => $paypal_email,
754
- 'checkout_mode' => $checkout_mode,
755
- 'paypal_mode' => $paypal_mode,
756
- 'javascript' => $javascript,
757
- 'user_id_wd' => $user_id_wd,
758
- 'send_to' => $send_to,
759
- 'frontend_submit_fields' => $frontend_submit_fields,
760
- 'frontend_submit_stat_fields' => $frontend_submit_stat_fields,
761
- 'mail_emptyfields' => $mail_emptyfields,
762
- 'mail_verify' => $mail_verify,
763
- 'mail_verify_expiretime' => $mail_verify_expiretime,
764
- 'mail_verification_post_id' => $mail_verification_post_id,
765
- );
766
-
767
- $message_id = 2;
768
- $save = $this->model->update_data('formmaker', $data, array( 'id' => $id ));
769
- if ( $save !== FALSE ) {
770
- $this->model->update_data("formmaker_backup", array(
771
- 'theme' => $theme,
772
- ), array( 'id' => $id )); //save theme in backup
773
- $this->model->create_js($id);
774
- if (WDFM()->is_free != 2) {
775
- $save_addon = do_action('fm_save_addon_init', $id);
776
- }
777
- $message_id = 8;
778
- }
779
- return $message_id;
780
- }
781
-
782
- /**
783
- * Form layout.
784
- *
785
- * @param int $id
786
- */
787
- public function form_layout( $id ) {
788
- $ids = array();
789
- $types = array();
790
- $labels = array();
791
-
792
- $row = $this->model->get_row_data( $id );
793
- if ( empty($row) ) {
794
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'display'), admin_url('admin.php') ) );
795
- }
796
- $fields = explode('*:*new_field*:*', $row->form_fields);
797
- $fields = array_slice($fields, 0, count($fields) - 1);
798
- foreach ( $fields as $field ) {
799
- $temp = explode('*:*id*:*', $field);
800
- array_push($ids, $temp[0]);
801
- $temp = explode('*:*type*:*', $temp[1]);
802
- array_push($types, $temp[0]);
803
- $temp = explode('*:*w_field_label*:*', $temp[1]);
804
- array_push($labels, $temp[0]);
805
- }
806
-
807
- // Set params for view.
808
- $params = array();
809
- $params['id'] = $id;
810
- $params['row'] = $row;
811
- $params['page'] = $this->page;
812
- $params['page_url'] = $this->page_url;
813
- $params['page_title'] = '"'. $row->title . '" ' . __('layout', WDFM()->prefix);
814
- $params['back_url'] = add_query_arg( array ('page' => 'manage' . WDFM()->menu_postfix,'task' => 'edit','current_id' => $id ), admin_url('admin.php'));
815
- $params['ids'] = $ids;
816
- $params['types'] = $types;
817
- $params['labels'] = $labels;
818
- $this->view->form_layout($params);
819
- }
820
-
821
- public function apply_layout( $id ) {
822
- $message = $this->save_db_layout( $id );
823
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'form_layout', 'current_id' => $id, 'message' => $message), admin_url('admin.php') ) );
824
- }
825
-
826
- /**
827
- * Save db layout.
828
- *
829
- * @param int $id
830
- *
831
- * @return int $id_message
832
- */
833
- public function save_db_layout( $id ) {
834
- $custom_front = WDW_FM_Library::get('custom_front', '', false);
835
- $autogen_layout = WDW_FM_Library::get('autogen_layout', '');
836
-
837
- $update = $this->model->update_data('formmaker', array(
838
- 'custom_front' => $custom_front,
839
- 'autogen_layout' => $autogen_layout,
840
- ), array( 'id' => $id ));
841
- if ( $update !== FALSE ) {
842
- return 1;
843
- }
844
- else {
845
- return 2;
846
- }
847
- }
848
-
849
- public function display_options() {
850
- $id = (int) WDW_FM_Library::get('current_id', $this->model->get_max_row("formmaker", "id"));
851
- $params = array();
852
- $params['row_form'] = $this->model->get_row_data($id);
853
- if ( empty($params['row_form']) ) {
854
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'display'), admin_url('admin.php') ) );
855
- }
856
- $params['row'] = $this->model->get_display_options($id);
857
- $params['page_title'] = '"'. $params['row_form']->title . '" ' . __('display options', WDFM()->prefix);
858
- $params['animation_effects'] = $this->animation_effects;
859
- $params['posts_and_pages'] = $this->model->fm_posts_query();
860
- $params['categories'] = $this->model->fm_categories_query();
861
- $params['selected_categories'] = explode(',', $params['row']->display_on_categories);
862
- $params['current_categories_array'] = explode(',', $params['row']->current_categories);
863
- $params['id'] = $id;
864
- $params['page'] = $this->page;
865
- $params['page_url'] = $this->page_url;
866
- $params['back_url'] = add_query_arg( array (
867
- 'page' => 'manage' . WDFM()->menu_postfix,
868
- 'task' => 'edit',
869
- 'current_id' => $id,
870
- ), admin_url('admin.php')
871
- );
872
-
873
- $params['fieldset_id'] = WDW_FM_Library::get('fieldset_id', 'embedded');
874
- $this->view->display_options($params);
875
- }
876
-
877
- public function save_display_options() {
878
- $message = $this->save_dis_options();
879
- $page = WDW_FM_Library::get('page');
880
-
881
- $current_id = (int) WDW_FM_Library::get('current_id', 0);
882
- WDW_FM_Library::fm_redirect(add_query_arg(array(
883
- 'page' => $page,
884
- 'task' => 'edit',
885
- 'current_id' => $current_id,
886
- 'message' => $message,
887
- ), admin_url('admin.php')));
888
- }
889
-
890
- public function apply_display_options() {
891
- $message = $this->save_dis_options();
892
- $page = WDW_FM_Library::get('page');
893
- $fieldset_id = WDW_FM_Library::get('fieldset_id', 'embedded');
894
- $current_id = (int) WDW_FM_Library::get('current_id', 0);
895
- WDW_FM_Library::fm_redirect(add_query_arg(array(
896
- 'page' => $page,
897
- 'task' => 'display_options',
898
- 'current_id' => $current_id,
899
- 'fieldset_id'=> $fieldset_id,
900
- 'message' => $message,
901
- ), admin_url('admin.php')));
902
- }
903
-
904
- /**
905
- * Remove query for MySQL Mapping.
906
- * @param int $id
907
- */
908
- public function remove_query( $id ) {
909
- $fieldset_id = WDW_FM_Library::get('fieldset_id', 'general');
910
- $query_id = WDW_FM_Library::get('query_id',0);
911
- $message = 2;
912
- if( $this->model->delete_formmaker_query( $query_id ) ) {
913
- $message = 3;
914
- }
915
-
916
- WDW_FM_Library::fm_redirect(add_query_arg(array(
917
- 'page' => $this->page,
918
- 'task' => 'form_options',
919
- 'current_id' => $id,
920
- 'fieldset_id' => $fieldset_id,
921
- 'message' => $message,
922
- ), admin_url('admin.php')));
923
- }
924
-
925
- /**
926
- * Check if loading_delay or frequency is positive numbers
927
- *
928
- * @param int $delay
929
- *
930
- * @return int
931
- */
932
- public function set_delay_freq_positive_val( $delay ) {
933
- if( $delay < 0 ) return 0;
934
- return $delay;
935
- }
936
-
937
- public function save_dis_options() {
938
- $option_data = array(
939
- 'form_id' => (int) WDW_FM_Library::get('current_id', 0),
940
- 'scrollbox_loading_delay' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('scrollbox_loading_delay', 0) ),
941
- 'popover_animate_effect' => WDW_FM_Library::get('popover_animate_effect', ''),
942
- 'popover_loading_delay' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('popover_loading_delay', 0) ),
943
- 'popover_frequency' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('popover_frequency', 0) ),
944
- 'topbar_position' => WDW_FM_Library::get('topbar_position', 1),
945
- 'topbar_remain_top' => WDW_FM_Library::get('topbar_remain_top', 1),
946
- 'topbar_closing' => WDW_FM_Library::get('topbar_closing', 1),
947
- 'topbar_hide_duration' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('topbar_hide_duration', 0) ),
948
- 'scrollbox_position' => WDW_FM_Library::get('scrollbox_position', 1),
949
- 'scrollbox_trigger_point' => WDW_FM_Library::get('scrollbox_trigger_point', 20),
950
- 'scrollbox_hide_duration' => $this->set_delay_freq_positive_val( WDW_FM_Library::get('scrollbox_hide_duration', 0)),
951
- 'scrollbox_auto_hide' => WDW_FM_Library::get('scrollbox_auto_hide', 1),
952
- 'hide_mobile' => WDW_FM_Library::get('hide_mobile', 0),
953
- 'scrollbox_closing' => WDW_FM_Library::get('scrollbox_closing', 1),
954
- 'scrollbox_minimize' => WDW_FM_Library::get('scrollbox_minimize', 1),
955
- 'scrollbox_minimize_text' => WDW_FM_Library::get('scrollbox_minimize_text', ''),
956
- 'type' => WDW_FM_Library::get('form_type', 'embadded'),
957
- 'display_on' => implode(',', WDW_FM_Library::get('display_on', array())),
958
- 'posts_include' => WDW_FM_Library::get('posts_include', ''),
959
- 'pages_include' => WDW_FM_Library::get('pages_include', ''),
960
- 'display_on_categories' => implode(',', WDW_FM_Library::get('display_on_categories', array())),
961
- 'current_categories' => WDW_FM_Library::get('current_categories', ''),
962
- 'show_for_admin' => WDW_FM_Library::get('show_for_admin', 0),
963
- );
964
-
965
- $save = $this->model->replace_display_options($option_data);
966
- if ( $save !== FALSE ) {
967
- $this->model->update_data('formmaker_backup', array(
968
- 'type' => $option_data['type'],
969
- ), array( 'id' => $option_data['form_id'] ));
970
- $this->model->update_data('formmaker', array(
971
- 'type' => $option_data['type'],
972
- ), array( 'id' => $option_data['form_id'] ));
973
- $this->model->create_js($option_data['form_id']);
974
-
975
- return 8;
976
- }
977
- else {
978
- return 2;
979
- }
980
- }
981
-
982
- // TODO: remove this function.
983
- public function save_as_copy() {
984
- $message = $this->save_db_as_copy();
985
- $page = WDW_FM_Library::get('page');
986
- WDW_FM_Library::fm_redirect(add_query_arg(array(
987
- 'page' => $page,
988
- 'task' => 'display',
989
- 'message' => $message,
990
- ), admin_url('admin.php')));
991
- }
992
-
993
- public function save() {
994
- $message = $this->save_db();
995
- $page = WDW_FM_Library::get('page');
996
- WDW_FM_Library::fm_redirect(add_query_arg(array(
997
- 'page' => $page,
998
- 'task' => 'display',
999
- 'message' => $message,
1000
- ), admin_url('admin.php')));
1001
- }
1002
-
1003
- public function apply() {
1004
- $message = $this->save_db();
1005
- $current_id = (int) WDW_FM_Library::get('current_id', 0);
1006
- if ( !$current_id ) {
1007
- $current_id = (int) $this->model->get_max_row('formmaker', 'id');
1008
- }
1009
- $page = WDW_FM_Library::get('page');
1010
- WDW_FM_Library::fm_redirect(add_query_arg(array(
1011
- 'page' => $page,
1012
- 'task' => 'edit',
1013
- 'current_id' => $current_id,
1014
- 'message' => $message,
1015
- ), admin_url('admin.php')));
1016
- }
1017
-
1018
- public function save_db() {
1019
- $javascript = "// Occurs before the form is loaded
1020
- function before_load() {
1021
- }
1022
- // Occurs just before submitting the form
1023
- function before_submit() {
1024
- // 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.
1025
- }
1026
- // Occurs just before resetting the form
1027
- function before_reset() {
1028
- }";
1029
- $id = (int) WDW_FM_Library::get('current_id', 0);
1030
- $title = WDW_FM_Library::get('title', '');
1031
- $theme = (int) WDW_FM_Library::get('theme', 0);
1032
- $theme = ($theme) ? $theme : $this->model->get_default_theme_id();
1033
- $form_front = WDW_FM_Library::get('form_front', '', false);
1034
- $sortable = WDW_FM_Library::get('sortable', 0);
1035
- $counter = WDW_FM_Library::get('counter', 0);
1036
- $label_order = WDW_FM_Library::get('label_order', '');
1037
- $pagination = WDW_FM_Library::get('pagination', '');
1038
- $show_title = WDW_FM_Library::get('show_title', '');
1039
- $show_numbers = WDW_FM_Library::get('show_numbers', '');
1040
- $public_key = WDW_FM_Library::get('public_key', '');
1041
- $private_key = WDW_FM_Library::get('private_key', '');
1042
- $recaptcha_theme = WDW_FM_Library::get('recaptcha_theme', '');
1043
- $label_order_current = WDW_FM_Library::get('label_order_current', '');
1044
- $form_fields = WDW_FM_Library::get('form_fields', '', false);
1045
- $header_title = WDW_FM_Library::get('header_title', '');
1046
- $header_description = WDW_FM_Library::get('header_description', '', FALSE);
1047
- $header_image_url = WDW_FM_Library::get('header_image_url', '');
1048
- $header_image_animation = WDW_FM_Library::get('header_image_animation', '');
1049
- $header_hide_image = WDW_FM_Library::get('header_hide_image', 0);
1050
- $type = WDW_FM_Library::get('form_type', 'embedded');
1051
- $scrollbox_minimize_text = $header_title ? $header_title : 'The form is minimized.';
1052
- if ( $id != 0 ) {
1053
- $save = $this->model->update_data('formmaker', array(
1054
- 'title' => $title,
1055
- 'theme' => $theme,
1056
- 'form_front' => $form_front,
1057
- 'sortable' => $sortable,
1058
- 'counter' => $counter,
1059
- 'label_order' => $label_order,
1060
- 'label_order_current' => $label_order_current,
1061
- 'pagination' => $pagination,
1062
- 'show_title' => $show_title,
1063
- 'show_numbers' => $show_numbers,
1064
- 'public_key' => $public_key,
1065
- 'private_key' => $private_key,
1066
- 'recaptcha_theme' => $recaptcha_theme,
1067
- 'form_fields' => $form_fields,
1068
- 'header_title' => $header_title,
1069
- 'header_description' => $header_description,
1070
- 'header_image_url' => $header_image_url,
1071
- 'header_image_animation' => $header_image_animation,
1072
- 'header_hide_image' => $header_hide_image,
1073
- ), array( 'id' => $id ));
1074
- }
1075
- else {
1076
- $this->model->insert_data_to_db('formmaker', array(
1077
- 'title' => $title,
1078
- 'type' => $type,
1079
- 'mail' => '',
1080
- 'form_front' => $form_front,
1081
- 'theme' => $theme,
1082
- 'counter' => $counter,
1083
- 'label_order' => $label_order,
1084
- 'pagination' => $pagination,
1085
- 'show_title' => $show_title,
1086
- 'show_numbers' => $show_numbers,
1087
- 'public_key' => $public_key,
1088
- 'private_key' => $private_key,
1089
- 'recaptcha_theme' => $recaptcha_theme,
1090
- 'javascript' => $javascript,
1091
- 'submit_text' => '',
1092
- 'url' => '',
1093
- 'article_id' => 0,
1094
- 'submit_text_type' => 1,
1095
- 'script_mail' => '%all%',
1096
- 'script_mail_user' => '%all%',
1097
- 'label_order_current' => $label_order_current,
1098
- 'tax' => 0,
1099
- 'payment_currency' => '',
1100
- 'paypal_email' => '',
1101
- 'checkout_mode' => 'testmode',
1102
- 'paypal_mode' => 0,
1103
- 'published' => 1,
1104
- 'form_fields' => $form_fields,
1105
- 'savedb' => 1,
1106
- 'sendemail' => 1,
1107
- 'requiredmark' => '*',
1108
- 'from_mail' => '',
1109
- 'from_name' => '',
1110
- 'reply_to' => '',
1111
- 'send_to' => '',
1112
- 'autogen_layout' => 1,
1113
- 'custom_front' => '',
1114
- 'mail_from_user' => '',
1115
- 'mail_from_name_user' => '',
1116
- 'reply_to_user' => '',
1117
- 'condition' => '',
1118
- 'mail_cc' => '',
1119
- 'mail_cc_user' => '',
1120
- 'mail_bcc' => '',
1121
- 'mail_bcc_user' => '',
1122
- 'mail_subject' => '',
1123
- 'mail_subject_user' => '',
1124
- 'mail_mode' => 1,
1125
- 'mail_mode_user' => 1,
1126
- 'mail_attachment' => 1,
1127
- 'mail_attachment_user' => 1,
1128
- 'sortable' => $sortable,
1129
- 'user_id_wd' => 'administrator,',
1130
- 'frontend_submit_fields' => '',
1131
- 'frontend_submit_stat_fields' => '',
1132
- 'save_uploads' => 1,
1133
- 'header_title' => $header_title,
1134
- 'header_description' => $header_description,
1135
- 'header_image_url' => $header_image_url,
1136
- 'header_image_animation' => $header_image_animation,
1137
- 'header_hide_image' => $header_hide_image,
1138
- ));
1139
- $id = (int) $this->model->get_max_row('formmaker', 'id');
1140
- if (WDFM()->is_free == 2) {
1141
- update_option('contact_form_forms', ((get_option('contact_form_forms')) ? (get_option('contact_form_forms')) . ',' . $id : $id));
1142
- }
1143
- $this->model->insert_data_to_db('formmaker_display_options', array(
1144
- 'form_id' => $id,
1145
- 'type' => $type,
1146
- 'scrollbox_loading_delay' => 0,
1147
- 'popover_animate_effect' => '',
1148
- 'popover_loading_delay' => 0,
1149
- 'popover_frequency' => 0,
1150
- 'topbar_position' => 1,
1151
- 'topbar_remain_top' => 1,
1152
- 'topbar_closing' => 1,
1153
- 'topbar_hide_duration' => 0,
1154
- 'scrollbox_position' => 1,
1155
- 'scrollbox_trigger_point' => 20,
1156
- 'scrollbox_hide_duration' => 0,
1157
- 'scrollbox_auto_hide' => 1,
1158
- 'hide_mobile' => 0,
1159
- 'scrollbox_closing' => 1,
1160
- 'scrollbox_minimize' => 1,
1161
- 'scrollbox_minimize_text' => $scrollbox_minimize_text,
1162
- 'display_on' => 'home,post,page',
1163
- 'posts_include' => '',
1164
- 'pages_include' => '',
1165
- 'display_on_categories' => '',
1166
- 'current_categories' => '',
1167
- 'show_for_admin' => 0,
1168
- ));
1169
- $this->model->insert_data_to_db('formmaker_views', array(
1170
- 'form_id' => $id,
1171
- 'views' => 0,
1172
- ));
1173
- }
1174
- $backup_id = (int) WDW_FM_Library::get('backup_id', '');
1175
- if ( $backup_id ) {
1176
- if ( $this->model->get_backup_id($backup_id, $id) ) {
1177
- $this->model->delete_rows(array(
1178
- "table" => "formmaker_backup",
1179
- "where" => "backup_id > " . $backup_id . " AND id = " . $id,
1180
- ));
1181
- }
1182
- // Get form_fields, form_front
1183
- $row1 = $this->model->select_rows("get_row", array(
1184
- "selection" => "form_fields, form_front",
1185
- "table" => "formmaker_backup",
1186
- "where" => "backup_id = " . $backup_id,
1187
- ));
1188
- if ( $row1->form_fields == $form_fields and $row1->form_front == $form_front ) {
1189
- $save = $this->model->update_data('formmaker_backup', array(
1190
- 'cur' => 1,
1191
- 'title' => $title,
1192
- 'theme' => $theme,
1193
- 'form_front' => $form_front,
1194
- 'sortable' => $sortable,
1195
- 'counter' => $counter,
1196
- 'label_order' => $label_order,
1197
- 'label_order_current' => $label_order_current,
1198
- 'pagination' => $pagination,
1199
- 'show_title' => $show_title,
1200
- 'show_numbers' => $show_numbers,
1201
- 'public_key' => $public_key,
1202
- 'private_key' => $private_key,
1203
- 'recaptcha_theme' => $recaptcha_theme,
1204
- 'form_fields' => $form_fields,
1205
- 'header_title' => $header_title,
1206
- 'header_description' => $header_description,
1207
- 'header_image_url' => $header_image_url,
1208
- 'header_image_animation' => $header_image_animation,
1209
- 'header_hide_image' => $header_hide_image,
1210
- ), array( 'backup_id' => $backup_id ));
1211
- if ( $save !== FALSE ) {
1212
- $this->model->create_js($id);
1213
-
1214
- return 1;
1215
- }
1216
- else {
1217
- return 2;
1218
- }
1219
- }
1220
- }
1221
- $this->model->update_data('formmaker_backup', array( 'cur' => 0 ), array( 'id' => $id ));
1222
- $save = $this->model->insert_data_to_db('formmaker_backup', array(
1223
- 'cur' => 1,
1224
- 'id' => $id,
1225
- 'title' => $title,
1226
- 'mail' => '',
1227
- 'form_front' => $form_front,
1228
- 'theme' => $theme,
1229
- 'counter' => $counter,
1230
- 'label_order' => $label_order,
1231
- 'pagination' => $pagination,
1232
- 'show_title' => $show_title,
1233
- 'show_numbers' => $show_numbers,
1234
- 'public_key' => $public_key,
1235
- 'private_key' => $private_key,
1236
- 'recaptcha_theme' => $recaptcha_theme,
1237
- 'javascript' => $javascript,
1238
- 'submit_text' => '',
1239
- 'url' => '',
1240
- 'article_id' => 0,
1241
- 'submit_text_type' => 1,
1242
- 'script_mail' => '%all%',
1243
- 'script_mail_user' => '%all%',
1244
- 'label_order_current' => $label_order_current,
1245
- 'tax' => 0,
1246
- 'payment_currency' => '',
1247
- 'paypal_email' => '',
1248
- 'checkout_mode' => 'testmode',
1249
- 'paypal_mode' => 0,
1250
- 'published' => 1,
1251
- 'form_fields' => $form_fields,
1252
- 'savedb' => 1,
1253
- 'sendemail' => 1,
1254
- 'requiredmark' => '*',
1255
- 'from_mail' => '',
1256
- 'from_name' => '',
1257
- 'reply_to' => '',
1258
- 'send_to' => '',
1259
- 'autogen_layout' => 1,
1260
- 'custom_front' => '',
1261
- 'mail_from_user' => '',
1262
- 'mail_from_name_user' => '',
1263
- 'reply_to_user' => '',
1264
- 'condition' => '',
1265
- 'mail_cc' => '',
1266
- 'mail_cc_user' => '',
1267
- 'mail_bcc' => '',
1268
- 'mail_bcc_user' => '',
1269
- 'mail_subject' => '',
1270
- 'mail_subject_user' => '',
1271
- 'mail_mode' => 1,
1272
- 'mail_mode_user' => 1,
1273
- 'mail_attachment' => 1,
1274
- 'mail_attachment_user' => 1,
1275
- 'sortable' => $sortable,
1276
- 'user_id_wd' => 'administrator,',
1277
- 'frontend_submit_fields' => '',
1278
- 'frontend_submit_stat_fields' => '',
1279
- 'header_title' => $header_title,
1280
- 'header_description' => $header_description,
1281
- 'header_image_url' => $header_image_url,
1282
- 'header_image_animation' => $header_image_animation,
1283
- 'header_hide_image' => $header_hide_image,
1284
- ));
1285
-
1286
- $backup_count = $this->model->get_count(array(
1287
- "selection" => "backup_id",
1288
- "table" => "formmaker_backup",
1289
- "where" => "backup_id = " . $id,
1290
- ));
1291
- if ( $backup_count > 10 ) {
1292
- $this->model->delete_rows(array(
1293
- "table" => "formmaker_backup",
1294
- "where" => "id = " . $id,
1295
- "order_by" => "ORDER BY backup_id ASC",
1296
- "limit" => "LIMIT 1",
1297
- ));
1298
- }
1299
- if ( $save !== FALSE ) {
1300
- $this->model->create_js($id);
1301
- return 1;
1302
- }
1303
- else {
1304
- return 2;
1305
- }
1306
- }
1307
-
1308
- public function fm_live_search() {
1309
- $search_string = !empty($_POST['pp_live_search']) ? sanitize_text_field($_POST['pp_live_search']) : '';
1310
- $post_type = !empty($_POST['pp_post_type']) ? sanitize_text_field($_POST['pp_post_type']) : 'any';
1311
- $full_content = !empty($_POST['pp_full_content']) ? sanitize_text_field($_POST['pp_full_content']) : 'true';
1312
- $args['s'] = $search_string;
1313
- $results = $this->fm_posts_query($args, $post_type);
1314
- $output = '<ul class="pp_search_results">';
1315
- if ( empty($results) ) {
1316
- $output .= sprintf('<li class="pp_no_res">%1$s</li>', esc_html__('No results found', 'fm-text'));
1317
- }
1318
- else {
1319
- foreach ( $results as $single_post ) {
1320
- $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']));
1321
- }
1322
- }
1323
- $output .= '</ul>';
1324
- die($output);
1325
- }
1326
-
1327
- public function fm_posts_query( $args = array(), $include_post_type = '' ) {
1328
- if ( 'only_pages' === $include_post_type ) {
1329
- $pt_names = array( 'page' );
1330
- }
1331
- elseif ( 'any' === $include_post_type || 'only_posts' === $include_post_type ) {
1332
- $default_post_types = array( 'post', 'page' );
1333
- $custom_post_types = get_post_types(array(
1334
- 'public' => TRUE,
1335
- '_builtin' => FALSE,
1336
- ));
1337
- $post_types = array_merge($default_post_types, $custom_post_types);
1338
- $pt_names = array_values($post_types);
1339
- if ( 'only_posts' === $include_post_type ) {
1340
- unset($pt_names[1]);
1341
- }
1342
- }
1343
- else {
1344
- $pt_names = $include_post_type;
1345
- }
1346
- $query = array(
1347
- 'post_type' => $pt_names,
1348
- 'suppress_filters' => TRUE,
1349
- 'update_post_term_cache' => FALSE,
1350
- 'update_post_meta_cache' => FALSE,
1351
- 'post_status' => 'publish',
1352
- 'posts_per_page' => -1,
1353
- );
1354
- if ( isset($args['s']) ) {
1355
- $query['s'] = $args['s'];
1356
- }
1357
- $get_posts = new WP_Query;
1358
- $posts = $get_posts->query($query);
1359
- if ( !$get_posts->post_count ) {
1360
- return FALSE;
1361
- }
1362
- $results = array();
1363
- foreach ( $posts as $post ) {
1364
- $results[] = array(
1365
- 'id' => (int) $post->ID,
1366
- 'title' => trim(esc_html(strip_tags(get_the_title($post)))),
1367
- 'post_type' => $post->post_type,
1368
- );
1369
- }
1370
- wp_reset_postdata();
1371
-
1372
- return $results;
1373
- }
1374
-
1375
- public function update_form_title( $id ) {
1376
- $page = WDW_FM_Library::get('page');
1377
- $form_name = WDW_FM_Library::get('form_name', '');
1378
-
1379
- // check id for db
1380
- if(isset($id) && $id != "") {
1381
- $id = intval($id);
1382
- $update = $this->model->update_data( "forms", array('title' => $form_name,), array('id' => $id) );
1383
- if( !$update ){
1384
- $message = 2;
1385
- WDW_FM_Library::fm_redirect(add_query_arg(array(
1386
- 'page' => $page,
1387
- 'task' => 'display',
1388
- 'message' => $message,
1389
- ), admin_url('admin.php')));
1390
- }
1391
-
1392
- }
1393
- else { // return message Failed
1394
- $message = 2;
1395
- WDW_FM_Library::fm_redirect(add_query_arg(array(
1396
- 'page' => $page,
1397
- 'task' => 'display',
1398
- 'message' => $message,
1399
- ), admin_url('admin.php')));
1400
- }
1401
-
1402
- return $message = 1;
1403
- }
1404
- /**
1405
- * Get stripe addon.
1406
- *
1407
- * @param int $id
1408
- *
1409
- * @return array $data
1410
- */
1411
- private function get_stripe_addon($id) {
1412
- return apply_filters('fm_stripe_display_init', array('form_id' => $id) );
1413
- }
1414
-
1415
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/Options_fm.php DELETED
@@ -1,43 +0,0 @@
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 DELETED
@@ -1,38 +0,0 @@
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 DELETED
@@ -1,36 +0,0 @@
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 DELETED
@@ -1,93 +0,0 @@
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 DELETED
@@ -1,27 +0,0 @@
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 DELETED
@@ -1,557 +0,0 @@
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
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'display', 'current_id' => $form_id, ($message === 2 ? 'message' : 'msg') => $message), admin_url('admin.php') ) );
129
- }
130
-
131
- /**
132
- * Forms.
133
- * @param int $id
134
- */
135
- public function forms($id) {
136
- // Set params for view.
137
- $params = array();
138
- $params['id'] = $id;
139
- $params['page'] = $this->page;
140
- $params['page_url'] = $this->page_url;
141
- $params['page_title'] = __('Submissions', WDFM()->prefix);
142
- $params['forms'] = $this->model->get_forms();
143
-
144
- $this->view->forms($params);
145
- }
146
-
147
- /**
148
- * Display.
149
- * @param int $id
150
- */
151
- public function display( $id = 0 ) {
152
- // Set params for view.
153
- $params = array();
154
- $params['id'] = $id;
155
- $params['page'] = $this->page;
156
- $params['page_url'] = $this->page_url;
157
- $params['page_title'] = __('Submissions', WDFM()->prefix);
158
- $params['actions'] = $this->actions;
159
-
160
- // Set pagination params.
161
- $params['pagination_url'] = add_query_arg( array( 'task' => 'display', 'current_id' => $id ), $this->page_url );
162
- $params['page_per_num'] = $this->page_per_num;
163
- $page = (int) WDW_FM_Library::get('paged', 1);
164
- $page_num = $page ? ($page - 1) * $params['page_per_num'] : 0;
165
-
166
- $params['forms'] = $this->model->get_forms();
167
- $params['statistics'] = $this->model->get_statistics( $id );
168
- $params['blocked_ips'] = $this->model->blocked_ips();
169
-
170
- $labels_parameters = $this->model->get_labels_parameters( $id , $page_num, $params['page_per_num'] );
171
- $params['sorted_labels_id'] = $labels_parameters[0];
172
- $params['sorted_label_types'] = $labels_parameters[1];
173
- $params['sorted_label_names'] = $labels_parameters[3];
174
- $params['sorted_label_names_original'] = $labels_parameters[4];
175
-
176
- $label_name_ids = array();
177
- foreach($labels_parameters[0] as $key => $label_id) {
178
- $label_name_ids[$label_id] = $labels_parameters[4][$key];
179
- }
180
- $params['label_name_ids'] = $label_name_ids;
181
- $group_ids = ((isset($labels_parameters[6])) ? $labels_parameters[6] : NULL);
182
- $params['group_id_s'] = $this->model->sort_group_ids(count($params['sorted_label_names']), $group_ids);
183
- $params['where_choices'] = $labels_parameters[7];
184
- $params['searched_ids'] = $labels_parameters[8] ? implode(',', $labels_parameters[8]) : '';
185
-
186
- $params['order_by'] = (isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
187
- $params['asc_or_desc'] = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
188
-
189
- $lists = $labels_parameters[2];
190
- $params['lists'] = $lists;
191
- $params['style_id'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
192
- $params['style_date'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
193
- $params['style_ip'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
194
- $params['style_username'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
195
- $params['style_useremail'] = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
196
- $params['style_payment_info'] = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
197
-
198
- $params['oder_class_default'] = "manage-column column-autor sortable desc";
199
- $params['oder_class'] = "manage-column column-autor column-title sorted " . $params['asc_or_desc'];
200
- $params['m'] = count($params['sorted_label_names']);
201
-
202
- $is_search = false;
203
- foreach($lists as $list_key => $list_val){
204
- if(!empty($_POST[$list_key])) {
205
- $is_search = true;
206
- }
207
- }
208
- $params['is_search'] = $is_search; // (($lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] || $lists['id_search']) ? true : false );
209
- $params['is_stats'] = FALSE;
210
-
211
- $params['rows_data'] = $lists;
212
- $params['rows'] = $labels_parameters[5];
213
- $params['subs_count'] = $labels_parameters[2]['total'];
214
-
215
- // Check is active pdf-integration add-on.
216
- $params['pdf_data'] = array();
217
- if ( defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF')) ) {
218
- require_once(WD_FM_PDF_DIR . '/model.php');
219
- $params['pdf_data'] = WD_FM_PDF_model::get_pdf_data( $id );
220
- }
221
-
222
- $this->view->display($params);
223
- }
224
-
225
- /**
226
- * Show stats.
227
- * @param int $id
228
- */
229
- public function show_stats( $id = 0 ) {
230
- ob_clean();
231
- $key = (int) WDW_FM_Library::get('sorted_label_key', '');
232
-
233
- $page = (int) WDW_FM_Library::get('paged', 1);
234
- $page_num = $page ? ($page - 1) * $this->page_per_num : 0;
235
-
236
- $labels_parameters = $this->model->get_labels_parameters( $id, $page_num, $this->page_per_num);
237
- $where_choices = $labels_parameters[7];
238
- $sorted_label_names_original = $labels_parameters[4];
239
- $sorted_labels_id = $labels_parameters[0];
240
-
241
- $all = 0;
242
- $choices_labels = array();
243
- $sorted_label_name_original = '';
244
- $choices_count = '';
245
- $unanswered = NULL;
246
- $colors = array();
247
- $choices_colors = array();
248
- if ( count($sorted_labels_id) != 0 ) {
249
- $choices_params = $this->model->statistic_for_radio($where_choices, $sorted_labels_id[$key]);
250
- $sorted_label_name_original = $sorted_label_names_original[$key];
251
- $choices_count = $choices_params[0];
252
- $choices_labels = $choices_params[1];
253
- $unanswered = $choices_params[2];
254
- $all = $choices_params[3];
255
- $colors = $choices_params[4];
256
- $choices_colors = $choices_params[5];
257
- }
258
-
259
- // Set params for view.
260
- $params = array();
261
- $params['key'] = $key;
262
- $params['all'] = $all;
263
- $params['choices_labels'] = $choices_labels;
264
- $params['sorted_label_name_original'] = $sorted_label_name_original;
265
- $params['choices_count'] = $choices_count;
266
- $params['unanswered'] = $unanswered;
267
- $params['colors'] = $colors;
268
- $params['choices_colors'] = $choices_colors;
269
-
270
- $json = array();
271
- $json['html'] = $this->view->show_stats($params);
272
- echo json_encode($json); exit;
273
- }
274
-
275
- /**
276
- * Edit.
277
- * @param int $id
278
- */
279
- public function edit( $id=0 ) {
280
- $form_id = WDW_FM_Library::get('form_id', 0);
281
- $data = $this->model->get_data_of_group_id( $id );
282
- if ( empty($data[0]) ) {
283
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'display', 'current_id' => $id ), admin_url('admin.php') ) );
284
- }
285
-
286
- $labels_id = '';
287
- $rows = array();
288
- $labels_type = array();
289
- $labels_name = array();
290
- $ispaypal = array();
291
- if ( !empty($data) ) {
292
- $labels_id = $data[1];
293
- $rows = $data[0];
294
- $labels_name = $data[2];
295
- $labels_type = $data[3];
296
- $ispaypal = $data[4];
297
- $form = $data[5];
298
- $userinfo = get_userdata($rows[0]->user_id_wd);
299
- }
300
-
301
- $username = $userinfo ? $userinfo->display_name : "";
302
- $useremail = $userinfo ? $userinfo->user_email : "";
303
-
304
- // Set params for view.
305
- $params = array();
306
- $params['form_id'] = $form_id;
307
- $params['form'] = $form;
308
- $params['current_id'] = $id;
309
- $params['rows'] = $rows;
310
- $params['labels_id'] = $labels_id;
311
- $params['labels_name'] = $labels_name;
312
- $params['labels_type'] = $labels_type;
313
- $params['ispaypal'] = $ispaypal;
314
- $params['username'] = $username;
315
- $params['useremail'] = $useremail;
316
- $this->view->edit($params);
317
- }
318
-
319
- /**
320
- * Save.
321
- * @param int $id
322
- */
323
- public function save( $id = 0 ) {
324
- $form_id = WDW_FM_Library::get('form_id', 0);
325
- $this->save_db( $id, $form_id );
326
- }
327
-
328
- /**
329
- * Save.
330
- * @param int $id
331
- * @param int $form_id
332
- */
333
- public function save_db( $id, $form_id) {
334
- $id = (isset($_POST['current_id']) ? (int) esc_html(stripslashes($_POST['current_id'])) : 0);
335
- $date = esc_html($_POST['date']);
336
- $ip = esc_html($_POST['ip']);
337
-
338
- $form = $this->model->get_all($form_id);
339
- $label_id = array();
340
- $label_order_original = array();
341
- $label_type = array();
342
- if ( strpos($form->label_order, 'type_paypal_') ) {
343
- $form->label_order = $form->label_order . "0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
344
- }
345
- $label_all = explode('#****#', $form->label_order);
346
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
347
- foreach ( $label_all as $key => $label_each ) {
348
- $label_id_each = explode('#**id**#', $label_each);
349
- array_push($label_id, $label_id_each[0]);
350
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
351
- array_push($label_order_original, $label_oder_each[0]);
352
- array_push($label_type, $label_oder_each[1]);
353
- }
354
- foreach ( $label_id as $key => $label_id_1 ) {
355
- if ( isset($_POST["submission_" . $label_id_1]) ) {
356
- $element_value = (isset($_POST["submission_" . $label_id_1]) ? esc_html(stripslashes($_POST["submission_" . $label_id_1])) : " ");
357
- $result = $this->model->get_id($id, $label_id_1);
358
- if ( $label_type[$key] == 'type_file_upload' ) {
359
- if ( $element_value ) {
360
- $element_value = $element_value . "*@@url@@*";
361
- }
362
- }
363
- if ( $result ) {
364
- $save = $this->model->update_fm_submits(array(
365
- 'element_value' => stripslashes($element_value),
366
- ), array(
367
- 'group_id' => $id,
368
- 'element_label' => $label_id_1,
369
- ), array(
370
- '%s',
371
- ), array(
372
- '%d',
373
- '%s',
374
- ));
375
- }
376
- else {
377
- $save = $this->model->insert_fm_submits(array(
378
- 'form_id' => $form_id,
379
- 'element_label' => $label_id_1,
380
- 'element_value' => stripslashes($element_value),
381
- 'group_id' => $id,
382
- 'date' => $date,
383
- 'ip' => $ip,
384
- ), array(
385
- '%d',
386
- '%s',
387
- '%s',
388
- '%d',
389
- '%s',
390
- '%s',
391
- ));
392
- }
393
- }
394
- else {
395
- if ( isset($_POST["submission_" . $label_id_1 . '_0']) ) {
396
- $element_value = '';
397
- for ( $z = 0; $z < 21; $z++ ) {
398
- $element_value_ch = isset($_POST["submission_" . $label_id_1 . '_' . $z]) ? $_POST["submission_" . $label_id_1 . '_' . $z] : NULL;
399
- if ( isset($element_value_ch) ) {
400
- $element_value = $element_value . $element_value_ch . '***br***';
401
- }
402
- else {
403
- break;
404
- }
405
- }
406
- $result = $this->model->get_id($id, $label_id_1);
407
- if ( $result ) {
408
- $save = $this->model->update_fm_submits(array(
409
- 'element_value' => stripslashes($element_value),
410
- ), array(
411
- 'group_id' => $id,
412
- 'element_label' => $label_id_1,
413
- ), array(
414
- '%s',
415
- ), array(
416
- '%d',
417
- '%s',
418
- ));
419
- }
420
- else {
421
- $save = $this->model->insert_fm_submits(array(
422
- 'form_id' => $form_id,
423
- 'element_label' => $label_id_1,
424
- 'element_value' => stripslashes($element_value),
425
- 'group_id' => $id,
426
- 'date' => $date,
427
- 'ip' => $ip,
428
- ), array(
429
- '%d',
430
- '%s',
431
- '%s',
432
- '%d',
433
- '%s',
434
- '%s',
435
- ));
436
- }
437
- }
438
- }
439
- }
440
-
441
- $message = 2;
442
- if ( $save !== FALSE ) {
443
- $message = 14;
444
- }
445
- $args = array(
446
- 'page' => $this->page,
447
- 'task' => 'edit',
448
- 'current_id' => $id,
449
- 'form_id' => $form_id,
450
- 'message' => $message,
451
- );
452
-
453
- WDW_FM_Library::fm_redirect(add_query_arg( $args, admin_url('admin.php')) );
454
- }
455
-
456
- /**
457
- * Delete form by id.
458
- *
459
- * @param $id
460
- * @param bool $bulk
461
- *
462
- * @return int
463
- */
464
- public function delete( $id, $bulk = FALSE ) {
465
- $form_id = (int) WDW_FM_Library::get('form_id', 0);
466
- $delete = $this->model->delete_row($id);
467
- $message = 2;
468
- if ( $delete ) {
469
- $message = 3;
470
- }
471
-
472
- if ( $bulk ) {
473
- return $message;
474
- }
475
-
476
- WDW_FM_Library::fm_redirect(add_query_arg(array(
477
- 'page' => $this->page,
478
- 'task' => 'display',
479
- 'current_id'=> $form_id,
480
- 'message' => $message,
481
- ), admin_url('admin.php')));
482
- }
483
-
484
- /**
485
- * Block IP form by id.
486
- *
487
- * @param $id
488
- * @param bool $bulk
489
- *
490
- * @return int
491
- */
492
- public function block_ip( $id, $bulk = FALSE ) {
493
- global $wpdb;
494
-
495
- $form_id = (int) WDW_FM_Library::get('form_id', 0);
496
- $q = $wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id ="%d"', $id);
497
- $row = $wpdb->get_row($q);
498
- $message = 2;
499
-
500
- if( !empty($row) ) {
501
- if( !$this->model->get_ips( $row->ip ) ) {
502
- $save = $this->model->set_ips( array('ip' => $row->ip), array( '%s', ) );
503
-
504
- if($save){
505
- $message = 12;
506
- }
507
- }
508
- }
509
- if ( $bulk ) {
510
- return $message;
511
- }
512
-
513
- WDW_FM_Library::fm_redirect(add_query_arg( array(
514
- 'page' => $this->page,
515
- 'task' => 'display',
516
- 'current_id'=> $form_id,
517
- 'message' => $message,
518
- ), admin_url('admin.php')) );
519
- }
520
-
521
- /**
522
- * Unblock IP form by id.
523
- *
524
- * @param $id
525
- * @param bool $bulk
526
- *
527
- * @return int
528
- */
529
- public function unblock_ip( $id, $bulk = FALSE ) {
530
- global $wpdb;
531
-
532
- $form_id = (int) WDW_FM_Library::get('form_id', 0);
533
- $q = $wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits WHERE group_id ="%d"', $id);
534
- $row = $wpdb->get_row($q);
535
- $message = 2;
536
-
537
- if( !empty($row) ) {
538
- if( $this->model->get_ips( $row->ip ) ) {
539
- $delete = $this->model->delete_by_ip( $row->ip );
540
- if($delete){
541
- $message = 13;
542
- }
543
- }
544
- }
545
-
546
- if ( $bulk ) {
547
- return $message;
548
- }
549
-
550
- WDW_FM_Library::fm_redirect(add_query_arg( array(
551
- 'page' => $this->page,
552
- 'task' => 'display',
553
- 'current_id'=> $form_id,
554
- 'message' => $message,
555
- ), admin_url('admin.php')) );
556
- }
557
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/Themes_fm.php DELETED
@@ -1,3012 +0,0 @@
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('page' => $this->page, 'task' => 'display', 'message' => $message), admin_url('admin.php') ) );
167
- }
168
-
169
- /**
170
- * Duplicate by id.
171
- *
172
- * @param $id
173
- * @param bool $bulk
174
- *
175
- * @return int
176
- */
177
- public function duplicate( $id, $bulk = FALSE ) {
178
- $message = 2;
179
- $table = 'formmaker_themes';
180
- $row = $this->model->select_rows("get_row", array(
181
- "selection" => "*",
182
- "table" => $table,
183
- "where" => "id=" . (int) $id,
184
- ));
185
- if ( $row ) {
186
- $row = (array) $row;
187
- unset($row['id']);
188
- $row['default'] = 0;
189
- $inserted = $this->model->insert_data_to_db($table, (array) $row);
190
- if ( $inserted !== FALSE ) {
191
- $message = 11;
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
- /**
207
- * Edit.
208
- *
209
- * @param int $id
210
- */
211
- public function edit($id = 0) {
212
- $params = array();
213
- $params['id'] = (int) $id;
214
- $params['row'] = $this->model->get_row_data($params['id'], FALSE);
215
-
216
- if ( $id != 0 && empty($params['row']) ) {
217
- WDW_FM_Library::fm_redirect( add_query_arg( array('page' => $this->page, 'task' => 'display'), admin_url('admin.php') ) );
218
- }
219
- $params['page_title'] = $params['row']->title;
220
- $params['param_values'] = $params['row']->css;
221
- $params['tabs'] = array(
222
- 'global' => __('Global Parameters', WDFM()->prefix),
223
- 'header' => __('Header', WDFM()->prefix),
224
- 'content' => __('Content', WDFM()->prefix),
225
- 'input_select' => __('Inputbox', WDFM()->prefix),
226
- 'choices' => __('Choices', WDFM()->prefix),
227
- 'subscribe' => __('General Buttons', WDFM()->prefix),
228
- 'paigination' => __('Pagination', WDFM()->prefix),
229
- 'buttons' => __('Buttons', WDFM()->prefix),
230
- 'close_button' => __('Close(Minimize) Button', WDFM()->prefix),
231
- 'minimize' => __('Minimize Text', WDFM()->prefix),
232
- 'other' => __('Other', WDFM()->prefix),
233
- 'custom_css' => __('Custom CSS', WDFM()->prefix),
234
- );
235
- $border_types = array(
236
- '' => '',
237
- 'solid' => 'Solid',
238
- 'dotted' => 'Dotted',
239
- 'dashed' => 'Dashed',
240
- 'double' => 'Double',
241
- 'groove' => 'Groove',
242
- 'ridge' => 'Ridge',
243
- 'inset' => 'Inset',
244
- 'outset' => 'Outset',
245
- 'initial' => 'Initial',
246
- 'inherit' => 'Inherit',
247
- 'hidden' => 'Hidden',
248
- 'none' => 'None',
249
- );
250
- $borders = array(
251
- '' => '',
252
- 'top' => __('Top', WDFM()->prefix),
253
- 'right' => __('Right', WDFM()->prefix),
254
- 'bottom' => __('Bottom', WDFM()->prefix),
255
- 'left' => __('Left', WDFM()->prefix)
256
- );
257
- $position_types = array(
258
- '' => '',
259
- 'static' => 'Static',
260
- 'relative' => 'Relative',
261
- 'fixed' => 'Fixed',
262
- 'absolute' => 'Absolute',
263
- );
264
- $font_weights = array(
265
- '' => '',
266
- 'normal' => 'Normal',
267
- 'bold' => 'Bold',
268
- 'bolder' => 'Bolder',
269
- 'lighter' => 'Lighter',
270
- 'initial' => 'Initial',
271
- );
272
- $aligns = array( '' => '', 'left' => __('Left', WDFM()->prefix), 'center' => __('Center', WDFM()->prefix), 'right' => __('Right', WDFM()->prefix) );
273
- $basic_fonts = array(
274
- '' => '',
275
- 'arial' => 'Arial',
276
- 'lucida grande' => 'Lucida grande',
277
- 'segoe ui' => 'Segoe ui',
278
- 'tahoma' => 'Tahoma',
279
- 'trebuchet ms' => 'Trebuchet ms',
280
- 'verdana' => 'Verdana',
281
- 'cursive' => 'Cursive',
282
- 'fantasy' => 'Fantasy',
283
- 'monospace' => 'Monospace',
284
- 'serif' => 'Serif',
285
- );
286
- $bg_repeats = array(
287
- '' => '',
288
- 'repeat' => 'repeat',
289
- 'repeat-x' => 'repeat-x',
290
- 'repeat-y' => 'repeat-y',
291
- 'no-repeat' => 'no-repeat',
292
- 'initial' => 'initial',
293
- 'inherit' => 'inherit',
294
- );
295
- $google_fonts = WDW_FM_Library::get_google_fonts();
296
- $font_families = $basic_fonts + $google_fonts;
297
- $params['fonts'] = implode("|", str_replace(' ', '+', $google_fonts));
298
- $params['all_params'] = $this->all_params($params['param_values'], $borders, $border_types, $font_weights, $position_types, $aligns, $bg_repeats, $font_families);
299
-
300
- $this->view->edit($params);
301
- }
302
-
303
- // set all params in array
304
- public function all_params( $param_values, $borders, $border_types, $font_weights, $position_types, $aligns, $bg_repeats, $font_families ) {
305
- $all_params = array(
306
- 'global' => array(
307
- array(
308
- 'label' => '',
309
- 'type' => 'panel',
310
- 'class' => 'col-md-12',
311
- 'label_class' => '',
312
- 'after' => '',
313
- ),
314
- array(
315
- 'label' => __('Font Family', WDFM()->prefix),
316
- 'name' => 'GPFontFamily',
317
- 'type' => 'select',
318
- 'options' => $font_families,
319
- 'class' => '',
320
- 'value' => isset($param_values->GPFontFamily) ? $param_values->GPFontFamily : '',
321
- 'after' => '',
322
- ),
323
- array(
324
- 'label' => __('Width', WDFM()->prefix),
325
- 'name' => 'AGPWidth',
326
- 'type' => 'text',
327
- 'class' => '',
328
- 'value' => isset($param_values->AGPWidth) ? $param_values->AGPWidth : '',
329
- 'after' => '%',
330
- ),
331
- array(
332
- 'label' => __('Width (for scrollbox, popup form types)', WDFM()->prefix),
333
- 'name' => 'AGPSPWidth',
334
- 'type' => 'text',
335
- 'class' => '',
336
- 'value' => isset($param_values->AGPSPWidth) ? $param_values->AGPSPWidth : '',
337
- 'after' => '%',
338
- ),
339
- array(
340
- 'label' => __('Padding', WDFM()->prefix),
341
- 'name' => 'AGPPadding',
342
- 'type' => 'text',
343
- 'class' => '',
344
- 'placeholder' => __('e.g. 3px 5px or 3% 5%', WDFM()->prefix),
345
- 'value' => isset($param_values->AGPPadding) ? $param_values->AGPPadding : '',
346
- 'after' => '',
347
- ),
348
- array(
349
- 'label' => __('Margin', WDFM()->prefix),
350
- 'name' => 'AGPMargin',
351
- 'type' => 'text',
352
- 'class' => '',
353
- 'value' => isset($param_values->AGPMargin) ? $param_values->AGPMargin : '',
354
- 'placeholder' => __('e.g. 5px 10px or 5% 10%', WDFM()->prefix),
355
- 'after' => '',
356
- ),
357
- array(
358
- 'label' => __('Border', WDFM()->prefix),
359
- 'name' => 'AGPBorder',
360
- 'type' => 'checkbox',
361
- 'options' => $borders,
362
- 'class' => '',
363
- 'after' => '',
364
- ),
365
- array(
366
- 'label' => __('Border Color', WDFM()->prefix),
367
- 'name' => 'AGPBorderColor',
368
- 'type' => 'text',
369
- 'class' => 'color',
370
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #e5e5e5',
371
- 'value' => isset($param_values->AGPBorderColor) ? $param_values->AGPBorderColor : '',
372
- 'after' => '',
373
- ),
374
- array(
375
- 'label' => __('Border Type', WDFM()->prefix),
376
- 'name' => 'AGPBorderType',
377
- 'type' => 'select',
378
- 'options' => $border_types,
379
- 'class' => '',
380
- 'value' => isset($param_values->AGPBorderType) ? $param_values->AGPBorderType : '',
381
- 'after' => '',
382
- ),
383
- array(
384
- 'label' => __('Border Width', WDFM()->prefix),
385
- 'name' => 'AGPBorderWidth',
386
- 'type' => 'text',
387
- 'class' => '',
388
- 'value' => isset($param_values->AGPBorderWidth) ? $param_values->AGPBorderWidth : '',
389
- 'after' => 'px',
390
- ),
391
- array(
392
- 'label' => __('Border Radius', WDFM()->prefix),
393
- 'name' => 'AGPBorderRadius',
394
- 'type' => 'text',
395
- 'class' => '',
396
- 'value' => isset($param_values->AGPBorderRadius) ? $param_values->AGPBorderRadius : '',
397
- 'after' => 'px',
398
- ),
399
- array(
400
- 'label' => __('Box Shadow', WDFM()->prefix),
401
- 'name' => 'AGPBoxShadow',
402
- 'type' => 'text',
403
- 'class' => '',
404
- 'value' => isset($param_values->AGPBoxShadow) ? $param_values->AGPBoxShadow : '',
405
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 5px 2px #888888',
406
- 'after' => '</div>',
407
- ),
408
- ),
409
- 'header' => array(
410
- array(
411
- 'label' => __('General Parameters', WDFM()->prefix),
412
- 'type' => 'panel',
413
- 'class' => 'col-md-12',
414
- 'label_class' => 'fm-mini-title',
415
- 'after' => '<br/>',
416
- ),
417
- array(
418
- 'label' => __('Alignment', WDFM()->prefix),
419
- 'name' => 'HPAlign',
420
- 'type' => 'select',
421
- 'options' => $borders,
422
- 'class' => '',
423
- 'value' => isset($param_values->HPAlign) ? $param_values->HPAlign : '',
424
- 'after' => '',
425
- ),
426
- array(
427
- 'label' => __('Background Color', WDFM()->prefix),
428
- 'name' => 'HPBGColor',
429
- 'type' => 'text',
430
- 'class' => 'color',
431
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
432
- 'value' => isset($param_values->HPBGColor) ? $param_values->HPBGColor : '',
433
- 'after' => '',
434
- ),
435
- array(
436
- 'label' => __('Width', WDFM()->prefix),
437
- 'name' => 'HPWidth',
438
- 'type' => 'text',
439
- 'class' => '',
440
- 'value' => isset($param_values->HPWidth) ? $param_values->HPWidth : '',
441
- 'after' => '%',
442
- ),
443
- array(
444
- 'label' => __('Width (for topbar form type)', WDFM()->prefix),
445
- 'name' => 'HTPWidth',
446
- 'type' => 'text',
447
- 'class' => '',
448
- 'value' => isset($param_values->HTPWidth) ? $param_values->HTPWidth : '',
449
- 'after' => '%',
450
- ),
451
- array(
452
- 'label' => __('Padding', WDFM()->prefix),
453
- 'name' => 'HPPadding',
454
- 'type' => 'text',
455
- 'class' => '',
456
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
457
- 'value' => isset($param_values->HPPadding) ? $param_values->HPPadding : '',
458
- 'after' => '',
459
- ),
460
- array(
461
- 'label' => __('Margin', WDFM()->prefix),
462
- 'name' => 'HPMargin',
463
- 'type' => 'text',
464
- 'class' => '',
465
- 'value' => isset($param_values->HPMargin) ? $param_values->HPMargin : '',
466
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
467
- 'after' => '',
468
- ),
469
- array(
470
- 'label' => __('Text Align', WDFM()->prefix),
471
- 'name' => 'HPTextAlign',
472
- 'type' => 'select',
473
- 'options' => $aligns,
474
- 'class' => '',
475
- 'value' => isset($param_values->HPTextAlign) ? $param_values->HPTextAlign : '',
476
- 'after' => '',
477
- ),
478
- array(
479
- 'label' => __('Border', WDFM()->prefix),
480
- 'name' => 'HPBorder',
481
- 'type' => 'checkbox',
482
- 'options' => $borders,
483
- 'class' => '',
484
- 'after' => '',
485
- ),
486
- array(
487
- 'label' => __('Border Color', WDFM()->prefix),
488
- 'name' => 'HPBorderColor',
489
- 'type' => 'text',
490
- 'class' => 'color',
491
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
492
- 'value' => isset($param_values->HPBorderColor) ? $param_values->HPBorderColor : '',
493
- 'after' => '',
494
- ),
495
- array(
496
- 'label' => __('Border Type', WDFM()->prefix),
497
- 'name' => 'HPBorderType',
498
- 'type' => 'select',
499
- 'options' => $border_types,
500
- 'class' => '',
501
- 'value' => isset($param_values->HPBorderType) ? $param_values->HPBorderType : '',
502
- 'after' => '',
503
- ),
504
- array(
505
- 'label' => __('Border Width', WDFM()->prefix),
506
- 'name' => 'HPBorderWidth',
507
- 'type' => 'text',
508
- 'class' => '',
509
- 'value' => isset($param_values->HPBorderWidth) ? $param_values->HPBorderWidth : '',
510
- 'after' => 'px',
511
- ),
512
- array(
513
- 'label' => __('Border Radius', WDFM()->prefix),
514
- 'name' => 'HPBorderRadius',
515
- 'type' => 'text',
516
- 'class' => '',
517
- 'value' => isset($param_values->HPBorderRadius) ? $param_values->HPBorderRadius : '',
518
- 'after' => 'px</div>',
519
- ),
520
- array(
521
- 'label' => __('Title Parameters', WDFM()->prefix),
522
- 'type' => 'panel',
523
- 'class' => 'col-md-12',
524
- 'label_class' => 'fm-mini-title',
525
- 'after' => '<br/>',
526
- ),
527
- array(
528
- 'label' => __('Font Size', WDFM()->prefix),
529
- 'name' => 'HTPFontSize',
530
- 'type' => 'text',
531
- 'class' => '',
532
- 'value' => isset($param_values->HTPFontSize) ? $param_values->HTPFontSize : '',
533
- 'after' => 'px',
534
- ),
535
- array(
536
- 'label' => __('Font Weight', WDFM()->prefix),
537
- 'name' => 'HTPWeight',
538
- 'type' => 'select',
539
- 'options' => $font_weights,
540
- 'class' => '',
541
- 'value' => isset($param_values->HTPWeight) ? $param_values->HTPWeight : '',
542
- 'after' => '',
543
- ),
544
- array(
545
- 'label' => __('Color', WDFM()->prefix),
546
- 'name' => 'HTPColor',
547
- 'type' => 'text',
548
- 'class' => 'color',
549
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
550
- 'value' => isset($param_values->HTPColor) ? $param_values->HTPColor : '',
551
- 'after' => '',
552
- ),
553
- array(
554
- 'label' => __('Description Parameters', WDFM()->prefix),
555
- 'type' => 'label',
556
- 'class' => 'fm-mini-title',
557
- 'after' => '<br/>',
558
- ),
559
- array(
560
- 'label' => __('Font Size', WDFM()->prefix),
561
- 'name' => 'HDPFontSize',
562
- 'type' => 'text',
563
- 'class' => '',
564
- 'value' => isset($param_values->HDPFontSize) ? $param_values->HDPFontSize : '',
565
- 'after' => 'px',
566
- ),
567
- array(
568
- 'label' => __('Color', WDFM()->prefix),
569
- 'name' => 'HDPColor',
570
- 'type' => 'text',
571
- 'class' => 'color',
572
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
573
- 'value' => isset($param_values->HDPColor) ? $param_values->HDPColor : '',
574
- 'after' => '',
575
- ),
576
- array(
577
- 'label' => __('Image Parameters', WDFM()->prefix),
578
- 'type' => 'label',
579
- 'class' => 'fm-mini-title',
580
- 'after' => '<br/>',
581
- ),
582
- array(
583
- 'label' => __('Alignment', WDFM()->prefix),
584
- 'name' => 'HIPAlign',
585
- 'type' => 'select',
586
- 'options' => $borders,
587
- 'class' => '',
588
- 'value' => isset($param_values->HIPAlign) ? $param_values->HIPAlign : '',
589
- 'after' => '',
590
- ),
591
- array(
592
- 'label' => __('Width', WDFM()->prefix),
593
- 'name' => 'HIPWidth',
594
- 'type' => 'text',
595
- 'class' => '',
596
- 'value' => isset($param_values->HIPWidth) ? $param_values->HIPWidth : '',
597
- 'after' => 'px',
598
- ),
599
- array(
600
- 'label' => __('Height', WDFM()->prefix),
601
- 'name' => 'HIPHeight',
602
- 'type' => 'text',
603
- 'class' => '',
604
- 'value' => isset($param_values->HIPHeight) ? $param_values->HIPHeight : '',
605
- 'after' => 'px</div>',
606
- ),
607
- ),
608
- 'content' => array(
609
- array(
610
- 'label' => __('General Parameters', WDFM()->prefix),
611
- 'type' => 'panel',
612
- 'class' => 'col-md-12',
613
- 'label_class' => 'fm-mini-title',
614
- 'after' => '<br/>',
615
- ),
616
- array(
617
- 'label' => __('Background Color', WDFM()->prefix),
618
- 'name' => 'GPBGColor',
619
- 'type' => 'text',
620
- 'class' => 'color',
621
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
622
- 'value' => isset($param_values->GPBGColor) ? $param_values->GPBGColor : '',
623
- 'after' => '',
624
- ),
625
- array(
626
- 'label' => __('Font Size', WDFM()->prefix),
627
- 'name' => 'GPFontSize',
628
- 'type' => 'text',
629
- 'class' => '',
630
- 'value' => isset($param_values->GPFontSize) ? $param_values->GPFontSize : '',
631
- 'after' => 'px',
632
- ),
633
- array(
634
- 'label' => __('Font Weight', WDFM()->prefix),
635
- 'name' => 'GPFontWeight',
636
- 'type' => 'select',
637
- 'options' => $font_weights,
638
- 'class' => '',
639
- 'value' => isset($param_values->GPFontWeight) ? $param_values->GPFontWeight : '',
640
- 'after' => '',
641
- ),
642
- array(
643
- 'label' => __('Width', WDFM()->prefix),
644
- 'name' => 'GPWidth',
645
- 'type' => 'text',
646
- 'class' => '',
647
- 'value' => isset($param_values->GPWidth) ? $param_values->GPWidth : '',
648
- 'after' => '%',
649
- ),
650
- array(
651
- 'label' => __('Width (for topbar form type)', WDFM()->prefix),
652
- 'name' => 'GTPWidth',
653
- 'type' => 'text',
654
- 'class' => '',
655
- 'value' => isset($param_values->GTPWidth) ? $param_values->GTPWidth : '',
656
- 'after' => '%',
657
- ),
658
- array(
659
- 'label' => __('Alignment', WDFM()->prefix),
660
- 'name' => 'GPAlign',
661
- 'type' => 'select',
662
- 'options' => $aligns,
663
- 'class' => '',
664
- 'value' => isset($param_values->GPAlign) ? $param_values->GPAlign : '',
665
- 'after' => '',
666
- ),
667
- array(
668
- 'label' => __('Background URL', WDFM()->prefix),
669
- 'name' => 'GPBackground',
670
- 'type' => 'text',
671
- 'class' => '',
672
- // 'placeholder' => __('e.g. http:// or https://', WDFM()->prefix),
673
- 'value' => isset($param_values->GPBackground) ? $param_values->GPBackground : '',
674
- 'after' => '',
675
- ),
676
- array(
677
- 'label' => __('Background Repeat', WDFM()->prefix),
678
- 'name' => 'GPBackgroundRepeat',
679
- 'type' => 'select',
680
- 'options' => $bg_repeats,
681
- 'class' => '',
682
- 'value' => isset($param_values->GPBackgroundRepeat) ? $param_values->GPBackgroundRepeat : '',
683
- 'after' => '',
684
- ),
685
- array(
686
- 'label' => __('Background Position', WDFM()->prefix),
687
- 'name1' => 'GPBGPosition1',
688
- 'name2' => 'GPBGPosition2',
689
- 'type' => '2text',
690
- 'class' => 'fm-2text',
691
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' px|%, top|bottom|left|right|center',
692
- 'value1' => isset($param_values->GPBGPosition1) ? $param_values->GPBGPosition1 : '',
693
- 'value2' => isset($param_values->GPBGPosition2) ? $param_values->GPBGPosition2 : '',
694
- 'before1' => '',
695
- 'before2' => '',
696
- 'after' => '',
697
- ),
698
- array(
699
- 'label' => __('Background Size', WDFM()->prefix),
700
- 'name1' => 'GPBGSize1',
701
- 'name2' => 'GPBGSize2',
702
- 'type' => '2text',
703
- 'class' => 'fm-2text',
704
- 'placeholder' => __('e.g.', WDFM()->prefix) .' px|%, auto|cover|contain',
705
- 'value1' => isset($param_values->GPBGSize1) ? $param_values->GPBGSize1 : '',
706
- 'value2' => isset($param_values->GPBGSize2) ? $param_values->GPBGSize2 : '',
707
- 'before1' => '',
708
- 'before2' => '',
709
- 'after' => '',
710
- ),
711
- array(
712
- 'label' => __('Color', WDFM()->prefix),
713
- 'name' => 'GPColor',
714
- 'type' => 'text',
715
- 'class' => 'color',
716
- 'value' => isset($param_values->GPColor) ? $param_values->GPColor : '',
717
- 'after' => '',
718
- ),
719
- array(
720
- 'label' => __('Padding', WDFM()->prefix),
721
- 'name' => 'GPPadding',
722
- 'type' => 'text',
723
- 'class' => '',
724
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
725
- 'value' => isset($param_values->GPPadding) ? $param_values->GPPadding : '',
726
- 'after' => '',
727
- ),
728
- array(
729
- 'label' => __('Margin', WDFM()->prefix),
730
- 'name' => 'GPMargin',
731
- 'type' => 'text',
732
- 'class' => '',
733
- 'value' => isset($param_values->GPMargin) ? $param_values->GPMargin : '',
734
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
735
- 'after' => '',
736
- ),
737
- array(
738
- 'label' => __('Border', WDFM()->prefix),
739
- 'name' => 'GPBorder',
740
- 'type' => 'checkbox',
741
- 'options' => $borders,
742
- 'class' => '',
743
- 'after' => '',
744
- ),
745
- array(
746
- 'label' => __('Border Color', WDFM()->prefix),
747
- 'name' => 'GPBorderColor',
748
- 'type' => 'text',
749
- 'class' => 'color',
750
- 'value' => isset($param_values->GPBorderColor) ? $param_values->GPBorderColor : '',
751
- 'after' => '',
752
- ),
753
- array(
754
- 'label' => __('Border Type', WDFM()->prefix),
755
- 'name' => 'GPBorderType',
756
- 'type' => 'select',
757
- 'options' => $border_types,
758
- 'class' => '',
759
- 'value' => isset($param_values->GPBorderType) ? $param_values->GPBorderType : '',
760
- 'after' => '',
761
- ),
762
- array(
763
- 'label' => __('Border Width', WDFM()->prefix),
764
- 'name' => 'GPBorderWidth',
765
- 'type' => 'text',
766
- 'class' => '',
767
- 'value' => isset($param_values->GPBorderWidth) ? $param_values->GPBorderWidth : '',
768
- 'after' => 'px',
769
- ),
770
- array(
771
- 'label' => __('Border Radius', WDFM()->prefix),
772
- 'name' => 'GPBorderRadius',
773
- 'type' => 'text',
774
- 'class' => '',
775
- 'value' => isset($param_values->GPBorderRadius) ? $param_values->GPBorderRadius : '',
776
- 'after' => 'px</div>',
777
- ),
778
- array(
779
- 'label' => __('Mini labels (name, phone, address, checkbox, radio) Parameters', WDFM()->prefix),
780
- 'type' => 'panel',
781
- 'class' => 'col-md-12',
782
- 'label_class' => 'fm-mini-title',
783
- 'after' => '<br/>',
784
- ),
785
- array(
786
- 'label' => __('Font Size', WDFM()->prefix),
787
- 'name' => 'GPMLFontSize',
788
- 'type' => 'text',
789
- 'class' => '',
790
- 'value' => isset($param_values->GPMLFontSize) ? $param_values->GPMLFontSize : '',
791
- 'after' => 'px',
792
- ),
793
- array(
794
- 'label' => __('Font Weight', WDFM()->prefix),
795
- 'name' => 'GPMLFontWeight',
796
- 'type' => 'select',
797
- 'options' => $font_weights,
798
- 'class' => '',
799
- 'value' => isset($param_values->GPMLFontWeight) ? $param_values->GPMLFontWeight : '',
800
- 'after' => '',
801
- ),
802
- array(
803
- 'label' => __('Color', WDFM()->prefix),
804
- 'name' => 'GPMLColor',
805
- 'type' => 'text',
806
- 'class' => 'color',
807
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
808
- 'value' => isset($param_values->GPMLColor) ? $param_values->GPMLColor : '',
809
- 'after' => '',
810
- ),
811
- array(
812
- 'label' => __('Padding', WDFM()->prefix),
813
- 'name' => 'GPMLPadding',
814
- 'type' => 'text',
815
- 'class' => '',
816
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
817
- 'value' => isset($param_values->GPMLPadding) ? $param_values->GPMLPadding : '',
818
- 'after' => '',
819
- ),
820
- array(
821
- 'label' => __('Margin', WDFM()->prefix),
822
- 'name' => 'GPMLMargin',
823
- 'type' => 'text',
824
- 'class' => '',
825
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
826
- 'value' => isset($param_values->GPMLMargin) ? $param_values->GPMLMargin : '',
827
- 'after' => '',
828
- ),
829
- array(
830
- 'label' => __('Section Parameters', WDFM()->prefix),
831
- 'type' => 'label',
832
- 'class' => 'fm-mini-title',
833
- 'after' => '<br/>',
834
- ),
835
- array(
836
- 'label' => __('Background Color', WDFM()->prefix),
837
- 'name' => 'SEPBGColor',
838
- 'type' => 'text',
839
- 'class' => 'color',
840
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
841
- 'value' => isset($param_values->SEPBGColor) ? $param_values->SEPBGColor : '',
842
- 'after' => '',
843
- ),
844
- array(
845
- 'label' => __('Padding', WDFM()->prefix),
846
- 'name' => 'SEPPadding',
847
- 'type' => 'text',
848
- 'class' => '',
849
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
850
- 'value' => isset($param_values->SEPPadding) ? $param_values->SEPPadding : '',
851
- 'after' => '',
852
- ),
853
- array(
854
- 'label' => __('Margin', WDFM()->prefix),
855
- 'name' => 'SEPMargin',
856
- 'type' => 'text',
857
- 'class' => '',
858
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
859
- 'value' => isset($param_values->SEPMargin) ? $param_values->SEPMargin : '',
860
- 'after' => '',
861
- ),
862
- array(
863
- 'label' => __('Section Column Parameters', WDFM()->prefix),
864
- 'type' => 'label',
865
- 'class' => 'fm-mini-title',
866
- 'after' => '<br/>',
867
- ),
868
- array(
869
- 'label' => __('Padding', WDFM()->prefix),
870
- 'name' => 'COPPadding',
871
- 'type' => 'text',
872
- 'class' => '',
873
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
874
- 'value' => isset($param_values->COPPadding) ? $param_values->COPPadding : '',
875
- 'after' => '',
876
- ),
877
- array(
878
- 'label' => __('Margin', WDFM()->prefix),
879
- 'name' => 'COPMargin',
880
- 'type' => 'text',
881
- 'class' => '',
882
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
883
- 'value' => isset($param_values->COPMargin) ? $param_values->COPMargin : '',
884
- 'after' => '',
885
- ),
886
- array(
887
- 'label' => __('Footer Parameters', WDFM()->prefix),
888
- 'type' => 'label',
889
- 'class' => 'fm-mini-title',
890
- 'after' => '<br/>',
891
- ),
892
- array(
893
- 'label' => __('Width', WDFM()->prefix),
894
- 'name' => 'FPWidth',
895
- 'type' => 'text',
896
- 'class' => '',
897
- 'value' => isset($param_values->FPWidth) ? $param_values->FPWidth : '',
898
- 'after' => '%',
899
- ),
900
- array(
901
- 'label' => __('Padding', WDFM()->prefix),
902
- 'name' => 'FPPadding',
903
- 'type' => 'text',
904
- 'class' => '',
905
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
906
- 'value' => isset($param_values->FPPadding) ? $param_values->FPPadding : '',
907
- 'after' => '',
908
- ),
909
- array(
910
- 'label' => __('Margin', WDFM()->prefix),
911
- 'name' => 'FPMargin',
912
- 'type' => 'text',
913
- 'class' => '',
914
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
915
- 'value' => isset($param_values->FPMargin) ? $param_values->FPMargin : '',
916
- 'after' => '</div>',
917
- ),
918
- ),
919
- 'input_select' => array(
920
- array(
921
- 'label' => '',
922
- 'type' => 'panel',
923
- 'class' => 'col-md-12',
924
- 'label_class' => '',
925
- 'after' => '',
926
- ),
927
- array(
928
- 'label' => __('Height', WDFM()->prefix),
929
- 'name' => 'IPHeight',
930
- 'type' => 'text',
931
- 'class' => '',
932
- 'value' => isset($param_values->IPHeight) ? $param_values->IPHeight : '',
933
- 'after' => 'px',
934
- ),
935
- array(
936
- 'label' => __('Font Size', WDFM()->prefix),
937
- 'name' => 'IPFontSize',
938
- 'type' => 'text',
939
- 'class' => '',
940
- 'value' => isset($param_values->IPFontSize) ? $param_values->IPFontSize : '',
941
- 'after' => 'px',
942
- ),
943
- array(
944
- 'label' => __('Font Weight', WDFM()->prefix),
945
- 'name' => 'IPFontWeight',
946
- 'type' => 'select',
947
- 'options' => $font_weights,
948
- 'class' => '',
949
- 'value' => isset($param_values->IPFontWeight) ? $param_values->IPFontWeight : '',
950
- 'after' => '',
951
- ),
952
- array(
953
- 'label' => __('Background Color', WDFM()->prefix),
954
- 'name' => 'IPBGColor',
955
- 'type' => 'text',
956
- 'class' => 'color',
957
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
958
- 'value' => isset($param_values->IPBGColor) ? $param_values->IPBGColor : '',
959
- 'after' => '',
960
- ),
961
- array(
962
- 'label' => __('Color', WDFM()->prefix),
963
- 'name' => 'IPColor',
964
- 'type' => 'text',
965
- 'class' => 'color',
966
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
967
- 'value' => isset($param_values->IPColor) ? $param_values->IPColor : '',
968
- 'after' => '',
969
- ),
970
- array(
971
- 'label' => __('Padding', WDFM()->prefix),
972
- 'name' => 'IPPadding',
973
- 'type' => 'text',
974
- 'class' => '',
975
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 3px 5px or 3% 5%',
976
- 'value' => isset($param_values->IPPadding) ? $param_values->IPPadding : '',
977
- 'after' => '',
978
- ),
979
- array(
980
- 'label' => __('Margin', WDFM()->prefix),
981
- 'name' => 'IPMargin',
982
- 'type' => 'text',
983
- 'class' => '',
984
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
985
- 'value' => isset($param_values->IPMargin) ? $param_values->IPMargin : '',
986
- 'after' => '',
987
- ),
988
- array(
989
- 'label' => __('Border', WDFM()->prefix),
990
- 'name' => 'IPBorder',
991
- 'type' => 'checkbox',
992
- 'options' => $borders,
993
- 'class' => '',
994
- 'after' => '',
995
- ),
996
- array(
997
- 'label' => __('Border Color', WDFM()->prefix),
998
- 'name' => 'IPBorderColor',
999
- 'type' => 'text',
1000
- 'class' => 'color',
1001
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
1002
- 'value' => isset($param_values->IPBorderColor) ? $param_values->IPBorderColor : '',
1003
- 'after' => '',
1004
- ),
1005
- array(
1006
- 'label' => __('Border Type', WDFM()->prefix),
1007
- 'name' => 'IPBorderType',
1008
- 'type' => 'select',
1009
- 'options' => $border_types,
1010
- 'class' => '',
1011
- 'value' => isset($param_values->IPBorderType) ? $param_values->IPBorderType : '',
1012
- 'after' => '',
1013
- ),
1014
- array(
1015
- 'label' => __('Border Width', WDFM()->prefix),
1016
- 'name' => 'IPBorderWidth',
1017
- 'type' => 'text',
1018
- 'class' => '',
1019
- 'value' => isset($param_values->IPBorderWidth) ? $param_values->IPBorderWidth : '',
1020
- 'after' => 'px',
1021
- ),
1022
- array(
1023
- 'label' => __('Border Radius', WDFM()->prefix),
1024
- 'name' => 'IPBorderRadius',
1025
- 'type' => 'text',
1026
- 'class' => '',
1027
- 'value' => isset($param_values->IPBorderRadius) ? $param_values->IPBorderRadius : '',
1028
- 'after' => 'px',
1029
- ),
1030
- array(
1031
- 'label' => __('Box Shadow', WDFM()->prefix),
1032
- 'name' => 'IPBoxShadow',
1033
- 'type' => 'text',
1034
- 'class' => '',
1035
- 'value' => isset($param_values->IPBoxShadow) ? $param_values->IPBoxShadow : '',
1036
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 5px 2px #888888',
1037
- 'after' => '</div>',
1038
- ),
1039
- array(
1040
- 'label' => __('Dropdown additional', WDFM()->prefix),
1041
- 'type' => 'panel',
1042
- 'class' => 'col-md-12',
1043
- 'label_class' => 'fm-mini-title',
1044
- 'after' => '<br/>',
1045
- ),
1046
- array(
1047
- 'label' => __('Appearance', WDFM()->prefix),
1048
- 'name' => 'SBPAppearance',
1049
- 'type' => 'text',
1050
- 'class' => '',
1051
- 'placeholder' => __('e.g.', WDFM()->prefix) .' normal, icon, window, button, menu, field',
1052
- 'value' => isset($param_values->SBPAppearance) ? $param_values->SBPAppearance : '',
1053
- 'after' => '',
1054
- ),
1055
- array(
1056
- 'label' => __('Background URL', WDFM()->prefix),
1057
- 'name' => 'SBPBackground',
1058
- 'type' => 'text',
1059
- 'class' => '',
1060
- // 'placeholder' => __('e.g. http:// or https://', WDFM()->prefix),
1061
- 'value' => isset($param_values->SBPBackground) ? $param_values->SBPBackground : '',
1062
- 'after' => '',
1063
- ),
1064
- array(
1065
- 'label' => __('Background Repeat', WDFM()->prefix),
1066
- 'name' => 'SBPBGRepeat',
1067
- 'type' => 'select',
1068
- 'options' => $bg_repeats,
1069
- 'class' => '',
1070
- 'value' => isset($param_values->SBPBGRepeat) ? $param_values->SBPBGRepeat : '',
1071
- 'after' => '',
1072
- ),
1073
- array(
1074
- 'label' => '',
1075
- 'type' => 'label',
1076
- 'class' => '',
1077
- 'after' => '</div>',
1078
- ),
1079
- ),
1080
- 'choices' => array(
1081
- array(
1082
- 'label' => __('Single Choice', WDFM()->prefix),
1083
- 'type' => 'panel',
1084
- 'class' => 'col-md-12',
1085
- 'label_class' => 'fm-mini-title',
1086
- 'after' => '<br/>',
1087
- ),
1088
- array(
1089
- 'label' => __('Background Color', WDFM()->prefix),
1090
- 'name' => 'SCPBGColor',
1091
- 'type' => 'text',
1092
- 'class' => 'color',
1093
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
1094
- 'value' => isset($param_values->SCPBGColor) ? $param_values->SCPBGColor : '',
1095
- 'after' => '',
1096
- ),
1097
- array(
1098
- 'label' => __('Width', WDFM()->prefix),
1099
- 'name' => 'SCPWidth',
1100
- 'type' => 'text',
1101
- 'class' => '',
1102
- 'value' => isset($param_values->SCPWidth) ? $param_values->SCPWidth : '',
1103
- 'after' => 'px',
1104
- ),
1105
- array(
1106
- 'label' => __('Height', WDFM()->prefix),
1107
- 'name' => 'SCPHeight',
1108
- 'type' => 'text',
1109
- 'class' => '',
1110
- 'value' => isset($param_values->SCPHeight) ? $param_values->SCPHeight : '',
1111
- 'after' => 'px',
1112
- ),
1113
- array(
1114
- 'label' => __('Margin', WDFM()->prefix),
1115
- 'name' => 'SCPMargin',
1116
- 'type' => 'text',
1117
- 'class' => '5px',
1118
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
1119
- 'value' => isset($param_values->SCPMargin) ? $param_values->SCPMargin : '',
1120
- 'after' => '',
1121
- ),
1122
- array(
1123
- 'label' => __('Border', WDFM()->prefix),
1124
- 'name' => 'SCPBorder',
1125
- 'type' => 'checkbox',
1126
- 'options' => $borders,
1127
- 'class' => '',
1128
- 'after' => '',
1129
- ),
1130
- array(
1131
- 'label' => __('Border Color', WDFM()->prefix),
1132
- 'name' => 'SCPBorderColor',
1133
- 'type' => 'text',
1134
- 'class' => 'color',
1135
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
1136
- 'value' => isset($param_values->SCPBorderColor) ? $param_values->SCPBorderColor : '',
1137
- 'after' => '',
1138
- ),
1139
- array(
1140
- 'label' => __('Border Type', WDFM()->prefix),
1141
- 'name' => 'SCPBorderType',
1142
- 'type' => 'select',
1143
- 'options' => $border_types,
1144
- 'class' => '',
1145
- 'value' => isset($param_values->SCPBorderType) ? $param_values->SCPBorderType : '',
1146
- 'after' => '',
1147
- ),
1148
- array(
1149
- 'label' => __('Border Width', WDFM()->prefix),
1150
- 'name' => 'SCPBorderWidth',
1151
- 'type' => 'text',
1152
- 'class' => '',
1153
- 'value' => isset($param_values->SCPBorderWidth) ? $param_values->SCPBorderWidth : '',
1154
- 'after' => 'px',
1155
- ),
1156
- array(
1157
- 'label' => __('Border Radius', WDFM()->prefix),
1158
- 'name' => 'SCPBorderRadius',
1159
- 'type' => 'text',
1160
- 'class' => '',
1161
- 'value' => isset($param_values->SCPBorderRadius) ? $param_values->SCPBorderRadius : '',
1162
- 'after' => 'px',
1163
- ),
1164
- array(
1165
- 'label' => __('Box Shadow', WDFM()->prefix),
1166
- 'name' => 'SCPBoxShadow',
1167
- 'type' => 'text',
1168
- 'class' => '',
1169
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 5px 2px #888888',
1170
- 'value' => isset($param_values->SCPBoxShadow) ? $param_values->SCPBoxShadow : '',
1171
- 'after' => '',
1172
- ),
1173
- array(
1174
- 'label' => __('Checked Parameters', WDFM()->prefix),
1175
- 'type' => 'label',
1176
- 'class' => 'fm-mini-title',
1177
- 'after' => '<br/>',
1178
- ),
1179
- array(
1180
- 'label' => __('Background Color', WDFM()->prefix),
1181
- 'name' => 'SCCPBGColor',
1182
- 'type' => 'text',
1183
- 'class' => 'color',
1184
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
1185
- 'value' => isset($param_values->SCCPBGColor) ? $param_values->SCCPBGColor : '',
1186
- 'after' => '',
1187
- ),
1188
- array(
1189
- 'label' => __('Width', WDFM()->prefix),
1190
- 'name' => 'SCCPWidth',
1191
- 'type' => 'text',
1192
- 'class' => '',
1193
- 'value' => isset($param_values->SCCPWidth) ? $param_values->SCCPWidth : '',
1194
- 'after' => 'px',
1195
- ),
1196
- array(
1197
- 'label' => __('Height', WDFM()->prefix),
1198
- 'name' => 'SCCPHeight',
1199
- 'type' => 'text',
1200
- 'class' => '',
1201
- 'value' => isset($param_values->SCCPHeight) ? $param_values->SCCPHeight : '',
1202
- 'after' => 'px',
1203
- ),
1204
- array(
1205
- 'label' => __('Margin', WDFM()->prefix),
1206
- 'name' => 'SCCPMargin',
1207
- 'type' => 'text',
1208
- 'class' => '',
1209
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
1210
- 'value' => isset($param_values->SCCPMargin) ? $param_values->SCCPMargin : '',
1211
- 'after' => '',
1212
- ),
1213
- array(
1214
- 'label' => __('Border Radius', WDFM()->prefix),
1215
- 'name' => 'SCCPBorderRadius',
1216
- 'type' => 'text',
1217
- 'class' => '',
1218
- 'value' => isset($param_values->SCCPBorderRadius) ? $param_values->SCCPBorderRadius : '',
1219
- 'after' => 'px</div>',
1220
- ),
1221
- array(
1222
- 'label' => __('Multiple Choice', WDFM()->prefix),
1223
- 'type' => 'panel',
1224
- 'class' => 'col-md-12',
1225
- 'label_class' => 'fm-mini-title',
1226
- 'after' => '<br/>',
1227
- ),
1228
- array(
1229
- 'label' => __('Background Color', WDFM()->prefix),
1230
- 'name' => 'MCPBGColor',
1231
- 'type' => 'text',
1232
- 'class' => 'color',
1233
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
1234
- 'value' => isset($param_values->MCPBGColor) ? $param_values->MCPBGColor : '',
1235
- 'after' => '',
1236
- ),
1237
- array(
1238
- 'label' => __('Width', WDFM()->prefix),
1239
- 'name' => 'MCPWidth',
1240
- 'type' => 'text',
1241
- 'class' => '',
1242
- 'value' => isset($param_values->MCPWidth) ? $param_values->MCPWidth : '',
1243
- 'after' => 'px',
1244
- ),
1245
- array(
1246
- 'label' => __('Height', WDFM()->prefix),
1247
- 'name' => 'MCPHeight',
1248
- 'type' => 'text',
1249
- 'class' => '',
1250
- 'value' => isset($param_values->MCPHeight) ? $param_values->MCPHeight : '',
1251
- 'after' => 'px',
1252
- ),
1253
- array(
1254
- 'label' => __('Margin', WDFM()->prefix),
1255
- 'name' => 'MCPMargin',
1256
- 'type' => 'text',
1257
- 'class' => '5px',
1258
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 10px or 5% 10%',
1259
- 'value' => isset($param_values->MCPMargin) ? $param_values->MCPMargin : '',
1260
- 'after' => '',
1261
- ),
1262
- array(
1263
- 'label' => __('Border', WDFM()->prefix),
1264
- 'name' => 'MCPBorder',
1265
- 'type' => 'checkbox',
1266
- 'options' => $borders,
1267
- 'class' => '',
1268
- 'after' => '',
1269
- ),
1270
- array(
1271
- 'label' => __('Border Color', WDFM()->prefix),
1272
- 'name' => 'MCPBorderColor',
1273
- 'type' => 'text',
1274
- 'class' => 'color',
1275
- 'placeholder' => __('e.g.', WDFM()->prefix) .' #efefef',
1276
- 'value' => isset($param_values->MCPBorderColor) ? $param_values->MCPBorderColor : '',
1277
- 'after' => '',
1278
- ),
1279
- array(
1280
- 'label' => __('Border Type', WDFM()->prefix),
1281
- 'name' => 'MCPBorderType',
1282
- 'type' => 'select',
1283
- 'options' => $border_types,
1284
- 'class' => '',
1285
- 'value' => isset($param_values->MCPBorderType) ? $param_values->MCPBorderType : '',
1286
- 'after' => '',
1287
- ),
1288
- array(
1289
- 'label' => __('Border Width', WDFM()->prefix),
1290
- 'name' => 'MCPBorderWidth',
1291
- 'type' => 'text',
1292
- 'class' => '',
1293
- 'value' => isset($param_values->MCPBorderWidth) ? $param_values->MCPBorderWidth : '',
1294
- 'after' => 'px',
1295
- ),
1296
-
1297
- array(
1298
- 'label' => __('Border Radius', WDFM()->prefix),
1299
- 'name' => 'MCPBorderRadius',
1300
- 'type' => 'text',
1301
- 'class' => '',
1302
- 'value' => isset($param_values->MCPBorderRadius) ? $param_values->MCPBorderRadius : '',
1303
- 'after' => 'px',
1304
- ),
1305
- array(
1306
- 'label' => __('Box Shadow', WDFM()->prefix),
1307
- 'name' => 'MCPBoxShadow',
1308
- 'type' => 'text',
1309
- 'class' => '',
1310
- 'placeholder' => __('e.g.', WDFM()->prefix) .' 5px 5px 2px #888888',
1311
- 'value' => isset($param_values->MCPBoxShadow) ? $param_values->MCPBoxShadow : '',
1312
- 'after' => '',
1313
- ),
1314
- array(
1315
- 'label' => __('Checked Parameters', WDFM()->prefix),
1316
- 'type' => 'label',
1317
- 'class' => 'fm-mini-title',
1318
- 'after' => '<br/>',
1319
- ),
1320
- array(
1321
- 'label' => __('Background Color', WDFM()->prefix),
1322
- 'name' => 'MCCPBGColor',
1323
- 'type' => 'text',
1324
- 'class' => 'color',
1325
- 'placeholder' => __('e.g.', WDFM()->prefix) .'#efefef',
1326
- 'value' => isset($param_values->MCCPBGColor) ? $param_values->MCCPBGColor : '',
1327
- 'after' => '',
1328
- ),
1329
- array(
1330
- 'label' => __('Background URL', WDFM()->prefix),
1331
- 'name' => 'MCCPBackground',
1332
- 'type' => 'text',
1333
- 'class' => '',
1334
- // 'placeholder' => __('e.g. http:// or https://', WDFM()->prefix),
1335
- 'value' => isset($param_values->MCCPBackground) ? $param_values->MCCPBackground : '',
1336
- 'after' => '',
1337
- ),
1338
- array(
1339
- 'label' => __('Background Repeat', WDFM()->prefix),
1340
- 'name' => 'MCCPBGRepeat',
1341
- 'type' => 'select',
1342
- 'options' => $bg_repeats,
1343
- 'class' => '',
1344
- 'value' => isset($param_values->MCCPBGRepeat) ? $param_values->MCCPBGRepeat : '',
1345
- 'after' => '',
1346
- ),
1347
- array(
1348
- 'label' => __('Background Position', WDFM()->prefix),
1349
- 'name1' => 'MCCPBGPos1',
1350
- 'name2' => 'MCCPBGPos2',
1351
- 'type' => '2text',
1352
- 'class' => 'fm-2text',
1353
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' px|%, top|bottom|left|right|center',
1354
- 'value1' => isset($param_values->MCCPBGPos1) ? $param_values->MCCPBGPos1 : '',
1355
- 'value2' => isset($param_values->MCCPBGPos2) ? $param_values->MCCPBGPos2 : '',
1356
- 'before1' => '',
1357
- 'before2' => '',
1358
- 'after' => '',
1359
- ),
1360
- array(
1361
- 'label' => __('Width', WDFM()->prefix),
1362
- 'name' => 'MCCPWidth',
1363
- 'type' => 'text',
1364
- 'class' => '',
1365
- 'value' => isset($param_values->MCCPWidth) ? $param_values->MCCPWidth : '',
1366
- 'after' => 'px',
1367
- ),
1368
- array(
1369
- 'label' => __('Height', WDFM()->prefix),
1370
- 'name' => 'MCCPHeight',
1371
- 'type' => 'text',
1372
- 'class' => '',
1373
- 'value' => isset($param_values->MCCPHeight) ? $param_values->MCCPHeight : '',
1374
- 'after' => 'px',
1375
- ),
1376
- array(
1377
- 'label' => __('Margin', WDFM()->prefix),
1378
- 'name' => 'MCCPMargin',
1379
- 'type' => 'text',
1380
- 'class' => '',
1381
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
1382
- 'value' => isset($param_values->MCCPMargin) ? $param_values->MCCPMargin : '',
1383
- 'after' => '',
1384
- ),
1385
- array(
1386
- 'label' => __('Border Radius', WDFM()->prefix),
1387
- 'name' => 'MCCPBorderRadius',
1388
- 'type' => 'text',
1389
- 'class' => '',
1390
- 'value' => isset($param_values->MCCPBorderRadius) ? $param_values->MCCPBorderRadius : '',
1391
- 'after' => 'px</div>',
1392
- ),
1393
- ),
1394
- 'subscribe' => array(
1395
- array(
1396
- 'label' => __('Global Parameters', WDFM()->prefix),
1397
- 'type' => 'panel',
1398
- 'class' => 'col-md-12',
1399
- 'label_class' => 'fm-mini-title',
1400
- 'after' => '<br/>',
1401
- ),
1402
- array(
1403
- 'label' => __('Alignment', WDFM()->prefix),
1404
- 'name' => 'SPAlign',
1405
- 'type' => 'select',
1406
- 'options' => $aligns,
1407
- 'class' => '',
1408
- 'value' => isset($param_values->SPAlign) ? $param_values->SPAlign : '',
1409
- 'after' => '</div>',
1410
- ),
1411
- array(
1412
- 'label' => __('Submit', WDFM()->prefix),
1413
- 'type' => 'panel',
1414
- 'class' => 'col-md-12',
1415
- 'label_class' => 'fm-mini-title',
1416
- 'after' => '<br/>',
1417
- ),
1418
- array(
1419
- 'label' => __('Background Color', WDFM()->prefix),
1420
- 'name' => 'SPBGColor',
1421
- 'type' => 'text',
1422
- 'class' => 'color',
1423
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1424
- 'value' => isset($param_values->SPBGColor) ? $param_values->SPBGColor : '',
1425
- 'after' => '',
1426
- ),
1427
- array(
1428
- 'label' => __('Width', WDFM()->prefix),
1429
- 'name' => 'SPWidth',
1430
- 'type' => 'text',
1431
- 'class' => '',
1432
- 'value' => isset($param_values->SPWidth) ? $param_values->SPWidth : '',
1433
- 'after' => 'px',
1434
- ),
1435
- array(
1436
- 'label' => __('Height', WDFM()->prefix),
1437
- 'name' => 'SPHeight',
1438
- 'type' => 'text',
1439
- 'class' => '',
1440
- 'value' => isset($param_values->SPHeight) ? $param_values->SPHeight : '',
1441
- 'after' => 'px',
1442
- ),
1443
- array(
1444
- 'label' => __('Font Size', WDFM()->prefix),
1445
- 'name' => 'SPFontSize',
1446
- 'type' => 'text',
1447
- 'class' => '',
1448
- 'value' => isset($param_values->SPFontSize) ? $param_values->SPFontSize : '',
1449
- 'after' => 'px',
1450
- ),
1451
- array(
1452
- 'label' => __('Font Weight', WDFM()->prefix),
1453
- 'name' => 'SPFontWeight',
1454
- 'type' => 'select',
1455
- 'options' => $font_weights,
1456
- 'class' => '',
1457
- 'value' => isset($param_values->SPFontWeight) ? $param_values->SPFontWeight : '',
1458
- 'after' => '',
1459
- ),
1460
- array(
1461
- 'label' => __('Color', WDFM()->prefix),
1462
- 'name' => 'SPColor',
1463
- 'type' => 'text',
1464
- 'class' => 'color',
1465
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1466
- 'value' => isset($param_values->SPColor) ? $param_values->SPColor : '',
1467
- 'after' => '',
1468
- ),
1469
- array(
1470
- 'label' => __('Padding', WDFM()->prefix),
1471
- 'name' => 'SPPadding',
1472
- 'type' => 'text',
1473
- 'class' => '',
1474
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
1475
- 'value' => isset($param_values->SPPadding) ? $param_values->SPPadding : '',
1476
- 'after' => '',
1477
- ),
1478
- array(
1479
- 'label' => __('Margin', WDFM()->prefix),
1480
- 'name' => 'SPMargin',
1481
- 'type' => 'text',
1482
- 'class' => '',
1483
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
1484
- 'value' => isset($param_values->SPMargin) ? $param_values->SPMargin : '',
1485
- 'after' => '',
1486
- ),
1487
- array(
1488
- 'label' => __('Border', WDFM()->prefix),
1489
- 'name' => 'SPBorder',
1490
- 'type' => 'checkbox',
1491
- 'options' => $borders,
1492
- 'class' => '',
1493
- 'after' => '',
1494
- ),
1495
- array(
1496
- 'label' => __('Border Color', WDFM()->prefix),
1497
- 'name' => 'SPBorderColor',
1498
- 'type' => 'text',
1499
- 'class' => 'color',
1500
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1501
- 'value' => isset($param_values->SPBorderColor) ? $param_values->SPBorderColor : '',
1502
- 'after' => '',
1503
- ),
1504
- array(
1505
- 'label' => __('Border Type', WDFM()->prefix),
1506
- 'name' => 'SPBorderType',
1507
- 'type' => 'select',
1508
- 'options' => $border_types,
1509
- 'class' => '',
1510
- 'value' => isset($param_values->SPBorderType) ? $param_values->SPBorderType : '',
1511
- 'after' => '',
1512
- ),
1513
- array(
1514
- 'label' => __('Border Width', WDFM()->prefix),
1515
- 'name' => 'SPBorderWidth',
1516
- 'type' => 'text',
1517
- 'class' => '',
1518
- 'value' => isset($param_values->SPBorderWidth) ? $param_values->SPBorderWidth : '',
1519
- 'after' => 'px',
1520
- ),
1521
- array(
1522
- 'label' => __('Border Radius', WDFM()->prefix),
1523
- 'name' => 'SPBorderRadius',
1524
- 'type' => 'text',
1525
- 'class' => '',
1526
- 'value' => isset($param_values->SPBorderRadius) ? $param_values->SPBorderRadius : '',
1527
- 'after' => 'px',
1528
- ),
1529
- array(
1530
- 'label' => __('Box Shadow', WDFM()->prefix),
1531
- 'name' => 'SPBoxShadow',
1532
- 'type' => 'text',
1533
- 'class' => '',
1534
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 5px 2px #888888',
1535
- 'value' => isset($param_values->SPBoxShadow) ? $param_values->SPBoxShadow : '',
1536
- 'after' => '',
1537
- ),
1538
- array(
1539
- 'label' => __('Hover Parameters', WDFM()->prefix),
1540
- 'type' => 'label',
1541
- 'class' => 'fm-mini-title',
1542
- 'after' => '<br/>',
1543
- ),
1544
- array(
1545
- 'label' => __('Background Color', WDFM()->prefix),
1546
- 'name' => 'SHPBGColor',
1547
- 'type' => 'text',
1548
- 'class' => 'color',
1549
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1550
- 'value' => isset($param_values->SHPBGColor) ? $param_values->SHPBGColor : '',
1551
- 'after' => '',
1552
- ),
1553
- array(
1554
- 'label' => __('Color', WDFM()->prefix),
1555
- 'name' => 'SHPColor',
1556
- 'type' => 'text',
1557
- 'class' => 'color',
1558
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1559
- 'value' => isset($param_values->SHPColor) ? $param_values->SHPColor : '',
1560
- 'after' => '',
1561
- ),
1562
- array(
1563
- 'label' => __('Border', WDFM()->prefix),
1564
- 'name' => 'SHPBorder',
1565
- 'type' => 'checkbox',
1566
- 'options' => $borders,
1567
- 'class' => '',
1568
- 'after' => '',
1569
- ),
1570
- array(
1571
- 'label' => __('Border Color', WDFM()->prefix),
1572
- 'name' => 'SHPBorderColor',
1573
- 'type' => 'text',
1574
- 'class' => 'color',
1575
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1576
- 'value' => isset($param_values->SHPBorderColor) ? $param_values->SHPBorderColor : '',
1577
- 'after' => '',
1578
- ),
1579
- array(
1580
- 'label' => __('Border Type', WDFM()->prefix),
1581
- 'name' => 'SHPBorderType',
1582
- 'type' => 'select',
1583
- 'options' => $border_types,
1584
- 'class' => '',
1585
- 'value' => isset($param_values->SHPBorderType) ? $param_values->SHPBorderType : '',
1586
- 'after' => '',
1587
- ),
1588
- array(
1589
- 'label' => __('Border Width', WDFM()->prefix),
1590
- 'name' => 'SHPBorderWidth',
1591
- 'type' => 'text',
1592
- 'class' => '',
1593
- 'value' => isset($param_values->SHPBorderWidth) ? $param_values->SHPBorderWidth : '',
1594
- 'after' => 'px</div>',
1595
- ),
1596
- array(
1597
- 'label' => __('Reset', WDFM()->prefix),
1598
- 'type' => 'panel',
1599
- 'class' => 'col-md-12',
1600
- 'label_class' => 'fm-mini-title',
1601
- 'after' => '<br/>',
1602
- ),
1603
- array(
1604
- 'label' => __('Background Color', WDFM()->prefix),
1605
- 'name' => 'BPBGColor',
1606
- 'type' => 'text',
1607
- 'class' => 'color',
1608
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1609
- 'value' => isset($param_values->BPBGColor) ? $param_values->BPBGColor : '',
1610
- 'after' => '',
1611
- ),
1612
- array(
1613
- 'label' => __('Width', WDFM()->prefix),
1614
- 'name' => 'BPWidth',
1615
- 'type' => 'text',
1616
- 'class' => '',
1617
- 'value' => isset($param_values->BPWidth) ? $param_values->BPWidth : '',
1618
- 'after' => 'px',
1619
- ),
1620
- array(
1621
- 'label' => __('Height', WDFM()->prefix),
1622
- 'name' => 'BPHeight',
1623
- 'type' => 'text',
1624
- 'class' => '',
1625
- 'value' => isset($param_values->BPHeight) ? $param_values->BPHeight : '',
1626
- 'after' => 'px',
1627
- ),
1628
- array(
1629
- 'label' => __('Font Size', WDFM()->prefix),
1630
- 'name' => 'BPFontSize',
1631
- 'type' => 'text',
1632
- 'class' => '',
1633
- 'value' => isset($param_values->BPFontSize) ? $param_values->BPFontSize : '',
1634
- 'after' => 'px',
1635
- ),
1636
- array(
1637
- 'label' => __('Font Weight', WDFM()->prefix),
1638
- 'name' => 'BPFontWeight',
1639
- 'type' => 'select',
1640
- 'options' => $font_weights,
1641
- 'class' => '',
1642
- 'value' => isset($param_values->BPFontWeight) ? $param_values->BPFontWeight : '',
1643
- 'after' => '',
1644
- ),
1645
- array(
1646
- 'label' => __('Color', WDFM()->prefix),
1647
- 'name' => 'BPColor',
1648
- 'type' => 'text',
1649
- 'class' => 'color',
1650
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1651
- 'value' => isset($param_values->BPColor) ? $param_values->BPColor : '',
1652
- 'after' => '',
1653
- ),
1654
- array(
1655
- 'label' => __('Padding', WDFM()->prefix),
1656
- 'name' => 'BPPadding',
1657
- 'type' => 'text',
1658
- 'class' => '',
1659
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5xp or 3% 5%',
1660
- 'value' => isset($param_values->BPPadding) ? $param_values->BPPadding : '',
1661
- 'after' => '',
1662
- ),
1663
- array(
1664
- 'label' => __('Margin', WDFM()->prefix),
1665
- 'name' => 'BPMargin',
1666
- 'type' => 'text',
1667
- 'class' => '',
1668
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10xp or 5% 10%',
1669
- 'value' => isset($param_values->BPMargin) ? $param_values->BPMargin : '',
1670
- 'after' => '',
1671
- ),
1672
- array(
1673
- 'label' => __('Border', WDFM()->prefix),
1674
- 'name' => 'BPBorder',
1675
- 'type' => 'checkbox',
1676
- 'options' => $borders,
1677
- 'class' => '',
1678
- 'after' => '',
1679
- ),
1680
- array(
1681
- 'label' => __('Border Color', WDFM()->prefix),
1682
- 'name' => 'BPBorderColor',
1683
- 'type' => 'text',
1684
- 'class' => 'color',
1685
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1686
- 'value' => isset($param_values->BPBorderColor) ? $param_values->BPBorderColor : '',
1687
- 'after' => '',
1688
- ),
1689
- array(
1690
- 'label' => __('Border Type', WDFM()->prefix),
1691
- 'name' => 'BPBorderType',
1692
- 'type' => 'select',
1693
- 'options' => $border_types,
1694
- 'class' => '',
1695
- 'value' => isset($param_values->BPBorderType) ? $param_values->BPBorderType : '',
1696
- 'after' => '',
1697
- ),
1698
- array(
1699
- 'label' => __('Border Width', WDFM()->prefix),
1700
- 'name' => 'BPBorderWidth',
1701
- 'type' => 'text',
1702
- 'class' => '',
1703
- 'value' => isset($param_values->BPBorderWidth) ? $param_values->BPBorderWidth : '',
1704
- 'after' => 'px',
1705
- ),
1706
- array(
1707
- 'label' => __('Border Radius', WDFM()->prefix),
1708
- 'name' => 'BPBorderRadius',
1709
- 'type' => 'text',
1710
- 'class' => '',
1711
- 'value' => isset($param_values->BPBorderRadius) ? $param_values->BPBorderRadius : '',
1712
- 'after' => 'px',
1713
- ),
1714
- array(
1715
- 'label' => __('Box Shadow', WDFM()->prefix),
1716
- 'name' => 'BPBoxShadow',
1717
- 'type' => 'text',
1718
- 'class' => '',
1719
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 5px 2px #888888',
1720
- 'value' => isset($param_values->BPBoxShadow) ? $param_values->BPBoxShadow : '',
1721
- 'after' => '',
1722
- ),
1723
- array(
1724
- 'label' => __('Hover Parameters', WDFM()->prefix),
1725
- 'type' => 'label',
1726
- 'class' => 'fm-mini-title',
1727
- 'after' => '<br/>',
1728
- ),
1729
- array(
1730
- 'label' => __('Background Color', WDFM()->prefix),
1731
- 'name' => 'BHPBGColor',
1732
- 'type' => 'text',
1733
- 'class' => 'color',
1734
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1735
- 'value' => isset($param_values->BHPBGColor) ? $param_values->BHPBGColor : '',
1736
- 'after' => '',
1737
- ),
1738
- array(
1739
- 'label' => __('Color', WDFM()->prefix),
1740
- 'name' => 'BHPColor',
1741
- 'type' => 'text',
1742
- 'class' => 'color',
1743
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1744
- 'value' => isset($param_values->BHPColor) ? $param_values->BHPColor : '',
1745
- 'after' => '',
1746
- ),
1747
- array(
1748
- 'label' => __('Border', WDFM()->prefix),
1749
- 'name' => 'BHPBorder',
1750
- 'type' => 'checkbox',
1751
- 'options' => $borders,
1752
- 'class' => '',
1753
- 'after' => '',
1754
- ),
1755
- array(
1756
- 'label' => __('Border Color', WDFM()->prefix),
1757
- 'name' => 'BHPBorderColor',
1758
- 'type' => 'text',
1759
- 'class' => 'color',
1760
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1761
- 'value' => isset($param_values->BHPBorderColor) ? $param_values->BHPBorderColor : '',
1762
- 'after' => '',
1763
- ),
1764
- array(
1765
- 'label' => __('Border Type', WDFM()->prefix),
1766
- 'name' => 'BHPBorderType',
1767
- 'type' => 'select',
1768
- 'options' => $border_types,
1769
- 'class' => '',
1770
- 'value' => isset($param_values->BHPBorderType) ? $param_values->BHPBorderType : '',
1771
- 'after' => '',
1772
- ),
1773
- array(
1774
- 'label' => __('Border Width', WDFM()->prefix),
1775
- 'name' => 'BHPBorderWidth',
1776
- 'type' => 'text',
1777
- 'class' => '',
1778
- 'value' => isset($param_values->BHPBorderWidth) ? $param_values->BHPBorderWidth : '',
1779
- 'after' => 'px</div>',
1780
- ),
1781
- ),
1782
- 'paigination' => array(
1783
- array(
1784
- 'label' => __('Active', WDFM()->prefix),
1785
- 'type' => 'panel',
1786
- 'class' => 'col-md-12',
1787
- 'label_class' => 'fm-mini-title',
1788
- 'after' => '',
1789
- ),
1790
- array(
1791
- 'label' => __('Background Color', WDFM()->prefix),
1792
- 'name' => 'PSAPBGColor',
1793
- 'type' => 'text',
1794
- 'class' => 'color',
1795
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1796
- 'value' => isset($param_values->PSAPBGColor) ? $param_values->PSAPBGColor : '',
1797
- 'after' => '',
1798
- ),
1799
- array(
1800
- 'label' => __('Font Size', WDFM()->prefix),
1801
- 'name' => 'PSAPFontSize',
1802
- 'type' => 'text',
1803
- 'class' => '',
1804
- 'value' => isset($param_values->PSAPFontSize) ? $param_values->PSAPFontSize : '',
1805
- 'after' => 'px',
1806
- ),
1807
- array(
1808
- 'label' => __('Font Weight', WDFM()->prefix),
1809
- 'name' => 'PSAPFontWeight',
1810
- 'type' => 'select',
1811
- 'options' => $font_weights,
1812
- 'class' => '',
1813
- 'value' => isset($param_values->PSAPFontWeight) ? $param_values->PSAPFontWeight : '',
1814
- 'after' => '',
1815
- ),
1816
- array(
1817
- 'label' => __('Color', WDFM()->prefix),
1818
- 'name' => 'PSAPColor',
1819
- 'type' => 'text',
1820
- 'class' => 'color',
1821
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1822
- 'value' => isset($param_values->PSAPColor) ? $param_values->PSAPColor : '',
1823
- 'after' => '',
1824
- ),
1825
- array(
1826
- 'label' => __('Height', WDFM()->prefix),
1827
- 'name' => 'PSAPHeight',
1828
- 'type' => 'text',
1829
- 'class' => '',
1830
- 'value' => isset($param_values->PSAPHeight) ? $param_values->PSAPHeight : '',
1831
- 'after' => 'px',
1832
- ),
1833
- array(
1834
- 'label' => __('Line Height', WDFM()->prefix),
1835
- 'name' => 'PSAPLineHeight',
1836
- 'type' => 'text',
1837
- 'class' => '',
1838
- 'value' => isset($param_values->PSAPLineHeight) ? $param_values->PSAPLineHeight : '',
1839
- 'after' => 'px',
1840
- ),
1841
- array(
1842
- 'label' => __('Padding', WDFM()->prefix),
1843
- 'name' => 'PSAPPadding',
1844
- 'type' => 'text',
1845
- 'class' => '',
1846
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
1847
- 'value' => isset($param_values->PSAPPadding) ? $param_values->PSAPPadding : '',
1848
- 'after' => '',
1849
- ),
1850
- array(
1851
- 'label' => __('Margin', WDFM()->prefix),
1852
- 'name' => 'PSAPMargin',
1853
- 'type' => 'text',
1854
- 'class' => '',
1855
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
1856
- 'value' => isset($param_values->PSAPMargin) ? $param_values->PSAPMargin : '',
1857
- 'after' => '',
1858
- ),
1859
- array(
1860
- 'label' => __('Border', WDFM()->prefix),
1861
- 'name' => 'PSAPBorder',
1862
- 'type' => 'checkbox',
1863
- 'options' => $borders,
1864
- 'class' => '',
1865
- 'after' => '',
1866
- ),
1867
- array(
1868
- 'label' => __('Border Color', WDFM()->prefix),
1869
- 'name' => 'PSAPBorderColor',
1870
- 'type' => 'text',
1871
- 'class' => 'color',
1872
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1873
- 'value' => isset($param_values->PSAPBorderColor) ? $param_values->PSAPBorderColor : '',
1874
- 'after' => '',
1875
- ),
1876
- array(
1877
- 'label' => __('Border Type', WDFM()->prefix),
1878
- 'name' => 'PSAPBorderType',
1879
- 'type' => 'select',
1880
- 'options' => $border_types,
1881
- 'class' => '',
1882
- 'value' => isset($param_values->PSAPBorderType) ? $param_values->PSAPBorderType : '',
1883
- 'after' => '',
1884
- ),
1885
- array(
1886
- 'label' => __('Border Width', WDFM()->prefix),
1887
- 'name' => 'PSAPBorderWidth',
1888
- 'type' => 'text',
1889
- 'class' => '',
1890
- 'value' => isset($param_values->PSAPBorderWidth) ? $param_values->PSAPBorderWidth : '',
1891
- 'after' => 'px',
1892
- ),
1893
- array(
1894
- 'label' => __('Border Radius', WDFM()->prefix),
1895
- 'name' => 'PSAPBorderRadius',
1896
- 'type' => 'text',
1897
- 'class' => '',
1898
- 'value' => isset($param_values->PSAPBorderRadius) ? $param_values->PSAPBorderRadius : '',
1899
- 'after' => 'px</div>',
1900
- ),
1901
- array(
1902
- 'label' => __('Inactive', WDFM()->prefix),
1903
- 'type' => 'panel',
1904
- 'class' => 'col-md-12',
1905
- 'label_class' => 'fm-mini-title',
1906
- 'after' => '',
1907
- ),
1908
- array(
1909
- 'label' => __('Background Color', WDFM()->prefix),
1910
- 'name' => 'PSDPBGColor',
1911
- 'type' => 'text',
1912
- 'class' => 'color',
1913
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1914
- 'value' => isset($param_values->PSDPBGColor) ? $param_values->PSDPBGColor : '',
1915
- 'after' => '',
1916
- ),
1917
- array(
1918
- 'label' => __('Font Size', WDFM()->prefix),
1919
- 'name' => 'PSDPFontSize',
1920
- 'type' => 'text',
1921
- 'class' => '',
1922
- 'value' => isset($param_values->PSDPFontSize) ? $param_values->PSDPFontSize : '',
1923
- 'after' => 'px',
1924
- ),
1925
- array(
1926
- 'label' => __('Font Weight', WDFM()->prefix),
1927
- 'name' => 'PSDPFontWeight',
1928
- 'type' => 'select',
1929
- 'options' => $font_weights,
1930
- 'class' => '',
1931
- 'value' => isset($param_values->PSDPFontWeight) ? $param_values->PSDPFontWeight : '',
1932
- 'after' => '',
1933
- ),
1934
- array(
1935
- 'label' => __('Color', WDFM()->prefix),
1936
- 'name' => 'PSDPColor',
1937
- 'type' => 'text',
1938
- 'class' => 'color',
1939
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1940
- 'value' => isset($param_values->PSDPColor) ? $param_values->PSDPColor : '',
1941
- 'after' => '',
1942
- ),
1943
- array(
1944
- 'label' => __('Height', WDFM()->prefix),
1945
- 'name' => 'PSDPHeight',
1946
- 'type' => 'text',
1947
- 'class' => '',
1948
- 'value' => isset($param_values->PSDPHeight) ? $param_values->PSDPHeight : '',
1949
- 'after' => 'px',
1950
- ),
1951
- array(
1952
- 'label' => __('Line Height', WDFM()->prefix),
1953
- 'name' => 'PSDPLineHeight',
1954
- 'type' => 'text',
1955
- 'class' => '',
1956
- 'value' => isset($param_values->PSDPLineHeight) ? $param_values->PSDPLineHeight : '',
1957
- 'after' => 'px',
1958
- ),
1959
- array(
1960
- 'label' => __('Padding', WDFM()->prefix),
1961
- 'name' => 'PSDPPadding',
1962
- 'type' => 'text',
1963
- 'class' => '',
1964
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
1965
- 'value' => isset($param_values->PSDPPadding) ? $param_values->PSDPPadding : '',
1966
- 'after' => '',
1967
- ),
1968
- array(
1969
- 'label' => __('Margin', WDFM()->prefix),
1970
- 'name' => 'PSDPMargin',
1971
- 'type' => 'text',
1972
- 'class' => '',
1973
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
1974
- 'value' => isset($param_values->PSDPMargin) ? $param_values->PSDPMargin : '',
1975
- 'after' => '',
1976
- ),
1977
- array(
1978
- 'label' => __('Border', WDFM()->prefix),
1979
- 'name' => 'PSDPBorder',
1980
- 'type' => 'checkbox',
1981
- 'options' => $borders,
1982
- 'class' => '',
1983
- 'after' => '',
1984
- ),
1985
- array(
1986
- 'label' => __('Border Color', WDFM()->prefix),
1987
- 'name' => 'PSDPBorderColor',
1988
- 'type' => 'text',
1989
- 'class' => 'color',
1990
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
1991
- 'value' => isset($param_values->PSDPBorderColor) ? $param_values->PSDPBorderColor : '',
1992
- 'after' => '',
1993
- ),
1994
- array(
1995
- 'label' => __('Border Type', WDFM()->prefix),
1996
- 'name' => 'PSDPBorderType',
1997
- 'type' => 'select',
1998
- 'options' => $border_types,
1999
- 'class' => '',
2000
- 'value' => isset($param_values->PSDPBorderType) ? $param_values->PSDPBorderType : '',
2001
- 'after' => '',
2002
- ),
2003
- array(
2004
- 'label' => __('Border Width', WDFM()->prefix),
2005
- 'name' => 'PSDPBorderWidth',
2006
- 'type' => 'text',
2007
- 'class' => '',
2008
- 'value' => isset($param_values->PSDPBorderWidth) ? $param_values->PSDPBorderWidth : '',
2009
- 'after' => 'px',
2010
- ),
2011
- array(
2012
- 'label' => __('Border Radius', WDFM()->prefix),
2013
- 'name' => 'PSDPBorderRadius',
2014
- 'type' => 'text',
2015
- 'class' => '',
2016
- 'value' => isset($param_values->PSDPBorderRadius) ? $param_values->PSDPBorderRadius : '',
2017
- 'after' => 'px</div>',
2018
- ),
2019
- array(
2020
- 'label' => __('Steps', WDFM()->prefix),
2021
- 'type' => 'panel',
2022
- 'class' => 'col-md-12',
2023
- 'label_class' => 'fm-mini-title',
2024
- 'after' => '',
2025
- ),
2026
- array(
2027
- 'label' => __('Alignment', WDFM()->prefix),
2028
- 'name' => 'PSAPAlign',
2029
- 'type' => 'select',
2030
- 'options' => $aligns,
2031
- 'class' => '',
2032
- 'value' => isset($param_values->PSAPAlign) ? $param_values->PSAPAlign : '',
2033
- 'after' => '',
2034
- ),
2035
- array(
2036
- 'label' => __('Width', WDFM()->prefix),
2037
- 'name' => 'PSAPWidth',
2038
- 'type' => 'text',
2039
- 'class' => '',
2040
- 'value' => isset($param_values->PSAPWidth) ? $param_values->PSAPWidth : '',
2041
- 'after' => 'px</div>',
2042
- ),
2043
- array(
2044
- 'label' => __('Percentage', WDFM()->prefix),
2045
- 'type' => 'panel',
2046
- 'class' => 'col-md-12',
2047
- 'label_class' => 'fm-mini-title',
2048
- 'after' => '',
2049
- ),
2050
- array(
2051
- 'label' => __('Width', WDFM()->prefix),
2052
- 'name' => 'PPAPWidth',
2053
- 'type' => 'text',
2054
- 'class' => '',
2055
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 500px or 50%',
2056
- 'value' => isset($param_values->PPAPWidth) ? $param_values->PPAPWidth : '',
2057
- 'after' => '</div>',
2058
- ),
2059
- ),
2060
- 'buttons' => array(
2061
- array(
2062
- 'label' => __('Global Parameters', WDFM()->prefix),
2063
- 'type' => 'panel',
2064
- 'class' => 'col-md-12',
2065
- 'label_class' => 'fm-mini-title',
2066
- 'after' => '<br/>',
2067
- ),
2068
- array(
2069
- 'label' => __('Font Size', WDFM()->prefix),
2070
- 'name' => 'BPFontSize',
2071
- 'type' => 'text',
2072
- 'class' => '',
2073
- 'value' => isset($param_values->BPFontSize) ? $param_values->BPFontSize : '',
2074
- 'after' => 'px',
2075
- ),
2076
- array(
2077
- 'label' => __('Font Weight', WDFM()->prefix),
2078
- 'name' => 'BPFontWeight',
2079
- 'type' => 'select',
2080
- 'options' => $font_weights,
2081
- 'class' => '',
2082
- 'value' => isset($param_values->BPFontWeight) ? $param_values->BPFontWeight : '',
2083
- 'after' => '</div>',
2084
- ),
2085
- array(
2086
- 'label' => __('Next Button Parameters', WDFM()->prefix),
2087
- 'type' => 'panel',
2088
- 'class' => 'col-md-12',
2089
- 'label_class' => 'fm-mini-title',
2090
- 'after' => '<br/>',
2091
- ),
2092
- array(
2093
- 'label' => __('Background Color', WDFM()->prefix),
2094
- 'name' => 'NBPBGColor',
2095
- 'type' => 'text',
2096
- 'class' => 'color',
2097
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2098
- 'value' => isset($param_values->NBPBGColor) ? $param_values->NBPBGColor : '',
2099
- 'after' => '',
2100
- ),
2101
- array(
2102
- 'label' => __('Width', WDFM()->prefix),
2103
- 'name' => 'NBPWidth',
2104
- 'type' => 'text',
2105
- 'class' => '',
2106
- 'value' => isset($param_values->NBPWidth) ? $param_values->NBPWidth : '',
2107
- 'after' => 'px',
2108
- ),
2109
- array(
2110
- 'label' => __('Height', WDFM()->prefix),
2111
- 'name' => 'NBPHeight',
2112
- 'type' => 'text',
2113
- 'class' => '',
2114
- 'value' => isset($param_values->NBPHeight) ? $param_values->NBPHeight : '',
2115
- 'after' => 'px',
2116
- ),
2117
- array(
2118
- 'label' => __('Line Height', WDFM()->prefix),
2119
- 'name' => 'NBPLineHeight',
2120
- 'type' => 'text',
2121
- 'class' => '',
2122
- 'value' => isset($param_values->NBPLineHeight) ? $param_values->NBPLineHeight : '',
2123
- 'after' => 'px',
2124
- ),
2125
- array(
2126
- 'label' => __('Color', WDFM()->prefix),
2127
- 'name' => 'NBPColor',
2128
- 'type' => 'text',
2129
- 'class' => 'color',
2130
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2131
- 'value' => isset($param_values->NBPColor) ? $param_values->NBPColor : '',
2132
- 'after' => '',
2133
- ),
2134
- array(
2135
- 'label' => __('Padding', WDFM()->prefix),
2136
- 'name' => 'NBPPadding',
2137
- 'type' => 'text',
2138
- 'class' => '',
2139
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
2140
- 'value' => isset($param_values->NBPPadding) ? $param_values->NBPPadding : '',
2141
- 'after' => '',
2142
- ),
2143
- array(
2144
- 'label' => __('Margin', WDFM()->prefix),
2145
- 'name' => 'NBPMargin',
2146
- 'type' => 'text',
2147
- 'class' => '',
2148
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
2149
- 'value' => isset($param_values->NBPMargin) ? $param_values->NBPMargin : '',
2150
- 'after' => '',
2151
- ),
2152
- array(
2153
- 'label' => __('Border', WDFM()->prefix),
2154
- 'name' => 'NBPBorder',
2155
- 'type' => 'checkbox',
2156
- 'options' => $borders,
2157
- 'class' => '',
2158
- 'after' => '',
2159
- ),
2160
- array(
2161
- 'label' => __('Border Color', WDFM()->prefix),
2162
- 'name' => 'NBPBorderColor',
2163
- 'type' => 'text',
2164
- 'class' => 'color',
2165
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2166
- 'value' => isset($param_values->NBPBorderColor) ? $param_values->NBPBorderColor : '',
2167
- 'after' => '',
2168
- ),
2169
- array(
2170
- 'label' => __('Border Type', WDFM()->prefix),
2171
- 'name' => 'NBPBorderType',
2172
- 'type' => 'select',
2173
- 'options' => $border_types,
2174
- 'class' => '',
2175
- 'value' => isset($param_values->NBPBorderType) ? $param_values->NBPBorderType : '',
2176
- 'after' => '',
2177
- ),
2178
- array(
2179
- 'label' => __('Border Width', WDFM()->prefix),
2180
- 'name' => 'NBPBorderWidth',
2181
- 'type' => 'text',
2182
- 'class' => '',
2183
- 'value' => isset($param_values->NBPBorderWidth) ? $param_values->NBPBorderWidth : '',
2184
- 'after' => 'px',
2185
- ),
2186
- array(
2187
- 'label' => __('Border Radius', WDFM()->prefix),
2188
- 'name' => 'NBPBorderRadius',
2189
- 'type' => 'text',
2190
- 'class' => '',
2191
- 'value' => isset($param_values->NBPBorderRadius) ? $param_values->NBPBorderRadius : '',
2192
- 'after' => 'px',
2193
- ),
2194
- array(
2195
- 'label' => __('Box Shadow', WDFM()->prefix),
2196
- 'name' => 'NBPBoxShadow',
2197
- 'type' => 'text',
2198
- 'class' => '',
2199
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 5px 2px #888888',
2200
- 'value' => isset($param_values->NBPBoxShadow) ? $param_values->NBPBoxShadow : '',
2201
- 'after' => '',
2202
- ),
2203
- array(
2204
- 'label' => __('Hover Parameters', WDFM()->prefix),
2205
- 'type' => 'label',
2206
- 'class' => 'fm-mini-title',
2207
- 'after' => '<br/>',
2208
- ),
2209
- array(
2210
- 'label' => __('Background Color', WDFM()->prefix),
2211
- 'name' => 'NBHPBGColor',
2212
- 'type' => 'text',
2213
- 'class' => 'color',
2214
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2215
- 'value' => isset($param_values->NBHPBGColor) ? $param_values->NBHPBGColor : '',
2216
- 'after' => '',
2217
- ),
2218
- array(
2219
- 'label' => __('Color', WDFM()->prefix),
2220
- 'name' => 'NBHPColor',
2221
- 'type' => 'text',
2222
- 'class' => 'color',
2223
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2224
- 'value' => isset($param_values->NBHPColor) ? $param_values->NBHPColor : '',
2225
- 'after' => '',
2226
- ),
2227
- array(
2228
- 'label' => __('Border', WDFM()->prefix),
2229
- 'name' => 'NBHPBorder',
2230
- 'type' => 'checkbox',
2231
- 'options' => $borders,
2232
- 'class' => '',
2233
- 'after' => '',
2234
- ),
2235
- array(
2236
- 'label' => __('Border Color', WDFM()->prefix),
2237
- 'name' => 'NBHPBorderColor',
2238
- 'type' => 'text',
2239
- 'class' => 'color',
2240
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2241
- 'value' => isset($param_values->NBHPBorderColor) ? $param_values->NBHPBorderColor : '',
2242
- 'after' => '',
2243
- ),
2244
- array(
2245
- 'label' => __('Border Type', WDFM()->prefix),
2246
- 'name' => 'NBHPBorderType',
2247
- 'type' => 'select',
2248
- 'options' => $border_types,
2249
- 'class' => '',
2250
- 'value' => isset($param_values->NBHPBorderType) ? $param_values->NBHPBorderType : '',
2251
- 'after' => '',
2252
- ),
2253
- array(
2254
- 'label' => __('Border Width', WDFM()->prefix),
2255
- 'name' => 'NBHPBorderWidth',
2256
- 'type' => 'text',
2257
- 'class' => '',
2258
- 'value' => isset($param_values->NBHPBorderWidth) ? $param_values->NBHPBorderWidth : '',
2259
- 'after' => 'px</div>',
2260
- ),
2261
- array(
2262
- 'label' => __('Previous Button Parameters', WDFM()->prefix),
2263
- 'type' => 'panel',
2264
- 'class' => 'col-md-12',
2265
- 'label_class' => 'fm-mini-title',
2266
- 'after' => '<br/>',
2267
- ),
2268
- array(
2269
- 'label' => __('Background Color', WDFM()->prefix),
2270
- 'name' => 'PBPBGColor',
2271
- 'type' => 'text',
2272
- 'class' => 'color',
2273
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2274
- 'value' => isset($param_values->PBPBGColor) ? $param_values->PBPBGColor : '',
2275
- 'after' => '',
2276
- ),
2277
- array(
2278
- 'label' => __('Width', WDFM()->prefix),
2279
- 'name' => 'PBPWidth',
2280
- 'type' => 'text',
2281
- 'class' => '',
2282
- 'value' => isset($param_values->PBPWidth) ? $param_values->PBPWidth : '',
2283
- 'after' => 'px',
2284
- ),
2285
- array(
2286
- 'label' => __('Height', WDFM()->prefix),
2287
- 'name' => 'PBPHeight',
2288
- 'type' => 'text',
2289
- 'class' => '',
2290
- 'value' => isset($param_values->PBPHeight) ? $param_values->PBPHeight : '',
2291
- 'after' => 'px',
2292
- ),
2293
- array(
2294
- 'label' => __('Line Height', WDFM()->prefix),
2295
- 'name' => 'PBPLineHeight',
2296
- 'type' => 'text',
2297
- 'class' => '',
2298
- 'value' => isset($param_values->PBPLineHeight) ? $param_values->PBPLineHeight : '',
2299
- 'after' => 'px',
2300
- ),
2301
- array(
2302
- 'label' => __('Color', WDFM()->prefix),
2303
- 'name' => 'PBPColor',
2304
- 'type' => 'text',
2305
- 'class' => 'color',
2306
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2307
- 'value' => isset($param_values->PBPColor) ? $param_values->PBPColor : '',
2308
- 'after' => '',
2309
- ),
2310
- array(
2311
- 'label' => __('Padding', WDFM()->prefix),
2312
- 'name' => 'PBPPadding',
2313
- 'type' => 'text',
2314
- 'class' => '',
2315
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
2316
- 'value' => isset($param_values->PBPPadding) ? $param_values->PBPPadding : '',
2317
- 'after' => '',
2318
- ),
2319
- array(
2320
- 'label' => __('Margin', WDFM()->prefix),
2321
- 'name' => 'PBPMargin',
2322
- 'type' => 'text',
2323
- 'class' => '',
2324
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
2325
- 'value' => isset($param_values->PBPMargin) ? $param_values->PBPMargin : '',
2326
- 'after' => '',
2327
- ),
2328
- array(
2329
- 'label' => __('Border', WDFM()->prefix),
2330
- 'name' => 'PBPBorder',
2331
- 'type' => 'checkbox',
2332
- 'options' => $borders,
2333
- 'class' => '',
2334
- 'after' => '',
2335
- ),
2336
- array(
2337
- 'label' => __('Border Color', WDFM()->prefix),
2338
- 'name' => 'PBPBorderColor',
2339
- 'type' => 'text',
2340
- 'class' => 'color',
2341
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2342
- 'value' => isset($param_values->PBPBorderColor) ? $param_values->PBPBorderColor : '',
2343
- 'after' => '',
2344
- ),
2345
- array(
2346
- 'label' => __('Border Type', WDFM()->prefix),
2347
- 'name' => 'PBPBorderType',
2348
- 'type' => 'select',
2349
- 'options' => $border_types,
2350
- 'class' => '',
2351
- 'value' => isset($param_values->PBPBorderType) ? $param_values->PBPBorderType : '',
2352
- 'after' => '',
2353
- ),
2354
- array(
2355
- 'label' => __('Border Width', WDFM()->prefix),
2356
- 'name' => 'PBPBorderWidth',
2357
- 'type' => 'text',
2358
- 'class' => '',
2359
- 'value' => isset($param_values->PBPBorderWidth) ? $param_values->PBPBorderWidth : '',
2360
- 'after' => 'px',
2361
- ),
2362
- array(
2363
- 'label' => __('Border Radius', WDFM()->prefix),
2364
- 'name' => 'PBPBorderRadius',
2365
- 'type' => 'text',
2366
- 'class' => '',
2367
- 'value' => isset($param_values->PBPBorderRadius) ? $param_values->PBPBorderRadius : '',
2368
- 'after' => 'px',
2369
- ),
2370
- array(
2371
- 'label' => __('Box Shadow', WDFM()->prefix),
2372
- 'name' => 'PBPBoxShadow',
2373
- 'type' => 'text',
2374
- 'class' => '',
2375
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 5px 2px #888888',
2376
- 'value' => isset($param_values->PBPBoxShadow) ? $param_values->PBPBoxShadow : '',
2377
- 'after' => '',
2378
- ),
2379
- array(
2380
- 'label' => __('Hover Parameters', WDFM()->prefix),
2381
- 'type' => 'label',
2382
- 'class' => 'fm-mini-title',
2383
- 'after' => '<br/>',
2384
- ),
2385
- array(
2386
- 'label' => __('Background Color', WDFM()->prefix),
2387
- 'name' => 'PBHPBGColor',
2388
- 'type' => 'text',
2389
- 'class' => 'color',
2390
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2391
- 'value' => isset($param_values->PBHPBGColor) ? $param_values->PBHPBGColor : '',
2392
- 'after' => '',
2393
- ),
2394
- array(
2395
- 'label' => __('Color', WDFM()->prefix),
2396
- 'name' => 'PBHPColor',
2397
- 'type' => 'text',
2398
- 'class' => 'color',
2399
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2400
- 'value' => isset($param_values->PBHPColor) ? $param_values->PBHPColor : '',
2401
- 'after' => '',
2402
- ),
2403
- array(
2404
- 'label' => __('Border', WDFM()->prefix),
2405
- 'name' => 'PBHPBorder',
2406
- 'type' => 'checkbox',
2407
- 'options' => $borders,
2408
- 'class' => '',
2409
- 'after' => '',
2410
- ),
2411
- array(
2412
- 'label' => __('Border Color', WDFM()->prefix),
2413
- 'name' => 'PBHPBorderColor',
2414
- 'type' => 'text',
2415
- 'class' => 'color',
2416
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2417
- 'value' => isset($param_values->PBHPBorderColor) ? $param_values->PBHPBorderColor : '',
2418
- 'after' => '',
2419
- ),
2420
- array(
2421
- 'label' => __('Border Type', WDFM()->prefix),
2422
- 'name' => 'PBHPBorderType',
2423
- 'type' => 'select',
2424
- 'options' => $border_types,
2425
- 'class' => '',
2426
- 'value' => isset($param_values->PBHPBorderType) ? $param_values->PBHPBorderType : '',
2427
- 'after' => '',
2428
- ),
2429
- array(
2430
- 'label' => __('Border Width', WDFM()->prefix),
2431
- 'name' => 'PBHPBorderWidth',
2432
- 'type' => 'text',
2433
- 'class' => '',
2434
- 'value' => isset($param_values->PBHPBorderWidth) ? $param_values->PBHPBorderWidth : '',
2435
- 'after' => 'px</div>',
2436
- ),
2437
- ),
2438
- 'close_button' => array(
2439
- array(
2440
- 'label' => '',
2441
- 'type' => 'panel',
2442
- 'class' => 'col-md-12',
2443
- 'label_class' => '',
2444
- 'after' => '',
2445
- ),
2446
- array(
2447
- 'label' => __('Position', WDFM()->prefix),
2448
- 'name' => 'CBPPosition',
2449
- 'type' => 'select',
2450
- 'options' => $position_types,
2451
- 'class' => '',
2452
- 'value' => isset($param_values->CBPPosition) ? $param_values->CBPPosition : '',
2453
- 'after' => '',
2454
- ),
2455
- array(
2456
- 'label' => __('Top', WDFM()->prefix),
2457
- 'name' => 'CBPTop',
2458
- 'type' => 'text',
2459
- 'class' => '',
2460
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 100px or 10%',
2461
- 'value' => isset($param_values->CBPTop) ? $param_values->CBPTop : '',
2462
- 'after' => '',
2463
- ),
2464
- array(
2465
- 'label' => __('Right', WDFM()->prefix),
2466
- 'name' => 'CBPRight',
2467
- 'type' => 'text',
2468
- 'class' => '',
2469
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 100px or 10%',
2470
- 'value' => isset($param_values->CBPRight) ? $param_values->CBPRight : '',
2471
- 'after' => '',
2472
- ),
2473
- array(
2474
- 'label' => __('Bottom', WDFM()->prefix),
2475
- 'name' => 'CBPBottom',
2476
- 'type' => 'text',
2477
- 'class' => '',
2478
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 100px or 10%',
2479
- 'value' => isset($param_values->CBPBottom) ? $param_values->CBPBottom : '',
2480
- 'after' => '',
2481
- ),
2482
- array(
2483
- 'label' => __('Left', WDFM()->prefix),
2484
- 'name' => 'CBPLeft',
2485
- 'type' => 'text',
2486
- 'class' => '',
2487
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 100px or 10%',
2488
- 'value' => isset($param_values->CBPLeft) ? $param_values->CBPLeft : '',
2489
- 'after' => '',
2490
- ),
2491
- array(
2492
- 'label' => __('Background Color', WDFM()->prefix),
2493
- 'name' => 'CBPBGColor',
2494
- 'type' => 'text',
2495
- 'class' => 'color',
2496
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2497
- 'value' => isset($param_values->CBPBGColor) ? $param_values->CBPBGColor : '',
2498
- 'after' => '',
2499
- ),
2500
- array(
2501
- 'label' => __('Font Size', WDFM()->prefix),
2502
- 'name' => 'CBPFontSize',
2503
- 'type' => 'text',
2504
- 'class' => '13',
2505
- 'value' => isset($param_values->CBPFontSize) ? $param_values->CBPFontSize : '',
2506
- 'after' => 'px',
2507
- ),
2508
- array(
2509
- 'label' => __('Font Weight', WDFM()->prefix),
2510
- 'name' => 'CBPFontWeight',
2511
- 'type' => 'select',
2512
- 'options' => $font_weights,
2513
- 'class' => '',
2514
- 'value' => isset($param_values->CBPFontWeight) ? $param_values->CBPFontWeight : '',
2515
- 'after' => '',
2516
- ),
2517
- array(
2518
- 'label' => __('Color', WDFM()->prefix),
2519
- 'name' => 'CBPColor',
2520
- 'type' => 'text',
2521
- 'class' => 'color',
2522
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2523
- 'value' => isset($param_values->CBPColor) ? $param_values->CBPColor : '',
2524
- 'after' => '',
2525
- ),
2526
- array(
2527
- 'label' => __('Padding', WDFM()->prefix),
2528
- 'name' => 'CBPPadding',
2529
- 'type' => 'text',
2530
- 'class' => '',
2531
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
2532
- 'value' => isset($param_values->CBPPadding) ? $param_values->CBPPadding : '',
2533
- 'after' => '',
2534
- ),
2535
- array(
2536
- 'label' => __('Margin', WDFM()->prefix),
2537
- 'name' => 'CBPMargin',
2538
- 'type' => 'text',
2539
- 'class' => '',
2540
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
2541
- 'value' => isset($param_values->CBPMargin) ? $param_values->CBPMargin : '',
2542
- 'after' => '',
2543
- ),
2544
- array(
2545
- 'label' => __('Border', WDFM()->prefix),
2546
- 'name' => 'CBPBorder',
2547
- 'type' => 'checkbox',
2548
- 'options' => $borders,
2549
- 'class' => '',
2550
- 'after' => '',
2551
- ),
2552
- array(
2553
- 'label' => __('Border Color', WDFM()->prefix),
2554
- 'name' => 'CBPBorderColor',
2555
- 'type' => 'text',
2556
- 'class' => 'color',
2557
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2558
- 'value' => isset($param_values->CBPBorderColor) ? $param_values->CBPBorderColor : '',
2559
- 'after' => '',
2560
- ),
2561
- array(
2562
- 'label' => __('Border Type', WDFM()->prefix),
2563
- 'name' => 'CBPBorderType',
2564
- 'type' => 'select',
2565
- 'options' => $border_types,
2566
- 'class' => '',
2567
- 'value' => isset($param_values->CBPBorderType) ? $param_values->CBPBorderType : '',
2568
- 'after' => '',
2569
- ),
2570
- array(
2571
- 'label' => __('Border Width', WDFM()->prefix),
2572
- 'name' => 'CBPBorderWidth',
2573
- 'type' => 'text',
2574
- 'class' => '',
2575
- 'value' => isset($param_values->CBPBorderWidth) ? $param_values->CBPBorderWidth : '',
2576
- 'after' => 'px',
2577
- ),
2578
- array(
2579
- 'label' => __('Border Radius', WDFM()->prefix),
2580
- 'name' => 'CBPBorderRadius',
2581
- 'type' => 'text',
2582
- 'class' => '',
2583
- 'value' => isset($param_values->CBPBorderRadius) ? $param_values->CBPBorderRadius : '',
2584
- 'after' => 'px',
2585
- ),
2586
- array(
2587
- 'label' => __('Hover Parameters', WDFM()->prefix),
2588
- 'type' => 'label',
2589
- 'class' => 'fm-mini-title',
2590
- 'after' => '<br/>',
2591
- ),
2592
- array(
2593
- 'label' => __('Background Color', WDFM()->prefix),
2594
- 'name' => 'CBHPBGColor',
2595
- 'type' => 'text',
2596
- 'class' => 'color',
2597
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2598
- 'value' => isset($param_values->CBHPBGColor) ? $param_values->CBHPBGColor : '',
2599
- 'after' => '',
2600
- ),
2601
- array(
2602
- 'label' => __('Color', WDFM()->prefix),
2603
- 'name' => 'CBHPColor',
2604
- 'type' => 'text',
2605
- 'class' => 'color',
2606
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2607
- 'value' => isset($param_values->CBHPColor) ? $param_values->CBHPColor : '',
2608
- 'after' => '',
2609
- ),
2610
- array(
2611
- 'label' => __('Border', WDFM()->prefix),
2612
- 'name' => 'CBHPBorder',
2613
- 'type' => 'checkbox',
2614
- 'options' => $borders,
2615
- 'class' => '',
2616
- 'after' => '',
2617
- ),
2618
- array(
2619
- 'label' => __('Border Color', WDFM()->prefix),
2620
- 'name' => 'CBHPBorderColor',
2621
- 'type' => 'text',
2622
- 'class' => 'color',
2623
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2624
- 'value' => isset($param_values->CBHPBorderColor) ? $param_values->CBHPBorderColor : '',
2625
- 'after' => '',
2626
- ),
2627
- array(
2628
- 'label' => __('Border Type', WDFM()->prefix),
2629
- 'name' => 'CBHPBorderType',
2630
- 'type' => 'select',
2631
- 'options' => $border_types,
2632
- 'class' => '',
2633
- 'value' => isset($param_values->CBHPBorderType) ? $param_values->CBHPBorderType : '',
2634
- 'after' => '',
2635
- ),
2636
- array(
2637
- 'label' => __('Border Width', WDFM()->prefix),
2638
- 'name' => 'CBHPBorderWidth',
2639
- 'type' => 'text',
2640
- 'class' => '',
2641
- 'value' => isset($param_values->CBHPBorderWidth) ? $param_values->CBHPBorderWidth : '',
2642
- 'after' => 'px</div>',
2643
- ),
2644
- ),
2645
- 'minimize' => array(
2646
- array(
2647
- 'label' => '',
2648
- 'type' => 'panel',
2649
- 'class' => 'col-md-12',
2650
- 'label_class' => '',
2651
- 'after' => '',
2652
- ),
2653
- array(
2654
- 'label' => __('Background Color', WDFM()->prefix),
2655
- 'name' => 'MBPBGColor',
2656
- 'type' => 'text',
2657
- 'class' => 'color',
2658
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2659
- 'value' => isset($param_values->MBPBGColor) ? $param_values->MBPBGColor : '',
2660
- 'after' => '',
2661
- ),
2662
- array(
2663
- 'label' => __('Font Size', WDFM()->prefix),
2664
- 'name' => 'MBPFontSize',
2665
- 'type' => 'text',
2666
- 'class' => '13',
2667
- 'value' => isset($param_values->MBPFontSize) ? $param_values->MBPFontSize : '',
2668
- 'after' => 'px',
2669
- ),
2670
- array(
2671
- 'label' => __('Font Weight', WDFM()->prefix),
2672
- 'name' => 'MBPFontWeight',
2673
- 'type' => 'select',
2674
- 'options' => $font_weights,
2675
- 'class' => '',
2676
- 'value' => isset($param_values->MBPFontWeight) ? $param_values->MBPFontWeight : '',
2677
- 'after' => '',
2678
- ),
2679
- array(
2680
- 'label' => __('Color', WDFM()->prefix),
2681
- 'name' => 'MBPColor',
2682
- 'type' => 'text',
2683
- 'class' => 'color',
2684
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2685
- 'value' => isset($param_values->MBPColor) ? $param_values->MBPColor : '',
2686
- 'after' => '',
2687
- ),
2688
- array(
2689
- 'label' => __('Text Align', WDFM()->prefix),
2690
- 'name' => 'MBPTextAlign',
2691
- 'type' => 'select',
2692
- 'options' => $aligns,
2693
- 'class' => '',
2694
- 'value' => isset($param_values->MBPTextAlign) ? $param_values->MBPTextAlign : '',
2695
- 'after' => '',
2696
- ),
2697
- array(
2698
- 'label' => __('Padding', WDFM()->prefix),
2699
- 'name' => 'MBPPadding',
2700
- 'type' => 'text',
2701
- 'class' => '',
2702
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 3px 5px or 3% 5%',
2703
- 'value' => isset($param_values->MBPPadding) ? $param_values->MBPPadding : '',
2704
- 'after' => 'px|%',
2705
- ),
2706
- array(
2707
- 'label' => __('Margin', WDFM()->prefix),
2708
- 'name' => 'MBPMargin',
2709
- 'type' => 'text',
2710
- 'class' => '',
2711
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' 5px 10px or 5% 10%',
2712
- 'value' => isset($param_values->MBPMargin) ? $param_values->MBPMargin : '',
2713
- 'after' => 'px|%',
2714
- ),
2715
- array(
2716
- 'label' => __('Border', WDFM()->prefix),
2717
- 'name' => 'MBPBorder',
2718
- 'type' => 'checkbox',
2719
- 'options' => $borders,
2720
- 'class' => '',
2721
- 'after' => '',
2722
- ),
2723
- array(
2724
- 'label' => __('Border Color', WDFM()->prefix),
2725
- 'name' => 'MBPBorderColor',
2726
- 'type' => 'text',
2727
- 'class' => 'color',
2728
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2729
- 'value' => isset($param_values->MBPBorderColor) ? $param_values->MBPBorderColor : '',
2730
- 'after' => '',
2731
- ),
2732
- array(
2733
- 'label' => __('Border Type', WDFM()->prefix),
2734
- 'name' => 'MBPBorderType',
2735
- 'type' => 'select',
2736
- 'options' => $border_types,
2737
- 'class' => '',
2738
- 'value' => isset($param_values->MBPBorderType) ? $param_values->MBPBorderType : '',
2739
- 'after' => '',
2740
- ),
2741
- array(
2742
- 'label' => __('Border Width', WDFM()->prefix),
2743
- 'name' => 'MBPBorderWidth',
2744
- 'type' => 'text',
2745
- 'class' => '',
2746
- 'value' => isset($param_values->MBPBorderWidth) ? $param_values->MBPBorderWidth : '',
2747
- 'after' => 'px',
2748
- ),
2749
- array(
2750
- 'label' => __('Border Radius', WDFM()->prefix),
2751
- 'name' => 'MBPBorderRadius',
2752
- 'type' => 'text',
2753
- 'class' => '',
2754
- 'value' => isset($param_values->MBPBorderRadius) ? $param_values->MBPBorderRadius : '',
2755
- 'after' => 'px',
2756
- ),
2757
- array(
2758
- 'label' => __('Hover Parameters', WDFM()->prefix),
2759
- 'type' => 'label',
2760
- 'class' => 'fm-mini-title',
2761
- 'after' => '<br/>',
2762
- ),
2763
- array(
2764
- 'label' => __('Background Color', WDFM()->prefix),
2765
- 'name' => 'MBHPBGColor',
2766
- 'type' => 'text',
2767
- 'class' => 'color',
2768
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2769
- 'value' => isset($param_values->MBHPBGColor) ? $param_values->MBHPBGColor : '',
2770
- 'after' => '',
2771
- ),
2772
- array(
2773
- 'label' => __('Color', WDFM()->prefix),
2774
- 'name' => 'MBHPColor',
2775
- 'type' => 'text',
2776
- 'class' => 'color',
2777
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2778
- 'value' => isset($param_values->MBHPColor) ? $param_values->MBHPColor : '',
2779
- 'after' => '',
2780
- ),
2781
- array(
2782
- 'label' => __('Border', WDFM()->prefix),
2783
- 'name' => 'MBHPBorder',
2784
- 'type' => 'checkbox',
2785
- 'options' => $borders,
2786
- 'class' => '',
2787
- 'after' => '',
2788
- ),
2789
- array(
2790
- 'label' => __('Border Color', WDFM()->prefix),
2791
- 'name' => 'MBHPBorderColor',
2792
- 'type' => 'text',
2793
- 'class' => 'color',
2794
- 'value' => isset($param_values->MBHPBorderColor) ? $param_values->MBHPBorderColor : '',
2795
- 'after' => '',
2796
- ),
2797
- array(
2798
- 'label' => __('Border Type', WDFM()->prefix),
2799
- 'name' => 'MBHPBorderType',
2800
- 'type' => 'select',
2801
- 'options' => $border_types,
2802
- 'class' => '',
2803
- 'value' => isset($param_values->MBHPBorderType) ? $param_values->MBHPBorderType : '',
2804
- 'after' => '',
2805
- ),
2806
- array(
2807
- 'label' => __('Border Width', WDFM()->prefix),
2808
- 'name' => 'MBHPBorderWidth',
2809
- 'type' => 'text',
2810
- 'class' => '',
2811
- 'value' => isset($param_values->MBHPBorderWidth) ? $param_values->MBHPBorderWidth : '',
2812
- 'after' => 'px</div>',
2813
- ),
2814
- ),
2815
- 'other' => array(
2816
- array(
2817
- 'label' => __('Inactive Text', WDFM()->prefix),
2818
- 'type' => 'panel',
2819
- 'class' => 'col-md-12',
2820
- 'label_class' => 'fm-mini-title',
2821
- 'after' => '<br/>',
2822
- ),
2823
- array(
2824
- 'label' => __('Color', WDFM()->prefix),
2825
- 'name' => 'OPDeInputColor',
2826
- 'type' => 'text',
2827
- 'class' => 'color',
2828
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' #efefef',
2829
- 'value' => isset($param_values->OPDeInputColor) ? $param_values->OPDeInputColor : '',
2830
- 'after' => '',
2831
- ),
2832
- array(
2833
- 'label' => __('Font Style', WDFM()->prefix),
2834
- 'name' => 'OPFontStyle',
2835
- 'type' => 'text',
2836
- 'class' => '',
2837
- 'value' => isset($param_values->OPFontStyle) ? $param_values->OPFontStyle : '',
2838
- 'after' => '',
2839
- ),
2840
- array(
2841
- 'label' => __('Required', WDFM()->prefix),
2842
- 'type' => 'label',
2843
- 'class' => 'fm-mini-title',
2844
- 'after' => '<br/>',
2845
- ),
2846
- array(
2847
- 'label' => __('Color', WDFM()->prefix),
2848
- 'name' => 'OPRColor',
2849
- 'type' => 'text',
2850
- 'class' => 'color',
2851
- 'value' => isset($param_values->OPRColor) ? $param_values->OPRColor : '',
2852
- 'after' => '',
2853
- ),
2854
- array(
2855
- 'label' => __('File Upload', WDFM()->prefix),
2856
- 'type' => 'label',
2857
- 'class' => 'fm-mini-title',
2858
- 'after' => '<br/>',
2859
- ),
2860
- array(
2861
- 'label' => __('Background URL', WDFM()->prefix),
2862
- 'name' => 'OPFBgUrl',
2863
- 'type' => 'text',
2864
- 'class' => '',
2865
- // 'placeholder' => __('e.g. http:// or https://', WDFM()->prefix),
2866
- 'value' => isset($param_values->OPFBgUrl) ? $param_values->OPFBgUrl : '',
2867
- 'after' => '',
2868
- ),
2869
- array(
2870
- 'label' => __('Background Repeat', WDFM()->prefix),
2871
- 'name' => 'OPFBGRepeat',
2872
- 'type' => 'select',
2873
- 'options' => $bg_repeats,
2874
- 'class' => '',
2875
- 'value' => isset($param_values->OPFBGRepeat) ? $param_values->OPFBGRepeat : '',
2876
- 'after' => '',
2877
- ),
2878
- array(
2879
- 'label' => __('Background Position', WDFM()->prefix),
2880
- 'name1' => 'OPFPos1',
2881
- 'name2' => 'OPFPos2',
2882
- 'type' => '2text',
2883
- 'class' => 'fm-2text',
2884
- 'placeholder' => __('e.g.', WDFM()->prefix) . ' px|%, top|bottom|left|right|center',
2885
- 'value1' => isset($param_values->OPFPos1) ? $param_values->OPFPos1 : '',
2886
- 'value2' => isset($param_values->OPFPos2) ? $param_values->OPFPos2 : '',
2887
- 'before1' => '',
2888
- 'before2' => '',
2889
- 'after' => '',
2890
- ),
2891
- array(
2892
- 'label' => __('Grading', WDFM()->prefix),
2893
- 'type' => 'label',
2894
- 'class' => 'fm-mini-title',
2895
- 'after' => '<br/>',
2896
- ),
2897
- array(
2898
- 'label' => __('Text Width', WDFM()->prefix),
2899
- 'name' => 'OPGWidth',
2900
- 'type' => 'text',
2901
- 'class' => '',
2902
- 'value' => isset($param_values->OPGWidth) ? $param_values->OPGWidth : '',
2903
- 'after' => 'px</div>',
2904
- ),
2905
- ),
2906
- 'custom_css' => array(
2907
- array(
2908
- 'label' => '',
2909
- 'type' => 'panel',
2910
- 'class' => 'col-md-12',
2911
- 'label_class' => '',
2912
- 'after' => '',
2913
- ),
2914
- array(
2915
- 'label' => __('Custom CSS', WDFM()->prefix),
2916
- 'name' => 'CUPCSS',
2917
- 'type' => 'textarea',
2918
- 'class' => '',
2919
- 'value' => isset($param_values->CUPCSS) ? $param_values->CUPCSS : '',
2920
- 'after' => '</div>',
2921
- ),
2922
- ),
2923
- );
2924
-
2925
- return $all_params;
2926
- }
2927
-
2928
- /**
2929
- * Save theme.
2930
- */
2931
- public function apply() {
2932
- $data = $this->save_db();
2933
- $page = WDW_FM_Library::get('page');
2934
- $active_tab = WDW_FM_Library::get('active_tab');
2935
- $pagination = WDW_FM_Library::get('pagination-type');
2936
- $form_type = WDW_FM_Library::get('form_type');
2937
- WDW_FM_Library::fm_redirect(add_query_arg(array(
2938
- 'page' => $page,
2939
- 'task' => 'edit',
2940
- 'current_id' => $data['id'],
2941
- 'message' => $data['msg'],
2942
- 'active_tab' => $active_tab,
2943
- 'pagination' => $pagination,
2944
- 'form_type' => $form_type,
2945
- ), admin_url('admin.php')));
2946
- }
2947
-
2948
- /**
2949
- * Save theme to DB.
2950
- *
2951
- * @return array
2952
- */
2953
- public function save_db() {
2954
- global $wpdb;
2955
- $id = (int) WDW_FM_Library::get('current_id', 0);
2956
- $title = (isset($_POST['title']) ? esc_html(stripslashes($_POST['title'])) : '');
2957
- $version = 2;
2958
- $params = (isset($_POST['params']) ? stripslashes(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $_POST['params'])) : '');
2959
- $default = (isset($_POST['default']) ? esc_html(stripslashes($_POST['default'])) : 0);
2960
- if ( $id != 0 ) {
2961
- $save = $this->model->update_formmaker_themes(array(
2962
- 'title' => $title,
2963
- 'css' => $params,
2964
- 'default' => $default,
2965
- ), array( 'id' => $id ));
2966
- $version = $this->model->get_theme_version($id);
2967
- }
2968
- else {
2969
- $save = $this->model->insert_theme(array(
2970
- 'title' => $title,
2971
- 'css' => $params,
2972
- 'default' => $default,
2973
- 'version' => $version,
2974
- ));
2975
- $id = $wpdb->insert_id;
2976
- }
2977
- if ( $save !== FALSE ) {
2978
- require_once WDFM()->plugin_dir . "/frontend/models/form_maker.php";
2979
- $model_frontend = new FMModelForm_maker();
2980
- $form_theme = json_decode(html_entity_decode($params), TRUE);
2981
- $model_frontend->create_css($id, $form_theme, $version == 1, TRUE);
2982
-
2983
- $msg = 1;
2984
- }
2985
- else {
2986
- $msg = 2;
2987
- }
2988
- return array('id' => $id, 'msg' => $msg);
2989
- }
2990
-
2991
- /**
2992
- * Set default.
2993
- *
2994
- * @param $id
2995
- */
2996
- public function setdefault( $id ) {
2997
- $this->model->update_formmaker_themes( array( 'default' => 0 ), array( 'default' => 1 ) );
2998
- $save = $this->model->update_formmaker_themes( array( 'default' => 1 ), array( 'id' => $id ) );
2999
- if ( $save !== FALSE ) {
3000
- $message = 7;
3001
- }
3002
- else {
3003
- $message = 2;
3004
- }
3005
- $page = WDW_FM_Library::get('page');
3006
- WDW_FM_Library::fm_redirect(add_query_arg(array(
3007
- 'page' => $page,
3008
- 'task' => 'display',
3009
- 'message' => $message,
3010
- ), admin_url('admin.php')));
3011
- }
3012
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/Uninstall_fm.php DELETED
@@ -1,66 +0,0 @@
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_free ) {
27
- global $fm_options;
28
- global $cfm_options;
29
- if (!class_exists("DoradoWebConfig")) {
30
- include_once(WDFM()->plugin_dir . "/wd/config.php");
31
- }
32
- $config = new DoradoWebConfig();
33
- $config->set_options(WDFM()->is_free == 1 ? $fm_options : $cfm_options);
34
- $deactivate_reasons = new DoradoWebDeactivate($config);
35
- $deactivate_reasons->submit_and_deactivate();
36
- }
37
- }
38
-
39
- public function execute() {
40
- $task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
41
- if ( method_exists($this, $task) ) {
42
- check_admin_referer(WDFM()->nonce, WDFM()->nonce);
43
- $this->$task();
44
- }
45
- else {
46
- $this->display();
47
- }
48
- }
49
-
50
- public function display() {
51
- $params = array();
52
- $params['addons'] = $this->addons;
53
- $this->view->display($params);
54
- }
55
-
56
- public function uninstall() {
57
- $this->model->delete_db_tables();
58
- global $wpdb;
59
- $params = array();
60
- $params['prefix'] = $wpdb->prefix;
61
- $params['addons'] = $this->addons;
62
- // Deactivate all addons
63
- WDW_FM_Library::deactivate_all_addons();
64
- $this->view->uninstall($params);
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/controllers/Widget.php DELETED
@@ -1,65 +0,0 @@
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.', WDFM()->prefix),
14
- );
15
- // Widget Control Settings.
16
- $control_ops = array( 'id_base' => 'form_maker_widget' );
17
- // Create the widget.
18
- parent::__construct('form_maker_widget', WDFM()->nicename, $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
- if( get_the_title() == 'Preview' && get_post_type() == 'form-maker' . WDFM()->plugin_postfix ) {
27
- return;
28
- }
29
- $contact_form_forms = explode(',', get_option('contact_form_forms'));
30
- if ( !WDFM()->is_free || !in_array($instance['form_id'], $contact_form_forms) ) {
31
- if ( function_exists('WDFM') ) {
32
- require_once(WDFM()->plugin_dir . '/frontend/controllers/form_maker.php');
33
- $controller_class = 'FMControllerForm_maker';
34
- }
35
- else {
36
- return;
37
- }
38
- }
39
- else {
40
- if ( function_exists('WDCFM') ) {
41
- require_once(WDCFM()->plugin_dir . '/frontend/controllers/form_maker.php');
42
- $controller_class = 'FMControllerForm_maker_fmc';
43
- }
44
- else {
45
- return;
46
- }
47
- }
48
- $controller = new $controller_class();
49
- $execute = $controller->execute($instance['form_id']);
50
- $this->view->widget($args, $instance, $execute);
51
- }
52
-
53
- public function form( $instance ) {
54
- $ids_FM = $this->model->get_gallery_rows_data(); // ids_Form_Maker
55
- $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'));
56
- }
57
-
58
- // Update Settings.
59
- public function update( $new_instance, $old_instance ) {
60
- $instance['title'] = $new_instance['title'];
61
- $instance['form_id'] = $new_instance['form_id'];
62
-
63
- return $instance;
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/Blocked_ips_fm.php DELETED
@@ -1,113 +0,0 @@
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/Checkpaypal.php DELETED
@@ -1,108 +0,0 @@
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
- if ( $params['checkout_mode'] == 1 || $params['checkout_mode'] == 'production' ) {
63
- $action = "https://www.paypal.com/cgi-bin/webscr";
64
- }
65
- else {
66
- $action = "https://www.sandbox.paypal.com/cgi-bin/webscr";
67
- }
68
- $post_fields = $params['post_fields'];
69
- $curlConfig = array(
70
- CURLOPT_URL => $action,
71
- CURLOPT_POST => TRUE,
72
- CURLOPT_RETURNTRANSFER => TRUE,
73
- CURLOPT_SSL_VERIFYPEER => FALSE,
74
- CURLOPT_POSTFIELDS => $post_fields,
75
- );
76
- $curl = curl_init();
77
- curl_setopt_array($curl, $curlConfig);
78
- $response = curl_exec($curl);
79
- curl_close($curl);
80
-
81
- return $response;
82
- }
83
-
84
- /**
85
- * Add form maker sessions.
86
- *
87
- * @param array $data
88
- */
89
- public function add_formmaker_sessions( $data ) {
90
- global $wpdb;
91
- $wpdb->insert($wpdb->prefix . "formmaker_sessions", $data);
92
-
93
- return;
94
- }
95
-
96
- /**
97
- * Update form maker sessions by group_id.
98
- *
99
- * @param int $group_id
100
- * @param array $data
101
- */
102
- public function update_formmaker_sessions_by_group_id( $group_id, $data ) {
103
- global $wpdb;
104
- $wpdb->update($wpdb->prefix . "formmaker_sessions", $data, array( 'group_id' => $group_id ));
105
-
106
- return;
107
- }
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMModelBlocked_ips_fm.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = in_array($order_by, $order_by_array) ? $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_blocked " . $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_blocked WHERE id="%d"', $id));
44
+ }
45
+ else {
46
+ $row->id = 0;
47
+ $row->ip = '';
48
+ }
49
+ return $row;
50
+ }
51
+
52
+ public function page_nav() {
53
+ global $wpdb;
54
+ $where = ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? 'WHERE `ip` LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
55
+ $query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_blocked " . $where;
56
+ $total = $wpdb->get_var($query);
57
+ $page_nav['total'] = $total;
58
+ if (isset($_POST['page_number']) && $_POST['page_number']) {
59
+ $limit = ((int) $_POST['page_number'] - 1) * 20;
60
+ }
61
+ else {
62
+ $limit = 0;
63
+ }
64
+ $page_nav['limit'] = (int) ($limit / 20 + 1);
65
+ return $page_nav;
66
+ }
67
+ ////////////////////////////////////////////////////////////////////////////////////////
68
+ // Getters & Setters //
69
+ ////////////////////////////////////////////////////////////////////////////////////////
70
+ ////////////////////////////////////////////////////////////////////////////////////////
71
+ // Private Methods //
72
+ ////////////////////////////////////////////////////////////////////////////////////////
73
+ ////////////////////////////////////////////////////////////////////////////////////////
74
+ // Listeners //
75
+ ////////////////////////////////////////////////////////////////////////////////////////
76
+ }
admin/models/FMModelExtensions_fm.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMModelExtensions_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/FMModelFeatured_plugins_fm.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMModelFeatured_plugins_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/FMModelFormMakerEditCSS.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMModelFormMakerEditCSS {
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_theme_row($id) {
23
+ global $wpdb;
24
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id));
25
+ return $row;
26
+ }
27
+
28
+ /*public function get_form($form_id) {
29
+ global $wpdb;
30
+ $form = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $form_id));
31
+ return $form;
32
+ }*/
33
+ ////////////////////////////////////////////////////////////////////////////////////////
34
+ // Getters & Setters //
35
+ ////////////////////////////////////////////////////////////////////////////////////////
36
+ ////////////////////////////////////////////////////////////////////////////////////////
37
+ // Private Methods //
38
+ ////////////////////////////////////////////////////////////////////////////////////////
39
+ ////////////////////////////////////////////////////////////////////////////////////////
40
+ // Listeners //
41
+ ////////////////////////////////////////////////////////////////////////////////////////
42
+ }
admin/models/FMModelFormMakerPreview.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_theme_css($id) {
23
+ global $wpdb;
24
+ $css = $wpdb->get_var($wpdb->prepare('SELECT css FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id));
25
+ return $css;
26
+ }
27
+
28
+ public function get_form($form_id) {
29
+ global $wpdb;
30
+ $form = $wpdb->get_var($wpdb->prepare('SELECT form_front FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $form_id));
31
+ return $form;
32
+ }
33
+ ////////////////////////////////////////////////////////////////////////////////////////
34
+ // Getters & Setters //
35
+ ////////////////////////////////////////////////////////////////////////////////////////
36
+ ////////////////////////////////////////////////////////////////////////////////////////
37
+ // Private Methods //
38
+ ////////////////////////////////////////////////////////////////////////////////////////
39
+ ////////////////////////////////////////////////////////////////////////////////////////
40
+ // Listeners //
41
+ ////////////////////////////////////////////////////////////////////////////////////////
42
+ }
admin/models/FMModelFormMakerSQLMapping.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/FMModelFormmakerwdcaptcha.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
22
+ public function get_data() {
23
+ $is_paypal_info = FALSE;
24
+ global $wpdb;
25
+ $params = array();
26
+ $form_id = (int)$_REQUEST['form_id'];
27
+ $paypal_info_fields = array('currency', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'ipn', 'tax', 'shipping');
28
+
29
+ $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
30
+
31
+
32
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d ORDER BY date ASC", $form_id);
33
+ $rows = $wpdb->get_results($query);
34
+
35
+
36
+ $query = $wpdb->prepare("SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
37
+ $labels = $wpdb->get_col($query);
38
+
39
+
40
+ $query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "formmaker_submits where element_label=%s AND form_id = %d",'item_total',$form_id);
41
+ $is_paypal = $wpdb->get_results($query);
42
+
43
+
44
+ $n = count($rows);
45
+ $query_lable = $wpdb->prepare("SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id= %d", $form_id);
46
+ $rows_lable = $wpdb->get_results($query_lable);
47
+ $ptn = "/[^a-zA-Z0-9_]/";
48
+ $rpltxt = "";
49
+ $title = preg_replace($ptn, $rpltxt, $rows_lable[0]->title);
50
+ $sorted_labels_id = array();
51
+ $sorted_labels = array();
52
+ $label_titles = array();
53
+ if ($labels) {
54
+ $label_id = array();
55
+ $label_order = array();
56
+ $label_order_original = array();
57
+ $label_type = array();
58
+ ///stexic
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
+ $ptn = "/[^a-zA-Z0-9_]/";
67
+ $rpltxt = "";
68
+ $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
69
+ array_push($label_order, $label_temp);
70
+ array_push($label_type, $label_oder_each[1]);
71
+ }
72
+ foreach ($label_id as $key => $label) {
73
+ if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
74
+ array_push($sorted_labels, $label_order[$key]);
75
+ array_push($sorted_labels_id, $label);
76
+ array_push($label_titles, stripslashes($label_order_original[$key]));
77
+ }
78
+ }
79
+ }
80
+
81
+ $m = count($sorted_labels);
82
+ $group_id_s = array();
83
+
84
+ if (count($rows) > 0 and $m){
85
+
86
+ $query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d",$form_id);
87
+ $group_id_s = $wpdb->get_col($query);
88
+
89
+ }
90
+
91
+ $data = array();
92
+ for ($www = 0; $www < count($group_id_s); $www++) {
93
+ $i = $group_id_s[$www];
94
+ $field_key = array_search($i, $label_id);
95
+ if($label_type[$field_key] != 'type_arithmetic_captcha') {
96
+ $data_temp = array();
97
+ $tt = $wpdb->get_results($wpdb->prepare("SELECT `element_label`, `id`, `form_id`, `element_value`, `group_id`, `date`, `ip`, `user_id_wd` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d",$i), OBJECT_K);
98
+ for ($h = 0; $h < $m; $h++) {
99
+ if(isset($data_temp[$label_titles[$h]]))
100
+ $label_titles[$h] .= '(1)';
101
+ if(isset($tt[$sorted_labels_id[$h]])) {
102
+ $t = $tt[$sorted_labels_id[$h]];
103
+ if ($t) {
104
+ $f=$t;
105
+ $date=$t->date;
106
+ $ip = $t->ip;
107
+ $user_id = get_userdata($t->user_id_wd);
108
+ $username = $user_id ? $user_id->display_name : "";
109
+ $useremail= $user_id ? $user_id->user_email : "";
110
+ $data_temp['Submit date']=$date;
111
+ $data_temp['Ip']=$ip;
112
+ $data_temp['Submitter\'s Username']=$username;
113
+ $data_temp['Submitter\'s Email Address']=$useremail;
114
+ if (strpos($t->element_value, "*@@url@@*")) {
115
+ $file_names = '';
116
+ $new_files = explode("*@@url@@*", $t->element_value);
117
+ foreach ($new_files as $new_file) {
118
+ if ($new_file) {
119
+ $file_names .= $new_file . ", ";
120
+ }
121
+ }
122
+ $data_temp[stripslashes($label_titles[$h])] = $file_names;
123
+ }
124
+ elseif (strpos($t->element_value, "***br***")) {
125
+ $element_value = str_replace("***br***", ', ', $t->element_value);
126
+ if (strpos($element_value, "***quantity***")) {
127
+ $element_value = str_replace("***quantity***", '', $element_value);
128
+ }
129
+ if (strpos($element_value, "***property***")) {
130
+ $element_value = str_replace("***property***", '', $element_value);
131
+ }
132
+ if(substr($element_value, -2) == ', ') {
133
+ $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
134
+ }
135
+ else {
136
+ $data_temp[stripslashes($label_titles[$h])]= $element_value;
137
+ }
138
+ }
139
+ elseif (strpos($t->element_value, "***map***")) {
140
+ $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $t->element_value);
141
+ }
142
+ elseif (strpos($t->element_value, "***star_rating***")) {
143
+ $element = str_replace("***star_rating***", '', $t->element_value);
144
+ $element = explode("***", $element);
145
+ $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
146
+ }
147
+ elseif (strpos($t->element_value, "@@@") || $t->element_value == "@@@" || $t->element_value == "@@@@@@@@@") {
148
+ $data_temp[stripslashes($label_titles[$h])] = str_replace("@@@", ' ', $t->element_value);
149
+ }
150
+ elseif (strpos($t->element_value, "***grading***")) {
151
+ $element = str_replace("***grading***", '', $t->element_value);
152
+ $grading = explode(":", $element);
153
+ $items_count = sizeof($grading) - 1;
154
+ $items = "";
155
+ $total = "";
156
+ for ($k = 0; $k < $items_count / 2; $k++) {
157
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
158
+ $total += $grading[$k];
159
+ }
160
+ $items .= "Total: " . $total;
161
+ $data_temp[stripslashes($label_titles[$h])] = $items;
162
+ }
163
+ elseif (strpos($t->element_value, "***matrix***")) {
164
+ $element = str_replace("***matrix***", '', $t->element_value);
165
+ $matrix_value = explode('***', $element);
166
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
167
+ $mat_rows = $matrix_value[0];
168
+ $mat_columns = $matrix_value[$mat_rows + 1];
169
+ $matrix = "";
170
+ $aaa = Array();
171
+ $var_checkbox = 1;
172
+ $selected_value = "";
173
+ $selected_value_yes = "";
174
+ $selected_value_no = "";
175
+ for ($k = 1; $k <= $mat_rows; $k++) {
176
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
177
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
178
+ $checked = "0";
179
+ $aaa[1] = "";
180
+ }
181
+ else {
182
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
183
+ }
184
+ for ($l = 1; $l <= $mat_columns; $l++) {
185
+ if ($aaa[1] == $l) {
186
+ $checked = '1';
187
+ }
188
+ else {
189
+ $checked = '0';
190
+ }
191
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
192
+ }
193
+ }
194
+ else {
195
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "checkbox") {
196
+ for ($l = 1; $l <= $mat_columns; $l++) {
197
+ if ($matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1) {
198
+ $checked = '1';
199
+ }
200
+ else {
201
+ $checked = '0';
202
+ }
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 = htmlspecialchars_decode($t->element_value);
229
+ $val = stripslashes(str_replace('&#039;', "'", $val));
230
+ $data_temp[stripslashes($label_titles[$h])] = ($t->element_value ? $val : '');
231
+ }
232
+ }
233
+ }
234
+ }
235
+
236
+ if($is_paypal) {
237
+ $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'));
238
+ $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'total'));
239
+ $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'));
240
+ $data_temp['Item Total'] = $item_total;
241
+ $data_temp['Total'] = $total;
242
+ $data_temp['Payment Status'] = $payment_status;
243
+ }
244
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id= %d",$i);
245
+ $paypal_info = $wpdb->get_results($query);
246
+ if ($paypal_info) {
247
+ $is_paypal_info = TRUE;
248
+ }
249
+ if ($is_paypal) {
250
+ foreach ($paypal_info_fields as $key=>$paypal_info_field) {
251
+ if ($paypal_info) {
252
+ $data_temp['PAYPAL_'.$paypal_info_labels[$key]]=$paypal_info[0]->$paypal_info_field;
253
+ }
254
+ else {
255
+ $data_temp['PAYPAL_'.$paypal_info_labels[$key]]='';
256
+ }
257
+ }
258
+ }
259
+ $data[] = $data_temp;
260
+ }
261
+ }
262
+ array_push($params, $data);
263
+ array_push($params, $title);
264
+ array_push($params, $is_paypal_info);
265
+ return $params;
266
+ }
267
+ ////////////////////////////////////////////////////////////////////////////////////////
268
+ // Getters & Setters //
269
+ ////////////////////////////////////////////////////////////////////////////////////////
270
+ ////////////////////////////////////////////////////////////////////////////////////////
271
+ // Private Methods //
272
+ ////////////////////////////////////////////////////////////////////////////////////////
273
+ ////////////////////////////////////////////////////////////////////////////////////////
274
+ // Listeners //
275
+ ////////////////////////////////////////////////////////////////////////////////////////
276
+ }
admin/models/FMModelGenerete_xml.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $is_paypal_info = FALSE;
24
+ global $wpdb;
25
+ $params = array();
26
+ $form_id = (int)$_REQUEST['form_id'];
27
+ $paypal_info_fields = array('ip', 'ord_date', 'ord_last_modified', 'status', 'full_name', 'fax', 'mobile_phone', 'email', 'phone', 'address', 'paypal_info', 'without_paypal_info', 'ipn', 'checkout_method', 'tax', 'shipping', 'shipping_type', 'read');
28
+ $paypal_info_labels = array( 'Currency', 'Last modified', 'Status', 'Full Name', 'Fax', 'Mobile phone', 'Email', 'Phone', 'Address', 'Paypal info', 'IPN', 'Tax', 'Shipping');
29
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_submits where form_id= %d ORDER BY date ASC", $form_id);
30
+ $rows = $wpdb->get_results($query);
31
+ $n = count($rows);
32
+ $labels = array();
33
+ for ($i = 0; $i < $n; $i++) {
34
+ $row = &$rows[$i];
35
+ if (!in_array($row->element_label, $labels)) {
36
+ array_push($labels, $row->element_label);
37
+ }
38
+ }
39
+ $label_titles = array();
40
+ $sorted_labels = array();
41
+ $query_lable = "SELECT label_order,title FROM " . $wpdb->prefix . "formmaker where id=$form_id ";
42
+ $rows_lable = $wpdb->get_results($query_lable);
43
+ $ptn = "/[^a-zA-Z0-9_]/";
44
+ $rpltxt = "";
45
+ $title = preg_replace($ptn, $rpltxt, $rows_lable[0]->title);
46
+ $sorted_labels_id = array();
47
+ $sorted_labels = array();
48
+ $label_titles = array();
49
+ if ($labels) {
50
+ $label_id = array();
51
+ $label_order = array();
52
+ $label_order_original = array();
53
+ $label_type = array();
54
+ $label_all = explode('#****#', $rows_lable[0]->label_order);
55
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
56
+ foreach ($label_all as $key => $label_each) {
57
+ $label_id_each = explode('#**id**#', $label_each);
58
+ array_push($label_id, $label_id_each[0]);
59
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
60
+ array_push($label_order_original, $label_oder_each[0]);
61
+ $ptn = "/[^a-zA-Z0-9_]/";
62
+ $rpltxt = "";
63
+ $label_temp = preg_replace($ptn, $rpltxt, $label_oder_each[0]);
64
+ array_push($label_order, $label_temp);
65
+ array_push($label_type, $label_oder_each[1]);
66
+ }
67
+ foreach ($label_id as $key => $label) {
68
+ if (in_array($label, $labels) && $label_type[$key] !='type_arithmetic_captcha') {
69
+ array_push($sorted_labels, $label_order[$key]);
70
+ array_push($sorted_labels_id, $label);
71
+ array_push($label_titles, stripslashes($label_order_original[$key]));
72
+ }
73
+ }
74
+ }
75
+ $m = count($sorted_labels);
76
+ $group_id_s = array();
77
+ $l = 0;
78
+ if (count($rows) > 0 and $m) {
79
+ for ($i = 0; $i < count($rows); $i++) {
80
+ $row = &$rows[$i];
81
+ if (!in_array($row->group_id, $group_id_s)) {
82
+ array_push($group_id_s, $row->group_id);
83
+ }
84
+ }
85
+ }
86
+ $data = array();
87
+ $temp_all = array();
88
+ for ($j = 0; $j < $n; $j++) {
89
+ $row = &$rows[$j];
90
+ $key = $row->group_id;
91
+ if (!isset($temp_all[$key])) {
92
+ $temp_all[$key] = array();
93
+ }
94
+ array_push($temp_all[$key], $row);
95
+ }
96
+
97
+ for ($www = 0; $www < count($group_id_s); $www++) {
98
+ $i = $group_id_s[$www];
99
+ $temp = array();
100
+ $data_temp = array();
101
+ $temp = $temp_all[$i];
102
+ $f = $temp[0];
103
+ $date = $f->date;
104
+ $ip = $f->ip;
105
+ $user_id = get_userdata($f->user_id_wd);
106
+ $username = $user_id ? $user_id->display_name : "";
107
+ $useremail= $user_id ? $user_id->user_email : "";
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
+ $ttt = count($temp);
113
+ for ($h = 0; $h < $m; $h++) {
114
+ if(isset($data_temp[$label_titles[$h]]))
115
+ $label_titles[$h] .= '(1)';
116
+ for ($g = 0; $g < $ttt; $g++) {
117
+ $t = $temp[$g];
118
+ if ($t->element_label == $sorted_labels_id[$h]) {
119
+ if (strpos($t->element_value, "*@@url@@*")) {
120
+ $file_names = '';
121
+ $new_files = explode("*@@url@@*", $t->element_value);
122
+ foreach ($new_files as $new_file) {
123
+ if ($new_file) {
124
+ $file_names .= $new_file . ", ";
125
+ }
126
+ }
127
+ $data_temp[stripslashes($label_titles[$h])] = $file_names;
128
+ }
129
+ elseif (strpos($t->element_value, "***br***")) {
130
+ $element_value = str_replace("***br***", ', ', $t->element_value);
131
+ if (strpos($element_value, "***quantity***")) {
132
+ $element_value = str_replace("***quantity***", '', $element_value);
133
+ }
134
+ if (strpos($element_value, "***property***")) {
135
+ $element_value = str_replace("***property***", '', $element_value);
136
+ }
137
+ if(substr($element_value, -2) == ', ') {
138
+ $data_temp[stripslashes($label_titles[$h])]= substr($element_value, 0, -2);
139
+ }
140
+ else {
141
+ $data_temp[stripslashes($label_titles[$h])]= $element_value;
142
+ }
143
+ }
144
+ elseif (strpos($t->element_value, "***map***")) {
145
+ $data_temp[stripslashes($label_titles[$h])] = 'Longitude:' . str_replace("***map***", ', Latitude:', $t->element_value);
146
+ }
147
+ elseif (strpos($t->element_value,"***star_rating***")) {
148
+ $element = str_replace("***star_rating***", '', $t->element_value);
149
+ $element = explode("***", $element);
150
+ $data_temp[stripslashes($label_titles[$h])] = ' ' . $element[1] . '/' . $element[0];
151
+ }
152
+ elseif (strpos($t->element_value, "@@@")>-1 || $t->element_value == "@@@" || $t->element_value == "@@@@@@@@@" || $t->element_value=="::" || $t->element_value==":" || $t->element_value=="--") {
153
+ $data_temp[stripslashes($label_titles[$h])] = str_replace(array("@@@",":","-"),' ', $t->element_value);
154
+ }
155
+ elseif (strpos($t->element_value, "***grading***")) {
156
+ $element = str_replace("***grading***", '', $t->element_value);
157
+ $grading = explode(":", $element);
158
+ $items_count = sizeof($grading) - 1;
159
+ $items = "";
160
+ $total = "";
161
+ for ($k = 0; $k < $items_count / 2; $k++) {
162
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . ", ";
163
+ $total += $grading[$k];
164
+ }
165
+ $items .= "Total: " . $total;
166
+ $data_temp[stripslashes($label_titles[$h])] = $items;
167
+ }
168
+ elseif (strpos($t->element_value, "***matrix***")) {
169
+ $element = str_replace("***matrix***", '', $t->element_value);
170
+ $matrix_value = explode('***', $element);
171
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
172
+ $mat_rows = $matrix_value[0];
173
+ $mat_columns = $matrix_value[$mat_rows + 1];
174
+ $matrix = "";
175
+ $aaa = Array();
176
+ $var_checkbox = 1;
177
+ $selected_value = "";
178
+ $selected_value_yes = "";
179
+ $selected_value_no = "";
180
+ for ($k = 1; $k <= $mat_rows; $k++) {
181
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
182
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
183
+ $checked = "0";
184
+ $aaa[1] = "";
185
+ }
186
+ else {
187
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
188
+ }
189
+ for ($l = 1; $l <= $mat_columns; $l++) {
190
+ if ($aaa[1] == $l) {
191
+ $checked = '1';
192
+ }
193
+ else {
194
+ $checked = '0';
195
+ }
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
+ if ($matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox] == 1) {
203
+ $checked = '1';
204
+ }
205
+ else {
206
+ $checked = '0';
207
+ }
208
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$checked."; ";
209
+ $var_checkbox++;
210
+ }
211
+ }
212
+ else {
213
+ if ($matrix_value[$mat_rows+$mat_columns + 2] == "text") {
214
+ for ($l = 1; $l <= $mat_columns; $l++) {
215
+ $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
216
+ $matrix .='['.$matrix_value[$k].','.$matrix_value[$mat_rows+1+$l].']='.$text_value."; ";
217
+ $var_checkbox++;
218
+ }
219
+ }
220
+ else {
221
+ for ($l = 1; $l <= $mat_columns; $l++) {
222
+ $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
223
+ $matrix .= '['.$matrix_value[$k].','.$matrix_value[$mat_rows + 1 + $l].']='.$selected_text."; ";
224
+ $var_checkbox++;
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ $data_temp[stripslashes($label_titles[$h])] = $matrix;
231
+ }
232
+ else {
233
+ $val = str_replace('&amp;', "&", $t->element_value);
234
+ $val = stripslashes(str_replace('&#039;', "'", $t->element_value));
235
+ $data_temp[stripslashes($label_titles[$h])] = ($t->element_value ? $val : '');
236
+ }
237
+ }
238
+ }
239
+ }
240
+
241
+
242
+
243
+ $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'));
244
+
245
+
246
+ $total = $wpdb->get_var($wpdb->prepare("SELECT `element_value` FROM " . $wpdb->prefix . "formmaker_submits where group_id=%d AND element_label=%s",$i,'total'));
247
+
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
+
262
+
263
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker_sessions where group_id= %d", $i);
264
+
265
+
266
+
267
+ $paypal_info = $wpdb->get_results($query);
268
+ if ($paypal_info) {
269
+ $is_paypal_info = TRUE;
270
+ }
271
+ if ($is_paypal_info) {
272
+ foreach ($paypal_info_fields as $key=>$paypal_info_field) {
273
+ if ($paypal_info) {
274
+ $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = $paypal_info[0]->$paypal_info_field;
275
+ }
276
+ else {
277
+ $data_temp['PAYPAL_' . $paypal_info_labels[$key]] = '';
278
+ }
279
+ }
280
+ }
281
+ $data[] = $data_temp;
282
+
283
+ }
284
+
285
+ array_push($params, $data);
286
+ array_push($params, $title);
287
+ return $params;
288
+ }
289
+ ////////////////////////////////////////////////////////////////////////////////////////
290
+ // Getters & Setters //
291
+ ////////////////////////////////////////////////////////////////////////////////////////
292
+ ////////////////////////////////////////////////////////////////////////////////////////
293
+ // Private Methods //
294
+ ////////////////////////////////////////////////////////////////////////////////////////
295
+ ////////////////////////////////////////////////////////////////////////////////////////
296
+ // Listeners //
297
+ ////////////////////////////////////////////////////////////////////////////////////////
298
+ }
admin/models/FMModelLicensing_fm.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,2217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = in_array($order_by, $order_by_array) ? $order_by : 'id';
29
+ $order_by = ' ORDER BY `' . $order_by . '` ' . $asc_or_desc;
30
+ if (isset($_POST['page_number']) && $_POST['page_number']) {
31
+ $limit = ((int) $_POST['page_number'] - 1) * 20;
32
+ }
33
+ else {
34
+ $limit = 0;
35
+ }
36
+ $query = "SELECT * FROM " . $wpdb->prefix . "formmaker " . $where . $order_by . " LIMIT " . $limit . ",20";
37
+ $rows = $wpdb->get_results($query);
38
+ return $rows;
39
+ }
40
+
41
+ public function get_row_data($id) {
42
+ global $wpdb;
43
+ if ($id != 0) {
44
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
45
+ }
46
+ else {
47
+ $row = new stdClass();
48
+ $row->id = 0;
49
+ $row->title = '';
50
+ $row->mail = '';
51
+ $row->form = '';
52
+ $row->form_front = '';
53
+ $row->theme = 0;
54
+ $row->javascript = '';
55
+ $row->submit_text = '';
56
+ $row->url = '';
57
+ $row->submit_text_type = 0;
58
+ $row->script1 = '';
59
+ $row->script2 = '';
60
+ $row->script_user1 = '';
61
+ $row->script_user2 = '';
62
+ $row->counter = 0;
63
+ $row->label_order = '';
64
+ $row->article_id = '';
65
+ $row->pagination = '';
66
+ $row->show_title = '';
67
+ $row->show_numbers = '';
68
+ $row->public_key = '';
69
+ $row->private_key = '';
70
+ $row->recaptcha_theme = '';
71
+ $row->from_name = '';
72
+ $row->from_mail = '';
73
+ $row->label_order_current = '';
74
+ $row->script_mail_user = '';
75
+ $row->script_mail = '';
76
+ $row->tax = 0;
77
+ $row->payment_currency = '$';
78
+ $row->paypal_email = '';
79
+ $row->checkout_mode = 'testmode';
80
+ $row->paypal_mode = 0;
81
+
82
+ $row->published = 1;
83
+ $row->form_fields = '';
84
+ $row->savedb = 1;
85
+ $row->sendemail = 1;
86
+ $row->requiredmark = '*';
87
+ $row->reply_to = 0;
88
+ $row->send_to = 0;
89
+ $row->autogen_layout = 1;
90
+ $row->custom_front = '';
91
+ $row->mail_from_user = '';
92
+ $row->mail_from_name_user = '';
93
+ $row->reply_to_user = '';
94
+ }
95
+ return $row;
96
+ }
97
+
98
+ public function get_row_data_new($id) {
99
+ global $wpdb;
100
+ if ($id != 0) {
101
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_backup WHERE backup_id="%d"', $id));
102
+ $labels2 = array();
103
+ $label_id = array();
104
+ $label_order_original = array();
105
+ $label_type = array();
106
+ $label_all = explode('#****#', $row->label_order);
107
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
108
+ foreach($label_all as $key => $label_each) {
109
+ $label_id_each=explode('#**id**#',$label_each);
110
+ array_push($label_id, $label_id_each[0]);
111
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
112
+ array_push($label_order_original, addslashes($label_oder_each[0]));
113
+ array_push($label_type, $label_oder_each[1]);
114
+ }
115
+ $labels2['id'] = '"' . implode('","', $label_id) . '"';
116
+ $labels2['label'] = '"' . implode('","', $label_order_original) . '"';
117
+ $labels2['type'] = '"' . implode('","', $label_type) . '"';
118
+ $ids = array();
119
+ $types = array();
120
+ $labels = array();
121
+ $paramss = array();
122
+ $fields = explode('*:*new_field*:*', $row->form_fields);
123
+ $fields = array_slice($fields, 0, count($fields) - 1);
124
+ foreach ($fields as $field) {
125
+ $temp=explode('*:*id*:*',$field);
126
+ array_push($ids, $temp[0]);
127
+ $temp=explode('*:*type*:*',$temp[1]);
128
+ array_push($types, $temp[0]);
129
+ $temp=explode('*:*w_field_label*:*',$temp[1]);
130
+ array_push($labels, $temp[0]);
131
+ array_push($paramss, $temp[1]);
132
+ }
133
+ $form = $row->form_front;
134
+ foreach ($ids as $ids_key => $id) {
135
+ $label = $labels[$ids_key];
136
+ $type = $types[$ids_key];
137
+ $params = $paramss[$ids_key];
138
+ if (strpos($form, '%'.$id.' - '.$label.'%') || strpos($form, '%'.$id.' -'.$label.'%')) {
139
+ $rep = '';
140
+ $arrows='';
141
+ $param = array();
142
+ $param['attributes'] = '';
143
+ switch($type)
144
+ {
145
+ case 'type_section_break':
146
+ {
147
+ $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" title="Remove the field" onclick="remove_section_break(&quot;'.$id.'&quot;)"></div><div id="edit_'.$id.'" class="element_toolbar"><img src="' . WD_FM_URL . '/images/edit.png" title="Edit the field" onclick="edit(&quot;'.$id.'&quot;)"><span id="'.$id.'_element_labelform_id_temp" style="display: none;">custom_'.$id.'</span></div><div id="dublicate_'.$id.'" class="element_toolbar"><img src="' . WD_FM_URL . '/images/dublicate.png" title="Dublicate the field" onclick="dublicate(&quot;'.$id.'&quot;)"></div></div>';
148
+ break;
149
+ }
150
+ case 'type_editor':
151
+ {
152
+ $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" 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" 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" 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" 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" 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" 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="dublicate_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/dublicate.png" title="Dublicate the field" onclick="dublicate(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;dublicate&quot;)" onmouseout="chnage_icons_src(this,&quot;dublicate&quot;)"></div><div id="page_up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_up.png" 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" 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>';
153
+ break;
154
+ }
155
+
156
+ case 'type_send_copy':
157
+ case 'type_captcha':
158
+ case 'type_arithmetic_captcha':
159
+ case 'type_recaptcha':
160
+ {
161
+ $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" title="Remove the field" onclick="remove_row(&quot;'.$id.'&quot;)"></div><div id="left_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/left.png" title="Move the field to the left" onclick="left_row(&quot;'.$id.'&quot;)"></div><div id="up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/up.png" title="Move the field up" onclick="up_row(&quot;'.$id.'&quot;)"></div><div id="down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/down.png" title="Move the field down" onclick="down_row(&quot;'.$id.'&quot;)"></div><div id="right_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/right.png" title="Move the field to the right" onclick="right_row(&quot;'.$id.'&quot;)"></div><div id="edit_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/edit.png" title="Edit the field" onclick="edit(&quot;'.$id.'&quot;)"></div><div id="dublicate_'.$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" title="Move the field to the upper page" onclick="page_up(&quot;'.$id.'&quot;)"></div><div id="page_down_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_down.png" title="Move the field to the lower page" onclick="page_down(&quot;'.$id.'&quot;)"></div></div>';
162
+ break;
163
+ }
164
+
165
+ default :
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" 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" 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" 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" 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" 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" 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="dublicate_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/dublicate.png" title="Dublicate the field" onclick="dublicate(&quot;'.$id.'&quot;)" onmouseover="chnage_icons_src(this,&quot;dublicate&quot;)" onmouseout="chnage_icons_src(this,&quot;dublicate&quot;)"></div><div id="page_up_'.$id.'" valign="middle" class="element_toolbar"><img src="' . WD_FM_URL . '/images/page_up.png" 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" 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
+ }
172
+ switch ($type) {
173
+ case 'type_section_break': {
174
+ $params_names = array('w_editor');
175
+ $temp = $params;
176
+ foreach ($params_names as $params_name) {
177
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
178
+ $param[$params_name] = $temp[0];
179
+ $temp = $temp[1];
180
+ }
181
+ $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>';
182
+ break;
183
+ }
184
+ case 'type_editor': {
185
+ $params_names = array('w_editor');
186
+ $temp = $params;
187
+ foreach ($params_names as $params_name ) {
188
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
189
+ $param[$params_name] = $temp[0];
190
+ $temp = $temp[1];
191
+ }
192
+ $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>';
193
+ break;
194
+ }
195
+ case 'type_send_copy': {
196
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required');
197
+ $temp = $params;
198
+ foreach ($params_names as $params_name ) {
199
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
200
+ $param[$params_name] = $temp[0];
201
+ $temp = $temp[1];
202
+ }
203
+ if ($temp) {
204
+ $temp = explode('*:*w_attr_name*:*', $temp);
205
+ $attrs = array_slice($temp, 0, count($temp) - 1);
206
+ foreach ($attrs as $attr) {
207
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
208
+ }
209
+ }
210
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
211
+ $input_active = ($param['w_first_val'] == 'true' ? "checked='checked'" : "");
212
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
213
+ $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: '.$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" 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="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>';
214
+ break;
215
+ }
216
+ case 'type_text': {
217
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique');
218
+ $temp = $params;
219
+ if(strpos($temp, 'w_regExp_status') > -1)
220
+ $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');
221
+ foreach ($params_names as $params_name) {
222
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
223
+ $param[$params_name] = $temp[0];
224
+ $temp = $temp[1];
225
+ }
226
+ if ($temp) {
227
+ $temp = explode('*:*w_attr_name*:*', $temp);
228
+ $attrs = array_slice($temp, 0, count($temp) - 1);
229
+ foreach ($attrs as $attr) {
230
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
231
+ }
232
+ }
233
+
234
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
235
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
236
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
237
+
238
+ $param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no");
239
+ $param['w_regExp_value'] = (isset($param['w_regExp_value']) ? $param['w_regExp_value'] : "");
240
+ $param['w_regExp_common'] = (isset($param['w_regExp_common']) ? $param['w_regExp_common'] : "");
241
+ $param['w_regExp_arg'] = (isset($param['w_regExp_arg']) ? $param['w_regExp_arg'] : "");
242
+ $param['w_regExp_alert'] = (isset($param['w_regExp_alert']) ? $param['w_regExp_alert'] : "Incorrect Value");
243
+
244
+ $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: '.$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" 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_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>';
245
+
246
+ break;
247
+ }
248
+ case 'type_number': {
249
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_first_val', 'w_title', 'w_required', 'w_unique', 'w_class');
250
+ $temp = $params;
251
+ foreach ($params_names as $params_name) {
252
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
253
+ $param[$params_name] = $temp[0];
254
+ $temp = $temp[1];
255
+ }
256
+ if ($temp) {
257
+ $temp = explode('*:*w_attr_name*:*', $temp);
258
+ $attrs = array_slice($temp, 0, count($temp) - 1);
259
+ foreach ($attrs as $attr) {
260
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
261
+ }
262
+ }
263
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
264
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
265
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
266
+ $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>';
267
+ break;
268
+ }
269
+ case 'type_password': {
270
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_required', 'w_unique', 'w_class');
271
+ $temp = $params;
272
+ foreach ($params_names as $params_name) {
273
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
274
+ $param[$params_name] = $temp[0];
275
+ $temp = $temp[1];
276
+ }
277
+ if ($temp) {
278
+ $temp = explode('*:*w_attr_name*:*', $temp);
279
+ $attrs = array_slice($temp, 0, count($temp) - 1);
280
+ foreach ($attrs as $attr) {
281
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
282
+ }
283
+ }
284
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
285
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
286
+ $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: '.$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_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_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></div>';
287
+ break;
288
+ }
289
+ case 'type_textarea': {
290
+ $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');
291
+ $temp = $params;
292
+ foreach ($params_names as $params_name) {
293
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
294
+ $param[$params_name] = $temp[0];
295
+ $temp = $temp[1];
296
+ }
297
+ if ($temp) {
298
+ $temp = explode('*:*w_attr_name*:*', $temp);
299
+ $attrs = array_slice($temp, 0, count($temp) - 1);
300
+ foreach ($attrs as $attr) {
301
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
302
+ }
303
+ }
304
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
305
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
306
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
307
+ $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:'.$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: 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_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>';
308
+ break;
309
+ }
310
+ case 'type_phone': {
311
+ $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');
312
+ $temp = $params;
313
+ foreach ($params_names as $params_name) {
314
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
315
+ $param[$params_name] = $temp[0];
316
+ $temp = $temp[1];
317
+ }
318
+ if ($temp) {
319
+ $temp = explode('*:*w_attr_name*:*', $temp);
320
+ $attrs = array_slice($temp, 0, count($temp) - 1);
321
+ foreach ($attrs as $attr) {
322
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
323
+ }
324
+ }
325
+ $w_first_val = explode('***', $param['w_first_val']);
326
+ $w_title = explode('***', $param['w_title']);
327
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
328
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
329
+ $input_active = ($param['w_first_val'] == $param['w_title'] ? "input_deactive" : "input_active");
330
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
331
+ $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: '.$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">'.$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_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>';
332
+ break;
333
+ }
334
+ case 'type_name': {
335
+ $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');
336
+ $temp = $params;
337
+ if(strpos($temp, 'w_name_fields') > -1)
338
+ $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');
339
+ foreach ($params_names as $params_name) {
340
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
341
+ $param[$params_name] = $temp[0];
342
+ $temp = $temp[1];
343
+ }
344
+ if ($temp) {
345
+ $temp = explode('*:*w_attr_name*:*', $temp);
346
+ $attrs = array_slice($temp, 0, count($temp) - 1);
347
+ foreach ($attrs as $attr) {
348
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
349
+ }
350
+ }
351
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
352
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
353
+ $w_first_val = explode('***', $param['w_first_val']);
354
+ $w_title = explode('***', $param['w_title']);
355
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
356
+
357
+ $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
358
+ $w_name_fields = explode('***', $param['w_name_fields']);
359
+
360
+ $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>';
361
+ $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>';
362
+
363
+ if($w_name_fields[0] == 'yes') {
364
+ $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;
365
+ $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;
366
+ }
367
+
368
+ if($w_name_fields[1] == 'yes') {
369
+ $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>';
370
+ $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>';
371
+ }
372
+
373
+ $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: '.$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_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_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_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>';
374
+ break;
375
+ }
376
+ case 'type_address': {
377
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_size', 'w_mini_labels', 'w_disabled_fields', 'w_required', 'w_class');
378
+ $temp = $params;
379
+ foreach ($params_names as $params_name) {
380
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
381
+ $param[$params_name] = $temp[0];
382
+ $temp = $temp[1];
383
+ }
384
+ if ($temp) {
385
+ $temp = explode('*:*w_attr_name*:*', $temp);
386
+ $attrs = array_slice($temp, 0, count($temp) - 1);
387
+ foreach ($attrs as $attr) {
388
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
389
+ }
390
+ }
391
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
392
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
393
+ $w_mini_labels = explode('***', $param['w_mini_labels']);
394
+ $w_disabled_fields = explode('***', $param['w_disabled_fields']);
395
+ $hidden_inputs = '';
396
+ $labels_for_id = array('street1', 'street2', 'city', 'state', 'postal', 'country');
397
+ foreach ($w_disabled_fields as $key => $w_disabled_field) {
398
+ if ($key != 6) {
399
+ if ($w_disabled_field == 'yes') {
400
+ $hidden_inputs .= '<input type="hidden" id="'.$id.'_'.$labels_for_id[$key].'form_id_temp" value="'.$w_mini_labels[$key].'" id_for_label="'.($id+$key).'">';
401
+ }
402
+ }
403
+ }
404
+ $address_fields ='';
405
+ $g=0;
406
+ if($w_disabled_fields[0]=='no')
407
+ {
408
+ $g+=2;
409
+ $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>';
410
+ }
411
+
412
+ if($w_disabled_fields[1]=='no')
413
+ {
414
+ $g+=2;
415
+ $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>';
416
+ }
417
+
418
+ if($w_disabled_fields[2]=='no')
419
+ {
420
+ $g++;
421
+ $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>';
422
+ }
423
+
424
+ if($w_disabled_fields[3]=='no')
425
+ {
426
+ $g++;
427
+ if($w_disabled_fields[5]=='yes' && $w_disabled_fields[6]=='yes')
428
+ $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>';
429
+ else
430
+ $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'].'><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_state">'.$w_mini_labels[3].'</label></span>';
431
+ }
432
+
433
+ if($w_disabled_fields[4]=='no')
434
+ {
435
+ $g++;
436
+ $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'].'><label class="mini_label" style="display: block;" id="'.$id.'_mini_label_postal">'.$w_mini_labels[4].'</label></span>';
437
+ }
438
+
439
+ if($w_disabled_fields[5]=='no')
440
+ {
441
+ $g++;
442
+ $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'].'><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 va
443
+ lue="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 Ki
444
+ ngdom</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>';
445
+ }
446
+
447
+ $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: '.$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_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" 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>';
448
+ break;
449
+ }
450
+ case 'type_submitter_mail': {
451
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_first_val','w_title','w_required','w_unique', 'w_class');
452
+ $temp=$params;
453
+ foreach($params_names as $params_name )
454
+ {
455
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
456
+ $param[$params_name] = $temp[0];
457
+ $temp=$temp[1];
458
+ }
459
+
460
+ if($temp)
461
+ {
462
+ $temp =explode('*:*w_attr_name*:*',$temp);
463
+ $attrs = array_slice($temp,0, count($temp)-1);
464
+ foreach($attrs as $attr)
465
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
466
+ }
467
+
468
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
469
+ $input_active = ($param['w_first_val']==$param['w_title'] ? "input_deactive" : "input_active");
470
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
471
+
472
+ $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: '.$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_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_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>';
473
+ break;
474
+ }
475
+ case 'type_checkbox':
476
+ {
477
+ $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');
478
+ $temp=$params;
479
+ if(strpos($temp, 'w_field_option_pos') > -1)
480
+ $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');
481
+ foreach($params_names as $params_name )
482
+ {
483
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
484
+ $param[$params_name] = $temp[0];
485
+ $temp=$temp[1];
486
+ }
487
+
488
+ if($temp)
489
+ {
490
+ $temp =explode('*:*w_attr_name*:*',$temp);
491
+ $attrs = array_slice($temp,0, count($temp)-1);
492
+ foreach($attrs as $attr)
493
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
494
+ }
495
+ if(!isset($param['w_value_disabled']))
496
+ $param['w_value_disabled'] = 'no';
497
+
498
+ if(!isset($param['w_field_option_pos']))
499
+ $param['w_field_option_pos'] = 'left';
500
+
501
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
502
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
503
+ $param['w_choices'] = explode('***',$param['w_choices']);
504
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
505
+
506
+ if(isset($param['w_choices_value']))
507
+ {
508
+ $param['w_choices_value'] = explode('***',$param['w_choices_value']);
509
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
510
+ }
511
+
512
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
513
+ {
514
+ if($choices_checked=='true')
515
+ $param['w_choices_checked'][$key]='checked="checked"';
516
+ else
517
+ $param['w_choices_checked'][$key]='';
518
+ }
519
+
520
+ $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: '.$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_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_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"' : '').'>';
521
+
522
+ if($param['w_flow']=='hor')
523
+ {
524
+ $j = 0;
525
+ for($i=0; $i<(int)$param['w_rowcol']; $i++)
526
+ {
527
+ $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
528
+
529
+ for($l=0; $l<=(int)(count($param['w_choices'])/$param['w_rowcol']); $l++)
530
+ {
531
+ if($j >= count($param['w_choices'])%$param['w_rowcol'] && $l==(int)(count($param['w_choices'])/$param['w_rowcol']))
532
+ continue;
533
+
534
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
535
+ $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>';
536
+ else
537
+ {
538
+ $where = '';
539
+ $order_by = '';
540
+ $db_info = '';
541
+ if(isset($param['w_choices_value']))
542
+ $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$l+$i];
543
+ else
544
+ $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$l+$i];
545
+
546
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$l+$i])
547
+ {
548
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$l+$i]);
549
+ $where = "where='".$w_choices_params[0]."'";
550
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
551
+ $order_by = "order_by='".$w_choices_params[0]."'";
552
+ $db_info = "db_info='".$w_choices_params[1]."'";
553
+ }
554
+
555
+ $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>';
556
+ }
557
+ }
558
+
559
+ $j++;
560
+ $rep.='</div>';
561
+
562
+ }
563
+
564
+ }
565
+ else
566
+ {
567
+ for($i=0; $i<(int)(count($param['w_choices'])/$param['w_rowcol']); $i++)
568
+ {
569
+ $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
570
+
571
+ if(count($param['w_choices']) > (int)$param['w_rowcol'])
572
+ for($l=0; $l<$param['w_rowcol']; $l++)
573
+ {
574
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
575
+ $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>';
576
+ else
577
+ {
578
+ $where = '' ;
579
+ $order_by = '' ;
580
+ $db_info = '' ;
581
+ if(isset($param['w_choices_value']))
582
+ $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
583
+ else
584
+ $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
585
+
586
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
587
+ {
588
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
589
+ $where = "where='".$w_choices_params[0]."'";
590
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
591
+ $order_by = "order_by='".$w_choices_params[0]."'";
592
+ $db_info = "db_info='".$w_choices_params[1]."'";
593
+ }
594
+
595
+ $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).'"
596
+ '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][(int)$param['w_rowcol']*$i+$l].'</label></div>';
597
+ }
598
+ }
599
+ else
600
+ for($l=0; $l<count($param['w_choices']); $l++)
601
+ {
602
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
603
+ $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>';
604
+ else
605
+ {
606
+ $where = '' ;
607
+ $order_by = '' ;
608
+ $db_info = '' ;
609
+ if(isset($param['w_choices_value']))
610
+ $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
611
+ else
612
+ $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
613
+
614
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
615
+ {
616
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
617
+ $where = "where='".$w_choices_params[0]."'";
618
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
619
+ $order_by = "order_by='".$w_choices_params[0]."'";
620
+ $db_info = "db_info='".$w_choices_params[1]."'";
621
+ }
622
+
623
+ $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>';
624
+ }
625
+ }
626
+
627
+ $rep.='</div>';
628
+ }
629
+
630
+ if(count($param['w_choices'])%$param['w_rowcol']!=0)
631
+ {
632
+ $rep.='<div id="'.$id.'_element_tr'.((int)(count($param['w_choices'])/(int)$param['w_rowcol'])).'" style="display: table-row;">';
633
+
634
+ for($k=0; $k<count($param['w_choices'])%$param['w_rowcol']; $k++)
635
+ {
636
+ $l = count($param['w_choices']) - count($param['w_choices'])%$param['w_rowcol'] + $k;
637
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$l)
638
+ $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>';
639
+ else
640
+ {
641
+ $where = '' ;
642
+ $order_by = '' ;
643
+ $db_info = '' ;
644
+ if(isset($param['w_choices_value']))
645
+ $choise_value = $param['w_choices_value'][$l];
646
+ else
647
+ $choise_value = $param['w_choices'][$l];
648
+
649
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$l])
650
+ {
651
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$l]);
652
+ $where = "where='".$w_choices_params[0]."'";
653
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
654
+ $order_by = "order_by='".$w_choices_params[0]."'";
655
+ $db_info = "db_info='".$w_choices_params[1]."'";
656
+ }
657
+ $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>';
658
+ }
659
+ }
660
+
661
+ $rep.='</div>';
662
+ }
663
+
664
+
665
+
666
+ }
667
+ $rep.='</div></div></div></div>';
668
+ break;
669
+ }
670
+ case 'type_radio':
671
+ {
672
+
673
+ $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');
674
+ $temp=$params;
675
+ if(strpos($temp, 'w_field_option_pos') > -1)
676
+ $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');
677
+ foreach($params_names as $params_name )
678
+ {
679
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
680
+ $param[$params_name] = $temp[0];
681
+ $temp=$temp[1];
682
+ }
683
+
684
+ if($temp)
685
+ {
686
+ $temp =explode('*:*w_attr_name*:*',$temp);
687
+ $attrs = array_slice($temp,0, count($temp)-1);
688
+ foreach($attrs as $attr)
689
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
690
+ }
691
+ if(!isset($param['w_value_disabled']))
692
+ $param['w_value_disabled'] = 'no';
693
+
694
+ if(!isset($param['w_field_option_pos']))
695
+ $param['w_field_option_pos'] = 'left';
696
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
697
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
698
+ $param['w_choices'] = explode('***',$param['w_choices']);
699
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
700
+
701
+ if(isset($param['w_choices_value']))
702
+ {
703
+ $param['w_choices_value'] = explode('***',$param['w_choices_value']);
704
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
705
+ }
706
+
707
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
708
+ {
709
+ if($choices_checked=='true')
710
+ $param['w_choices_checked'][$key]='checked="checked"';
711
+ else
712
+ $param['w_choices_checked'][$key]='';
713
+ }
714
+
715
+ $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: '.$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_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_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"' : '').'>';
716
+
717
+
718
+ if($param['w_flow']=='hor')
719
+ {
720
+ $j = 0;
721
+ for($i=0; $i<(int)$param['w_rowcol']; $i++)
722
+ {
723
+ $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
724
+
725
+ for($l=0; $l<=(int)(count($param['w_choices'])/$param['w_rowcol']); $l++)
726
+ {
727
+ if($j >= count($param['w_choices'])%$param['w_rowcol'] && $l==(int)(count($param['w_choices'])/$param['w_rowcol']))
728
+ continue;
729
+
730
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$l+$i)
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="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>';
732
+ else
733
+ {
734
+ $where = '' ;
735
+ $order_by = '' ;
736
+ $db_info = '' ;
737
+ if(isset($param['w_choices_value']))
738
+ $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$l+$i];
739
+ else
740
+ $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$l+$i];
741
+
742
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$l+$i])
743
+ {
744
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$l+$i]);
745
+ $where = "where='".$w_choices_params[0]."'";
746
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
747
+ $order_by = "order_by='".$w_choices_params[0]."'";
748
+ $db_info = "db_info='".$w_choices_params[1]."'";
749
+ }
750
+
751
+ $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>';
752
+ }
753
+ }
754
+
755
+ $j++;
756
+ $rep.='</div>';
757
+
758
+ }
759
+
760
+ }
761
+ else
762
+ {
763
+ for($i=0; $i<(int)(count($param['w_choices'])/$param['w_rowcol']); $i++)
764
+ {
765
+ $rep.='<div id="'.$id.'_element_tr'.$i.'" style="display: table-row;">';
766
+
767
+ if(count($param['w_choices']) > (int)$param['w_rowcol'])
768
+ for($l=0; $l<$param['w_rowcol']; $l++)
769
+ {
770
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
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="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>';
772
+ else
773
+ {
774
+ $where = '' ;
775
+ $order_by = '' ;
776
+ $db_info = '' ;
777
+ if(isset($param['w_choices_value']))
778
+ $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
779
+ else
780
+ $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
781
+
782
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
783
+ {
784
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
785
+ $where = "where='".$w_choices_params[0]."'";
786
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
787
+ $order_by = "order_by='".$w_choices_params[0]."'";
788
+ $db_info = "db_info='".$w_choices_params[1]."'";
789
+ }
790
+
791
+ $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>';
792
+ }
793
+ }
794
+ else
795
+ for($l=0; $l<count($param['w_choices']); $l++)
796
+ {
797
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==(int)$param['w_rowcol']*$i+$l)
798
+ $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>';
799
+ else
800
+ {
801
+ $where = '' ;
802
+ $order_by = '' ;
803
+ $db_info = '' ;
804
+ if(isset($param['w_choices_value']))
805
+ $choise_value = $param['w_choices_value'][(int)$param['w_rowcol']*$i+$l];
806
+ else
807
+ $choise_value = $param['w_choices'][(int)$param['w_rowcol']*$i+$l];
808
+
809
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][(int)$param['w_rowcol']*$i+$l])
810
+ {
811
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][(int)$param['w_rowcol']*$i+$l]);
812
+ $where = "where='".$w_choices_params[0]."'";
813
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
814
+ $order_by = "order_by='".$w_choices_params[0]."'";
815
+ $db_info = "db_info='".$w_choices_params[1]."'";
816
+ }
817
+
818
+ $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>';
819
+ }
820
+ }
821
+
822
+ $rep.='</div>';
823
+ }
824
+
825
+ if(count($param['w_choices'])%$param['w_rowcol']!=0)
826
+ {
827
+ $rep.='<div id="'.$id.'_element_tr'.((int)(count($param['w_choices'])/(int)$param['w_rowcol'])).'" style="display: table-row;">';
828
+
829
+ for($k=0; $k<count($param['w_choices'])%$param['w_rowcol']; $k++)
830
+ {
831
+ $l = count($param['w_choices']) - count($param['w_choices'])%$param['w_rowcol'] + $k;
832
+ if($param['w_allow_other']=="yes" && $param['w_allow_other_num']==$l)
833
+ $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>';
834
+ else
835
+ {
836
+ $where = '' ;
837
+ $order_by = '' ;
838
+ $db_info = '' ;
839
+ if(isset($param['w_choices_value']))
840
+ $choise_value = $param['w_choices_value'][$l];
841
+ else
842
+ $choise_value = $param['w_choices'][$l];
843
+
844
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$l])
845
+ {
846
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$l]);
847
+ $where = "where='".$w_choices_params[0]."'";
848
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
849
+ $order_by = "order_by='".$w_choices_params[0]."'";
850
+ $db_info = "db_info='".$w_choices_params[1]."'";
851
+ }
852
+
853
+ $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.'"
854
+ '.$where.' '.$order_by.' '.$db_info.'>'.$param['w_choices'][$l].'</label></div>';
855
+ }
856
+ }
857
+
858
+ $rep.='</div>';
859
+ }
860
+
861
+ }
862
+
863
+
864
+
865
+ $rep.='</div></div></div></div>';
866
+
867
+ break;
868
+ }
869
+ case 'type_own_select':
870
+ {
871
+ $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');
872
+ $temp=$params;
873
+ if(strpos($temp, 'w_choices_value') > -1)
874
+ $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');
875
+ foreach($params_names as $params_name )
876
+ {
877
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
878
+ $param[$params_name] = $temp[0];
879
+ $temp=$temp[1];
880
+ }
881
+
882
+ if($temp)
883
+ {
884
+ $temp =explode('*:*w_attr_name*:*',$temp);
885
+ $attrs = array_slice($temp,0, count($temp)-1);
886
+ foreach($attrs as $attr)
887
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
888
+ }
889
+
890
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
891
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
892
+ $param['w_choices'] = explode('***',$param['w_choices']);
893
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
894
+ $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
895
+
896
+ if(isset($param['w_choices_value']))
897
+ {
898
+ $param['w_choices_value'] = explode('***',$param['w_choices_value']);
899
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
900
+ }
901
+
902
+ if(!isset($param['w_value_disabled']))
903
+ $param['w_value_disabled'] = 'no';
904
+
905
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
906
+ {
907
+ if($choices_checked=='true')
908
+ $param['w_choices_checked'][$key]='selected="selected"';
909
+ else
910
+ $param['w_choices_checked'][$key]='';
911
+ }
912
+
913
+ $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: '.$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_own_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_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>';
914
+ foreach($param['w_choices'] as $key => $choice)
915
+ {
916
+ $where = '';
917
+ $order_by = '';
918
+ $db_info = '';
919
+ $choice_value = $param['w_choices_disabled'][$key]=='true' ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
920
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
921
+ {
922
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
923
+ $where = "where='".$w_choices_params[0]."'";
924
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
925
+ $order_by = "order_by='".$w_choices_params[0]."'";
926
+ $db_info = "db_info='".$w_choices_params[1]."'";
927
+ }
928
+
929
+ $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>';
930
+ }
931
+ $rep.='</select></div></div>';
932
+ break;
933
+ }
934
+
935
+ case 'type_country':
936
+ {
937
+ $params_names=array('w_field_label_size','w_field_label_pos','w_size','w_countries','w_required','w_class');
938
+ $temp=$params;
939
+ foreach($params_names as $params_name )
940
+ {
941
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
942
+ $param[$params_name] = $temp[0];
943
+ $temp=$temp[1];
944
+ }
945
+
946
+ if($temp)
947
+ {
948
+ $temp =explode('*:*w_attr_name*:*',$temp);
949
+ $attrs = array_slice($temp,0, count($temp)-1);
950
+ foreach($attrs as $attr)
951
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
952
+ }
953
+
954
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
955
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
956
+ $param['w_countries'] = explode('***',$param['w_countries']);
957
+
958
+ $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: '.$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_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"><select id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled>';
959
+ foreach($param['w_countries'] as $key => $choice)
960
+ {
961
+ $choice_value=$choice;
962
+ $rep.='<option value="'.$choice_value.'">'.$choice.'</option>';
963
+ }
964
+ $rep.='</select></div></div>';
965
+ break;
966
+ }
967
+
968
+ case 'type_time':
969
+ {
970
+ $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');
971
+ $temp=$params;
972
+ foreach($params_names as $params_name )
973
+ {
974
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
975
+ $param[$params_name] = $temp[0];
976
+ $temp=$temp[1];
977
+ }
978
+
979
+ if($temp)
980
+ {
981
+ $temp =explode('*:*w_attr_name*:*',$temp);
982
+ $attrs = array_slice($temp,0, count($temp)-1);
983
+ foreach($attrs as $attr)
984
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
985
+ }
986
+
987
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
988
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
989
+
990
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
991
+
992
+
993
+ if($param['w_sec']=='1')
994
+ {
995
+ $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>';
996
+ $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>';
997
+ }
998
+ else
999
+ {
1000
+ $w_sec = '';
1001
+ $w_sec_label='';
1002
+ }
1003
+
1004
+ if($param['w_time_type']=='12')
1005
+ {
1006
+ if($param['w_am_pm']=='am')
1007
+ {
1008
+ $am_ = "selected=\"selected\"";
1009
+ $pm_ = "";
1010
+ }
1011
+ else
1012
+ {
1013
+ $am_ = "";
1014
+ $pm_ = "selected=\"selected\"";
1015
+
1016
+ }
1017
+
1018
+ $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>';
1019
+
1020
+ $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>';
1021
+
1022
+ }
1023
+ else
1024
+ {
1025
+ $w_time_type='';
1026
+ $w_time_type_label = '';
1027
+ }
1028
+
1029
+
1030
+ $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: '.$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_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"><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>';
1031
+
1032
+ break;
1033
+ }
1034
+ case 'type_date':
1035
+ {
1036
+ $params_names=array('w_field_label_size','w_field_label_pos','w_date','w_required','w_class','w_format','w_but_val');
1037
+ $temp = $params;
1038
+ if(strpos($temp, 'w_disable_past_days') > -1)
1039
+ $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');
1040
+ foreach($params_names as $params_name )
1041
+ {
1042
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1043
+ $param[$params_name] = $temp[0];
1044
+ $temp=$temp[1];
1045
+ }
1046
+
1047
+ if($temp)
1048
+ {
1049
+ $temp =explode('*:*w_attr_name*:*',$temp);
1050
+ $attrs = array_slice($temp,0, count($temp)-1);
1051
+ foreach($attrs as $attr)
1052
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1053
+ }
1054
+
1055
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1056
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1057
+ $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1058
+ $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1059
+
1060
+ $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" alt="calendario" '.$param['attributes'].' onclick="return showCalendar(&quot;'.$id.'_elementform_id_temp&quot; , &quot;'.$param['w_format'].'&quot;, '.$disable_past_days.')"></div></div>';
1061
+
1062
+ break;
1063
+ }
1064
+ case 'type_date_fields':
1065
+ {
1066
+ $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');
1067
+
1068
+ $temp=$params;
1069
+ foreach($params_names as $params_name )
1070
+ {
1071
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1072
+ $param[$params_name] = $temp[0];
1073
+ $temp=$temp[1];
1074
+ }
1075
+
1076
+ if($temp)
1077
+ {
1078
+ $temp =explode('*:*w_attr_name*:*',$temp);
1079
+ $attrs = array_slice($temp,0, count($temp)-1);
1080
+ foreach($attrs as $attr)
1081
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1082
+ }
1083
+
1084
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1085
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1086
+
1087
+
1088
+ if($param['w_day_type']=="SELECT")
1089
+ {
1090
+
1091
+
1092
+ $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>';
1093
+ for($k=0; $k<=31; $k++)
1094
+ {
1095
+ if($k<10)
1096
+ {
1097
+ if($param['w_day']=='0'.$k)
1098
+ $selected = "selected=\"selected\"";
1099
+ else
1100
+ $selected = "";
1101
+
1102
+ $w_day_type .= '<option value="0'.$k.'" '.$selected.'>0'.$k.'</option>';
1103
+ }
1104
+ else
1105
+ {
1106
+ if($param['w_day']==''.$k)
1107
+ $selected = "selected=\"selected\"";
1108
+ else
1109
+ $selected = "";
1110
+
1111
+ $w_day_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
1112
+ }
1113
+
1114
+
1115
+
1116
+ }
1117
+ $w_day_type .= '</select>';
1118
+ }
1119
+ else
1120
+ {
1121
+ $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/>';
1122
+ }
1123
+
1124
+ if($param['w_month_type']=="SELECT")
1125
+ {
1126
+
1127
+ $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>';
1128
+
1129
+ }
1130
+ else
1131
+ {
1132
+ $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/>';
1133
+
1134
+ }
1135
+
1136
+ if($param['w_year_type']=="SELECT")
1137
+ {
1138
+ $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>';
1139
+ for($k=$param['w_to']; $k>=$param['w_from']; $k--)
1140
+ {
1141
+ if($param['w_year']==$k)
1142
+ $selected = "selected=\"selected\"";
1143
+ else
1144
+ $selected = "";
1145
+
1146
+ $w_year_type .= '<option value="'.$k.'" '.$selected.'>'.$k.'</option>';
1147
+ }
1148
+ $w_year_type .= '</select>';
1149
+
1150
+ }
1151
+ else
1152
+ {
1153
+ $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/>';
1154
+ }
1155
+
1156
+
1157
+ $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: '.$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_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"><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;">
1158
+ '.$w_day_type.'
1159
+
1160
+ </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>';
1161
+
1162
+ break;
1163
+ }
1164
+ case 'type_file_upload':
1165
+ {
1166
+ $params_names=array('w_field_label_size','w_field_label_pos','w_destination','w_extension','w_max_size','w_required','w_multiple','w_class');
1167
+ $temp=$params;
1168
+ foreach($params_names as $params_name )
1169
+ {
1170
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1171
+ $param[$params_name] = $temp[0];
1172
+ if (isset($temp[1])) {
1173
+ $temp = $temp[1];
1174
+ }
1175
+ else {
1176
+ $temp = '';
1177
+ }
1178
+ }
1179
+
1180
+ if($temp)
1181
+ {
1182
+ $temp =explode('*:*w_attr_name*:*',$temp);
1183
+ $attrs = array_slice($temp,0, count($temp)-1);
1184
+ foreach($attrs as $attr)
1185
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1186
+ }
1187
+
1188
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1189
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1190
+ $multiple = ($param['w_multiple']=="yes" ? "multiple='multiple'" : "");
1191
+
1192
+ $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: '.$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_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="***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>';
1193
+
1194
+ break;
1195
+ }
1196
+ case 'type_captcha':
1197
+ {
1198
+ $params_names=array('w_field_label_size','w_field_label_pos','w_digit','w_class');
1199
+ $temp=$params;
1200
+ foreach($params_names as $params_name )
1201
+ {
1202
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1203
+ $param[$params_name] = $temp[0];
1204
+ $temp=$temp[1];
1205
+ }
1206
+
1207
+ if($temp)
1208
+ {
1209
+ $temp =explode('*:*w_attr_name*:*',$temp);
1210
+ $attrs = array_slice($temp,0, count($temp)-1);
1211
+ foreach($attrs as $attr)
1212
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1213
+ }
1214
+
1215
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1216
+
1217
+ $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:'.$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></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/></div></div></div></div></div>';
1218
+
1219
+ break;
1220
+ }
1221
+ case 'type_arithmetic_captcha':
1222
+ {
1223
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_count', 'w_operations','w_class', 'w_input_size');
1224
+ $temp=$params;
1225
+ foreach($params_names as $params_name )
1226
+ {
1227
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1228
+ $param[$params_name] = $temp[0];
1229
+ $temp=$temp[1];
1230
+ }
1231
+
1232
+ if($temp)
1233
+ {
1234
+ $temp =explode('*:*w_attr_name*:*',$temp);
1235
+ $attrs = array_slice($temp,0, count($temp)-1);
1236
+ foreach($attrs as $attr)
1237
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1238
+ }
1239
+
1240
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1241
+ $param['w_count'] = $param['w_count'] ? $param['w_count'] : 1;
1242
+ $param['w_operations'] = $param['w_operations'] ? $param['w_operations'] : '+, -, *, /';
1243
+ $param['w_input_size'] = $param['w_input_size'] ? $param['w_input_size'] : 60;
1244
+
1245
+ $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:'.$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></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' => $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/></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>';
1246
+
1247
+ break;
1248
+ }
1249
+
1250
+
1251
+ case 'type_recaptcha':
1252
+ {
1253
+ $params_names=array('w_field_label_size','w_field_label_pos','w_public','w_private','w_theme','w_class');
1254
+ $temp=$params;
1255
+ foreach($params_names as $params_name )
1256
+ {
1257
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1258
+ $param[$params_name] = $temp[0];
1259
+ $temp=$temp[1];
1260
+ }
1261
+
1262
+ if($temp)
1263
+ {
1264
+ $temp =explode('*:*w_attr_name*:*',$temp);
1265
+ $attrs = array_slice($temp,0, count($temp)-1);
1266
+ foreach($attrs as $attr)
1267
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1268
+ }
1269
+
1270
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1271
+
1272
+ $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: '.$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></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"><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>';
1273
+
1274
+ break;
1275
+ }
1276
+
1277
+ case 'type_hidden':
1278
+ {
1279
+ $params_names=array('w_name','w_value');
1280
+ $temp=$params;
1281
+ foreach($params_names as $params_name )
1282
+ {
1283
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1284
+ $param[$params_name] = $temp[0];
1285
+ $temp=$temp[1];
1286
+ }
1287
+
1288
+ if($temp)
1289
+ {
1290
+ $temp =explode('*:*w_attr_name*:*',$temp);
1291
+ $attrs = array_slice($temp,0, count($temp)-1);
1292
+ foreach($attrs as $attr)
1293
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1294
+ }
1295
+ $param['w_name'] = str_replace('&nbsp;','',$param['w_name']);
1296
+ $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>';
1297
+
1298
+ break;
1299
+ }
1300
+ case 'type_mark_map':
1301
+ {
1302
+ $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');
1303
+ $temp=$params;
1304
+ foreach($params_names as $params_name )
1305
+ {
1306
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1307
+ $param[$params_name] = $temp[0];
1308
+ $temp=$temp[1];
1309
+ }
1310
+
1311
+ if($temp)
1312
+ {
1313
+ $temp =explode('*:*w_attr_name*:*',$temp);
1314
+ $attrs = array_slice($temp,0, count($temp)-1);
1315
+ foreach($attrs as $attr)
1316
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1317
+ }
1318
+
1319
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1320
+
1321
+ $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: '.$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></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_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> ';
1322
+
1323
+ break;
1324
+ }
1325
+
1326
+ case 'type_map':
1327
+ {
1328
+ $params_names=array('w_center_x','w_center_y','w_long','w_lat','w_zoom','w_width','w_height','w_info','w_class');
1329
+ $temp=$params;
1330
+ foreach($params_names as $params_name )
1331
+ {
1332
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1333
+ $param[$params_name] = $temp[0];
1334
+ $temp=$temp[1];
1335
+ }
1336
+
1337
+ if($temp)
1338
+ {
1339
+ $temp =explode('*:*w_attr_name*:*',$temp);
1340
+ $attrs = array_slice($temp,0, count($temp)-1);
1341
+ foreach($attrs as $attr)
1342
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1343
+ }
1344
+
1345
+ $marker='';
1346
+
1347
+ $param['w_long'] = explode('***',$param['w_long']);
1348
+ $param['w_lat'] = explode('***',$param['w_lat']);
1349
+ $param['w_info'] = explode('***',$param['w_info']);
1350
+ foreach($param['w_long'] as $key => $w_long )
1351
+ {
1352
+ $marker.='long'.$key.'="'.$w_long.'" lat'.$key.'="'.$param['w_lat'][$key].'" info'.$key.'="'.$param['w_info'][$key].'"';
1353
+ }
1354
+
1355
+ $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>';
1356
+
1357
+ break;
1358
+ }
1359
+ case 'type_paypal_price':
1360
+ {
1361
+
1362
+ $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');
1363
+ $temp=$params;
1364
+ foreach($params_names as $params_name )
1365
+ {
1366
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1367
+ $param[$params_name] = $temp[0];
1368
+ $temp=$temp[1];
1369
+ }
1370
+
1371
+ if($temp)
1372
+ {
1373
+ $temp =explode('*:*w_attr_name*:*',$temp);
1374
+ $attrs = array_slice($temp,0, count($temp)-1);
1375
+ foreach($attrs as $attr)
1376
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1377
+ }
1378
+
1379
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1380
+ $input_active = ($param['w_first_val']==$param['w_title'] ? "input_deactive" : "input_active");
1381
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1382
+ $hide_cents = ($param['w_hide_cents']=="yes" ? "none;" : "table-cell;");
1383
+
1384
+
1385
+ $w_first_val = explode('***',$param['w_first_val']);
1386
+ $w_title = explode('***',$param['w_title']);
1387
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
1388
+
1389
+ $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>';
1390
+ break;
1391
+ }
1392
+
1393
+ case 'type_paypal_select':
1394
+ {
1395
+ $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');
1396
+ $temp=$params;
1397
+ if(strpos($temp, 'w_choices_params') > -1)
1398
+ $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');
1399
+ foreach($params_names as $params_name )
1400
+ {
1401
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1402
+ $param[$params_name] = $temp[0];
1403
+ $temp=$temp[1];
1404
+ }
1405
+
1406
+ if($temp)
1407
+ {
1408
+ $temp =explode('*:*w_attr_name*:*',$temp);
1409
+ $attrs = array_slice($temp,0, count($temp)-1);
1410
+ foreach($attrs as $attr)
1411
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1412
+ }
1413
+
1414
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1415
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1416
+ $param['w_choices'] = explode('***',$param['w_choices']);
1417
+
1418
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
1419
+
1420
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1421
+
1422
+ $param['w_choices_disabled'] = explode('***',$param['w_choices_disabled']);
1423
+ $param['w_property'] = explode('***',$param['w_property']);
1424
+ $param['w_property_values'] = explode('***',$param['w_property_values']);
1425
+ if(isset($param['w_choices_params']))
1426
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1427
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
1428
+ {
1429
+ if($choices_checked=='true')
1430
+ $param['w_choices_checked'][$key]='selected="selected"';
1431
+ else
1432
+ $param['w_choices_checked'][$key]='';
1433
+ }
1434
+
1435
+
1436
+ $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: '.$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_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"><select id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" onchange="set_select(this)" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled>';
1437
+ foreach($param['w_choices'] as $key => $choice)
1438
+ {
1439
+ $where = '';
1440
+ $order_by = '';
1441
+ $db_info = '';
1442
+ $choice_value = $param['w_choices_disabled'][$key]=="true" ? '' : $param['w_choices_price'][$key];
1443
+
1444
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1445
+ {
1446
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1447
+ $where = "where='".$w_choices_params[0]."'";
1448
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1449
+ $order_by = "order_by='".$w_choices_params[0]."'";
1450
+ $db_info = "db_info='".$w_choices_params[1]."'";
1451
+ }
1452
+ $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>';
1453
+ }
1454
+ $rep.='</select><div id="'.$id.'_divform_id_temp">';
1455
+ if($param['w_quantity']=="yes")
1456
+ $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>';
1457
+ if($param['w_property'][0])
1458
+ foreach($param['w_property'] as $key => $property)
1459
+ {
1460
+
1461
+ $rep.='
1462
+ <span id="'.$id.'_property_'.$key.'" style="margin-right: 15px;">
1463
+
1464
+ <label class="mini_label" id="'.$id.'_property_label_form_id_temp'.$key.'" style="margin-right: 5px;">'.$property.'</label>
1465
+ <select id="'.$id.'_propertyform_id_temp'.$key.'" name="'.$id.'_propertyform_id_temp'.$key.'" style="width: auto; margin: 2px 0px;" disabled>';
1466
+ $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
1467
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
1468
+ foreach($param['w_property_values'][$key] as $subkey => $property_value)
1469
+ {
1470
+ $rep.='<option id="'.$id.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'">'.$property_value.'</option>';
1471
+ }
1472
+ $rep.='</select></span>';
1473
+ }
1474
+
1475
+ $rep.='</div></div></div>';
1476
+ break;
1477
+ }
1478
+
1479
+ case 'type_paypal_checkbox':
1480
+ {
1481
+
1482
+ $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');
1483
+ $temp=$params;
1484
+ if(strpos($temp, 'w_field_option_pos') > -1)
1485
+ $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');
1486
+ foreach($params_names as $params_name )
1487
+ {
1488
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1489
+ $param[$params_name] = $temp[0];
1490
+ $temp=$temp[1];
1491
+ }
1492
+
1493
+ if($temp)
1494
+ {
1495
+ $temp =explode('*:*w_attr_name*:*',$temp);
1496
+ $attrs = array_slice($temp,0, count($temp)-1);
1497
+ foreach($attrs as $attr)
1498
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1499
+ }
1500
+ if(!isset($param['w_field_option_pos']))
1501
+ $param['w_field_option_pos'] = 'left';
1502
+
1503
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1504
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1505
+ $param['w_choices'] = explode('***',$param['w_choices']);
1506
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
1507
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1508
+ $param['w_property'] = explode('***',$param['w_property']);
1509
+ $param['w_property_values'] = explode('***',$param['w_property_values']);
1510
+
1511
+ if(isset($param['w_choices_params']))
1512
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1513
+
1514
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
1515
+ {
1516
+ if($choices_checked=='true')
1517
+ $param['w_choices_checked'][$key]='checked="checked"';
1518
+ else
1519
+ $param['w_choices_checked'][$key]='';
1520
+ }
1521
+
1522
+ $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: '.$param['w_field_label_pos'].'; 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_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;">';
1523
+
1524
+ if($param['w_flow']=='hor')
1525
+ {
1526
+ $rep.= '<div id="'.$id.'_hor" style="display: table-row;">';
1527
+ foreach($param['w_choices'] as $key => $choice)
1528
+ {
1529
+ $where ='';
1530
+ $order_by ='';
1531
+ $db_info = '';
1532
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1533
+ {
1534
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1535
+ $where = "where='".$w_choices_params[0]."'";
1536
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1537
+ $order_by = "order_by='".$w_choices_params[0]."'";
1538
+ $db_info = "db_info='".$w_choices_params[1]."'";
1539
+ }
1540
+
1541
+ $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>';
1542
+ }
1543
+ $rep.= '</div>';
1544
+ }
1545
+ else
1546
+ {
1547
+
1548
+ foreach($param['w_choices'] as $key => $choice)
1549
+ {
1550
+ $where ='';
1551
+ $order_by ='';
1552
+ $db_info ='';
1553
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1554
+ {
1555
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1556
+ $where = "where='".$w_choices_params[0]."'";
1557
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1558
+ $order_by = "order_by='".$w_choices_params[0]."'";
1559
+ $db_info = "db_info='".$w_choices_params[1]."'";
1560
+ }
1561
+
1562
+ $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>';
1563
+ }
1564
+
1565
+ }
1566
+ $rep.='</div></div>';
1567
+
1568
+ $rep.='<div id="'.$id.'_divform_id_temp">';
1569
+ if($param['w_quantity']=="yes")
1570
+ $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>';
1571
+ if($param['w_property'][0])
1572
+ foreach($param['w_property'] as $key => $property)
1573
+ {
1574
+ $rep.='
1575
+ <span id="'.$id.'_property_'.$key.'" style="margin-right: 15px;">
1576
+
1577
+ <label class="mini_label" id="'.$id.'_property_label_form_id_temp'.$key.'" style="margin-right: 5px;">'.$property.'</label>
1578
+ <select id="'.$id.'_propertyform_id_temp'.$key.'" name="'.$id.'_propertyform_id_temp'.$key.'" style="width: auto; margin: 2px 0px;" disabled>';
1579
+ $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
1580
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
1581
+ foreach($param['w_property_values'][$key] as $subkey => $property_value)
1582
+ {
1583
+ $rep.='<option id="'.$id.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'">'.$property_value.'</option>';
1584
+ }
1585
+ $rep.='</select></span>';
1586
+ }
1587
+
1588
+ $rep.='</div></div></div>';
1589
+ break;
1590
+ }
1591
+ case 'type_paypal_radio':
1592
+ {
1593
+
1594
+ $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');
1595
+ $temp=$params;
1596
+ if(strpos($temp, 'w_field_option_pos') > -1)
1597
+ $params_names=array('w_field_label_size','w_field_label_pos', 'w_field_option_pos', 'w_flow','w_choices','w_choices_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');
1598
+ foreach($params_names as $params_name )
1599
+ {
1600
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1601
+ $param[$params_name] = $temp[0];
1602
+ $temp=$temp[1];
1603
+ }
1604
+
1605
+ if($temp)
1606
+ {
1607
+ $temp =explode('*:*w_attr_name*:*',$temp);
1608
+ $attrs = array_slice($temp,0, count($temp)-1);
1609
+ foreach($attrs as $attr)
1610
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1611
+ }
1612
+ if(!isset($param['w_field_option_pos']))
1613
+ $param['w_field_option_pos'] = 'left';
1614
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1615
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1616
+ $param['w_choices'] = explode('***',$param['w_choices']);
1617
+
1618
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
1619
+
1620
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1621
+
1622
+ $param['w_property'] = explode('***',$param['w_property']);
1623
+ $param['w_property_values'] = explode('***',$param['w_property_values']);
1624
+
1625
+ if(isset($param['w_choices_params']))
1626
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1627
+
1628
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
1629
+ {
1630
+ if($choices_checked=='true')
1631
+ $param['w_choices_checked'][$key]='checked="checked"';
1632
+ else
1633
+ $param['w_choices_checked'][$key]='';
1634
+ }
1635
+
1636
+ $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: '.$param['w_field_label_pos'].'; 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_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;">';
1637
+
1638
+ if($param['w_flow']=='hor')
1639
+ {
1640
+ $rep.= '<div id="'.$id.'_hor" style="display: table-row;">';
1641
+ foreach($param['w_choices'] as $key => $choice)
1642
+ {
1643
+ $where ='';
1644
+ $order_by ='';
1645
+ $db_info ='';
1646
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1647
+ {
1648
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1649
+ $where = "where='".$w_choices_params[0]."'";
1650
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1651
+ $order_by = "order_by='".$w_choices_params[0]."'";
1652
+ $db_info = "db_info='".$w_choices_params[1]."'";
1653
+ }
1654
+
1655
+ $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>';
1656
+ }
1657
+ $rep.= '</div>';
1658
+ }
1659
+ else
1660
+ {
1661
+
1662
+ foreach($param['w_choices'] as $key => $choice)
1663
+ {
1664
+
1665
+ $where ='';
1666
+ $order_by ='';
1667
+ $db_info ='';
1668
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1669
+ {
1670
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1671
+ $where = "where='".$w_choices_params[0]."'";
1672
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1673
+ $order_by = "order_by='".$w_choices_params[0]."'";
1674
+ $db_info = "db_info='".$w_choices_params[1]."'";
1675
+ }
1676
+
1677
+ $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>';
1678
+ }
1679
+
1680
+ }
1681
+ $rep.='</div></div>';
1682
+
1683
+ $rep.='<div id="'.$id.'_divform_id_temp">';
1684
+ if($param['w_quantity']=="yes")
1685
+ $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>';
1686
+ if($param['w_property'][0])
1687
+ foreach($param['w_property'] as $key => $property)
1688
+ {
1689
+ $rep.='
1690
+ <span id="'.$id.'_property_'.$key.'" style="margin-right: 15px;">
1691
+
1692
+ <label class="mini_label" id="'.$id.'_property_label_form_id_temp'.$key.'" style="margin-right: 5px;">'.$property.'</label>
1693
+ <select id="'.$id.'_propertyform_id_temp'.$key.'" name="'.$id.'_propertyform_id_temp'.$key.'" style="width: auto; margin: 2px 0px;" disabled>';
1694
+ $param['w_property_values'][$key] = explode('###',$param['w_property_values'][$key]);
1695
+ $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key],1, count($param['w_property_values'][$key]));
1696
+ foreach($param['w_property_values'][$key] as $subkey => $property_value)
1697
+ {
1698
+ $rep.='<option id="'.$id.'_'.$key.'_option'.$subkey.'" value="'.$property_value.'">'.$property_value.'</option>';
1699
+ }
1700
+ $rep.='</select></span>';
1701
+ }
1702
+
1703
+ $rep.='</div></div></div>';
1704
+
1705
+ break;
1706
+ }
1707
+ case 'type_paypal_shipping':
1708
+ {
1709
+
1710
+ $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_class');
1711
+ $temp=$params;
1712
+ if(strpos($temp, 'w_field_option_pos') > -1)
1713
+ $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_choices_params','w_class');
1714
+ foreach($params_names as $params_name )
1715
+ {
1716
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1717
+ $param[$params_name] = $temp[0];
1718
+ $temp=$temp[1];
1719
+ }
1720
+
1721
+ if($temp)
1722
+ {
1723
+ $temp =explode('*:*w_attr_name*:*',$temp);
1724
+ $attrs = array_slice($temp,0, count($temp)-1);
1725
+ foreach($attrs as $attr)
1726
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1727
+ }
1728
+ if(!isset($param['w_field_option_pos']))
1729
+ $param['w_field_option_pos'] = 'left';
1730
+
1731
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1732
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1733
+ $param['w_choices'] = explode('***',$param['w_choices']);
1734
+
1735
+ $param['w_choices_price'] = explode('***',$param['w_choices_price']);
1736
+
1737
+ $param['w_choices_checked'] = explode('***',$param['w_choices_checked']);
1738
+
1739
+ if(isset($param['w_choices_params']))
1740
+ $param['w_choices_params'] = explode('***',$param['w_choices_params']);
1741
+
1742
+ foreach($param['w_choices_checked'] as $key => $choices_checked )
1743
+ {
1744
+ if($choices_checked=='true')
1745
+ $param['w_choices_checked'][$key]='checked="checked"';
1746
+ else
1747
+ $param['w_choices_checked'][$key]='';
1748
+ }
1749
+
1750
+ $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: '.$param['w_field_label_pos'].'; 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_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;">';
1751
+
1752
+ if($param['w_flow']=='hor')
1753
+ {
1754
+ $rep.= '<div id="'.$id.'_hor" style="display: table-row;">';
1755
+ foreach($param['w_choices'] as $key => $choice)
1756
+ {
1757
+ $where ='';
1758
+ $order_by ='';
1759
+ $db_info ='';
1760
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1761
+ {
1762
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1763
+ $where = "where='".$w_choices_params[0]."'";
1764
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1765
+ $order_by = "order_by='".$w_choices_params[0]."'";
1766
+ $db_info = "db_info='".$w_choices_params[1]."'";
1767
+ }
1768
+
1769
+ $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>';
1770
+ }
1771
+ $rep.= '</div>';
1772
+ }
1773
+ else
1774
+ {
1775
+
1776
+ foreach($param['w_choices'] as $key => $choice)
1777
+ {
1778
+ $where ='';
1779
+ $order_by ='';
1780
+ $db_info ='';
1781
+ if(isset($param['w_choices_params']) && $param['w_choices_params'][$key])
1782
+ {
1783
+ $w_choices_params = explode('[where_order_by]',$param['w_choices_params'][$key]);
1784
+ $where = "where='".$w_choices_params[0]."'";
1785
+ $w_choices_params = explode('[db_info]',$w_choices_params[1]);
1786
+ $order_by = "order_by='".$w_choices_params[0]."'";
1787
+ $db_info = "db_info='".$w_choices_params[1]."'";
1788
+ }
1789
+
1790
+ $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>';
1791
+ }
1792
+
1793
+ }
1794
+ $rep.='</div></div>';
1795
+
1796
+ $rep.='</div></div>';
1797
+
1798
+ break;
1799
+ }
1800
+ case 'type_paypal_total':
1801
+ {
1802
+ $params_names=array('w_field_label_size','w_field_label_pos','w_class');
1803
+ $temp=$params;
1804
+ foreach($params_names as $params_name )
1805
+ {
1806
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1807
+ $param[$params_name] = $temp[0];
1808
+ $temp=$temp[1];
1809
+ }
1810
+
1811
+ if($temp)
1812
+ {
1813
+ $temp =explode('*:*w_attr_name*:*',$temp);
1814
+ $attrs = array_slice($temp,0, count($temp)-1);
1815
+ foreach($attrs as $attr)
1816
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1817
+ }
1818
+
1819
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1820
+
1821
+
1822
+
1823
+ $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: '.$param['w_field_label_pos'].'; 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"><div id="'.$id.'paypal_totalform_id_temp" class="wdform_paypal_total paypal_totalform_id_temp"><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>';
1824
+
1825
+
1826
+ break;
1827
+ }
1828
+
1829
+ case 'type_star_rating':
1830
+ {
1831
+ $params_names=array('w_field_label_size','w_field_label_pos','w_field_label_col','w_star_amount','w_required','w_class');
1832
+ $temp=$params;
1833
+ foreach($params_names as $params_name )
1834
+ {
1835
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1836
+ $param[$params_name] = $temp[0];
1837
+ $temp=$temp[1];
1838
+ }
1839
+
1840
+ if($temp)
1841
+ {
1842
+ $temp =explode('*:*w_attr_name*:*',$temp);
1843
+ $attrs = array_slice($temp,0, count($temp)-1);
1844
+ foreach($attrs as $attr)
1845
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1846
+ }
1847
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1848
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1849
+
1850
+
1851
+ $images = '';
1852
+ for($i=0; $i<$param['w_star_amount']; $i++)
1853
+ {
1854
+ $images .= '<img id="'.$id.'_star_'.$i.'" src="' . WD_FM_URL . '/images/star.png" 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;)">';
1855
+ }
1856
+
1857
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
1858
+
1859
+
1860
+ break;
1861
+ }
1862
+ case 'type_scale_rating':
1863
+ {
1864
+ $params_names=array('w_field_label_size','w_field_label_pos','w_mini_labels','w_scale_amount','w_required','w_class');
1865
+ $temp=$params;
1866
+ foreach($params_names as $params_name )
1867
+ {
1868
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1869
+ $param[$params_name] = $temp[0];
1870
+ $temp=$temp[1];
1871
+ }
1872
+
1873
+ if($temp)
1874
+ {
1875
+ $temp =explode('*:*w_attr_name*:*',$temp);
1876
+ $attrs = array_slice($temp,0, count($temp)-1);
1877
+ foreach($attrs as $attr)
1878
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1879
+ }
1880
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1881
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1882
+
1883
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
1884
+
1885
+ $numbers = '';
1886
+ for($i=1; $i<=$param['w_scale_amount']; $i++)
1887
+ {
1888
+ $numbers .= '<div id="'.$id.'_scale_td1_'.$i.'form_id_temp" style="text-align: center; display: table-cell;"><span>'.$i.'</span></div>';
1889
+ }
1890
+
1891
+
1892
+ $radio_buttons = '';
1893
+ for($k=1; $k<=$param['w_scale_amount']; $k++)
1894
+ {
1895
+ $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>';
1896
+ }
1897
+
1898
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
1899
+
1900
+ break;
1901
+ }
1902
+ case 'type_spinner':
1903
+ {
1904
+ $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');
1905
+ $temp=$params;
1906
+ foreach($params_names as $params_name ) {
1907
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
1908
+ $param[$params_name] = $temp[0];
1909
+ $temp=$temp[1];
1910
+ }
1911
+ if($temp) {
1912
+ $temp =explode('*:*w_attr_name*:*',$temp);
1913
+ $attrs = array_slice($temp,0, count($temp)-1);
1914
+ foreach($attrs as $attr)
1915
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1916
+ }
1917
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1918
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1919
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
1920
+ break;
1921
+ }
1922
+ case 'type_slider': {
1923
+ $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');
1924
+ $temp=$params;
1925
+ foreach($params_names as $params_name ) {
1926
+ $temp = explode('*:*'.$params_name.'*:*',$temp);
1927
+ $param[$params_name] = $temp[0];
1928
+ $temp=$temp[1];
1929
+ }
1930
+ if ($temp) {
1931
+ $temp = explode('*:*w_attr_name*:*', $temp);
1932
+ $attrs = array_slice($temp,0, count($temp)-1);
1933
+ foreach($attrs as $attr) {
1934
+ $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1935
+ }
1936
+ }
1937
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1938
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1939
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
1940
+ break;
1941
+ }
1942
+ case 'type_range': {
1943
+ $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');
1944
+ $temp = $params;
1945
+ foreach ($params_names as $params_name ) {
1946
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1947
+ $param[$params_name] = $temp[0];
1948
+ $temp = $temp[1];
1949
+ }
1950
+ if ($temp) {
1951
+ $temp = explode('*:*w_attr_name*:*', $temp);
1952
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1953
+ foreach($attrs as $attr) {
1954
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1955
+ }
1956
+ }
1957
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
1958
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
1959
+ $w_mini_labels = explode('***',$param['w_mini_labels']);
1960
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
1961
+ break;
1962
+ }
1963
+ case 'type_grading': {
1964
+ $params_names = array('w_field_label_size', 'w_field_label_pos', 'w_items', 'w_total', 'w_required', 'w_class');
1965
+ $temp = $params;
1966
+ foreach($params_names as $params_name) {
1967
+ $temp = explode('*:*' . $params_name . '*:*', $temp);
1968
+ $param[$params_name] = $temp[0];
1969
+ $temp = $temp[1];
1970
+ }
1971
+ if ($temp) {
1972
+ $temp = explode('*:*w_attr_name*:*', $temp);
1973
+ $attrs = array_slice($temp, 0, count($temp) - 1);
1974
+ foreach ($attrs as $attr) {
1975
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
1976
+ }
1977
+ }
1978
+ $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1979
+ $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1980
+ $w_items = explode('***', $param['w_items']);
1981
+ $grading_items = '';
1982
+ for($i=0; $i<count($w_items); $i++)
1983
+ {
1984
+ $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>';
1985
+ }
1986
+
1987
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
1988
+
1989
+ break;
1990
+ }
1991
+ case 'type_matrix': {
1992
+ $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');
1993
+ $temp = $params;
1994
+ foreach ($params_names as $params_name) {
1995
+ $temp = explode('*:*'.$params_name.'*:*',$temp);
1996
+ $param[$params_name] = $temp[0];
1997
+ $temp = $temp[1];
1998
+ }
1999
+ if ($temp) {
2000
+ $temp = explode('*:*w_attr_name*:*', $temp);
2001
+ $attrs = array_slice($temp, 0, count($temp) - 1);
2002
+ foreach ($attrs as $attr) {
2003
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
2004
+ }
2005
+ }
2006
+ $param['w_field_label_pos'] = ($param['w_field_label_pos']=="left" ? "table-cell" : "block");
2007
+ $required_sym = ($param['w_required']=="yes" ? " *" : "");
2008
+ $param['w_textbox_size'] = isset($param['w_textbox_size']) ? $param['w_textbox_size'] : '100';
2009
+ $w_rows = explode('***',$param['w_rows']);
2010
+ $w_columns = explode('***',$param['w_columns']);
2011
+ $column_labels = '';
2012
+ for ($i = 1; $i < count($w_columns); $i++) {
2013
+ $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>';
2014
+ }
2015
+ $rows_columns = '';
2016
+ for($i=1; $i<count($w_rows); $i++)
2017
+ {
2018
+
2019
+ $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>';
2020
+
2021
+
2022
+ for($k=1; $k<count($w_columns); $k++)
2023
+ {
2024
+ if($param['w_field_input_type']=='radio')
2025
+ $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>';
2026
+ else
2027
+ if($param['w_field_input_type']=='checkbox')
2028
+ $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>';
2029
+ else
2030
+ if($param['w_field_input_type']=='text')
2031
+ $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>';
2032
+ else
2033
+ if($param['w_field_input_type']=='select')
2034
+ $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>';
2035
+
2036
+ }
2037
+
2038
+ $rows_columns .= '</div>';
2039
+ }
2040
+
2041
+
2042
+
2043
+ $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: '.$param['w_field_label_pos'].'; 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_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>';
2044
+
2045
+ break;
2046
+ }
2047
+ case 'type_submit_reset': {
2048
+ $params_names=array('w_submit_title','w_reset_title','w_class','w_act');
2049
+ $temp=$params;
2050
+ foreach ($params_names as $params_name) {
2051
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2052
+ $param[$params_name] = $temp[0];
2053
+ $temp=$temp[1];
2054
+ }
2055
+ if ($temp) {
2056
+ $temp = explode('*:*w_attr_name*:*',$temp);
2057
+ $attrs = array_slice($temp,0, count($temp)-1);
2058
+ foreach ($attrs as $attr) {
2059
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
2060
+ }
2061
+ }
2062
+ $param['w_act'] = ($param['w_act']=="false" ? 'style="display: none;"' : "");
2063
+ $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'].'" onclick="check_required(&quot;submit&quot;, &quot;form_id_temp&quot;);" '.$param['attributes'].'>'.$param['w_submit_title'].'</button><button type="button" class="button-reset" id="'.$id.'_element_resetform_id_temp" value="'.$param['w_reset_title'].'" onclick="check_required(&quot;reset&quot;);" '.$param['w_act'].' '.$param['attributes'].'>'.$param['w_reset_title'].'</button></div></div>';
2064
+ break;
2065
+ }
2066
+ case 'type_button': {
2067
+ $params_names=array('w_title','w_func','w_class');
2068
+ $temp=$params;
2069
+ foreach($params_names as $params_name) {
2070
+ $temp=explode('*:*'.$params_name.'*:*',$temp);
2071
+ $param[$params_name] = $temp[0];
2072
+ $temp=$temp[1];
2073
+ }
2074
+ if ($temp) {
2075
+ $temp = explode('*:*w_attr_name*:*',$temp);
2076
+ $attrs = array_slice($temp,0, count($temp)-1);
2077
+ foreach($attrs as $attr) {
2078
+ $param['attributes'] = $param['attributes'].' add_'.$attr;
2079
+ }
2080
+ }
2081
+ $param['w_title'] = explode('***',$param['w_title']);
2082
+ $param['w_func'] = explode('***',$param['w_func']);
2083
+ $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">';
2084
+ foreach ($param['w_title'] as $key => $title) {
2085
+ $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>';
2086
+ }
2087
+ $rep .= '</div></div>';
2088
+ break;
2089
+ }
2090
+ }
2091
+
2092
+ $form = str_replace('%' . $id . ' - ' . $labels[$ids_key] . '%', $rep, $form);
2093
+ $form = str_replace('%' . $id . ' -' . $labels[$ids_key] . '%', $rep, $form);
2094
+ $row->form_front = $form;
2095
+ }
2096
+ }
2097
+ }
2098
+ else {
2099
+ $row = new stdClass();
2100
+ $row->id = 0;
2101
+ $row->backup_id ='';
2102
+ $row->title = '';
2103
+ $row->mail = '';
2104
+ $row->form = '';
2105
+ $row->form_front = '';
2106
+ $row->theme = 0;
2107
+ $row->javascript = '';
2108
+ $row->submit_text = '';
2109
+ $row->url = '';
2110
+ $row->submit_text_type = 0;
2111
+ $row->script1 = '';
2112
+ $row->script2 = '';
2113
+ $row->script_user1 = '';
2114
+ $row->script_user2 = '';
2115
+ $row->counter = 0;
2116
+ $row->label_order = '';
2117
+ $row->article_id = '';
2118
+ $row->pagination = '';
2119
+ $row->show_title = '';
2120
+ $row->show_numbers = '';
2121
+ $row->public_key = '';
2122
+ $row->private_key = '';
2123
+ $row->recaptcha_theme = '';
2124
+ $row->from_name = '';
2125
+ $row->from_mail = '';
2126
+ $row->label_order_current = '';
2127
+ $row->script_mail_user = '';
2128
+ $row->script_mail = '';
2129
+ $row->tax = 0;
2130
+ $row->payment_currency = '$';
2131
+ $row->paypal_email = '';
2132
+ $row->checkout_mode = 'testmode';
2133
+ $row->paypal_mode = 0;
2134
+
2135
+ $row->published = 1;
2136
+ $row->form_fields = '';
2137
+ $row->savedb = 1;
2138
+ $row->sendemail = 1;
2139
+ $row->requiredmark = '*';
2140
+ $row->reply_to = 0;
2141
+ $row->send_to = 0;
2142
+ $row->autogen_layout = 1;
2143
+ $row->custom_front = '';
2144
+ $row->mail_from_user = '';
2145
+ $row->mail_from_name_user = '';
2146
+ $row->reply_to_user = '';
2147
+
2148
+ $row->condition = '';
2149
+ $row->mail_cc = '';
2150
+ $row->mail_cc_user = '';
2151
+ $row->mail_bcc = '';
2152
+ $row->mail_bcc_user = '';
2153
+ $row->mail_subject = '';
2154
+ $row->mail_subject_user = '';
2155
+ $row->mail_mode = 1;
2156
+ $row->mail_mode_user = 1;
2157
+ $row->mail_attachment = 1;
2158
+ $row->mail_attachment_user = 1;
2159
+
2160
+ $row->user_id_wd = '';
2161
+ $row->sortable = 1;
2162
+ $row->frontend_submit_fields = '';
2163
+ $row->frontend_submit_stat_fields = '';
2164
+ }
2165
+ return $row;
2166
+ }
2167
+
2168
+ public function get_theme_rows_data($old = '') {
2169
+ global $wpdb;
2170
+ $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_themes WHERE css " . ($old ? 'NOT' : '') . " LIKE '%.wdform_section%' ORDER BY title");
2171
+ return $rows;
2172
+ }
2173
+
2174
+ public function get_queries_rows_data($id) {
2175
+ global $wpdb;
2176
+ $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=" . $id . " ORDER BY id ASC");
2177
+ return $rows;
2178
+ }
2179
+
2180
+ public function get_labels($id) {
2181
+ global $wpdb;
2182
+ $rows = $wpdb->get_col("SELECT DISTINCT `element_label` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=" . $id);
2183
+ return $rows;
2184
+ }
2185
+
2186
+ public function is_paypal($id) {
2187
+ global $wpdb;
2188
+ $rows = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_sessions WHERE form_id=" . $id);
2189
+ return $rows;
2190
+ }
2191
+
2192
+ public function page_nav() {
2193
+ global $wpdb;
2194
+ $where = 'WHERE `id` NOT IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')';
2195
+ $where .= ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? ' AND title LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
2196
+ $query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker " . $where;
2197
+ $total = $wpdb->get_var($query);
2198
+ $page_nav['total'] = $total;
2199
+ if (isset($_POST['page_number']) && $_POST['page_number']) {
2200
+ $limit = ((int) $_POST['page_number'] - 1) * 20;
2201
+ }
2202
+ else {
2203
+ $limit = 0;
2204
+ }
2205
+ $page_nav['limit'] = (int) ($limit / 20 + 1);
2206
+ return $page_nav;
2207
+ }
2208
+ ////////////////////////////////////////////////////////////////////////////////////////
2209
+ // Getters & Setters //
2210
+ ////////////////////////////////////////////////////////////////////////////////////////
2211
+ ////////////////////////////////////////////////////////////////////////////////////////
2212
+ // Private Methods //
2213
+ ////////////////////////////////////////////////////////////////////////////////////////
2214
+ ////////////////////////////////////////////////////////////////////////////////////////
2215
+ // Listeners //
2216
+ ////////////////////////////////////////////////////////////////////////////////////////
2217
+ }
admin/models/FMModelSelect_data_from_db.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,659 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $rows_ord = array();
62
+ $join = '';
63
+ for ($i = 0; $i < 8; $i++) {
64
+ array_push($labels_parameters, NULL);
65
+ }
66
+ $sorted_label_names = array();
67
+ $sorted_label_names_original = array();
68
+ $where_labels = array();
69
+ $where2 = array();
70
+ $order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
71
+ $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
72
+ $limit = ((isset($_POST['page_number'])) ? ((int) $_POST['page_number'] - 1) * 20 : 0);
73
+ $lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : '');
74
+ $lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : '');
75
+ $lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : '');
76
+ $lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : '');
77
+
78
+ $lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : '');
79
+ $lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : '');
80
+ $lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : '');
81
+
82
+ if ($lists['ip_search']) {
83
+ $where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"';
84
+ }
85
+ if ($lists['startdate'] != '') {
86
+ $where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' ";
87
+ }
88
+ if ($lists['enddate'] != '') {
89
+ $where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' ";
90
+ }
91
+
92
+
93
+ if ($lists['username_search']) {
94
+ $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%'.$lists['username_search'].'%")';
95
+ }
96
+ if ($lists['useremail_search']) {
97
+ $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%'.$lists['useremail_search'].'%")';
98
+ }
99
+
100
+ if ($lists['id_search']) {
101
+ $where[] = 'group_id ='.$lists['id_search'];
102
+ }
103
+
104
+ $where[] = 'form_id=' . $form_id . '';
105
+ $where = (count($where) ? ' ' . implode(' AND ', $where) : '');
106
+ if ($order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip') {
107
+ $orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . '';
108
+ }elseif($order_by == 'display_name' or $order_by == 'user_email'){
109
+ $orderby = ' ORDER BY (SELECT '.$order_by.' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) '. $asc_or_desc .'';
110
+ }
111
+ else {
112
+ $orderby = "";
113
+ }
114
+ if ($form_id) {
115
+ for($i = 0; $i < 8; $i++) {
116
+ array_pop($labels_parameters);
117
+ }
118
+ $query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE ". $where;
119
+ $results = $wpdb->get_results($query);
120
+ for ($i = 0; $i < count($results); $i++) {
121
+ array_push($labels, $results[$i]->element_label);
122
+ }
123
+ $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id));
124
+ if (strpos($form->label_order, 'type_paypal_')) {
125
+ $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#****#";
126
+ }
127
+ $form_labels = explode('#****#', $form->label_order);
128
+ $form_labels = array_slice($form_labels, 0, count($form_labels) - 1);
129
+ foreach ($form_labels as $key => $form_label) {
130
+ $label_id = explode('#**id**#', $form_label);
131
+ array_push($labels_id, $label_id[0]);
132
+ $label_name_type = explode('#**label**#', $label_id[1]);
133
+ array_push($label_names_original, $label_name_type[0]);
134
+ $ptn = "/[^a-zA-Z0-9_]/";
135
+ $rpltxt = "";
136
+ $label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]);
137
+ array_push($label_names, $label_name);
138
+ array_push($label_types, $label_name_type[1]);
139
+ }
140
+ foreach ($labels_id as $key => $label_id) {
141
+ if (in_array($label_id, $labels)) {
142
+ if (!in_array($label_id, $sorted_labels_id)) {
143
+ array_push($sorted_labels_id, $label_id);
144
+ }
145
+ array_push($sorted_label_names, $label_names[$key]);
146
+ array_push($sorted_label_types, $label_types[$key]);
147
+ array_push($sorted_label_names_original, $label_names_original[$key]);
148
+ if (isset($_POST[$form_id . '_' . $label_id . '_search'])) {
149
+ $search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']);
150
+ }
151
+ else {
152
+ $search_temp = '';
153
+ }
154
+ $search_temp = strtolower($search_temp);
155
+ $lists[$form_id . '_' . $label_id . '_search'] = $search_temp;
156
+ if ($search_temp) {
157
+ $join_query[] = 'search';
158
+ $join_where[] = array('label' => $label_id, 'search' => $search_temp);
159
+ }
160
+ }
161
+ }
162
+ if (strpos($order_by, "_field")) {
163
+ if (in_array(str_replace("_field", "", $order_by), $labels)) {
164
+ $join_query[] = 'sort';
165
+ $join_where[] = array('label'=>str_replace("_field", "", $order_by));
166
+ }
167
+ }
168
+ $cols = 'group_id';
169
+ if ($order_by == 'date' or $order_by == 'ip') {
170
+ $cols = 'group_id, date, ip';
171
+ }
172
+ switch (count($join_query)) {
173
+ case 0:
174
+ $join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '. $where;
175
+ break;
176
+ case 1:
177
+ if ($join_query[0] == 'sort') {
178
+ $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" ';
179
+ $join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" ';
180
+ $orderby = ' ORDER BY `element_value` ' . $asc_or_desc;
181
+ }
182
+ else {
183
+ $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . $join_where[0]['label'] . '" AND element_value LIKE "%' . $join_where[0]['search'] . '%" AND ' . $where;
184
+ }
185
+ break;
186
+ default:
187
+ $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'] . '%" ) as t ';
188
+ for ($key = 1; $key < count($join_query); $key++) {
189
+ if ($join_query[$key] == 'sort') {
190
+ $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 ';
191
+ $orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . '';
192
+ }
193
+ else {
194
+ $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'] . '%" ) as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
195
+ }
196
+ }
197
+ break;
198
+ }
199
+ $pos = strpos($join, 'SELECT t.group_id');
200
+ if ($pos === FALSE) {
201
+ $query = str_replace(array('SELECT group_id','SELECT distinct group_id'), array('SELECT count(distinct group_id)','SELECT count(distinct group_id)'), $join);
202
+ }
203
+ else {
204
+ $query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join);
205
+ }
206
+ $total = $wpdb->get_var($query);
207
+ $query = $join . ' ' . $orderby . ' limit ' . $limit . ', 20 ';
208
+ $results = $wpdb->get_results($query);
209
+ for ($i = 0; $i < count($results); $i++) {
210
+ array_push($rows_ord, $results[$i]->group_id);
211
+ }
212
+ $where2 = array();
213
+ $where2[] = "group_id='0'";
214
+ foreach ($rows_ord as $rows_ordd) {
215
+ $where2[] = "group_id='" . $rows_ordd . "'";
216
+ }
217
+ $where2 = (count($where2) ? ' WHERE ' . implode( ' OR ', $where2 ) . '' : '' );
218
+ $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
219
+ $rows = $wpdb->get_results($query);
220
+ $group_ids = $rows_ord;
221
+ $lists['total'] = $total;
222
+ $lists['limit'] = (int) ($limit / 20 + 1);
223
+ $where_choices = $where;
224
+ array_push($labels_parameters, $sorted_labels_id);
225
+ array_push($labels_parameters, $sorted_label_types);
226
+ array_push($labels_parameters, $lists);
227
+ array_push($labels_parameters, $sorted_label_names);
228
+ array_push($labels_parameters, $sorted_label_names_original);
229
+ array_push($labels_parameters, $rows);
230
+ array_push($labels_parameters, $group_ids);
231
+ array_push($labels_parameters, $where_choices);
232
+ }
233
+ return $labels_parameters;
234
+ }
235
+
236
+ public function get_type_address($sorted_label_type, $sorted_label_name_original) {
237
+ if ($sorted_label_type == 'type_address') {
238
+ switch ($sorted_label_name_original) {
239
+ case 'Street Line':
240
+ $field_title = __('Street Address', 'form_maker');
241
+ break;
242
+ case 'Street Line2':
243
+ $field_title = __('Street Address Line 2', 'form_maker');
244
+ break;
245
+ case 'City':
246
+ $field_title = __('City', 'form_maker');
247
+ break;
248
+ case 'State':
249
+ $field_title = __('State / Province / Region', 'form_maker');
250
+ break;
251
+ case 'Postal':
252
+ $field_title = __('Postal / Zip Code', 'form_maker');
253
+ break;
254
+ case 'Country':
255
+ $field_title = __('Country', 'form_maker');
256
+ break;
257
+ default :
258
+ $field_title = stripslashes($sorted_label_name_original);
259
+ break;
260
+ }
261
+ }
262
+ else {
263
+ $field_title = stripslashes($sorted_label_name_original);
264
+ }
265
+ return $field_title;
266
+ }
267
+
268
+ public function hide_or_not($hide_strings,$hide_string) {
269
+ if (strpos($hide_string,'@') === FALSE) {
270
+ if (strpos($hide_strings, '@' . $hide_string . '@') === FALSE) {
271
+ $style = '';
272
+ }
273
+ else {
274
+ $style = 'style="display:none"';
275
+ }
276
+ }
277
+ else {
278
+ if (strpos($hide_strings, $hide_string) === FALSE) {
279
+ $style = '';
280
+ }
281
+ else {
282
+ $style = 'style="display:none"';
283
+ }
284
+ }
285
+ return $style;
286
+ }
287
+
288
+ public function sort_group_ids($sorted_label_names_count, $group_ids) {
289
+ $count_labe = $sorted_label_names_count;
290
+ $group_id_s = array();
291
+ $l = 0;
292
+ if (count($group_ids) > 0 and $count_labe) {
293
+ for ($i = 0; $i < count($group_ids); $i++) {
294
+ if (!in_array($group_ids[$i], $group_id_s)) {
295
+ array_push($group_id_s, $group_ids[$i]);
296
+ }
297
+ }
298
+ }
299
+ return $group_id_s;
300
+ }
301
+
302
+ public function array_for_group_id($group, $rows) {
303
+ $i = $group;
304
+ $count_rows = count($rows);
305
+ $temp = array();
306
+ for ($j = 0; $j < $count_rows; $j++) {
307
+ $row = $rows[$j];
308
+ if ($row->group_id == $i) {
309
+ array_push($temp, $row);
310
+ }
311
+ }
312
+ return $temp;
313
+ }
314
+
315
+ public function check_radio_type($sorted_label_type) {
316
+ 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") {
317
+ return TRUE;
318
+ }
319
+ else {
320
+ return FALSE;
321
+ }
322
+ }
323
+
324
+ public function statistic_for_radio($where_choices, $sorted_label_id) {
325
+ global $wpdb;
326
+ $choices_params = array();
327
+ $query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where_choices . " AND element_label='" . $sorted_label_id . "'";
328
+ $choices = $wpdb->get_results($query);
329
+ $colors = array(
330
+ '#2CBADE',
331
+ '#FE6400'
332
+ );
333
+ $choices_labels = array();
334
+ $choices_count = array();
335
+ $all = count($choices);
336
+ $unanswered = 0;
337
+ foreach ($choices as $key => $choice) {
338
+ if ($choice->element_value == '') {
339
+ $unanswered++;
340
+ }
341
+ else {
342
+ if (!in_array($choice->element_value, $choices_labels)) {
343
+ array_push($choices_labels, $choice->element_value);
344
+ array_push($choices_count, 0);
345
+ }
346
+ $choices_count[array_search($choice->element_value, $choices_labels)]++;
347
+ }
348
+ }
349
+ array_multisort($choices_count, SORT_DESC, $choices_labels);
350
+ array_push($choices_params, $choices_count);
351
+ array_push($choices_params, $choices_labels);
352
+ array_push($choices_params, $unanswered);
353
+ array_push($choices_params, $all);
354
+ array_push($choices_params, $colors);
355
+ return $choices_params;
356
+ }
357
+
358
+ public function get_data_of_group_id($id) {
359
+ global $wpdb;
360
+ $query = "SELECT * FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id=" . $id;
361
+ $rows = $wpdb->get_results($query);
362
+ $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=" . $rows[0]->form_id);
363
+ $params = array();
364
+ $label_id = array();
365
+ $label_order_original = array();
366
+ $label_type = array();
367
+ $ispaypal = strpos($form->label_order, 'type_paypal_');
368
+ if ($form->paypal_mode == 1) {
369
+ if ($ispaypal) {
370
+ $form->label_order = $form->label_order."0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
371
+ }
372
+ }
373
+ $label_all = explode('#****#', $form->label_order);
374
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
375
+ foreach ($label_all as $key => $label_each) {
376
+ $label_id_each = explode('#**id**#', $label_each);
377
+ array_push($label_id, $label_id_each[0]);
378
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
379
+ array_push($label_order_original, $label_oder_each[0]);
380
+ array_push($label_type, $label_oder_each[1]);
381
+ }
382
+ /*$theme_id = $wpdb->get_var("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form->id . "'");*/
383
+ $css = $wpdb->get_var("SELECT css FROM " . $wpdb->prefix . "formmaker_themes");
384
+ array_push($params, $rows);
385
+ array_push($params, $label_id);
386
+ array_push($params, $label_order_original);
387
+ array_push($params, $label_type);
388
+ array_push($params, $ispaypal);
389
+ array_push($params, $form);
390
+ array_push($params, $css);
391
+ return $params;
392
+ }
393
+
394
+ public function check_type_for_edit_function($label_type) {
395
+ 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') {
396
+ return TRUE;
397
+ }
398
+ else {
399
+ return FALSE;
400
+ }
401
+ }
402
+
403
+ public function check_for_submited_label($rows, $label_id) {
404
+ foreach ($rows as $row) {
405
+ if ($row->element_label == $label_id) {
406
+ $element_value = $row->element_value;
407
+ break;
408
+ }
409
+ else {
410
+ $element_value = 'continue';
411
+ }
412
+ }
413
+ return $element_value;
414
+ }
415
+
416
+ public function view_for_star_rating($element_value, $element_label) {
417
+ $view_star_rating_array = array();
418
+ $new_filename = str_replace("***star_rating***", '', $element_value);
419
+ $stars = "";
420
+ $new_filename=explode('***', $new_filename);
421
+ for ($j = 0; $j < $new_filename[1]; $j++) {
422
+ $stars .= '<img id="' . $element_label . '_star_' . $j . '" src="' . WD_FM_URL . '/images/star_' . $new_filename[2] . '.png" /> ';
423
+ }
424
+ for ($k = $new_filename[1]; $k < $new_filename[0]; $k++) {
425
+ $stars .= '<img id="' . $element_label . '_star_' . $k . '" src="' . WD_FM_URL . '/images/star.png" /> ';
426
+ }
427
+ array_push($view_star_rating_array, $stars);
428
+ return $view_star_rating_array;
429
+ }
430
+
431
+ public function view_for_grading($element_value) {
432
+ $view_grading_array = array();
433
+ $new_filename = str_replace("***grading***", '', $element_value);
434
+ $grading = explode(":", $new_filename);
435
+ $items_count = sizeof($grading) - 1;
436
+ $items = "";
437
+ $total = "";
438
+ for ($k = 0; $k < $items_count / 2; $k++) {
439
+ $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
440
+ $total += $grading[$k];
441
+ }
442
+ $items .= "Total: " . $total;
443
+ array_push($view_grading_array, $items);
444
+ return $view_grading_array;
445
+ }
446
+
447
+ public function images_for_star_rating($element_value, $label_id) {
448
+ $edit_stars = "";
449
+ $star_rating_array = array();
450
+ $element_value1 = str_replace("***star_rating***", '', $element_value);
451
+ $stars_value = explode('***', $element_value1);
452
+ for ($j = 0; $j < $stars_value[1]; $j++) {
453
+ $edit_stars .= '<img id="'.$label_id.'_star_'.$j.'" onclick="edit_star_rating('.$j.','.$label_id.')" src="' . WD_FM_URL . '/images/star_'.$stars_value[2].'.png" /> ';
454
+ }
455
+ for( $k=$stars_value[1];$k<$stars_value[0];$k++) {
456
+ $edit_stars .= '<img id="'.$label_id.'_star_'.$k.'" onclick="edit_star_rating('.$k.','.$label_id.')" src="' . WD_FM_URL . '/images/star.png" /> ';
457
+ }
458
+ array_push($star_rating_array, $edit_stars);
459
+ array_push($star_rating_array, $stars_value);
460
+ return $star_rating_array;
461
+ }
462
+
463
+ public function params_for_scale_rating($element_value, $label_id) {
464
+ $scale_rating_array = array();
465
+ $scale_radio = explode('/', $element_value);
466
+ $scale_value = $scale_radio[0];
467
+ $scale = '<table><tr>';
468
+ for ($k = 1; $k <= $scale_radio[1]; $k++) {
469
+ $scale .= '<td style="text-align:center"><span>' . $k . '</span></td>';
470
+ }
471
+ $scale .= '<tr></tr>';
472
+ for ($l = 1; $l <= $scale_radio[1]; $l++) {
473
+ if ($l == $scale_radio[0]) {
474
+ $checked = "checked";
475
+ }
476
+ else {
477
+ $checked = "";
478
+ }
479
+ $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>';
480
+ }
481
+ $scale .= '</tr></table>';
482
+ array_push($scale_rating_array, $scale);
483
+ array_push($scale_rating_array, $scale_radio);
484
+ array_push($scale_rating_array, $checked);
485
+ return $scale_rating_array;
486
+ }
487
+
488
+ public function params_for_type_range($element_value, $label_id) {
489
+ $range_value = explode('-', $element_value);
490
+ $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"/>';
491
+ return $range;
492
+ }
493
+
494
+ public function params_for_type_grading($element_value, $label_id) {
495
+ $type_grading_array = array();
496
+ $element_value1 = str_replace("***grading***", '', $element_value);
497
+ $garding_value = explode(':', $element_value1);
498
+ $items_count = sizeof($garding_value) - 1;
499
+ $garding = "";
500
+ $sum = "";
501
+ for ($k = 0; $k < $items_count/2; $k++) {
502
+ $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>';
503
+ $sum += $garding_value[$k];
504
+ }
505
+ array_push($type_grading_array, $garding);
506
+ array_push($type_grading_array, $garding_value);
507
+ array_push($type_grading_array, $sum);
508
+ array_push($type_grading_array, $items_count);
509
+ array_push($type_grading_array, $element_value1);
510
+ return $type_grading_array;
511
+ }
512
+
513
+ public function params_for_type_matrix($element_value, $label_id) {
514
+ $type_matrix_array = array();
515
+ $new_filename = str_replace("***matrix***", '', $element_value);
516
+ $matrix_value = explode('***', $new_filename);
517
+ $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
518
+ $mat_rows = $matrix_value[0];
519
+ $mat_columns = $matrix_value[$mat_rows + 1];
520
+ $matrix = "<table>";
521
+ $matrix .= '<tr><td></td>';
522
+ for ($k = 1; $k <= $mat_columns; $k++) {
523
+ $matrix .= '<td style="background-color:#BBBBBB; padding:5px; border:1px; ">'.$matrix_value[$mat_rows+1+$k].'</td>';
524
+ }
525
+ $matrix .= '</tr>';
526
+ $aaa = Array();
527
+ $var_checkbox = 1;
528
+ $selected_value = "";
529
+ $selected_value_yes = "";
530
+ $selected_value_no = "";
531
+ for ($k = 1; $k <= $mat_rows; $k++) {
532
+ $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px; border:1px;">'.$matrix_value[$k].'</td>';
533
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
534
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
535
+ $checked = "";
536
+ $aaa[1] = "";
537
+ }
538
+ else {
539
+ $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
540
+ }
541
+ for ($l = 1; $l <= $mat_columns; $l++) {
542
+ if ($aaa[1] == $l) {
543
+ $checked = 'checked';
544
+ }
545
+ else {
546
+ $checked = "";
547
+ }
548
+ $index = "'" . $k . '_' . $l . "'";
549
+ $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>';
550
+ }
551
+ }
552
+ else {
553
+ if ($matrix_value[$mat_rows+$mat_columns+2] == "checkbox") {
554
+ for ($l = 1; $l <= $mat_columns; $l++) {
555
+ if ($matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox] == 1) {
556
+ $checked = 'checked';
557
+ }
558
+ else {
559
+ $checked = '';
560
+ }
561
+ $index = "'".$k.'_'.$l."'";
562
+ $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>';
563
+ $var_checkbox++;
564
+ }
565
+ }
566
+ else {
567
+ if ($matrix_value[$mat_rows + $mat_columns + 2] == "text") {
568
+ for ($l = 1; $l <= $mat_columns; $l++) {
569
+ $text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
570
+ $index = "'".$k.'_'.$l."'";
571
+ $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>';
572
+ $var_checkbox++;
573
+ }
574
+ }
575
+ else {
576
+ for ($l = 1; $l <= $mat_columns; $l++) {
577
+ $selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
578
+ if ($selected_text == 'yes') {
579
+ $selected_value_yes = 'selected';
580
+ $selected_value_no = '';
581
+ $selected_value = '';
582
+ }
583
+ else {
584
+ if ($selected_text=='no') {
585
+ $selected_value_yes ='';
586
+ $selected_value_no ='selected';
587
+ $selected_value ='';
588
+ }
589
+ else {
590
+ $selected_value_yes = '';
591
+ $selected_value_no ='';
592
+ $selected_value ='selected';
593
+ }
594
+ }
595
+ $index = "'".$k.'_'.$l."'";
596
+ $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>';
597
+ $var_checkbox++;
598
+ }
599
+ }
600
+ }
601
+ }
602
+ $matrix .= '</tr>';
603
+ }
604
+ $matrix .= '</table>';
605
+ array_push($type_matrix_array, $matrix);
606
+ array_push($type_matrix_array, $new_filename);
607
+ return $type_matrix_array;
608
+ }
609
+
610
+ public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
611
+ global $wpdb;
612
+
613
+ $query = "SELECT `" . $label_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
614
+ if($db_info) {
615
+ $temp = explode('@@@wdfhostwdf@@@',$db_info);
616
+ $host = $temp[0];
617
+ $temp = explode('@@@wdfportwdf@@@',$temp[1]);
618
+ $port = $temp[0];
619
+ $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
620
+ $username = $temp[0];
621
+ $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
622
+ $password = $temp[0];
623
+ $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
624
+ $database = $temp[0];
625
+
626
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
627
+ $choices_labels = $wpdb_temp->get_col($query);
628
+ }
629
+ else {
630
+ $choices_labels = $wpdb->get_col($query);
631
+ }
632
+ return $choices_labels;
633
+ }
634
+ public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
635
+ global $wpdb;
636
+ $query = "SELECT `" . $value_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
637
+ if($db_info) {
638
+ $temp = explode('@@@wdfhostwdf@@@',$db_info);
639
+ $host = $temp[0];
640
+ $temp = explode('@@@wdfportwdf@@@',$temp[1]);
641
+ $port = $temp[0];
642
+ $temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
643
+ $username = $temp[0];
644
+ $temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
645
+ $password = $temp[0];
646
+ $temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
647
+ $database = $temp[0];
648
+
649
+ $wpdb_temp = new wpdb($username, $password, $database, $host);
650
+ $choices_values = $wpdb_temp->get_col($query);
651
+ }
652
+ else {
653
+ $choices_values = $wpdb->get_col($query);
654
+ }
655
+ return $choices_values;
656
+ }
657
+ }
658
+
659
+ ?>
admin/models/FMModelThemes_fm.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMModelThemes_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 title 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', 'title', 'default');
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_themes " . $where . $order_by . " LIMIT " . $limit . ",20";
35
+ $rows = $wpdb->get_results($query);
36
+ return $rows;
37
+ }
38
+
39
+ public function get_row_data($id, $reset) {
40
+ global $wpdb;
41
+ if ($id != 0) {
42
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes WHERE id="%d"', $id));
43
+ if ($reset) {
44
+ if (!$row->default) {
45
+ $row_id = $row->id;
46
+ $row_title = $row->title;
47
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_themes WHERE default="%d"', 1));
48
+ $row->id = $row_id;
49
+ $row->title = $row_title;
50
+ $row->default = FALSE;
51
+ }
52
+ else {
53
+ $row->css = '';
54
+ }
55
+ }
56
+ }
57
+ else {
58
+ $row = new stdClass();
59
+ $row->id = 0;
60
+ $row->title = '';
61
+ $row->css = '';
62
+ $row->default = 0;
63
+ }
64
+ return $row;
65
+ }
66
+
67
+ public function page_nav() {
68
+ global $wpdb;
69
+ $where = ((isset($_POST['search_value']) && (esc_html($_POST['search_value']) != '')) ? 'WHERE title LIKE "%' . esc_html($_POST['search_value']) . '%"' : '');
70
+ $query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_themes " . $where;
71
+ $total = $wpdb->get_var($query);
72
+ $page_nav['total'] = $total;
73
+ if (isset($_POST['page_number']) && $_POST['page_number']) {
74
+ $limit = ((int) $_POST['page_number'] - 1) * 20;
75
+ }
76
+ else {
77
+ $limit = 0;
78
+ }
79
+ $page_nav['limit'] = (int) ($limit / 20 + 1);
80
+ return $page_nav;
81
+ }
82
+ ////////////////////////////////////////////////////////////////////////////////////////
83
+ // Getters & Setters //
84
+ ////////////////////////////////////////////////////////////////////////////////////////
85
+ ////////////////////////////////////////////////////////////////////////////////////////
86
+ // Private Methods //
87
+ ////////////////////////////////////////////////////////////////////////////////////////
88
+ ////////////////////////////////////////////////////////////////////////////////////////
89
+ // Listeners //
90
+ ////////////////////////////////////////////////////////////////////////////////////////
91
+ }
admin/models/FMModelUninstall_fm.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FMModelUninstall_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 delete_db_tables() {
22
+ global $wpdb;
23
+ $true_or_false_forms = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker WHERE `id` IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
24
+ if ($true_or_false_forms) {
25
+ $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker WHERE `id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
26
+ $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
27
+ $wpdb->query("DELETE FROM " . $wpdb->prefix . "formmaker_views WHERE `form_id` NOT IN (" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ")");
28
+ }
29
+ else {
30
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker");
31
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_submits");
32
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_views");
33
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_themes");
34
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_sessions");
35
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_blocked");
36
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_query");
37
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "formmaker_backup");
38
+ delete_option('contact_form_forms');
39
+ delete_option("wd_form_maker_version");
40
+ delete_option('formmaker_cureent_version');
41
+ delete_option('fm_emailverification');
42
+ delete_option('form_maker_pro_active');
43
+ }
44
+ }
45
+ ////////////////////////////////////////////////////////////////////////////////////////
46
+ // Getters & Setters //
47
+ ////////////////////////////////////////////////////////////////////////////////////////
48
+ ////////////////////////////////////////////////////////////////////////////////////////
49
+ // Private Methods //
50
+ ////////////////////////////////////////////////////////////////////////////////////////
51
+ ////////////////////////////////////////////////////////////////////////////////////////
52
+ // Listeners //
53
+ ////////////////////////////////////////////////////////////////////////////////////////
54
+ }
admin/models/FMModelWidget.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 DELETED
@@ -1,20 +0,0 @@
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/FMSelectDataFromDb.php DELETED
@@ -1,134 +0,0 @@
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 DELETED
@@ -1,18 +0,0 @@
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`" . (!WDFM()->is_free ? '' : ' WHERE id' . (WDFM()->is_free == 1 ? ' NOT ' : ' ') . 'IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ') ORDER BY `title`'));
15
-
16
- return $rows;
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FMSqlMapping.php DELETED
@@ -1,119 +0,0 @@
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 DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,3850 +0,0 @@
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.* FROM " . $wpdb->prefix . "formmaker as t1 ";
24
- $query .= (!WDFM()->is_free ? '' : 'WHERE t1.id' . (WDFM()->is_free == 1 ? ' NOT ' : ' ') . 'IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')');
25
- if ( $search ) {
26
- $query .= (!WDFM()->is_free ? 'WHERE' : ' AND') . ' t1.title LIKE "%' . $search . '%"';
27
- }
28
- $query .= ' ORDER BY t1.`' . $orderby . '` ' . $order;
29
- $query .= " LIMIT " . $limit . "," . $items_per_page;
30
- $rows = $wpdb->get_results($query);
31
- if ( !empty($rows) ) {
32
- foreach ( $rows as $row ) {
33
- $query = "SELECT count(DISTINCT group_id) FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=" . (int) $row->id . "";
34
- $row->submission_count = $wpdb->get_var($query);
35
- }
36
- }
37
-
38
- return $rows;
39
- }
40
-
41
- public function get_row_data( $id ) {
42
- global $wpdb;
43
- if ( $id != 0 ) {
44
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
45
- }
46
- else {
47
- // Add "Submit" button to new forms.
48
- $row = new stdClass();
49
- $row->id = 0;
50
- $row->title = '';
51
- $row->mail = '';
52
- $row->form = '';
53
- $row->form_front = '<div class="wdform-page-and-images wd-table"><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 wd-width-100"><div class="wd-width-100"><div class="wd-width-100 wd-table" style="padding-top:10px;"><div class="wd-table-group"><div id="form_id_temppage_nav1" class="wd-table-row"></div></div></div></div></div></div></div>';
54
- $row->theme = 0;
55
- $row->javascript = '';
56
- $row->submit_text = '';
57
- $row->url = '';
58
- $row->submit_text_type = 0;
59
- $row->script1 = '';
60
- $row->script2 = '';
61
- $row->script_user1 = '';
62
- $row->script_user2 = '';
63
- $row->counter = 2;
64
- $row->label_order = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****##**id**##**label**##****#';
65
- $row->article_id = '';
66
- $row->pagination = '';
67
- $row->show_title = '';
68
- $row->show_numbers = '';
69
- $row->public_key = '';
70
- $row->private_key = '';
71
- $row->recaptcha_theme = '';
72
- $row->from_name = '';
73
- $row->from_mail = '';
74
- $row->label_order_current = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****#';
75
- $row->script_mail_user = '';
76
- $row->script_mail = '';
77
- $row->tax = 0;
78
- $row->payment_currency = '$';
79
- $row->paypal_email = '';
80
- $row->checkout_mode = 'testmode';
81
- $row->paypal_mode = 0;
82
- $row->published = 1;
83
- $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*:*';
84
- $row->savedb = 1;
85
- $row->sendemail = 1;
86
- $row->requiredmark = '*';
87
- $row->reply_to = 0;
88
- $row->send_to = 0;
89
- $row->autogen_layout = 1;
90
- $row->custom_front = '';
91
- $row->mail_from_user = '';
92
- $row->mail_from_name_user = '';
93
- $row->reply_to_user = '';
94
- $row->save_uploads = 1;
95
- $row->header_title = '';
96
- $row->header_description = '';
97
- $row->header_image_url = '';
98
- $row->header_image_animation = '';
99
- $row->header_hide_image = '';
100
- }
101
-
102
- return $row;
103
- }
104
-
105
- public function get_row_data_new( $id ) {
106
- global $wpdb;
107
- if ( $id != 0 ) {
108
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_backup WHERE backup_id="%d"', $id));
109
- }
110
- else {
111
- // Add "Submit" button to new forms.
112
- $row = new stdClass();
113
- $row->id = 0;
114
- $row->backup_id = '';
115
- $row->title = '';
116
- $row->mail = '';
117
- $row->form = '';
118
- $row->form_front = '<div class="wdform-page-and-images" class="wd-table"><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 wd-width-100"><div class="wd-width-100"><div class="wd-width-100 wd-table" style="padding-top:10px;"><div class="wd-table-group"><div id="form_id_temppage_nav1" class="wd-table-row"></div></div></div></div></div></div></div>';
119
- $row->theme = $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
120
- $row->javascript = '';
121
- $row->submit_text = '';
122
- $row->url = '';
123
- $row->submit_text_type = 1;
124
- $row->script1 = '%all%';
125
- $row->script2 = '%all%';
126
- $row->script_user1 = '';
127
- $row->script_user2 = '';
128
- $row->counter = 2;
129
- $row->label_order = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****##**id**##**label**##****#';
130
- $row->article_id = 0;
131
- $row->pagination = 'none';
132
- $row->show_title = false;
133
- $row->show_numbers = true;
134
- $row->public_key = '';
135
- $row->private_key = '';
136
- $row->recaptcha_theme = '';
137
- $row->from_name = '';
138
- $row->from_mail = '';
139
- $row->label_order_current = '1#**id**#type_submit_reset_1#**label**#type_submit_reset#****#';
140
- $row->script_mail_user = '';
141
- $row->script_mail = '';
142
- $row->tax = 0;
143
- $row->payment_currency = '$';
144
- $row->paypal_email = '';
145
- $row->checkout_mode = 'testmode';
146
- $row->paypal_mode = 0;
147
- $row->published = 1;
148
- $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*:*';
149
- $row->savedb = 1;
150
- $row->sendemail = 1;
151
- $row->requiredmark = '*';
152
- $row->reply_to = 0;
153
- $row->send_to = 0;
154
- $row->autogen_layout = 1;
155
- $row->custom_front = '';
156
- $row->mail_from_user = '';
157
- $row->mail_from_name_user = '';
158
- $row->reply_to_user = '';
159
- $row->save_uploads = 1;
160
- $row->header_title = '';
161
- $row->header_description = '';
162
- $row->header_image_url = '';
163
- $row->header_image_animation = 'none';
164
- $row->header_hide_image = 0;
165
- $row->condition = '';
166
- $row->mail_cc = '';
167
- $row->mail_cc_user = '';
168
- $row->mail_bcc = '';
169
- $row->mail_bcc_user = '';
170
- $row->mail_subject = '';
171
- $row->mail_subject_user = '';
172
- $row->mail_mode = 1;
173
- $row->mail_mode_user = 1;
174
- $row->mail_attachment = 1;
175
- $row->mail_attachment_user = 1;
176
- $row->user_id_wd = '';
177
- $row->sortable = 1;
178
- $row->frontend_submit_fields = '';
179
- $row->frontend_submit_stat_fields = '';
180
- $row->mail_emptyfields = 0;
181
- $row->mail_verify = 0;
182
- $row->mail_verify_expiretime = 0;
183
- $row->mail_verification_post_id = 0;
184
- }
185
-
186
- $labels2 = array();
187
- $label_id = array();
188
- $label_order_original = array();
189
- $label_type = array();
190
- $label_all = explode('#****#', $row->label_order);
191
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
192
- foreach ( $label_all as $key => $label_each ) {
193
- $label_id_each = explode('#**id**#', $label_each);
194
- array_push($label_id, $label_id_each[0]);
195
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
196
- array_push($label_order_original, addslashes($label_oder_each[0]));
197
- array_push($label_type, $label_oder_each[1]);
198
- }
199
- $labels2['id'] = '"' . implode('","', $label_id) . '"';
200
- $labels2['label'] = '"' . implode('","', $label_order_original) . '"';
201
- $labels2['type'] = '"' . implode('","', $label_type) . '"';
202
- $ids = array();
203
- $types = array();
204
- $labels = array();
205
- $paramss = array();
206
- $fields = explode('*:*new_field*:*', $row->form_fields);
207
- $fields = array_slice($fields, 0, count($fields) - 1);
208
- foreach ( $fields as $field ) {
209
- $temp = explode('*:*id*:*', $field);
210
- array_push($ids, $temp[0]);
211
- $temp = explode('*:*type*:*', $temp[1]);
212
- array_push($types, $temp[0]);
213
- $temp = explode('*:*w_field_label*:*', $temp[1]);
214
- array_push($labels, $temp[0]);
215
- array_push($paramss, $temp[1]);
216
- }
217
- $form = $row->form_front;
218
- foreach ( $ids as $ids_key => $id ) {
219
- $label = $labels[$ids_key];
220
- $type = $types[$ids_key];
221
- $params = $paramss[$ids_key];
222
- if ( strpos($form, '%' . $id . ' - ' . $label . '%') || strpos($form, '%' . $id . ' -' . $label . '%') ) {
223
- $rep = '';
224
- $arrows = '';
225
- $param = array();
226
- $param['attributes'] = '';
227
- switch ( $type ) {
228
- case 'type_section_break': {
229
- $arrows = '<div id="wdform_arrows' . $id . '" class="wdform_arrows" style="display: none;">
230
- <span class="wdform_arrows_basic wdform_arrows_container">
231
- <span id="edit_' . $id . '" valign="middle" class="element_toolbar">
232
- <span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></span>
233
- </span>
234
- <span id="duplicate_' . $id . '" valign="middle" class="element_toolbar">
235
- <span title="Duplicate the field" class="page_toolbar dashicons dashicons-admin-page" onclick="duplicate(&quot;' . $id . '&quot;)"></span>
236
- </span>
237
- <span id="X_' . $id . '" valign="middle" align="right" class="element_toolbar">
238
- <span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_section_break(&quot;' . $id . '&quot;)"></span>
239
- </span>
240
- </span>
241
- </div>';
242
- break;
243
- }
244
- case 'type_send_copy':
245
- case 'type_stripe':
246
- case 'type_captcha':
247
- case 'type_arithmetic_captcha':
248
- case 'type_recaptcha': {
249
- $arrows = '<div id="wdform_arrows' . $id . '" class="wdform_arrows" style="display: none;">
250
- <div class="wdform_arrows_basic wdform_arrows_container">
251
- <span id="edit_' . $id . '" valign="middle" class="element_toolbar">
252
- <span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></span>
253
- </span>
254
- <span id="duplicate_' . $id . '" valign="middle" class="element_toolbar"></span>
255
- <span id="X_' . $id . '" valign="middle" align="right" class="element_toolbar">
256
- <span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_row(&quot;' . $id . '&quot;)"></span>
257
- </span>
258
- </div>
259
- <div class="wdform_arrows_advanced wdform_arrows_container" style="display: none;">
260
- <span id="left_' . $id . '" valign="middle" class="element_toolbar">
261
- <span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;' . $id . '&quot;)"></span>
262
- </span>
263
- <span id="up_' . $id . '" valign="middle" class="element_toolbar">
264
- <span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;' . $id . '&quot;)"></span>
265
- </span>
266
- <span id="down_' . $id . '" valign="middle" class="element_toolbar">
267
- <span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;' . $id . '&quot;)"></span>
268
- </span>
269
- <span id="right_' . $id . '" valign="middle" class="element_toolbar">
270
- <span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;' . $id . '&quot;)"></span>
271
- </span>
272
- <span id="page_up_' . $id . '" valign="middle" class="element_toolbar">
273
- <span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;' . $id . '&quot;)"></span>
274
- </span>
275
- <span id="page_down_' . $id . '" valign="middle" class="element_toolbar">
276
- <span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;' . $id . '&quot;)"></span>
277
- </span>
278
- </div>
279
- </div>';
280
- break;
281
- }
282
- default : {
283
- $arrows = '<div id="wdform_arrows' . $id . '" class="wdform_arrows" style="display: none;">
284
- <div class="wdform_arrows_basic wdform_arrows_container"> <span id="edit_' . $id . '" valign="middle" class="element_toolbar">
285
- <span title="Edit the field" class="page_toolbar dashicons dashicons-edit" onclick="edit(&quot;' . $id . '&quot;)"></span>
286
- </span>
287
- <span id="duplicate_' . $id . '" valign="middle" class="element_toolbar">
288
- <span title="Duplicate the field" class="page_toolbar dashicons dashicons-admin-page" onclick="duplicate(&quot;' . $id . '&quot;)"></span>
289
- </span>
290
- <span id="X_' . $id . '" valign="middle" align="right" class="element_toolbar">
291
- <span title="Remove the field" class="page_toolbar dashicons dashicons-no-alt" onclick="remove_row(&quot;' . $id . '&quot;)"></span>
292
- </span>
293
- </div>
294
- <div class="wdform_arrows_advanced wdform_arrows_container" style="display: none;">
295
- <span id="left_' . $id . '" valign="middle" class="element_toolbar">
296
- <span title="Move the field to the left" class="page_toolbar dashicons dashicons-arrow-left-alt" onclick="left_row(&quot;' . $id . '&quot;)"></span>
297
- </span>
298
- <span id="up_' . $id . '" valign="middle" class="element_toolbar">
299
- <span title="Move the field up" class="page_toolbar dashicons dashicons-arrow-up-alt" onclick="up_row(&quot;' . $id . '&quot;)"></span>
300
- </span>
301
- <span id="down_' . $id . '" valign="middle" class="element_toolbar">
302
- <span title="Move the field down" class="page_toolbar dashicons dashicons-arrow-down-alt" onclick="down_row(&quot;' . $id . '&quot;)"></span>
303
- </span>
304
- <span id="right_' . $id . '" valign="middle" class="element_toolbar">
305
- <span title="Move the field to the right" class="page_toolbar dashicons dashicons-arrow-right-alt" onclick="right_row(&quot;' . $id . '&quot;)"></span>
306
- </span>
307
- <span id="page_up_' . $id . '" valign="middle" class="element_toolbar">
308
- <span title="Move the field to the upper page" class="page_toolbar dashicons dashicons-upload" onclick="page_up(&quot;' . $id . '&quot;)"></span>
309
- </span>
310
- <span id="page_down_' . $id . '" valign="middle" class="element_toolbar">
311
- <span title="Move the field to the lower page" class="page_toolbar dashicons dashicons-download" onclick="page_down(&quot;' . $id . '&quot;)"></span>
312
- </span>
313
- </div>
314
- </div>';
315
- break;
316
- }
317
- }
318
- switch ( $type ) {
319
- case 'type_section_break': {
320
- $params_names = array( 'w_editor' );
321
- $temp = $params;
322
- foreach ( $params_names as $params_name ) {
323
- $temp = explode('*:*' . $params_name . '*:*', $temp);
324
- $param[$params_name] = $temp[0];
325
- $temp = $temp[1];
326
- }
327
- $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;">' . __('Section Break', WDFM()->prefix) . '</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;">' . __('Section Break', WDFM()->prefix) . '</div>';
328
- break;
329
- }
330
- case 'type_editor': {
331
- $params_names = array( 'w_editor' );
332
- $temp = $params;
333
- foreach ( $params_names as $params_name ) {
334
- $temp = explode('*:*' . $params_name . '*:*', $temp);
335
- $param[$params_name] = $temp[0];
336
- $temp = $temp[1];
337
- }
338
- $rep = '<div id="wdform_field' . $id . '" type="type_editor" class="wdform_field" >' . $param['w_editor'] . '</div>' . $arrows . '<div id="' . $id . '_element_labelform_id_temp" style="color: red;">' . __('Custom HTML', WDFM()->prefix) . $id . '</div>';
339
- break;
340
- }
341
- case 'type_send_copy': {
342
- $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_required' );
343
- $temp = $params;
344
- if ( strpos($temp, 'w_hide_label') > -1 ) {
345
- $params_names = array(
346
- 'w_field_label_size',
347
- 'w_field_label_pos',
348
- 'w_hide_label',
349
- 'w_first_val',
350
- 'w_required',
351
- );
352
- }
353
- foreach ( $params_names as $params_name ) {
354
- $temp = explode('*:*' . $params_name . '*:*', $temp);
355
- $param[$params_name] = $temp[0];
356
- $temp = $temp[1];
357
- }
358
- if ( $temp ) {
359
- $temp = explode('*:*w_attr_name*:*', $temp);
360
- $attrs = array_slice($temp, 0, count($temp) - 1);
361
- foreach ( $attrs as $attr ) {
362
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
363
- }
364
- }
365
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
366
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
367
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
368
- $input_active = ($param['w_first_val'] == 'true' ? "checked='checked'" : "");
369
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
370
- $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>';
371
- break;
372
- }
373
- case 'type_text': {
374
- $params_names = array(
375
- 'w_field_label_size',
376
- 'w_field_label_pos',
377
- 'w_size',
378
- 'w_first_val',
379
- 'w_title',
380
- 'w_required',
381
- 'w_unique',
382
- );
383
- $temp = $params;
384
- if ( strpos($temp, 'w_regExp_status') > -1 ) {
385
- $params_names = array(
386
- 'w_field_label_size',
387
- 'w_field_label_pos',
388
- 'w_size',
389
- 'w_first_val',
390
- 'w_title',
391
- 'w_required',
392
- 'w_regExp_status',
393
- 'w_regExp_value',
394
- 'w_regExp_common',
395
- 'w_regExp_arg',
396
- 'w_regExp_alert',
397
- 'w_unique',
398
- );
399
- }
400
- if ( strpos($temp, 'w_readonly') > -1 ) {
401
- $params_names = array(
402
- 'w_field_label_size',
403
- 'w_field_label_pos',
404
- 'w_size',
405
- 'w_first_val',
406
- 'w_title',
407
- 'w_required',
408
- 'w_regExp_status',
409
- 'w_regExp_value',
410
- 'w_regExp_common',
411
- 'w_regExp_arg',
412
- 'w_regExp_alert',
413
- 'w_unique',
414
- 'w_readonly',
415
- );
416
- }
417
- if ( strpos($temp, 'w_hide_label') > -1 ) {
418
- $params_names = array(
419
- 'w_field_label_size',
420
- 'w_field_label_pos',
421
- 'w_hide_label',
422
- 'w_size',
423
- 'w_first_val',
424
- 'w_title',
425
- 'w_required',
426
- 'w_regExp_status',
427
- 'w_regExp_value',
428
- 'w_regExp_common',
429
- 'w_regExp_arg',
430
- 'w_regExp_alert',
431
- 'w_unique',
432
- 'w_readonly',
433
- );
434
- }
435
- foreach ( $params_names as $params_name ) {
436
- $temp = explode('*:*' . $params_name . '*:*', $temp);
437
- $param[$params_name] = $temp[0];
438
- $temp = $temp[1];
439
- }
440
- if ( $temp ) {
441
- $temp = explode('*:*w_attr_name*:*', $temp);
442
- $attrs = array_slice($temp, 0, count($temp) - 1);
443
- foreach ( $attrs as $attr ) {
444
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
445
- }
446
- }
447
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
448
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
449
- $param['w_regExp_status'] = (isset($param['w_regExp_status']) ? $param['w_regExp_status'] : "no");
450
- $param['w_regExp_value'] = (isset($param['w_regExp_value']) ? $param['w_regExp_value'] : "");
451
- $param['w_regExp_common'] = (isset($param['w_regExp_common']) ? $param['w_regExp_common'] : "");
452
- $param['w_regExp_arg'] = (isset($param['w_regExp_arg']) ? $param['w_regExp_arg'] : "");
453
- $param['w_regExp_alert'] = (isset($param['w_regExp_alert']) ? $param['w_regExp_alert'] : "Incorrect Value");
454
- $param['w_readonly'] = (isset($param['w_readonly']) ? $param['w_readonly'] : "no");
455
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
456
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
457
- $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" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div></div>';
458
- break;
459
- }
460
- case 'type_number': {
461
- $params_names = array(
462
- 'w_field_label_size',
463
- 'w_field_label_pos',
464
- 'w_size',
465
- 'w_first_val',
466
- 'w_title',
467
- 'w_required',
468
- 'w_unique',
469
- 'w_class',
470
- );
471
- $temp = $params;
472
- foreach ( $params_names as $params_name ) {
473
- $temp = explode('*:*' . $params_name . '*:*', $temp);
474
- $param[$params_name] = $temp[0];
475
- $temp = $temp[1];
476
- }
477
- if ( $temp ) {
478
- $temp = explode('*:*w_attr_name*:*', $temp);
479
- $attrs = array_slice($temp, 0, count($temp) - 1);
480
- foreach ( $attrs as $attr ) {
481
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
482
- }
483
- }
484
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
485
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
486
- $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" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div></div>';
487
- break;
488
- }
489
- case 'type_password': {
490
- $params_names = array(
491
- 'w_field_label_size',
492
- 'w_field_label_pos',
493
- 'w_size',
494
- 'w_required',
495
- 'w_unique',
496
- 'w_class',
497
- );
498
- $temp = $params;
499
- if ( strpos($temp, 'w_hide_label') > -1 ) {
500
- $params_names = array(
501
- 'w_field_label_size',
502
- 'w_field_label_pos',
503
- 'w_hide_label',
504
- 'w_size',
505
- 'w_required',
506
- 'w_unique',
507
- 'w_class',
508
- );
509
- }
510
- if ( strpos($temp, 'w_verification') > -1 ) {
511
- $params_names = array(
512
- 'w_field_label_size',
513
- 'w_field_label_pos',
514
- 'w_hide_label',
515
- 'w_size',
516
- 'w_required',
517
- 'w_unique',
518
- 'w_class',
519
- 'w_verification',
520
- 'w_verification_label',
521
- );
522
- }
523
- if ( strpos($temp, 'w_placeholder') > -1 ) {
524
- $params_names = array(
525
- 'w_field_label_size',
526
- 'w_field_label_pos',
527
- 'w_hide_label',
528
- 'w_size',
529
- 'w_required',
530
- 'w_unique',
531
- 'w_class',
532
- 'w_verification',
533
- 'w_verification_label',
534
- 'w_placeholder',
535
- );
536
- }
537
- foreach ( $params_names as $params_name ) {
538
- $temp = explode('*:*' . $params_name . '*:*', $temp);
539
- $param[$params_name] = $temp[0];
540
- $temp = $temp[1];
541
- }
542
- if ( $temp ) {
543
- $temp = explode('*:*w_attr_name*:*', $temp);
544
- $attrs = array_slice($temp, 0, count($temp) - 1);
545
- foreach ( $attrs as $attr ) {
546
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
547
- }
548
- }
549
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
550
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
551
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
552
- if ( isset($param['w_verification']) && $param['w_verification'] == "yes" ) {
553
- $display_label_confirm = $display_label;
554
- $display_element_confirm = $param['w_field_label_pos'];
555
- }
556
- else {
557
- $display_label_confirm = "none";
558
- $display_element_confirm = "none";
559
- }
560
- $param['w_verification'] = isset($param['w_verification']) ? $param['w_verification'] : "no";
561
- $param['w_verification_label'] = isset($param['w_verification_label']) ? $param['w_verification_label'] : "Password confirmation:";
562
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
563
- $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" 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>';
564
- $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>';
565
- break;
566
- }
567
- case 'type_textarea': {
568
- $params_names = array(
569
- 'w_field_label_size',
570
- 'w_field_label_pos',
571
- 'w_size_w',
572
- 'w_size_h',
573
- 'w_first_val',
574
- 'w_title',
575
- 'w_required',
576
- 'w_unique',
577
- 'w_class',
578
- );
579
- $temp = $params;
580
- if ( strpos($temp, 'w_hide_label') > -1 ) {
581
- $params_names = array(
582
- 'w_field_label_size',
583
- 'w_field_label_pos',
584
- 'w_hide_label',
585
- 'w_size_w',
586
- 'w_size_h',
587
- 'w_first_val',
588
- 'w_title',
589
- 'w_required',
590
- 'w_unique',
591
- 'w_class',
592
- );
593
- }
594
- foreach ( $params_names as $params_name ) {
595
- $temp = explode('*:*' . $params_name . '*:*', $temp);
596
- $param[$params_name] = $temp[0];
597
- $temp = $temp[1];
598
- }
599
- if ( $temp ) {
600
- $temp = explode('*:*w_attr_name*:*', $temp);
601
- $attrs = array_slice($temp, 0, count($temp) - 1);
602
- foreach ( $attrs as $attr ) {
603
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
604
- }
605
- }
606
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
607
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
608
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
609
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
610
- $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: ' . $param['w_field_label_pos'] . '"><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 id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" style="width: ' . $param['w_size_w'] . 'px; height: ' . $param['w_size_h'] . 'px;" ' . $param['attributes'] . ' disabled>' . $param['w_first_val'] . '</textarea></div></div>';
611
- break;
612
- }
613
- case 'type_phone': {
614
- $params_names = array(
615
- 'w_field_label_size',
616
- 'w_field_label_pos',
617
- 'w_size',
618
- 'w_first_val',
619
- 'w_title',
620
- 'w_mini_labels',
621
- 'w_required',
622
- 'w_unique',
623
- 'w_class',
624
- );
625
- $temp = $params;
626
- if ( strpos($temp, 'w_hide_label') > -1 ) {
627
- $params_names = array(
628
- 'w_field_label_size',
629
- 'w_field_label_pos',
630
- 'w_hide_label',
631
- 'w_size',
632
- 'w_first_val',
633
- 'w_title',
634
- 'w_mini_labels',
635
- 'w_required',
636
- 'w_unique',
637
- 'w_class',
638
- );
639
- }
640
- foreach ( $params_names as $params_name ) {
641
- $temp = explode('*:*' . $params_name . '*:*', $temp);
642
- $param[$params_name] = $temp[0];
643
- $temp = $temp[1];
644
- }
645
- if ( $temp ) {
646
- $temp = explode('*:*w_attr_name*:*', $temp);
647
- $attrs = array_slice($temp, 0, count($temp) - 1);
648
- foreach ( $attrs as $attr ) {
649
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
650
- }
651
- }
652
- $w_first_val = explode('***', $param['w_first_val']);
653
- $w_title = explode('***', $param['w_title']);
654
- $w_mini_labels = explode('***', $param['w_mini_labels']);
655
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
656
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
657
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
658
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
659
- $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" 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] . '" 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" 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] . '" 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>';
660
- break;
661
- }
662
- case 'type_phone_new': {
663
- $temp = $params;
664
- $params_names = array(
665
- 'w_field_label_size',
666
- 'w_field_label_pos',
667
- 'w_hide_label',
668
- 'w_size',
669
- 'w_first_val',
670
- 'w_top_country',
671
- 'w_required',
672
- 'w_unique',
673
- 'w_class',
674
- );
675
- foreach ( $params_names as $params_name ) {
676
- $temp = explode('*:*' . $params_name . '*:*', $temp);
677
- $param[$params_name] = $temp[0];
678
- $temp = $temp[1];
679
- }
680
- if ( $temp ) {
681
- $temp = explode('*:*w_attr_name*:*', $temp);
682
- $attrs = array_slice($temp, 0, count($temp) - 1);
683
- foreach ( $attrs as $attr ) {
684
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
685
- }
686
- }
687
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
688
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
689
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
690
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
691
- $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'] . '" onkeypress="return check_isnum(&quot;' . $id . '_elementform_id_temp&quot;)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled></div></div></div></div></div>';
692
- break;
693
- }
694
- case 'type_name': {
695
- $params_names = array(
696
- 'w_field_label_size',
697
- 'w_field_label_pos',
698
- 'w_first_val',
699
- 'w_title',
700
- 'w_mini_labels',
701
- 'w_size',
702
- 'w_name_format',
703
- 'w_required',
704
- 'w_unique',
705
- 'w_class',
706
- );
707
- $temp = $params;
708
- if ( strpos($temp, 'w_name_fields') > -1 ) {
709
- $params_names = array(
710
- 'w_field_label_size',
711
- 'w_field_label_pos',
712
- 'w_first_val',
713
- 'w_title',
714
- 'w_mini_labels',
715
- 'w_size',
716
- 'w_name_format',
717
- 'w_required',
718
- 'w_unique',
719
- 'w_class',
720
- 'w_name_fields',
721
- );
722
- }
723
- if ( strpos($temp, 'w_autofill') > -1 ) {
724
- $params_names = array(
725
- 'w_field_label_size',
726
- 'w_field_label_pos',
727
- 'w_first_val',
728
- 'w_title',
729
- 'w_mini_labels',
730
- 'w_size',
731
- 'w_name_format',
732
- 'w_required',
733
- 'w_unique',
734
- 'w_class',
735
- 'w_name_fields',
736
- 'w_autofill',
737
- );
738
- }
739
- if ( strpos($temp, 'w_hide_label') > -1 ) {
740
- $params_names = array(
741
- 'w_field_label_size',
742
- 'w_field_label_pos',
743
- 'w_hide_label',
744
- 'w_first_val',
745
- 'w_title',
746
- 'w_mini_labels',
747
- 'w_size',
748
- 'w_name_format',
749
- 'w_required',
750
- 'w_unique',
751
- 'w_class',
752
- 'w_name_fields',
753
- 'w_autofill',
754
- );
755
- }
756
- foreach ( $params_names as $params_name ) {
757
- $temp = explode('*:*' . $params_name . '*:*', $temp);
758
- $param[$params_name] = $temp[0];
759
- $temp = $temp[1];
760
- }
761
- if ( $temp ) {
762
- $temp = explode('*:*w_attr_name*:*', $temp);
763
- $attrs = array_slice($temp, 0, count($temp) - 1);
764
- foreach ( $attrs as $attr ) {
765
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
766
- }
767
- }
768
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
769
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
770
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
771
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
772
- $w_first_val = explode('***', $param['w_first_val']);
773
- $w_title = explode('***', $param['w_title']);
774
- $w_mini_labels = explode('***', $param['w_mini_labels']);
775
- $param['w_name_fields'] = isset($param['w_name_fields']) ? $param['w_name_fields'] : ($param['w_name_format'] == 'normal' ? 'no***no' : 'yes***yes');
776
- $w_name_fields = explode('***', $param['w_name_fields']);
777
- $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
778
- $w_name_format = '<div id="' . $id . '_td_name_input_first" style="display: table-cell;"><input type="text" 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] . '" 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" 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] . '" style="margin-right: 10px; width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>';
779
- $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>';
780
- if ( $w_name_fields[0] == 'yes' ) {
781
- $w_name_format = '<div id="' . $id . '_td_name_input_title" style="display: table-cell;"><input type="text" id="' . $id . '_element_titleform_id_temp" name="' . $id . '_element_titleform_id_temp" value="' . $w_first_val[2] . '" title="' . $w_title[2] . '" style="margin: 0px 10px 0px 0px; width: 40px;" disabled /></div>' . $w_name_format;
782
- $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;
783
- }
784
- if ( $w_name_fields[1] == 'yes' ) {
785
- $w_name_format = $w_name_format . '<div id="' . $id . '_td_name_input_middle" style="display: table-cell;"><input type="text" id="' . $id . '_element_middleform_id_temp" name="' . $id . '_element_middleform_id_temp" value="' . $w_first_val[3] . '" title="' . $w_title[3] . '" style="width: ' . $param['w_size'] . 'px;" disabled /></div>';
786
- $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>';
787
- }
788
- $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>';
789
- break;
790
- }
791
- case 'type_address': {
792
- $params_names = array(
793
- 'w_field_label_size',
794
- 'w_field_label_pos',
795
- 'w_size',
796
- 'w_mini_labels',
797
- 'w_disabled_fields',
798
- 'w_required',
799
- 'w_class',
800
- );
801
- $temp = $params;
802
- if ( strpos($temp, 'w_hide_label') > -1 ) {
803
- $params_names = array(
804
- 'w_field_label_size',
805
- 'w_field_label_pos',
806
- 'w_hide_label',
807
- 'w_size',
808
- 'w_mini_labels',
809
- 'w_disabled_fields',
810
- 'w_required',
811
- 'w_class',
812
- );
813
- }
814
- foreach ( $params_names as $params_name ) {
815
- $temp = explode('*:*' . $params_name . '*:*', $temp);
816
- $param[$params_name] = $temp[0];
817
- $temp = $temp[1];
818
- }
819
- if ( $temp ) {
820
- $temp = explode('*:*w_attr_name*:*', $temp);
821
- $attrs = array_slice($temp, 0, count($temp) - 1);
822
- foreach ( $attrs as $attr ) {
823
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
824
- }
825
- }
826
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
827
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
828
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
829
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
830
- $w_mini_labels = explode('***', $param['w_mini_labels']);
831
- $w_disabled_fields = explode('***', $param['w_disabled_fields']);
832
- $hidden_inputs = '';
833
- $labels_for_id = array( 'street1', 'street2', 'city', 'state', 'postal', 'country' );
834
- foreach ( $w_disabled_fields as $key => $w_disabled_field ) {
835
- if ( $key != 6 ) {
836
- if ( $w_disabled_field == 'yes' ) {
837
- $hidden_inputs .= '<input type="hidden" id="' . $id . '_' . $labels_for_id[$key] . 'form_id_temp" value="' . $w_mini_labels[$key] . '" id_for_label="' . ($id + $key) . '">';
838
- }
839
- }
840
- }
841
- $address_fields = '';
842
- $g = 0;
843
- if ( $w_disabled_fields[0] == 'no' ) {
844
- $g += 2;
845
- $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" style="width: 100%;" ' . $param['attributes'] . ' disabled /><label class="mini_label" id="' . $id . '_mini_label_street1" style="display: block;">' . $w_mini_labels[0] . '</label></span>';
846
- }
847
- if ( $w_disabled_fields[1] == 'no' ) {
848
- $g += 2;
849
- $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" style="width: 100%;" ' . $param['attributes'] . ' disabled /><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_street2">' . $w_mini_labels[1] . '</label></span>';
850
- }
851
- if ( $w_disabled_fields[2] == 'no' ) {
852
- $g++;
853
- $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" style="width: 100%;" ' . $param['attributes'] . ' disabled /><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_city">' . $w_mini_labels[2] . '</label></span>';
854
- }
855
- if ( $w_disabled_fields[3] == 'no' ) {
856
- $g++;
857
- if ( $w_disabled_fields[5] == 'yes' && $w_disabled_fields[6] == 'yes' ) {
858
- $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" style="width: 100%;" ' . $param['attributes'] . ' disabled >';
859
- $states = WDW_FM_Library::get_states();
860
- foreach ($states as $st => $state) {
861
- $address_fields .= '<option value="' . $st . '">' . $state . '</option>';
862
- }
863
- $address_fields .= '</select><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
864
- }
865
- else {
866
- $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" style="width: 100%;" ' . $param['attributes'] . ' disabled><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_state">' . $w_mini_labels[3] . '</label></span>';
867
- }
868
- }
869
- if ( $w_disabled_fields[4] == 'no' ) {
870
- $g++;
871
- $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" style="width: 100%;" ' . $param['attributes'] . ' disabled><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_postal">' . $w_mini_labels[4] . '</label></span>';
872
- }
873
- if ( $w_disabled_fields[5] == 'no' ) {
874
- $g++;
875
- $countries_list = WDW_FM_Library::get_countries();
876
- $address_fields .= '<span style="float: ' . (($g % 2 == 0) ? 'right' : 'left') . '; width: 48%; padding-bottom: 8px;">
877
- <select type="text" id="' . $id . '_countryform_id_temp" name="' . ($id + 5) . '_countryform_id_temp" style="width: 100%;" ' . $param['attributes'] . ' disabled>';
878
- foreach ($countries_list as $value => $item) {
879
- $address_fields .= '<option value="' . $value . '">' . $item . '</option>';
880
- }
881
- $address_fields .= '</select><label class="mini_label" style="display: block;" id="' . $id . '_mini_label_country">' . $w_mini_labels[5] . '</span>';
882
- }
883
- $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>';
884
- break;
885
- }
886
- case 'type_submitter_mail': {
887
- $params_names = array(
888
- 'w_field_label_size',
889
- 'w_field_label_pos',
890
- 'w_size',
891
- 'w_first_val',
892
- 'w_title',
893
- 'w_required',
894
- 'w_unique',
895
- 'w_class',
896
- );
897
- $temp = $params;
898
- if ( strpos($temp, 'w_autofill') > -1 ) {
899
- $params_names = array(
900
- 'w_field_label_size',
901
- 'w_field_label_pos',
902
- 'w_size',
903
- 'w_first_val',
904
- 'w_title',
905
- 'w_required',
906
- 'w_unique',
907
- 'w_class',
908
- 'w_autofill',
909
- );
910
- }
911
- if ( strpos($temp, 'w_hide_label') > -1 ) {
912
- $params_names = array(
913
- 'w_field_label_size',
914
- 'w_field_label_pos',
915
- 'w_hide_label',
916
- 'w_size',
917
- 'w_first_val',
918
- 'w_title',
919
- 'w_required',
920
- 'w_unique',
921
- 'w_class',
922
- 'w_autofill',
923
- );
924
- }
925
- if ( strpos($temp, 'w_verification') > -1 ) {
926
- $params_names = array(
927
- 'w_field_label_size',
928
- 'w_field_label_pos',
929
- 'w_hide_label',
930
- 'w_size',
931
- 'w_first_val',
932
- 'w_title',
933
- 'w_required',
934
- 'w_unique',
935
- 'w_class',
936
- 'w_verification',
937
- 'w_verification_label',
938
- 'w_verification_placeholder',
939
- 'w_autofill',
940
- );
941
- }
942
- foreach ( $params_names as $params_name ) {
943
- $temp = explode('*:*' . $params_name . '*:*', $temp);
944
- $param[$params_name] = $temp[0];
945
- $temp = $temp[1];
946
- }
947
- if ( $temp ) {
948
- $temp = explode('*:*w_attr_name*:*', $temp);
949
- $attrs = array_slice($temp, 0, count($temp) - 1);
950
- foreach ( $attrs as $attr ) {
951
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
952
- }
953
- }
954
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
955
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
956
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
957
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
958
- $param['w_autofill'] = isset($param['w_autofill']) ? $param['w_autofill'] : 'no';
959
- if ( isset($param['w_verification']) && $param['w_verification'] == "yes" ) {
960
- $display_label_confirm = $display_label;
961
- $display_element_confirm = $param['w_field_label_pos'];
962
- }
963
- else {
964
- $display_label_confirm = "none";
965
- $display_element_confirm = "none";
966
- }
967
- $param['w_verification'] = isset($param['w_verification']) ? $param['w_verification'] : "no";
968
- $param['w_verification_label'] = isset($param['w_verification_label']) ? $param['w_verification_label'] : "E-mail confirmation:";
969
- $param['w_verification_placeholder'] = isset($param['w_verification_placeholder']) ? $param['w_verification_placeholder'] : "";
970
- $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" id="' . $id . '_1_elementform_id_temp" name="' . $id . '_1_elementform_id_temp" value="' . $param['w_verification_placeholder'] . '" title="' . $param['w_verification_placeholder'] . '" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>';
971
- $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" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled /></div>' . $confirm_emeil . '</div>';
972
- break;
973
- }
974
- case 'type_checkbox': {
975
- $params_names = array(
976
- 'w_field_label_size',
977
- 'w_field_label_pos',
978
- 'w_flow',
979
- 'w_choices',
980
- 'w_choices_checked',
981
- 'w_rowcol',
982
- 'w_required',
983
- 'w_randomize',
984
- 'w_allow_other',
985
- 'w_allow_other_num',
986
- 'w_class',
987
- );
988
- $temp = $params;
989
- if ( strpos($temp, 'w_field_option_pos') > -1 ) {
990
- $params_names = array(
991
- 'w_field_label_size',
992
- 'w_field_label_pos',
993
- 'w_field_option_pos',
994
- 'w_flow',
995
- 'w_choices',
996
- 'w_choices_checked',
997
- 'w_rowcol',
998
- 'w_required',
999
- 'w_randomize',
1000
- 'w_allow_other',
1001
- 'w_allow_other_num',
1002
- 'w_value_disabled',
1003
- 'w_choices_value',
1004
- 'w_choices_params',
1005
- 'w_class',
1006
- );
1007
- }
1008
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1009
- $params_names = array(
1010
- 'w_field_label_size',
1011
- 'w_field_label_pos',
1012
- 'w_field_option_pos',
1013
- 'w_hide_label',
1014
- 'w_flow',
1015
- 'w_choices',
1016
- 'w_choices_checked',
1017
- 'w_rowcol',
1018
- 'w_required',
1019
- 'w_randomize',
1020
- 'w_allow_other',
1021
- 'w_allow_other_num',
1022
- 'w_value_disabled',
1023
- 'w_choices_value',
1024
- 'w_choices_params',
1025
- 'w_class',
1026
- );
1027
- }
1028
- foreach ( $params_names as $params_name ) {
1029
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1030
- $param[$params_name] = $temp[0];
1031
- $temp = $temp[1];
1032
- }
1033
- if ( $temp ) {
1034
- $temp = explode('*:*w_attr_name*:*', $temp);
1035
- $attrs = array_slice($temp, 0, count($temp) - 1);
1036
- foreach ( $attrs as $attr ) {
1037
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1038
- }
1039
- }
1040
- if ( !isset($param['w_value_disabled']) ) {
1041
- $param['w_value_disabled'] = 'no';
1042
- }
1043
- if ( !isset($param['w_field_option_pos']) ) {
1044
- $param['w_field_option_pos'] = 'left';
1045
- }
1046
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1047
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1048
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1049
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1050
- $param['w_choices'] = explode('***', $param['w_choices']);
1051
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1052
- if ( isset($param['w_choices_value']) ) {
1053
- $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1054
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1055
- }
1056
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
1057
- if ( $choices_checked == 'true' ) {
1058
- $param['w_choices_checked'][$key] = 'checked="checked"';
1059
- }
1060
- else {
1061
- $param['w_choices_checked'][$key] = '';
1062
- }
1063
- }
1064
- $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"' : '') . '>';
1065
- if ( $param['w_flow'] == 'hor' ) {
1066
- $j = 0;
1067
- for ( $i = 0; $i < (int) $param['w_rowcol']; $i++ ) {
1068
- $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1069
- for ( $l = 0; $l <= (int) (count($param['w_choices']) / $param['w_rowcol']); $l++ ) {
1070
- if ( $j >= count($param['w_choices']) % $param['w_rowcol'] && $l == (int) (count($param['w_choices']) / $param['w_rowcol']) ) {
1071
- continue;
1072
- }
1073
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1074
- $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>';
1075
- }
1076
- else {
1077
- $where = '';
1078
- $order_by = '';
1079
- $db_info = '';
1080
- if ( isset($param['w_choices_value']) ) {
1081
- $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $l + $i];
1082
- }
1083
- else {
1084
- $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $l + $i];
1085
- }
1086
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i] ) {
1087
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i]);
1088
- $where = 'where="' . $w_choices_params[0] . '"';
1089
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1090
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1091
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1092
- }
1093
- $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>';
1094
- }
1095
- }
1096
- $j++;
1097
- $rep .= '</div>';
1098
- }
1099
- }
1100
- else {
1101
- for ( $i = 0; $i < (int) (count($param['w_choices']) / $param['w_rowcol']); $i++ ) {
1102
- $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1103
- if ( count($param['w_choices']) > (int) $param['w_rowcol'] ) {
1104
- for ( $l = 0; $l < $param['w_rowcol']; $l++ ) {
1105
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1106
- $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>';
1107
- }
1108
- else {
1109
- $where = '';
1110
- $order_by = '';
1111
- $db_info = '';
1112
- if ( isset($param['w_choices_value']) ) {
1113
- $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1114
- }
1115
- else {
1116
- $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1117
- }
1118
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1119
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1120
- $where = 'where="' . $w_choices_params[0] . '"';
1121
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1122
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1123
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1124
- }
1125
- $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) . '"
1126
- ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][(int) $param['w_rowcol'] * $i + $l] . '</label></div>';
1127
- }
1128
- }
1129
- }
1130
- else {
1131
- for ( $l = 0; $l < count($param['w_choices']); $l++ ) {
1132
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1133
- $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>';
1134
- }
1135
- else {
1136
- $where = '';
1137
- $order_by = '';
1138
- $db_info = '';
1139
- if ( isset($param['w_choices_value']) ) {
1140
- $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1141
- }
1142
- else {
1143
- $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1144
- }
1145
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1146
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1147
- $where = 'where="' . $w_choices_params[0] . '"';
1148
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1149
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1150
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1151
- }
1152
- $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>';
1153
- }
1154
- }
1155
- }
1156
- $rep .= '</div>';
1157
- }
1158
- if ( count($param['w_choices']) % $param['w_rowcol'] != 0 ) {
1159
- $rep .= '<div id="' . $id . '_element_tr' . ((int) (count($param['w_choices']) / (int) $param['w_rowcol'])) . '" style="display: table-row;">';
1160
- for ( $k = 0; $k < count($param['w_choices']) % $param['w_rowcol']; $k++ ) {
1161
- $l = count($param['w_choices']) - count($param['w_choices']) % $param['w_rowcol'] + $k;
1162
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $l ) {
1163
- $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>';
1164
- }
1165
- else {
1166
- $where = '';
1167
- $order_by = '';
1168
- $db_info = '';
1169
- if ( isset($param['w_choices_value']) ) {
1170
- $choise_value = $param['w_choices_value'][$l];
1171
- }
1172
- else {
1173
- $choise_value = $param['w_choices'][$l];
1174
- }
1175
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$l] ) {
1176
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$l]);
1177
- $where = 'where="' . $w_choices_params[0] . '"';
1178
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1179
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1180
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1181
- }
1182
- $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>';
1183
- }
1184
- }
1185
- $rep .= '</div>';
1186
- }
1187
- }
1188
- $rep .= '</div></div></div></div>';
1189
- break;
1190
- }
1191
- case 'type_radio': {
1192
- $params_names = array(
1193
- 'w_field_label_size',
1194
- 'w_field_label_pos',
1195
- 'w_flow',
1196
- 'w_choices',
1197
- 'w_choices_checked',
1198
- 'w_rowcol',
1199
- 'w_required',
1200
- 'w_randomize',
1201
- 'w_allow_other',
1202
- 'w_allow_other_num',
1203
- 'w_class',
1204
- );
1205
- $temp = $params;
1206
- if ( strpos($temp, 'w_field_option_pos') > -1 ) {
1207
- $params_names = array(
1208
- 'w_field_label_size',
1209
- 'w_field_label_pos',
1210
- 'w_field_option_pos',
1211
- 'w_flow',
1212
- 'w_choices',
1213
- 'w_choices_checked',
1214
- 'w_rowcol',
1215
- 'w_required',
1216
- 'w_randomize',
1217
- 'w_allow_other',
1218
- 'w_allow_other_num',
1219
- 'w_value_disabled',
1220
- 'w_choices_value',
1221
- 'w_choices_params',
1222
- 'w_class',
1223
- );
1224
- }
1225
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1226
- $params_names = array(
1227
- 'w_field_label_size',
1228
- 'w_field_label_pos',
1229
- 'w_field_option_pos',
1230
- 'w_hide_label',
1231
- 'w_flow',
1232
- 'w_choices',
1233
- 'w_choices_checked',
1234
- 'w_rowcol',
1235
- 'w_required',
1236
- 'w_randomize',
1237
- 'w_allow_other',
1238
- 'w_allow_other_num',
1239
- 'w_value_disabled',
1240
- 'w_choices_value',
1241
- 'w_choices_params',
1242
- 'w_class',
1243
- );
1244
- }
1245
- foreach ( $params_names as $params_name ) {
1246
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1247
- $param[$params_name] = $temp[0];
1248
- $temp = $temp[1];
1249
- }
1250
- if ( $temp ) {
1251
- $temp = explode('*:*w_attr_name*:*', $temp);
1252
- $attrs = array_slice($temp, 0, count($temp) - 1);
1253
- foreach ( $attrs as $attr ) {
1254
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1255
- }
1256
- }
1257
- if ( !isset($param['w_value_disabled']) ) {
1258
- $param['w_value_disabled'] = 'no';
1259
- }
1260
- if ( !isset($param['w_field_option_pos']) ) {
1261
- $param['w_field_option_pos'] = 'left';
1262
- }
1263
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1264
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1265
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1266
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1267
- $param['w_choices'] = explode('***', $param['w_choices']);
1268
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1269
- if ( isset($param['w_choices_value']) ) {
1270
- $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1271
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1272
- }
1273
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
1274
- if ( $choices_checked == 'true' ) {
1275
- $param['w_choices_checked'][$key] = 'checked="checked"';
1276
- }
1277
- else {
1278
- $param['w_choices_checked'][$key] = '';
1279
- }
1280
- }
1281
- $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"' : '') . '>';
1282
- if ( $param['w_flow'] == 'hor' ) {
1283
- $j = 0;
1284
- for ( $i = 0; $i < (int) $param['w_rowcol']; $i++ ) {
1285
- $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1286
- for ( $l = 0; $l <= (int) (count($param['w_choices']) / $param['w_rowcol']); $l++ ) {
1287
- if ( $j >= count($param['w_choices']) % $param['w_rowcol'] && $l == (int) (count($param['w_choices']) / $param['w_rowcol']) ) {
1288
- continue;
1289
- }
1290
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $l + $i ) {
1291
- $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>';
1292
- }
1293
- else {
1294
- $where = '';
1295
- $order_by = '';
1296
- $db_info = '';
1297
- if ( isset($param['w_choices_value']) ) {
1298
- $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $l + $i];
1299
- }
1300
- else {
1301
- $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $l + $i];
1302
- }
1303
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i] ) {
1304
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $l + $i]);
1305
- $where = 'where="' . $w_choices_params[0] . '"';
1306
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1307
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1308
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1309
- }
1310
- $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>';
1311
- }
1312
- }
1313
- $j++;
1314
- $rep .= '</div>';
1315
- }
1316
- }
1317
- else {
1318
- for ( $i = 0; $i < (int) (count($param['w_choices']) / $param['w_rowcol']); $i++ ) {
1319
- $rep .= '<div id="' . $id . '_element_tr' . $i . '" style="display: table-row;">';
1320
- if ( count($param['w_choices']) > (int) $param['w_rowcol'] ) {
1321
- for ( $l = 0; $l < $param['w_rowcol']; $l++ ) {
1322
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1323
- $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>';
1324
- }
1325
- else {
1326
- $where = '';
1327
- $order_by = '';
1328
- $db_info = '';
1329
- if ( isset($param['w_choices_value']) ) {
1330
- $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1331
- }
1332
- else {
1333
- $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1334
- }
1335
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1336
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1337
- $where = 'where="' . $w_choices_params[0] . '"';
1338
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1339
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1340
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1341
- }
1342
- $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>';
1343
- }
1344
- }
1345
- }
1346
- else {
1347
- for ( $l = 0; $l < count($param['w_choices']); $l++ ) {
1348
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == (int) $param['w_rowcol'] * $i + $l ) {
1349
- $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>';
1350
- }
1351
- else {
1352
- $where = '';
1353
- $order_by = '';
1354
- $db_info = '';
1355
- if ( isset($param['w_choices_value']) ) {
1356
- $choise_value = $param['w_choices_value'][(int) $param['w_rowcol'] * $i + $l];
1357
- }
1358
- else {
1359
- $choise_value = $param['w_choices'][(int) $param['w_rowcol'] * $i + $l];
1360
- }
1361
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l] ) {
1362
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][(int) $param['w_rowcol'] * $i + $l]);
1363
- $where = 'where="' . $w_choices_params[0] . '"';
1364
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1365
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1366
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1367
- }
1368
- $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>';
1369
- }
1370
- }
1371
- }
1372
- $rep .= '</div>';
1373
- }
1374
- if ( count($param['w_choices']) % $param['w_rowcol'] != 0 ) {
1375
- $rep .= '<div id="' . $id . '_element_tr' . ((int) (count($param['w_choices']) / (int) $param['w_rowcol'])) . '" style="display: table-row;">';
1376
- for ( $k = 0; $k < count($param['w_choices']) % $param['w_rowcol']; $k++ ) {
1377
- $l = count($param['w_choices']) - count($param['w_choices']) % $param['w_rowcol'] + $k;
1378
- if ( $param['w_allow_other'] == "yes" && $param['w_allow_other_num'] == $l ) {
1379
- $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>';
1380
- }
1381
- else {
1382
- $where = '';
1383
- $order_by = '';
1384
- $db_info = '';
1385
- if ( isset($param['w_choices_value']) ) {
1386
- $choise_value = $param['w_choices_value'][$l];
1387
- }
1388
- else {
1389
- $choise_value = $param['w_choices'][$l];
1390
- }
1391
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$l] ) {
1392
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$l]);
1393
- $where = 'where="' . $w_choices_params[0] . '"';
1394
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1395
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1396
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1397
- }
1398
- $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 . '"
1399
- ' . $where . ' ' . $order_by . ' ' . $db_info . '>' . $param['w_choices'][$l] . '</label></div>';
1400
- }
1401
- }
1402
- $rep .= '</div>';
1403
- }
1404
- }
1405
- $rep .= '</div></div></div></div>';
1406
- break;
1407
- }
1408
- case 'type_own_select': {
1409
- $params_names = array(
1410
- 'w_field_label_size',
1411
- 'w_field_label_pos',
1412
- 'w_size',
1413
- 'w_choices',
1414
- 'w_choices_checked',
1415
- 'w_choices_disabled',
1416
- 'w_required',
1417
- 'w_class',
1418
- );
1419
- $temp = $params;
1420
- if ( strpos($temp, 'w_choices_value') > -1 ) {
1421
- $params_names = array(
1422
- 'w_field_label_size',
1423
- 'w_field_label_pos',
1424
- 'w_size',
1425
- 'w_choices',
1426
- 'w_choices_checked',
1427
- 'w_choices_disabled',
1428
- 'w_required',
1429
- 'w_value_disabled',
1430
- 'w_choices_value',
1431
- 'w_choices_params',
1432
- 'w_class',
1433
- );
1434
- }
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_choices',
1442
- 'w_choices_checked',
1443
- 'w_choices_disabled',
1444
- 'w_required',
1445
- 'w_value_disabled',
1446
- 'w_choices_value',
1447
- 'w_choices_params',
1448
- 'w_class',
1449
- );
1450
- }
1451
- foreach ( $params_names as $params_name ) {
1452
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1453
- $param[$params_name] = $temp[0];
1454
- $temp = $temp[1];
1455
- }
1456
- if ( $temp ) {
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
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1467
- $param['w_choices'] = explode('***', $param['w_choices']);
1468
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
1469
- $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
1470
- if ( isset($param['w_choices_value']) ) {
1471
- $param['w_choices_value'] = explode('***', $param['w_choices_value']);
1472
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
1473
- }
1474
- if ( !isset($param['w_value_disabled']) ) {
1475
- $param['w_value_disabled'] = 'no';
1476
- }
1477
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
1478
- if ( $choices_checked == 'true' ) {
1479
- $param['w_choices_checked'][$key] = 'selected="selected"';
1480
- }
1481
- else {
1482
- $param['w_choices_checked'][$key] = '';
1483
- }
1484
- }
1485
- $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>';
1486
- foreach ( $param['w_choices'] as $key => $choice ) {
1487
- $where = '';
1488
- $order_by = '';
1489
- $db_info = '';
1490
- $choice_value = $param['w_choices_disabled'][$key] == 'true' ? '' : (isset($param['w_choices_value']) ? $param['w_choices_value'][$key] : $choice);
1491
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
1492
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
1493
- $where = 'where="' . $w_choices_params[0] . '"';
1494
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
1495
- $order_by = "order_by='" . $w_choices_params[0] . "'";
1496
- $db_info = "db_info='" . $w_choices_params[1] . "'";
1497
- }
1498
- $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>';
1499
- }
1500
- $rep .= '</select></div></div>';
1501
- break;
1502
- }
1503
- case 'type_country': {
1504
- $params_names = array(
1505
- 'w_field_label_size',
1506
- 'w_field_label_pos',
1507
- 'w_size',
1508
- 'w_countries',
1509
- 'w_required',
1510
- 'w_class',
1511
- );
1512
- $temp = $params;
1513
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1514
- $params_names = array(
1515
- 'w_field_label_size',
1516
- 'w_field_label_pos',
1517
- 'w_hide_label',
1518
- 'w_size',
1519
- 'w_countries',
1520
- 'w_required',
1521
- 'w_class',
1522
- );
1523
- }
1524
- foreach ( $params_names as $params_name ) {
1525
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1526
- $param[$params_name] = $temp[0];
1527
- $temp = $temp[1];
1528
- }
1529
- if ( $temp ) {
1530
- $temp = explode('*:*w_attr_name*:*', $temp);
1531
- $attrs = array_slice($temp, 0, count($temp) - 1);
1532
- foreach ( $attrs as $attr ) {
1533
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1534
- }
1535
- }
1536
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1537
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1538
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1539
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1540
- $param['w_countries'] = explode('***', $param['w_countries']);
1541
- $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>';
1542
- foreach ( $param['w_countries'] as $key => $choice ) {
1543
- $choice_value = $choice;
1544
- $rep .= '<option value="' . $choice_value . '">' . $choice . '</option>';
1545
- }
1546
- $rep .= '</select></div></div>';
1547
- break;
1548
- }
1549
- case 'type_time': {
1550
- $params_names = array(
1551
- 'w_field_label_size',
1552
- 'w_field_label_pos',
1553
- 'w_time_type',
1554
- 'w_am_pm',
1555
- 'w_sec',
1556
- 'w_hh',
1557
- 'w_mm',
1558
- 'w_ss',
1559
- 'w_mini_labels',
1560
- 'w_required',
1561
- 'w_class',
1562
- );
1563
- $temp = $params;
1564
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1565
- $params_names = array(
1566
- 'w_field_label_size',
1567
- 'w_field_label_pos',
1568
- 'w_hide_label',
1569
- 'w_time_type',
1570
- 'w_am_pm',
1571
- 'w_sec',
1572
- 'w_hh',
1573
- 'w_mm',
1574
- 'w_ss',
1575
- 'w_mini_labels',
1576
- 'w_required',
1577
- 'w_class',
1578
- );
1579
- }
1580
- foreach ( $params_names as $params_name ) {
1581
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1582
- $param[$params_name] = $temp[0];
1583
- $temp = $temp[1];
1584
- }
1585
- if ( $temp ) {
1586
- $temp = explode('*:*w_attr_name*:*', $temp);
1587
- $attrs = array_slice($temp, 0, count($temp) - 1);
1588
- foreach ( $attrs as $attr ) {
1589
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1590
- }
1591
- }
1592
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1593
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1594
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1595
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1596
- $w_mini_labels = explode('***', $param['w_mini_labels']);
1597
- if ( $param['w_sec'] == '1' ) {
1598
- $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" onblur="add_0(&quot;' . $id . '_ssform_id_temp&quot;)" ' . $param['attributes'] . ' disabled /></div>';
1599
- $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>';
1600
- }
1601
- else {
1602
- $w_sec = '';
1603
- $w_sec_label = '';
1604
- }
1605
- if ( $param['w_time_type'] == '12' ) {
1606
- if ( $param['w_am_pm'] == 'am' ) {
1607
- $am_ = "selected=\"selected\"";
1608
- $pm_ = "";
1609
- }
1610
- else {
1611
- $am_ = "";
1612
- $pm_ = "selected=\"selected\"";
1613
- }
1614
- $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>';
1615
- $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>';
1616
- }
1617
- else {
1618
- $w_time_type = '';
1619
- $w_time_type_label = '';
1620
- }
1621
- $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" 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" 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>';
1622
- break;
1623
- }
1624
- case 'type_date': {
1625
- $params_names = array(
1626
- 'w_field_label_size',
1627
- 'w_field_label_pos',
1628
- 'w_date',
1629
- 'w_required',
1630
- 'w_class',
1631
- 'w_format',
1632
- 'w_but_val',
1633
- );
1634
- $temp = $params;
1635
- if ( strpos($temp, 'w_disable_past_days') > -1 ) {
1636
- $params_names = array(
1637
- 'w_field_label_size',
1638
- 'w_field_label_pos',
1639
- 'w_date',
1640
- 'w_required',
1641
- 'w_class',
1642
- 'w_format',
1643
- 'w_but_val',
1644
- 'w_disable_past_days',
1645
- );
1646
- }
1647
- foreach ( $params_names as $params_name ) {
1648
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1649
- $param[$params_name] = $temp[0];
1650
- $temp = $temp[1];
1651
- }
1652
- if ( $temp ) {
1653
- $temp = explode('*:*w_attr_name*:*', $temp);
1654
- $attrs = array_slice($temp, 0, count($temp) - 1);
1655
- foreach ( $attrs as $attr ) {
1656
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1657
- }
1658
- }
1659
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1660
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1661
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1662
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1663
- $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" ' . $param['attributes'] . ' disabled/></div></div>';
1664
- break;
1665
- }
1666
- ///////////////////////// type_date_new ////////////////////////////
1667
- case 'type_date_new': {
1668
- $params_names = array(
1669
- 'w_field_label_size',
1670
- 'w_field_label_pos',
1671
- 'w_size',
1672
- 'w_date',
1673
- 'w_required',
1674
- 'w_show_image',
1675
- 'w_class',
1676
- 'w_format',
1677
- 'w_start_day',
1678
- 'w_default_date',
1679
- 'w_min_date',
1680
- 'w_max_date',
1681
- 'w_invalid_dates',
1682
- 'w_show_days',
1683
- 'w_hide_time',
1684
- 'w_but_val',
1685
- 'w_disable_past_days',
1686
- );
1687
- $temp = $params;
1688
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1689
- $params_names = array(
1690
- 'w_field_label_size',
1691
- 'w_field_label_pos',
1692
- 'w_hide_label',
1693
- 'w_size',
1694
- 'w_date',
1695
- 'w_required',
1696
- 'w_show_image',
1697
- 'w_class',
1698
- 'w_format',
1699
- 'w_start_day',
1700
- 'w_default_date',
1701
- 'w_min_date',
1702
- 'w_max_date',
1703
- 'w_invalid_dates',
1704
- 'w_show_days',
1705
- 'w_hide_time',
1706
- 'w_but_val',
1707
- 'w_disable_past_days',
1708
- );
1709
- }
1710
- foreach ( $params_names as $params_name ) {
1711
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1712
- $param[$params_name] = $temp[0];
1713
- $temp = $temp[1];
1714
- }
1715
- if ( $temp ) {
1716
- $temp = explode('*:*w_attr_name*:*', $temp);
1717
- $attrs = array_slice($temp, 0, count($temp) - 1);
1718
- foreach ( $attrs as $attr ) {
1719
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1720
- }
1721
- }
1722
- $w_show_week_days = explode('***', $param['w_show_days']);
1723
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1724
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1725
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1726
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1727
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1728
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1729
- $display_image_date = $param['w_show_image'] == 'yes' ? 'inline' : 'none';
1730
- $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">
1731
- <input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp">
1732
-
1733
- <input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/>
1734
-
1735
- <input type="hidden" value="' . $param['w_show_image'] . '" name="' . $id . '_show_imageform_id_temp" id="' . $id . '_show_imageform_id_temp">
1736
-
1737
- <input type="hidden" value="' . $param['w_disable_past_days'] . '" name="' . $id . '_dis_past_daysform_id_temp" id="' . $id . '_dis_past_daysform_id_temp">
1738
-
1739
- <input type="hidden" value="' . $param['w_default_date'] . '" name="' . $id . '_default_date_id_temp" id="' . $id . '_default_date_id_temp">
1740
- <input type="hidden" value="' . $param['w_min_date'] . '" name="' . $id . '_min_date_id_temp" id="' . $id . '_min_date_id_temp">
1741
- <input type="hidden" value="' . $param['w_max_date'] . '" name="' . $id . '_max_date_id_temp" id="' . $id . '_max_date_id_temp">
1742
- <input type="hidden" value="' . $param['w_invalid_dates'] . '" name="' . $id . '_invalid_dates_id_temp" id="' . $id . '_invalid_dates_id_temp">
1743
-
1744
- <input type="hidden" value="' . $param['w_start_day'] . '" name="' . $id . '_start_dayform_id_temp" id="' . $id . '_start_dayform_id_temp">
1745
-
1746
- <input type="hidden" value="' . $param['w_hide_time'] . '" name="' . $id . '_hide_timeform_id_temp" id="' . $id . '_hide_timeform_id_temp">
1747
-
1748
- <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] . '" />
1749
- <input type="text" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled />
1750
- <span id="' . $id . '_show_imagedateform_id_temp" class="dashicons dashicons-calendar-alt wd-calendar-button ' . ($param['w_show_image'] == "yes" ? "wd-inline-block" : "wd-hidden") . '"></span>
1751
- <input id="' . $id . '_buttonform_id_temp" type="hidden" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" ></div></div>';
1752
- break;
1753
- }
1754
- case 'type_date_range': {
1755
- $params_names = array(
1756
- 'w_field_label_size',
1757
- 'w_field_label_pos',
1758
- 'w_size',
1759
- 'w_date',
1760
- 'w_required',
1761
- 'w_show_image',
1762
- 'w_class',
1763
- 'w_format',
1764
- 'w_start_day',
1765
- 'w_default_date_start',
1766
- 'w_default_date_end',
1767
- 'w_min_date',
1768
- 'w_max_date',
1769
- 'w_invalid_dates',
1770
- 'w_show_days',
1771
- 'w_hide_time',
1772
- 'w_but_val',
1773
- 'w_disable_past_days',
1774
- );
1775
- $temp = $params;
1776
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1777
- $params_names = array(
1778
- 'w_field_label_size',
1779
- 'w_field_label_pos',
1780
- 'w_hide_label',
1781
- 'w_size',
1782
- 'w_date',
1783
- 'w_required',
1784
- 'w_show_image',
1785
- 'w_class',
1786
- 'w_format',
1787
- 'w_start_day',
1788
- 'w_default_date_start',
1789
- 'w_default_date_end',
1790
- 'w_min_date',
1791
- 'w_max_date',
1792
- 'w_invalid_dates',
1793
- 'w_show_days',
1794
- 'w_hide_time',
1795
- 'w_but_val',
1796
- 'w_disable_past_days',
1797
- );
1798
- }
1799
- foreach ( $params_names as $params_name ) {
1800
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1801
- $param[$params_name] = $temp[0];
1802
- $temp = $temp[1];
1803
- }
1804
- if ( $temp ) {
1805
- $temp = explode('*:*w_attr_name*:*', $temp);
1806
- $attrs = array_slice($temp, 0, count($temp) - 1);
1807
- foreach ( $attrs as $attr ) {
1808
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1809
- }
1810
- }
1811
- $w_show_week_days = explode('***', $param['w_show_days']);
1812
- $defaul_day_array = explode(',', $param['w_date']);
1813
- $defaul_day_start = $defaul_day_array[0];
1814
- $defaul_day_end = $defaul_day_array[1];
1815
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1816
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1817
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1818
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1819
- $param['w_disable_past_days'] = isset($param['w_disable_past_days']) ? $param['w_disable_past_days'] : 'no';
1820
- $disable_past_days = $param['w_disable_past_days'] == 'yes' ? 'true' : 'false';
1821
- $display_image_date = $param['w_show_image'] == 'yes' ? 'inline' : 'none';
1822
- $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'] . ';">
1823
-
1824
- <input type="hidden" value="type_date_range" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp">
1825
-
1826
- <input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp">
1827
-
1828
- <input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/>
1829
-
1830
- <input type="hidden" value="' . $param['w_show_image'] . '" name="' . $id . '_show_imageform_id_temp" id="' . $id . '_show_imageform_id_temp">
1831
-
1832
- <input type="hidden" value="' . $param['w_disable_past_days'] . '" name="' . $id . '_dis_past_daysform_id_temp" id="' . $id . '_dis_past_daysform_id_temp">
1833
-
1834
- <input type="hidden" value="' . $param['w_default_date_start'] . '" name="' . $id . '_default_date_id_temp_start" id="' . $id . '_default_date_id_temp_start">
1835
-
1836
- <input type="hidden" value="' . $param['w_default_date_end'] . '" name="' . $id . '_default_date_id_temp_end" id="' . $id . '_default_date_id_temp_end">
1837
-
1838
- <input type="hidden" value="' . $param['w_min_date'] . '" name="' . $id . '_min_date_id_temp" id="' . $id . '_min_date_id_temp">
1839
-
1840
- <input type="hidden" value="' . $param['w_max_date'] . '" name="' . $id . '_max_date_id_temp" id="' . $id . '_max_date_id_temp">
1841
-
1842
- <input type="hidden" value="' . $param['w_invalid_dates'] . '" name="' . $id . '_invalid_dates_id_temp" id="' . $id . '_invalid_dates_id_temp">
1843
-
1844
- <input type="hidden" value="' . $param['w_start_day'] . '" name="' . $id . '_start_dayform_id_temp" id="' . $id . '_start_dayform_id_temp">
1845
-
1846
- <input type="hidden" value="' . $param['w_hide_time'] . '" name="' . $id . '_hide_timeform_id_temp" id="' . $id . '_hide_timeform_id_temp">
1847
-
1848
- <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] . '">
1849
-
1850
-
1851
-
1852
-
1853
-
1854
- <input type="text" id="' . $id . '_elementform_id_temp0" name="' . $id . '_elementform_id_temp0" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled />
1855
- <span id="' . $id . '_show_imagedateform_id_temp0" class="dashicons dashicons-calendar-alt wd-calendar-button ' . ($param['w_show_image'] == "yes" ? "wd-inline-block" : "wd-hidden") . '"></span>
1856
- <span>-</span>
1857
- <input type="text" id="' . $id . '_elementform_id_temp1" name="' . $id . '_elementform_id_temp1" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled />
1858
- <span id="' . $id . '_show_imagedateform_id_temp1" class="dashicons dashicons-calendar-alt wd-calendar-button ' . ($param['w_show_image'] == "yes" ? "wd-inline-block" : "wd-hidden") . '"></span>
1859
- <input id="' . $id . '_buttonform_id_temp" type="hidden" value="' . $param['w_but_val'] . '" format="' . $param['w_format'] . '" />
1860
- </div></div>';
1861
- break;
1862
- }
1863
- case 'type_date_fields': {
1864
- $params_names = array(
1865
- 'w_field_label_size',
1866
- 'w_field_label_pos',
1867
- 'w_day',
1868
- 'w_month',
1869
- 'w_year',
1870
- 'w_day_type',
1871
- 'w_month_type',
1872
- 'w_year_type',
1873
- 'w_day_label',
1874
- 'w_month_label',
1875
- 'w_year_label',
1876
- 'w_day_size',
1877
- 'w_month_size',
1878
- 'w_year_size',
1879
- 'w_required',
1880
- 'w_class',
1881
- 'w_from',
1882
- 'w_to',
1883
- 'w_divider',
1884
- );
1885
- $temp = $params;
1886
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1887
- $params_names = array(
1888
- 'w_field_label_size',
1889
- 'w_field_label_pos',
1890
- 'w_hide_label',
1891
- 'w_day',
1892
- 'w_month',
1893
- 'w_year',
1894
- 'w_day_type',
1895
- 'w_month_type',
1896
- 'w_year_type',
1897
- 'w_day_label',
1898
- 'w_month_label',
1899
- 'w_year_label',
1900
- 'w_day_size',
1901
- 'w_month_size',
1902
- 'w_year_size',
1903
- 'w_required',
1904
- 'w_class',
1905
- 'w_from',
1906
- 'w_to',
1907
- 'w_divider',
1908
- );
1909
- }
1910
- foreach ( $params_names as $params_name ) {
1911
- $temp = explode('*:*' . $params_name . '*:*', $temp);
1912
- $param[$params_name] = $temp[0];
1913
- $temp = $temp[1];
1914
- }
1915
- if ( $temp ) {
1916
- $temp = explode('*:*w_attr_name*:*', $temp);
1917
- $attrs = array_slice($temp, 0, count($temp) - 1);
1918
- foreach ( $attrs as $attr ) {
1919
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
1920
- }
1921
- }
1922
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
1923
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
1924
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
1925
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
1926
- if ( $param['w_day_type'] == "SELECT" ) {
1927
- $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>';
1928
- for ( $k = 0; $k <= 31; $k++ ) {
1929
- if ( $k < 10 ) {
1930
- if ( $param['w_day'] == '0' . $k ) {
1931
- $selected = "selected=\"selected\"";
1932
- }
1933
- else {
1934
- $selected = "";
1935
- }
1936
- $w_day_type .= '<option value="0' . $k . '" ' . $selected . '>0' . $k . '</option>';
1937
- }
1938
- else {
1939
- if ( $param['w_day'] == '' . $k ) {
1940
- $selected = "selected=\"selected\"";
1941
- }
1942
- else {
1943
- $selected = "";
1944
- }
1945
- $w_day_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
1946
- }
1947
- }
1948
- $w_day_type .= '</select>';
1949
- }
1950
- else {
1951
- $w_day_type = '<input type="text" value="' . $param['w_day'] . '" id="' . $id . '_dayform_id_temp" name="' . $id . '_dayform_id_temp" 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/>';
1952
- }
1953
- if ( $param['w_month_type'] == "SELECT" ) {
1954
- $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>';
1955
- }
1956
- else {
1957
- $w_month_type = '<input type="text" value="' . $param['w_month'] . '" id="' . $id . '_monthform_id_temp" name="' . $id . '_monthform_id_temp" onblur="if (this.value==&quot;0&quot;) this.value=&quot;&quot;; else add_0(&quot;' . $id . '_monthform_id_temp&quot;)" style="width: ' . $param['w_month_size'] . 'px;" ' . $param['attributes'] . ' disabled/>';
1958
- }
1959
- $param['w_to'] = isset($param['w_to']) && $param['w_to'] != "NaN" ? $param['w_to'] : date("Y");
1960
- if ( $param['w_year_type'] == "SELECT" ) {
1961
- $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>';
1962
- for ( $k = $param['w_to']; $k >= $param['w_from']; $k-- ) {
1963
- if ( $param['w_year'] == $k ) {
1964
- $selected = "selected=\"selected\"";
1965
- }
1966
- else {
1967
- $selected = "";
1968
- }
1969
- $w_year_type .= '<option value="' . $k . '" ' . $selected . '>' . $k . '</option>';
1970
- }
1971
- $w_year_type .= '</select>';
1972
- }
1973
- else {
1974
- $w_year_type = '<input type="text" value="' . $param['w_year'] . '" id="' . $id . '_yearform_id_temp" name="' . $id . '_yearform_id_temp" from="' . $param['w_from'] . '" to="' . $param['w_to'] . '" style="width: ' . $param['w_year_size'] . 'px;" ' . $param['attributes'] . ' disabled/>';
1975
- }
1976
- $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;">
1977
- ' . $w_day_type . '
1978
-
1979
- </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>';
1980
- break;
1981
- }
1982
- case 'type_file_upload': {
1983
- $params_names = array(
1984
- 'w_field_label_size',
1985
- 'w_field_label_pos',
1986
- 'w_destination',
1987
- 'w_extension',
1988
- 'w_max_size',
1989
- 'w_required',
1990
- 'w_multiple',
1991
- 'w_class',
1992
- );
1993
- $temp = $params;
1994
- if ( strpos($temp, 'w_hide_label') > -1 ) {
1995
- $params_names = array(
1996
- 'w_field_label_size',
1997
- 'w_field_label_pos',
1998
- 'w_hide_label',
1999
- 'w_destination',
2000
- 'w_extension',
2001
- 'w_max_size',
2002
- 'w_required',
2003
- 'w_multiple',
2004
- 'w_class',
2005
- );
2006
- }
2007
- foreach ( $params_names as $params_name ) {
2008
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2009
- $param[$params_name] = $temp[0];
2010
- if ( isset($temp[1]) ) {
2011
- $temp = $temp[1];
2012
- }
2013
- else {
2014
- $temp = '';
2015
- }
2016
- }
2017
- if ( $temp ) {
2018
- $temp = explode('*:*w_attr_name*:*', $temp);
2019
- $attrs = array_slice($temp, 0, count($temp) - 1);
2020
- foreach ( $attrs as $attr ) {
2021
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2022
- }
2023
- }
2024
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2025
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2026
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2027
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2028
- $multiple = ($param['w_multiple'] == "yes" ? "multiple='multiple'" : "");
2029
- $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>';
2030
- break;
2031
- }
2032
- case 'type_captcha': {
2033
- $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_digit', 'w_class' );
2034
- $temp = $params;
2035
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2036
- $params_names = array(
2037
- 'w_field_label_size',
2038
- 'w_field_label_pos',
2039
- 'w_hide_label',
2040
- 'w_digit',
2041
- 'w_class',
2042
- );
2043
- }
2044
- foreach ( $params_names as $params_name ) {
2045
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2046
- $param[$params_name] = $temp[0];
2047
- $temp = $temp[1];
2048
- }
2049
- if ( $temp ) {
2050
- $temp = explode('*:*w_attr_name*:*', $temp);
2051
- $attrs = array_slice($temp, 0, count($temp) - 1);
2052
- foreach ( $attrs as $attr ) {
2053
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2054
- }
2055
- }
2056
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2057
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2058
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2059
- $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(
2060
- 'action' => 'formmakerwdcaptcha' . WDFM()->plugin_postfix,
2061
- 'digit' => $param['w_digit'],
2062
- 'i' => 'form_id_temp',
2063
- ), 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>';
2064
- break;
2065
- }
2066
- case 'type_arithmetic_captcha': {
2067
- $params_names = array(
2068
- 'w_field_label_size',
2069
- 'w_field_label_pos',
2070
- 'w_count',
2071
- 'w_operations',
2072
- 'w_class',
2073
- 'w_input_size',
2074
- );
2075
- $temp = $params;
2076
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2077
- $params_names = array(
2078
- 'w_field_label_size',
2079
- 'w_field_label_pos',
2080
- 'w_hide_label',
2081
- 'w_count',
2082
- 'w_operations',
2083
- 'w_class',
2084
- 'w_input_size',
2085
- );
2086
- }
2087
- foreach ( $params_names as $params_name ) {
2088
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2089
- $param[$params_name] = $temp[0];
2090
- $temp = $temp[1];
2091
- }
2092
- if ( $temp ) {
2093
- $temp = explode('*:*w_attr_name*:*', $temp);
2094
- $attrs = array_slice($temp, 0, count($temp) - 1);
2095
- foreach ( $attrs as $attr ) {
2096
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2097
- }
2098
- }
2099
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2100
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2101
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2102
- $param['w_count'] = $param['w_count'] ? $param['w_count'] : 1;
2103
- $param['w_operations'] = $param['w_operations'] ? $param['w_operations'] : '+, -, *, /';
2104
- $param['w_input_size'] = $param['w_input_size'] ? $param['w_input_size'] : 60;
2105
- $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(
2106
- 'action' => 'formmakerwdmathcaptcha' . WDFM()->plugin_postfix,
2107
- 'operations_count' => $param['w_count'],
2108
- 'operations' => urlencode($param['w_operations']),
2109
- 'i' => 'form_id_temp',
2110
- ), 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>';
2111
- break;
2112
- }
2113
- case 'type_recaptcha': {
2114
- $params_names = array(
2115
- 'w_field_label_size',
2116
- 'w_field_label_pos',
2117
- 'w_public',
2118
- 'w_private',
2119
- 'w_theme',
2120
- 'w_class',
2121
- );
2122
- $temp = $params;
2123
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2124
- $params_names = array(
2125
- 'w_field_label_size',
2126
- 'w_field_label_pos',
2127
- 'w_hide_label',
2128
- 'w_public',
2129
- 'w_private',
2130
- 'w_theme',
2131
- 'w_class',
2132
- );
2133
- }
2134
- if ( strpos($temp, 'w_type') > -1 ) {
2135
- $params_names = array(
2136
- 'w_field_label_size',
2137
- 'w_field_label_pos',
2138
- 'w_hide_label',
2139
- 'w_type',
2140
- 'w_position',
2141
- );
2142
- }
2143
- $param['w_type'] = 'v2';
2144
- $param['w_position'] = 'hidden';
2145
- foreach ( $params_names as $params_name ) {
2146
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2147
- $param[$params_name] = $temp[0];
2148
- $temp = $temp[1];
2149
- }
2150
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2151
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2152
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2153
- $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" 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" 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" w_type="' . $param['w_type'] . '" position="' . $param['w_position'] . '"><span style="color: red; font-style: italic;">' . __('No preview available for reCAPTCHA.', WDFM()->prefix) . '</span></div></div></div>';
2154
- break;
2155
- }
2156
- case 'type_hidden': {
2157
- $params_names = array( 'w_name', 'w_value' );
2158
- $temp = $params;
2159
- foreach ( $params_names as $params_name ) {
2160
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2161
- $param[$params_name] = $temp[0];
2162
- $temp = $temp[1];
2163
- }
2164
- if ( $temp ) {
2165
- $temp = explode('*:*w_attr_name*:*', $temp);
2166
- $attrs = array_slice($temp, 0, count($temp) - 1);
2167
- foreach ( $attrs as $attr ) {
2168
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2169
- }
2170
- }
2171
- $param['w_name'] = str_replace('&nbsp;', '', $param['w_name']);
2172
- $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>';
2173
- break;
2174
- }
2175
- case 'type_mark_map': {
2176
- $params_names = array(
2177
- 'w_field_label_size',
2178
- 'w_field_label_pos',
2179
- 'w_center_x',
2180
- 'w_center_y',
2181
- 'w_long',
2182
- 'w_lat',
2183
- 'w_zoom',
2184
- 'w_width',
2185
- 'w_height',
2186
- 'w_info',
2187
- 'w_class',
2188
- );
2189
- $temp = $params;
2190
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2191
- $params_names = array(
2192
- 'w_field_label_size',
2193
- 'w_field_label_pos',
2194
- 'w_hide_label',
2195
- 'w_center_x',
2196
- 'w_center_y',
2197
- 'w_long',
2198
- 'w_lat',
2199
- 'w_zoom',
2200
- 'w_width',
2201
- 'w_height',
2202
- 'w_info',
2203
- 'w_class',
2204
- );
2205
- }
2206
- foreach ( $params_names as $params_name ) {
2207
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2208
- $param[$params_name] = $temp[0];
2209
- $temp = $temp[1];
2210
- }
2211
- if ( $temp ) {
2212
- $temp = explode('*:*w_attr_name*:*', $temp);
2213
- $attrs = array_slice($temp, 0, count($temp) - 1);
2214
- foreach ( $attrs as $attr ) {
2215
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2216
- }
2217
- }
2218
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
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
- $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> ';
2222
- break;
2223
- }
2224
- case 'type_map': {
2225
- $params_names = array(
2226
- 'w_center_x',
2227
- 'w_center_y',
2228
- 'w_long',
2229
- 'w_lat',
2230
- 'w_zoom',
2231
- 'w_width',
2232
- 'w_height',
2233
- 'w_info',
2234
- 'w_class',
2235
- );
2236
- $temp = $params;
2237
- foreach ( $params_names as $params_name ) {
2238
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2239
- $param[$params_name] = $temp[0];
2240
- $temp = $temp[1];
2241
- }
2242
- if ( $temp ) {
2243
- $temp = explode('*:*w_attr_name*:*', $temp);
2244
- $attrs = array_slice($temp, 0, count($temp) - 1);
2245
- foreach ( $attrs as $attr ) {
2246
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2247
- }
2248
- }
2249
- $marker = '';
2250
- $param['w_long'] = explode('***', $param['w_long']);
2251
- $param['w_lat'] = explode('***', $param['w_lat']);
2252
- $param['w_info'] = explode('***', $param['w_info']);
2253
- foreach ( $param['w_long'] as $key => $w_long ) {
2254
- $marker .= 'long' . $key . '="' . $w_long . '" lat' . $key . '="' . $param['w_lat'][$key] . '" info' . $key . '="' . $param['w_info'][$key] . '"';
2255
- }
2256
- $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>';
2257
- break;
2258
- }
2259
- case 'type_paypal_price': {
2260
- $params_names = array(
2261
- 'w_field_label_size',
2262
- 'w_field_label_pos',
2263
- 'w_first_val',
2264
- 'w_title',
2265
- 'w_mini_labels',
2266
- 'w_size',
2267
- 'w_required',
2268
- 'w_hide_cents',
2269
- 'w_class',
2270
- 'w_range_min',
2271
- 'w_range_max',
2272
- );
2273
- $temp = $params;
2274
- foreach ( $params_names as $params_name ) {
2275
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2276
- $param[$params_name] = $temp[0];
2277
- $temp = $temp[1];
2278
- }
2279
- if ( $temp ) {
2280
- $temp = explode('*:*w_attr_name*:*', $temp);
2281
- $attrs = array_slice($temp, 0, count($temp) - 1);
2282
- foreach ( $attrs as $attr ) {
2283
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2284
- }
2285
- }
2286
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2287
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2288
- $hide_cents = ($param['w_hide_cents'] == "yes" ? "none;" : "table-cell;");
2289
- $w_first_val = explode('***', $param['w_first_val']);
2290
- $w_title = explode('***', $param['w_title']);
2291
- $w_mini_labels = explode('***', $param['w_mini_labels']);
2292
- $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" id="' . $id . '_element_dollarsform_id_temp" name="' . $id . '_element_dollarsform_id_temp" value="' . $w_first_val[0] . '" title="' . $w_title[0] . '" 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" id="' . $id . '_element_centsform_id_temp" name="' . $id . '_element_centsform_id_temp" value="' . $w_first_val[1] . '" title="' . $w_title[1] . '" onblur="add_0(&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>';
2293
- break;
2294
- }
2295
- case 'type_paypal_price_new': {
2296
- $params_names = array(
2297
- 'w_field_label_size',
2298
- 'w_field_label_pos',
2299
- 'w_first_val',
2300
- 'w_title',
2301
- 'w_size',
2302
- 'w_required',
2303
- 'w_class',
2304
- 'w_range_min',
2305
- 'w_range_max',
2306
- 'w_readonly',
2307
- 'w_currency',
2308
- );
2309
- $temp = $params;
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_first_val',
2316
- 'w_title',
2317
- 'w_size',
2318
- 'w_required',
2319
- 'w_class',
2320
- 'w_range_min',
2321
- 'w_range_max',
2322
- 'w_readonly',
2323
- 'w_currency',
2324
- );
2325
- }
2326
- foreach ( $params_names as $params_name ) {
2327
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2328
- $param[$params_name] = $temp[0];
2329
- $temp = $temp[1];
2330
- }
2331
- if ( $temp ) {
2332
- $temp = explode('*:*w_attr_name*:*', $temp);
2333
- $attrs = array_slice($temp, 0, count($temp) - 1);
2334
- foreach ( $attrs as $attr ) {
2335
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2336
- }
2337
- }
2338
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2339
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2340
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2341
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2342
- $currency_sumbol = ($param['w_currency'] == "yes" ? "display:none;" : "display: table-cell;");
2343
- $param['w_readonly'] = (isset($param['w_readonly']) ? $param['w_readonly'] : "no");
2344
- $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" id="' . $id . '_elementform_id_temp" name="' . $id . '_elementform_id_temp" value="' . $param['w_first_val'] . '" title="' . $param['w_title'] . '" placeholder="' . $param['w_title'] . '" onkeypress="return check_isnum(event)" style="width: ' . $param['w_size'] . 'px;" ' . $param['attributes'] . ' disabled/></div></div></div></div></div>';
2345
- break;
2346
- }
2347
- case 'type_paypal_select': {
2348
- $params_names = array(
2349
- 'w_field_label_size',
2350
- 'w_field_label_pos',
2351
- 'w_size',
2352
- 'w_choices',
2353
- 'w_choices_price',
2354
- 'w_choices_checked',
2355
- 'w_choices_disabled',
2356
- 'w_required',
2357
- 'w_quantity',
2358
- 'w_quantity_value',
2359
- 'w_class',
2360
- 'w_property',
2361
- 'w_property_values',
2362
- );
2363
- $temp = $params;
2364
- if ( strpos($temp, 'w_choices_params') > -1 ) {
2365
- $params_names = array(
2366
- 'w_field_label_size',
2367
- 'w_field_label_pos',
2368
- 'w_size',
2369
- 'w_choices',
2370
- 'w_choices_price',
2371
- 'w_choices_checked',
2372
- 'w_choices_disabled',
2373
- 'w_required',
2374
- 'w_quantity',
2375
- 'w_quantity_value',
2376
- 'w_choices_params',
2377
- 'w_class',
2378
- 'w_property',
2379
- 'w_property_values',
2380
- );
2381
- }
2382
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2383
- $params_names = array(
2384
- 'w_field_label_size',
2385
- 'w_field_label_pos',
2386
- 'w_hide_label',
2387
- 'w_size',
2388
- 'w_choices',
2389
- 'w_choices_price',
2390
- 'w_choices_checked',
2391
- 'w_choices_disabled',
2392
- 'w_required',
2393
- 'w_quantity',
2394
- 'w_quantity_value',
2395
- 'w_choices_params',
2396
- 'w_class',
2397
- 'w_property',
2398
- 'w_property_values',
2399
- );
2400
- }
2401
- foreach ( $params_names as $params_name ) {
2402
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2403
- $param[$params_name] = $temp[0];
2404
- $temp = $temp[1];
2405
- }
2406
- if ( $temp ) {
2407
- $temp = explode('*:*w_attr_name*:*', $temp);
2408
- $attrs = array_slice($temp, 0, count($temp) - 1);
2409
- foreach ( $attrs as $attr ) {
2410
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2411
- }
2412
- }
2413
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2414
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2415
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2416
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2417
- $param['w_choices'] = explode('***', $param['w_choices']);
2418
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2419
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2420
- $param['w_choices_disabled'] = explode('***', $param['w_choices_disabled']);
2421
- $param['w_property'] = explode('***', $param['w_property']);
2422
- $param['w_property_values'] = explode('***', $param['w_property_values']);
2423
- if ( isset($param['w_choices_params']) ) {
2424
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2425
- }
2426
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2427
- if ( $choices_checked == 'true' ) {
2428
- $param['w_choices_checked'][$key] = 'selected="selected"';
2429
- }
2430
- else {
2431
- $param['w_choices_checked'][$key] = '';
2432
- }
2433
- }
2434
- $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>';
2435
- foreach ( $param['w_choices'] as $key => $choice ) {
2436
- $where = '';
2437
- $order_by = '';
2438
- $db_info = '';
2439
- $choice_value = $param['w_choices_disabled'][$key] == "true" ? '' : $param['w_choices_price'][$key];
2440
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2441
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2442
- $where = 'where="' . $w_choices_params[0] . '"';
2443
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2444
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2445
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2446
- }
2447
- $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>';
2448
- }
2449
- $rep .= '</select><div id="' . $id . '_divform_id_temp">';
2450
- if ( $param['w_quantity'] == "yes" ) {
2451
- $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)" style="width: 30px; margin: 2px 0px;" disabled /></span>';
2452
- }
2453
- if ( $param['w_property'][0] ) {
2454
- foreach ( $param['w_property'] as $key => $property ) {
2455
- $rep .= '
2456
- <span id="' . $id . '_property_' . $key . '" style="margin-right: 15px;">
2457
-
2458
- <label class="mini_label" id="' . $id . '_property_label_form_id_temp' . $key . '" style="margin-right: 5px;">' . $property . '</label>
2459
- <select id="' . $id . '_propertyform_id_temp' . $key . '" name="' . $id . '_propertyform_id_temp' . $key . '" style="width: auto; margin: 2px 0px;" disabled>';
2460
- $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
2461
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
2462
- foreach ( $param['w_property_values'][$key] as $subkey => $property_value ) {
2463
- $rep .= '<option id="' . $id . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '">' . $property_value . '</option>';
2464
- }
2465
- $rep .= '</select></span>';
2466
- }
2467
- }
2468
- $rep .= '</div></div></div>';
2469
- break;
2470
- }
2471
- case 'type_paypal_checkbox': {
2472
- $params_names = array(
2473
- 'w_field_label_size',
2474
- 'w_field_label_pos',
2475
- 'w_flow',
2476
- 'w_choices',
2477
- 'w_choices_price',
2478
- 'w_choices_checked',
2479
- 'w_required',
2480
- 'w_randomize',
2481
- 'w_allow_other',
2482
- 'w_allow_other_num',
2483
- 'w_class',
2484
- 'w_property',
2485
- 'w_property_values',
2486
- 'w_quantity',
2487
- 'w_quantity_value',
2488
- );
2489
- $temp = $params;
2490
- if ( strpos($temp, 'w_field_option_pos') > -1 ) {
2491
- $params_names = array(
2492
- 'w_field_label_size',
2493
- 'w_field_label_pos',
2494
- 'w_field_option_pos',
2495
- 'w_flow',
2496
- 'w_choices',
2497
- 'w_choices_price',
2498
- 'w_choices_checked',
2499
- 'w_required',
2500
- 'w_randomize',
2501
- 'w_allow_other',
2502
- 'w_allow_other_num',
2503
- 'w_choices_params',
2504
- 'w_class',
2505
- 'w_property',
2506
- 'w_property_values',
2507
- 'w_quantity',
2508
- 'w_quantity_value',
2509
- );
2510
- }
2511
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2512
- $params_names = array(
2513
- 'w_field_label_size',
2514
- 'w_field_label_pos',
2515
- 'w_field_option_pos',
2516
- 'w_hide_label',
2517
- 'w_flow',
2518
- 'w_choices',
2519
- 'w_choices_price',
2520
- 'w_choices_checked',
2521
- 'w_required',
2522
- 'w_randomize',
2523
- 'w_allow_other',
2524
- 'w_allow_other_num',
2525
- 'w_choices_params',
2526
- 'w_class',
2527
- 'w_property',
2528
- 'w_property_values',
2529
- 'w_quantity',
2530
- 'w_quantity_value',
2531
- );
2532
- }
2533
- foreach ( $params_names as $params_name ) {
2534
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2535
- $param[$params_name] = $temp[0];
2536
- $temp = $temp[1];
2537
- }
2538
- if ( $temp ) {
2539
- $temp = explode('*:*w_attr_name*:*', $temp);
2540
- $attrs = array_slice($temp, 0, count($temp) - 1);
2541
- foreach ( $attrs as $attr ) {
2542
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2543
- }
2544
- }
2545
- if ( !isset($param['w_field_option_pos']) ) {
2546
- $param['w_field_option_pos'] = 'left';
2547
- }
2548
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2549
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2550
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2551
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2552
- $param['w_choices'] = explode('***', $param['w_choices']);
2553
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2554
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2555
- $param['w_property'] = explode('***', $param['w_property']);
2556
- $param['w_property_values'] = explode('***', $param['w_property_values']);
2557
- if ( isset($param['w_choices_params']) ) {
2558
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2559
- }
2560
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2561
- if ( $choices_checked == 'true' ) {
2562
- $param['w_choices_checked'][$key] = 'checked="checked"';
2563
- }
2564
- else {
2565
- $param['w_choices_checked'][$key] = '';
2566
- }
2567
- }
2568
- $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;">';
2569
- if ( $param['w_flow'] == 'hor' ) {
2570
- $rep .= '<div id="' . $id . '_hor" style="display: table-row;">';
2571
- foreach ( $param['w_choices'] as $key => $choice ) {
2572
- $where = '';
2573
- $order_by = '';
2574
- $db_info = '';
2575
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2576
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2577
- $where = 'where="' . $w_choices_params[0] . '"';
2578
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2579
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2580
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2581
- }
2582
- $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>';
2583
- }
2584
- $rep .= '</div>';
2585
- }
2586
- else {
2587
- foreach ( $param['w_choices'] as $key => $choice ) {
2588
- $where = '';
2589
- $order_by = '';
2590
- $db_info = '';
2591
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2592
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2593
- $where = 'where="' . $w_choices_params[0] . '"';
2594
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2595
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2596
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2597
- }
2598
- $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>';
2599
- }
2600
- }
2601
- $rep .= '</div></div>';
2602
- $rep .= '<div id="' . $id . '_divform_id_temp">';
2603
- if ( $param['w_quantity'] == "yes" ) {
2604
- $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)" style="width: 30px; margin: 2px 0px;" disabled/></span>';
2605
- }
2606
- if ( $param['w_property'][0] ) {
2607
- foreach ( $param['w_property'] as $key => $property ) {
2608
- $rep .= '
2609
- <span id="' . $id . '_property_' . $key . '" style="margin-right: 15px;">
2610
-
2611
- <label class="mini_label" id="' . $id . '_property_label_form_id_temp' . $key . '" style="margin-right: 5px;">' . $property . '</label>
2612
- <select id="' . $id . '_propertyform_id_temp' . $key . '" name="' . $id . '_propertyform_id_temp' . $key . '" style="width: auto; margin: 2px 0px;" disabled>';
2613
- $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
2614
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
2615
- foreach ( $param['w_property_values'][$key] as $subkey => $property_value ) {
2616
- $rep .= '<option id="' . $id . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '">' . $property_value . '</option>';
2617
- }
2618
- $rep .= '</select></span>';
2619
- }
2620
- }
2621
- $rep .= '</div></div></div>';
2622
- break;
2623
- }
2624
- case 'type_paypal_radio': {
2625
- $params_names = array(
2626
- 'w_field_label_size',
2627
- 'w_field_label_pos',
2628
- 'w_flow',
2629
- 'w_choices',
2630
- 'w_choices_price',
2631
- 'w_choices_checked',
2632
- 'w_required',
2633
- 'w_randomize',
2634
- 'w_allow_other',
2635
- 'w_allow_other_num',
2636
- 'w_class',
2637
- 'w_property',
2638
- 'w_property_values',
2639
- 'w_quantity',
2640
- 'w_quantity_value',
2641
- );
2642
- $temp = $params;
2643
- if ( strpos($temp, 'w_field_option_pos') > -1 ) {
2644
- $params_names = array(
2645
- 'w_field_label_size',
2646
- 'w_field_label_pos',
2647
- 'w_field_option_pos',
2648
- 'w_flow',
2649
- 'w_choices',
2650
- 'w_choices_price',
2651
- 'w_choices_checked',
2652
- 'w_required',
2653
- 'w_randomize',
2654
- 'w_allow_other',
2655
- 'w_allow_other_num',
2656
- 'w_choices_params',
2657
- 'w_class',
2658
- 'w_property',
2659
- 'w_property_values',
2660
- 'w_quantity',
2661
- 'w_quantity_value',
2662
- );
2663
- }
2664
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2665
- $params_names = array(
2666
- 'w_field_label_size',
2667
- 'w_field_label_pos',
2668
- 'w_field_option_pos',
2669
- 'w_hide_label',
2670
- 'w_flow',
2671
- 'w_choices',
2672
- 'w_choices_price',
2673
- 'w_choices_checked',
2674
- 'w_required',
2675
- 'w_randomize',
2676
- 'w_allow_other',
2677
- 'w_allow_other_num',
2678
- 'w_choices_params',
2679
- 'w_class',
2680
- 'w_property',
2681
- 'w_property_values',
2682
- 'w_quantity',
2683
- 'w_quantity_value',
2684
- );
2685
- }
2686
- foreach ( $params_names as $params_name ) {
2687
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2688
- $param[$params_name] = $temp[0];
2689
- $temp = $temp[1];
2690
- }
2691
- if ( $temp ) {
2692
- $temp = explode('*:*w_attr_name*:*', $temp);
2693
- $attrs = array_slice($temp, 0, count($temp) - 1);
2694
- foreach ( $attrs as $attr ) {
2695
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2696
- }
2697
- }
2698
- if ( !isset($param['w_field_option_pos']) ) {
2699
- $param['w_field_option_pos'] = 'left';
2700
- }
2701
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2702
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2703
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2704
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2705
- $param['w_choices'] = explode('***', $param['w_choices']);
2706
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2707
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2708
- $param['w_property'] = explode('***', $param['w_property']);
2709
- $param['w_property_values'] = explode('***', $param['w_property_values']);
2710
- if ( isset($param['w_choices_params']) ) {
2711
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2712
- }
2713
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2714
- if ( $choices_checked == 'true' ) {
2715
- $param['w_choices_checked'][$key] = 'checked="checked"';
2716
- }
2717
- else {
2718
- $param['w_choices_checked'][$key] = '';
2719
- }
2720
- }
2721
- $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;">';
2722
- if ( $param['w_flow'] == 'hor' ) {
2723
- $rep .= '<div id="' . $id . '_hor" style="display: table-row;">';
2724
- foreach ( $param['w_choices'] as $key => $choice ) {
2725
- $where = '';
2726
- $order_by = '';
2727
- $db_info = '';
2728
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2729
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2730
- $where = 'where="' . $w_choices_params[0] . '"';
2731
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2732
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2733
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2734
- }
2735
- $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>';
2736
- }
2737
- $rep .= '</div>';
2738
- }
2739
- else {
2740
- foreach ( $param['w_choices'] as $key => $choice ) {
2741
- $where = '';
2742
- $order_by = '';
2743
- $db_info = '';
2744
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2745
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2746
- $where = 'where="' . $w_choices_params[0] . '"';
2747
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2748
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2749
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2750
- }
2751
- $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>';
2752
- }
2753
- }
2754
- $rep .= '</div></div>';
2755
- $rep .= '<div id="' . $id . '_divform_id_temp">';
2756
- if ( $param['w_quantity'] == "yes" ) {
2757
- $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)" style="width: 30px; margin: 2px 0px;" disabled/></span>';
2758
- }
2759
- if ( $param['w_property'][0] ) {
2760
- foreach ( $param['w_property'] as $key => $property ) {
2761
- $rep .= '
2762
- <span id="' . $id . '_property_' . $key . '" style="margin-right: 15px;">
2763
-
2764
- <label class="mini_label" id="' . $id . '_property_label_form_id_temp' . $key . '" style="margin-right: 5px;">' . $property . '</label>
2765
- <select id="' . $id . '_propertyform_id_temp' . $key . '" name="' . $id . '_propertyform_id_temp' . $key . '" style="width: auto; margin: 2px 0px;" disabled>';
2766
- $param['w_property_values'][$key] = explode('###', $param['w_property_values'][$key]);
2767
- $param['w_property_values'][$key] = array_slice($param['w_property_values'][$key], 1, count($param['w_property_values'][$key]));
2768
- foreach ( $param['w_property_values'][$key] as $subkey => $property_value ) {
2769
- $rep .= '<option id="' . $id . '_' . $key . '_option' . $subkey . '" value="' . $property_value . '">' . $property_value . '</option>';
2770
- }
2771
- $rep .= '</select></span>';
2772
- }
2773
- }
2774
- $rep .= '</div></div></div>';
2775
- break;
2776
- }
2777
- case 'type_paypal_shipping': {
2778
- $params_names = array(
2779
- 'w_field_label_size',
2780
- 'w_field_label_pos',
2781
- 'w_flow',
2782
- 'w_choices',
2783
- 'w_choices_price',
2784
- 'w_choices_checked',
2785
- 'w_required',
2786
- 'w_randomize',
2787
- 'w_allow_other',
2788
- 'w_allow_other_num',
2789
- 'w_class',
2790
- );
2791
- $temp = $params;
2792
- if ( strpos($temp, 'w_field_option_pos') > -1 ) {
2793
- $params_names = array(
2794
- 'w_field_label_size',
2795
- 'w_field_label_pos',
2796
- 'w_field_option_pos',
2797
- 'w_flow',
2798
- 'w_choices',
2799
- 'w_choices_price',
2800
- 'w_choices_checked',
2801
- 'w_required',
2802
- 'w_randomize',
2803
- 'w_allow_other',
2804
- 'w_allow_other_num',
2805
- 'w_choices_params',
2806
- 'w_class',
2807
- );
2808
- }
2809
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2810
- $params_names = array(
2811
- 'w_field_label_size',
2812
- 'w_field_label_pos',
2813
- 'w_field_option_pos',
2814
- 'w_hide_label',
2815
- 'w_flow',
2816
- 'w_choices',
2817
- 'w_choices_price',
2818
- 'w_choices_checked',
2819
- 'w_required',
2820
- 'w_randomize',
2821
- 'w_allow_other',
2822
- 'w_allow_other_num',
2823
- 'w_choices_params',
2824
- 'w_class',
2825
- );
2826
- }
2827
- foreach ( $params_names as $params_name ) {
2828
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2829
- $param[$params_name] = $temp[0];
2830
- $temp = $temp[1];
2831
- }
2832
- if ( $temp ) {
2833
- $temp = explode('*:*w_attr_name*:*', $temp);
2834
- $attrs = array_slice($temp, 0, count($temp) - 1);
2835
- foreach ( $attrs as $attr ) {
2836
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2837
- }
2838
- }
2839
- if ( !isset($param['w_field_option_pos']) ) {
2840
- $param['w_field_option_pos'] = 'left';
2841
- }
2842
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2843
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2844
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2845
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2846
- $param['w_choices'] = explode('***', $param['w_choices']);
2847
- $param['w_choices_price'] = explode('***', $param['w_choices_price']);
2848
- $param['w_choices_checked'] = explode('***', $param['w_choices_checked']);
2849
- if ( isset($param['w_choices_params']) ) {
2850
- $param['w_choices_params'] = explode('***', $param['w_choices_params']);
2851
- }
2852
- foreach ( $param['w_choices_checked'] as $key => $choices_checked ) {
2853
- if ( $choices_checked == 'true' ) {
2854
- $param['w_choices_checked'][$key] = 'checked="checked"';
2855
- }
2856
- else {
2857
- $param['w_choices_checked'][$key] = '';
2858
- }
2859
- }
2860
- $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;">';
2861
- if ( $param['w_flow'] == 'hor' ) {
2862
- $rep .= '<div id="' . $id . '_hor" style="display: table-row;">';
2863
- foreach ( $param['w_choices'] as $key => $choice ) {
2864
- $where = '';
2865
- $order_by = '';
2866
- $db_info = '';
2867
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2868
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2869
- $where = 'where="' . $w_choices_params[0] . '"';
2870
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2871
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2872
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2873
- }
2874
- $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>';
2875
- }
2876
- $rep .= '</div>';
2877
- }
2878
- else {
2879
- foreach ( $param['w_choices'] as $key => $choice ) {
2880
- $where = '';
2881
- $order_by = '';
2882
- $db_info = '';
2883
- if ( isset($param['w_choices_params']) && $param['w_choices_params'][$key] ) {
2884
- $w_choices_params = explode('[where_order_by]', $param['w_choices_params'][$key]);
2885
- $where = 'where="' . $w_choices_params[0] . '"';
2886
- $w_choices_params = explode('[db_info]', $w_choices_params[1]);
2887
- $order_by = "order_by='" . $w_choices_params[0] . "'";
2888
- $db_info = "db_info='" . $w_choices_params[1] . "'";
2889
- }
2890
- $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>';
2891
- }
2892
- }
2893
- $rep .= '</div></div>';
2894
- $rep .= '</div></div>';
2895
- break;
2896
- }
2897
- case 'type_paypal_total': {
2898
- $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_class' );
2899
- $temp = $params;
2900
- if ( strpos($temp, 'w_size') > -1 ) {
2901
- $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_class', 'w_size' );
2902
- }
2903
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2904
- $params_names = array( 'w_field_label_size', 'w_field_label_pos', 'w_hide_label', 'w_class', 'w_size' );
2905
- }
2906
- foreach ( $params_names as $params_name ) {
2907
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2908
- $param[$params_name] = $temp[0];
2909
- $temp = $temp[1];
2910
- }
2911
- if ( $temp ) {
2912
- $temp = explode('*:*w_attr_name*:*', $temp);
2913
- $attrs = array_slice($temp, 0, count($temp) - 1);
2914
- foreach ( $attrs as $attr ) {
2915
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2916
- }
2917
- }
2918
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2919
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2920
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2921
- $param['w_size'] = isset($param['w_size']) ? $param['w_size'] : '300';
2922
- $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>';
2923
- break;
2924
- }
2925
- case 'type_stripe': {
2926
- $params_names = array( 'w_field_size', 'w_field_label_size', 'w_field_label_pos', 'w_class' );
2927
- $temp = $params;
2928
- foreach ( $params_names as $params_name ) {
2929
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2930
- $param[$params_name] = $temp[0];
2931
- $temp = $temp[1];
2932
- }
2933
- if ( $temp ) {
2934
- $temp = explode('*:*w_attr_name*:*', $temp);
2935
- $attrs = array_slice($temp, 0, count($temp) - 1);
2936
- foreach ( $attrs as $attr ) {
2937
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2938
- }
2939
- }
2940
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2941
- $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>';
2942
- break;
2943
- }
2944
- case 'type_star_rating': {
2945
- $params_names = array(
2946
- 'w_field_label_size',
2947
- 'w_field_label_pos',
2948
- 'w_field_label_col',
2949
- 'w_star_amount',
2950
- 'w_required',
2951
- 'w_class',
2952
- );
2953
- $temp = $params;
2954
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2955
- $params_names = array(
2956
- 'w_field_label_size',
2957
- 'w_field_label_pos',
2958
- 'w_hide_label',
2959
- 'w_field_label_col',
2960
- 'w_star_amount',
2961
- 'w_required',
2962
- 'w_class',
2963
- );
2964
- }
2965
- foreach ( $params_names as $params_name ) {
2966
- $temp = explode('*:*' . $params_name . '*:*', $temp);
2967
- $param[$params_name] = $temp[0];
2968
- $temp = $temp[1];
2969
- }
2970
- if ( $temp ) {
2971
- $temp = explode('*:*w_attr_name*:*', $temp);
2972
- $attrs = array_slice($temp, 0, count($temp) - 1);
2973
- foreach ( $attrs as $attr ) {
2974
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
2975
- }
2976
- }
2977
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
2978
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
2979
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
2980
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
2981
- $images = '';
2982
- for ( $i = 0; $i < $param['w_star_amount']; $i++ ) {
2983
- $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;)">';
2984
- }
2985
- $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>';
2986
- break;
2987
- }
2988
- case 'type_scale_rating': {
2989
- $params_names = array(
2990
- 'w_field_label_size',
2991
- 'w_field_label_pos',
2992
- 'w_mini_labels',
2993
- 'w_scale_amount',
2994
- 'w_required',
2995
- 'w_class',
2996
- );
2997
- $temp = $params;
2998
- if ( strpos($temp, 'w_hide_label') > -1 ) {
2999
- $params_names = array(
3000
- 'w_field_label_size',
3001
- 'w_field_label_pos',
3002
- 'w_hide_label',
3003
- 'w_mini_labels',
3004
- 'w_scale_amount',
3005
- 'w_required',
3006
- 'w_class',
3007
- );
3008
- }
3009
- foreach ( $params_names as $params_name ) {
3010
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3011
- $param[$params_name] = $temp[0];
3012
- $temp = $temp[1];
3013
- }
3014
- if ( $temp ) {
3015
- $temp = explode('*:*w_attr_name*:*', $temp);
3016
- $attrs = array_slice($temp, 0, count($temp) - 1);
3017
- foreach ( $attrs as $attr ) {
3018
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3019
- }
3020
- }
3021
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3022
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3023
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3024
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3025
- $w_mini_labels = explode('***', $param['w_mini_labels']);
3026
- $numbers = '';
3027
- for ( $i = 1; $i <= $param['w_scale_amount']; $i++ ) {
3028
- $numbers .= '<div id="' . $id . '_scale_td1_' . $i . 'form_id_temp" style="text-align: center; display: table-cell;"><span>' . $i . '</span></div>';
3029
- }
3030
- $radio_buttons = '';
3031
- for ( $k = 1; $k <= $param['w_scale_amount']; $k++ ) {
3032
- $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>';
3033
- }
3034
- $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>';
3035
- break;
3036
- }
3037
- case 'type_spinner': {
3038
- $params_names = array(
3039
- 'w_field_label_size',
3040
- 'w_field_label_pos',
3041
- 'w_field_width',
3042
- 'w_field_min_value',
3043
- 'w_field_max_value',
3044
- 'w_field_step',
3045
- 'w_field_value',
3046
- 'w_required',
3047
- 'w_class',
3048
- );
3049
- $temp = $params;
3050
- if ( strpos($temp, 'w_hide_label') > -1 ) {
3051
- $params_names = array(
3052
- 'w_field_label_size',
3053
- 'w_field_label_pos',
3054
- 'w_hide_label',
3055
- 'w_field_width',
3056
- 'w_field_min_value',
3057
- 'w_field_max_value',
3058
- 'w_field_step',
3059
- 'w_field_value',
3060
- 'w_required',
3061
- 'w_class',
3062
- );
3063
- }
3064
- foreach ( $params_names as $params_name ) {
3065
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3066
- $param[$params_name] = $temp[0];
3067
- $temp = $temp[1];
3068
- }
3069
- if ( $temp ) {
3070
- $temp = explode('*:*w_attr_name*:*', $temp);
3071
- $attrs = array_slice($temp, 0, count($temp) - 1);
3072
- foreach ( $attrs as $attr ) {
3073
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3074
- }
3075
- }
3076
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3077
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3078
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3079
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3080
- $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>';
3081
- break;
3082
- }
3083
- case 'type_slider': {
3084
- $params_names = array(
3085
- 'w_field_label_size',
3086
- 'w_field_label_pos',
3087
- 'w_field_width',
3088
- 'w_field_min_value',
3089
- 'w_field_max_value',
3090
- 'w_field_value',
3091
- 'w_required',
3092
- 'w_class',
3093
- );
3094
- $temp = $params;
3095
- if ( strpos($temp, 'w_hide_label') > -1 ) {
3096
- $params_names = array(
3097
- 'w_field_label_size',
3098
- 'w_field_label_pos',
3099
- 'w_hide_label',
3100
- 'w_field_width',
3101
- 'w_field_min_value',
3102
- 'w_field_max_value',
3103
- 'w_field_value',
3104
- 'w_required',
3105
- 'w_class',
3106
- );
3107
- }
3108
- foreach ( $params_names as $params_name ) {
3109
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3110
- $param[$params_name] = $temp[0];
3111
- $temp = $temp[1];
3112
- }
3113
- if ( $temp ) {
3114
- $temp = explode('*:*w_attr_name*:*', $temp);
3115
- $attrs = array_slice($temp, 0, count($temp) - 1);
3116
- foreach ( $attrs as $attr ) {
3117
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3118
- }
3119
- }
3120
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3121
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3122
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3123
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3124
- $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>';
3125
- break;
3126
- }
3127
- case 'type_range': {
3128
- $params_names = array(
3129
- 'w_field_label_size',
3130
- 'w_field_label_pos',
3131
- 'w_field_range_width',
3132
- 'w_field_range_step',
3133
- 'w_field_value1',
3134
- 'w_field_value2',
3135
- 'w_mini_labels',
3136
- 'w_required',
3137
- 'w_class',
3138
- );
3139
- $temp = $params;
3140
- if ( strpos($temp, 'w_hide_label') > -1 ) {
3141
- $params_names = array(
3142
- 'w_field_label_size',
3143
- 'w_field_label_pos',
3144
- 'w_hide_label',
3145
- 'w_field_range_width',
3146
- 'w_field_range_step',
3147
- 'w_field_value1',
3148
- 'w_field_value2',
3149
- 'w_mini_labels',
3150
- 'w_required',
3151
- 'w_class',
3152
- );
3153
- }
3154
- foreach ( $params_names as $params_name ) {
3155
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3156
- $param[$params_name] = $temp[0];
3157
- $temp = $temp[1];
3158
- }
3159
- if ( $temp ) {
3160
- $temp = explode('*:*w_attr_name*:*', $temp);
3161
- $attrs = array_slice($temp, 0, count($temp) - 1);
3162
- foreach ( $attrs as $attr ) {
3163
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3164
- }
3165
- }
3166
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3167
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3168
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3169
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3170
- $w_mini_labels = explode('***', $param['w_mini_labels']);
3171
- $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>';
3172
- break;
3173
- }
3174
- case 'type_grading': {
3175
- $params_names = array(
3176
- 'w_field_label_size',
3177
- 'w_field_label_pos',
3178
- 'w_items',
3179
- 'w_total',
3180
- 'w_required',
3181
- 'w_class',
3182
- );
3183
- $temp = $params;
3184
- if ( strpos($temp, 'w_hide_label') > -1 ) {
3185
- $params_names = array(
3186
- 'w_field_label_size',
3187
- 'w_field_label_pos',
3188
- 'w_hide_label',
3189
- 'w_items',
3190
- 'w_total',
3191
- 'w_required',
3192
- 'w_class',
3193
- );
3194
- }
3195
- foreach ( $params_names as $params_name ) {
3196
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3197
- $param[$params_name] = $temp[0];
3198
- $temp = $temp[1];
3199
- }
3200
- if ( $temp ) {
3201
- $temp = explode('*:*w_attr_name*:*', $temp);
3202
- $attrs = array_slice($temp, 0, count($temp) - 1);
3203
- foreach ( $attrs as $attr ) {
3204
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3205
- }
3206
- }
3207
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3208
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3209
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3210
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3211
- $w_items = explode('***', $param['w_items']);
3212
- $grading_items = '';
3213
- for ( $i = 0; $i < count($w_items); $i++ ) {
3214
- $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>';
3215
- }
3216
- $rep = '<div id="wdform_field' . $id . '" type="type_grading" class="wdform_field" style="display: table-cell;">'
3217
- . $arrows . '
3218
- <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;">
3219
- <span id="' . $id . '_element_labelform_id_temp" class="label">' . $label . '</span>
3220
- <span id="' . $id . '_required_elementform_id_temp" class="required">' . $required_sym . '</span>
3221
- </div>
3222
- <div align="left" id="' . $id . '_element_sectionform_id_temp" class="' . $param['w_class'] . '" style="display: ' . $param['w_field_label_pos'] . ';">
3223
- <input type="hidden" value="type_grading" name="' . $id . '_typeform_id_temp" id="' . $id . '_typeform_id_temp">
3224
- <input type="hidden" value="' . $param['w_required'] . '" name="' . $id . '_requiredform_id_temp" id="' . $id . '_requiredform_id_temp">
3225
- <input type="hidden" value="' . $param['w_hide_label'] . '" name="' . $id . '_hide_labelform_id_temp" id="' . $id . '_hide_labelform_id_temp"/>
3226
- <input type="hidden" value="' . $param['w_total'] . '" name="' . $id . '_grading_totalform_id_temp" id="' . $id . '_grading_totalform_id_temp">
3227
- <div id="' . $id . '_elementform_id_temp">' . $grading_items . '
3228
- <div id="' . $id . '_element_total_divform_id_temp" class="grading_div" style="display: ' . (!$param['w_total'] ? 'none' : 'block') . ';">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>
3229
- <span id="' . $id . '_text_elementform_id_temp" name="' . $id . '_text_elementform_id_temp"></span>
3230
- </div>
3231
- </div>
3232
- </div>
3233
- </div>';
3234
- break;
3235
- }
3236
- case 'type_matrix': {
3237
- $params_names = array(
3238
- 'w_field_label_size',
3239
- 'w_field_label_pos',
3240
- 'w_field_input_type',
3241
- 'w_rows',
3242
- 'w_columns',
3243
- 'w_required',
3244
- 'w_class',
3245
- 'w_textbox_size',
3246
- );
3247
- $temp = $params;
3248
- if ( strpos($temp, 'w_hide_label') > -1 ) {
3249
- $params_names = array(
3250
- 'w_field_label_size',
3251
- 'w_field_label_pos',
3252
- 'w_hide_label',
3253
- 'w_field_input_type',
3254
- 'w_rows',
3255
- 'w_columns',
3256
- 'w_required',
3257
- 'w_class',
3258
- 'w_textbox_size',
3259
- );
3260
- }
3261
- foreach ( $params_names as $params_name ) {
3262
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3263
- $param[$params_name] = $temp[0];
3264
- $temp = $temp[1];
3265
- }
3266
- if ( $temp ) {
3267
- $temp = explode('*:*w_attr_name*:*', $temp);
3268
- $attrs = array_slice($temp, 0, count($temp) - 1);
3269
- foreach ( $attrs as $attr ) {
3270
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3271
- }
3272
- }
3273
- $param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
3274
- $param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
3275
- $display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
3276
- $required_sym = ($param['w_required'] == "yes" ? " *" : "");
3277
- $param['w_textbox_size'] = isset($param['w_textbox_size']) ? $param['w_textbox_size'] : '100';
3278
- $w_rows = explode('***', $param['w_rows']);
3279
- $w_columns = explode('***', $param['w_columns']);
3280
- $column_labels = '';
3281
- for ( $i = 1; $i < count($w_columns); $i++ ) {
3282
- $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>';
3283
- }
3284
- $rows_columns = '';
3285
- for ( $i = 1; $i < count($w_rows); $i++ ) {
3286
- $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>';
3287
- for ( $k = 1; $k < count($w_columns); $k++ ) {
3288
- if ( $param['w_field_input_type'] == 'radio' ) {
3289
- $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>';
3290
- }
3291
- else {
3292
- if ( $param['w_field_input_type'] == 'checkbox' ) {
3293
- $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>';
3294
- }
3295
- else {
3296
- if ( $param['w_field_input_type'] == 'text' ) {
3297
- $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>';
3298
- }
3299
- else {
3300
- if ( $param['w_field_input_type'] == 'select' ) {
3301
- $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>';
3302
- }
3303
- }
3304
- }
3305
- }
3306
- }
3307
- $rows_columns .= '</div>';
3308
- }
3309
- $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>';
3310
- break;
3311
- }
3312
- case 'type_submit_reset': {
3313
- $params_names = array( 'w_submit_title', 'w_reset_title', 'w_class', 'w_act' );
3314
- $temp = $params;
3315
- foreach ( $params_names as $params_name ) {
3316
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3317
- $param[$params_name] = $temp[0];
3318
- $temp = $temp[1];
3319
- }
3320
- if ( $temp ) {
3321
- $temp = explode('*:*w_attr_name*:*', $temp);
3322
- $attrs = array_slice($temp, 0, count($temp) - 1);
3323
- foreach ( $attrs as $attr ) {
3324
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3325
- }
3326
- }
3327
- $param['w_act'] = ($param['w_act'] == "false" ? 'style="display: none;"' : "");
3328
- $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 button-hero 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 button-secondary button-hero 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>';
3329
- break;
3330
- }
3331
- case 'type_button': {
3332
- $params_names = array( 'w_title', 'w_func', 'w_class' );
3333
- $temp = $params;
3334
- foreach ( $params_names as $params_name ) {
3335
- $temp = explode('*:*' . $params_name . '*:*', $temp);
3336
- $param[$params_name] = $temp[0];
3337
- $temp = $temp[1];
3338
- }
3339
- if ( $temp ) {
3340
- $temp = explode('*:*w_attr_name*:*', $temp);
3341
- $attrs = array_slice($temp, 0, count($temp) - 1);
3342
- foreach ( $attrs as $attr ) {
3343
- $param['attributes'] = $param['attributes'] . ' add_' . $attr;
3344
- }
3345
- }
3346
- $param['w_title'] = explode('***', $param['w_title']);
3347
- $param['w_func'] = explode('***', $param['w_func']);
3348
- $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">';
3349
- foreach ( $param['w_title'] as $key => $title ) {
3350
- $rep .= '<button type="button" class="button button-secondary button-large" id="' . $id . '_elementform_id_temp' . $key . '" name="' . $id . '_elementform_id_temp' . $key . '" value="' . $title . '" onclick="' . $param['w_func'][$key] . '" ' . $param['attributes'] . '>' . $title . '</button>';
3351
- }
3352
- $rep .= '</div></div>';
3353
- break;
3354
- }
3355
- }
3356
- $form = str_replace('%' . $id . ' - ' . $labels[$ids_key] . '%', $rep, $form);
3357
- $form = str_replace('%' . $id . ' -' . $labels[$ids_key] . '%', $rep, $form);
3358
- $row->form_front = $form;
3359
- }
3360
- }
3361
-
3362
- return $row;
3363
- }
3364
-
3365
- public function get_theme_rows_data( $old = '' ) {
3366
- global $wpdb;
3367
- $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_themes ORDER BY `default` DESC, `version` DESC, `id` ASC");
3368
-
3369
- return $rows;
3370
- }
3371
-
3372
- public function get_queries_rows_data( $id ) {
3373
- global $wpdb;
3374
- $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "formmaker_query WHERE form_id=" . $id . " ORDER BY id ASC");
3375
-
3376
- return $rows;
3377
- }
3378
-
3379
- public function get_labels( $id ) {
3380
- global $wpdb;
3381
- $rows = $wpdb->get_col("SELECT DISTINCT `element_label` FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=" . $id);
3382
-
3383
- return $rows;
3384
- }
3385
-
3386
- public function is_paypal( $id ) {
3387
- global $wpdb;
3388
- $rows = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "formmaker_sessions WHERE form_id=" . $id);
3389
-
3390
- return $rows;
3391
- }
3392
-
3393
- /**
3394
- * Return total count of forms.
3395
- *
3396
- * @return null|string
3397
- */
3398
- public function total() {
3399
- global $wpdb;
3400
- $query = "SELECT COUNT(*) FROM `" . $wpdb->prefix . "formmaker`";
3401
-
3402
- $search = WDW_FM_Library::get('s', '');
3403
-
3404
- $query .= (!WDFM()->is_free ? '' : 'WHERE id' . (WDFM()->is_free == 1 ? ' NOT ' : ' ') . 'IN (' . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ')');
3405
- if ( $search ) {
3406
- $query .= (!WDFM()->is_free ? 'WHERE' : ' AND') . ' `title` LIKE "%' . $search . '%"';
3407
- }
3408
-
3409
- $total = $wpdb->get_var($query);
3410
-
3411
- return $total;
3412
- }
3413
-
3414
- /**
3415
- * Get display options.
3416
- *
3417
- * @param int $id
3418
- *
3419
- * @return string
3420
- */
3421
- public function get_display_options( $id ) {
3422
- global $wpdb;
3423
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'formmaker_display_options WHERE form_id="%d"', $id));
3424
- if ( !$row ) {
3425
- $row = new stdClass();
3426
- $row->form_id = $id;
3427
- $row->type = 'embedded';
3428
- $row->scrollbox_loading_delay = 0;
3429
- $row->popover_animate_effect = '';
3430
- $row->popover_loading_delay = 0;
3431
- $row->popover_frequency = 0;
3432
- $row->topbar_position = 1;
3433
- $row->topbar_remain_top = 1;
3434
- $row->topbar_closing = 1;
3435
- $row->topbar_hide_duration = 0;
3436
- $row->scrollbox_position = 1;
3437
- $row->scrollbox_trigger_point = 20;
3438
- $row->scrollbox_hide_duration = 0;
3439
- $row->scrollbox_auto_hide = 1;
3440
- $row->hide_mobile = 0;
3441
- $row->scrollbox_closing = 1;
3442
- $row->scrollbox_minimize = 1;
3443
- $row->scrollbox_minimize_text = '';
3444
- $row->display_on = 'everything';
3445
- $row->posts_include = '';
3446
- $row->pages_include = '';
3447
- $row->display_on_categories = '';
3448
- $row->current_categories = '';
3449
- $row->show_for_admin = 0;
3450
- }
3451
-
3452
- return $row;
3453
- }
3454
-
3455
- public function fm_posts_query() {
3456
- $default_post_types = array( 'post', 'page' );
3457
- $custom_post_types = get_post_types(array(
3458
- 'public' => TRUE,
3459
- '_builtin' => FALSE,
3460
- ));
3461
- $post_types = array_merge($default_post_types, $custom_post_types);
3462
- $pt_names = array_values($post_types);
3463
- $query = array(
3464
- 'post_type' => $pt_names,
3465
- 'suppress_filters' => TRUE,
3466
- 'update_post_term_cache' => FALSE,
3467
- 'update_post_meta_cache' => FALSE,
3468
- 'post_status' => 'publish',
3469
- 'posts_per_page' => -1,
3470
- );
3471
- $get_posts = new WP_Query;
3472
- $posts = $get_posts->query($query);
3473
- if ( !$get_posts->post_count ) {
3474
- return FALSE;
3475
- }
3476
- $results = array();
3477
- foreach ( $posts as $post ) {
3478
- $results[(int) $post->ID] = array(
3479
- 'title' => trim(esc_html(strip_tags(get_the_title($post)))),
3480
- 'post_type' => $post->post_type,
3481
- );
3482
- }
3483
- wp_reset_postdata();
3484
-
3485
- return $results;
3486
- }
3487
-
3488
- public function fm_categories_query() {
3489
- $categories = get_categories(array(
3490
- 'hide_empty' => 0,
3491
- ));
3492
- $final_categories = array();
3493
- foreach ( $categories as $key => $value ) {
3494
- $final_categories[$value->term_id] = $value->name;
3495
- }
3496
-
3497
- return $final_categories;
3498
- }
3499
-
3500
- /**
3501
- * Get previous or next id.
3502
- *
3503
- * @param int $backup_id
3504
- * @param int $id
3505
- * @param string $type (undo,redo)
3506
- * type 0 = undo, 1 = redo
3507
- *
3508
- * @return int
3509
- */
3510
- public function get_undo_redo_id( $backup_id, $id, $type ) {
3511
- global $wpdb;
3512
- if ( $type == 1 ) {
3513
- $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 ";
3514
- }
3515
- elseif ( $type == 0 ) {
3516
- $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 ";
3517
- }
3518
-
3519
- return $wpdb->get_var($query);
3520
- }
3521
-
3522
- /**
3523
- * Get max row.
3524
- *
3525
- * @param string $table
3526
- * @param string $column
3527
- *
3528
- * @return int
3529
- */
3530
- public function get_max_row( $table, $column ) {
3531
- global $wpdb;
3532
- $query = "SELECT max(" . $column . ") FROM " . $wpdb->prefix . $table;
3533
-
3534
- return $wpdb->get_var($query);
3535
- }
3536
-
3537
- /**
3538
- * Delete row.
3539
- *
3540
- * @param int $id
3541
- *
3542
- * @return bool
3543
- */
3544
- public function delete_formmaker_query( $id ) {
3545
- global $wpdb;
3546
- $query = 'DELETE FROM ' . $wpdb->prefix . 'formmaker_query WHERE id =' . $id;
3547
- return $wpdb->query($query);
3548
- }
3549
-
3550
- public function get_mail_verification_post_id() {
3551
- global $wpdb;
3552
- $query = 'SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id!=0';
3553
-
3554
- return $wpdb->get_var($query);
3555
- }
3556
-
3557
- /**
3558
- * Update row(s) in db.
3559
- *
3560
- * @param string $table
3561
- * @param array $data_params
3562
- * @param array $where_data_params
3563
- * params = [where]
3564
- *
3565
- * @return bool
3566
- */
3567
- public function update_data( $table, $data_params = array(), $where_data_params = array() ) {
3568
- global $wpdb;
3569
- return $wpdb->update($wpdb->prefix . $table, $data_params, $where_data_params);
3570
- }
3571
-
3572
- /**
3573
- * Get request value.
3574
- *
3575
- * @param string $table
3576
- * @param array $data
3577
- *
3578
- * @return array
3579
- */
3580
- public function insert_data_to_db( $table, $data ) {
3581
- global $wpdb;
3582
- $query = $wpdb->insert($wpdb->prefix . $table, $data);
3583
- $wpdb->show_errors();
3584
-
3585
- return $query;
3586
- }
3587
-
3588
- /**
3589
- * Get id of default theme.
3590
- *
3591
- * @return int (id)
3592
- */
3593
- public function get_default_theme_id() {
3594
- global $wpdb;
3595
-
3596
- return $wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "formmaker_themes WHERE `default`='1'");
3597
- }
3598
-
3599
- /**
3600
- * Replace data.
3601
- *
3602
- * @param array $data
3603
- *
3604
- * @return bool
3605
- */
3606
- public function replace_display_options( $data ) {
3607
- global $wpdb;
3608
-
3609
- return $wpdb->replace($wpdb->prefix . 'formmaker_display_options', $data);
3610
- }
3611
-
3612
- /**
3613
- * Get previous backup_id.
3614
- *
3615
- * @param int $backup_id
3616
- * @param int $id
3617
- *
3618
- * @return int
3619
- */
3620
- public function get_prev_backup_id( $backup_id, $id ) {
3621
- global $wpdb;
3622
- $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 ";
3623
-
3624
- return $wpdb->get_var($query);
3625
- }
3626
-
3627
- /**
3628
- * Get next backup_id.
3629
- *
3630
- * @param int $backup_id
3631
- * @param int $id
3632
- *
3633
- * @return int
3634
- */
3635
- public function get_backup_id( $backup_id, $id ) {
3636
- global $wpdb;
3637
- $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 ";
3638
-
3639
- return $wpdb->get_var($query);
3640
- }
3641
-
3642
- public function get_autogen_layout( $id ) {
3643
- global $wpdb;
3644
- $autogen_layout = $wpdb->get_var($wpdb->prepare('SELECT autogen_layout FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $id));
3645
- return $autogen_layout == '1';
3646
- }
3647
-
3648
- /**
3649
- * Get count of rows from table.
3650
- *
3651
- * @param array $params
3652
- * params = [selection, table, where]
3653
- *
3654
- * @return int
3655
- */
3656
- public function get_count( $params ) {
3657
- global $wpdb;
3658
- $query = "SELECT count(" . $params['selection'] . ") FROM " . $wpdb->prefix . $params['table'];
3659
- if ( isset($params['where']) ) {
3660
- $query .= " WHERE " . $params['where'];
3661
- }
3662
-
3663
- return $wpdb->get_var($query);
3664
- }
3665
-
3666
- /**
3667
- * Delete row(s) from db.
3668
- *
3669
- * @param array $params
3670
- * params = [selection, table, where, order_by, limit]
3671
- *
3672
- * @return array
3673
- */
3674
- public function delete_rows( $params ) {
3675
- global $wpdb;
3676
- $query = "DELETE FROM " . $wpdb->prefix . $params['table'];
3677
- if ( isset($params['where']) ) {
3678
- $query .= " WHERE " . $params['where'];
3679
- }
3680
- if ( isset($params['order_by']) ) {
3681
- $query .= " " . $params['order_by'];
3682
- }
3683
- if ( isset($params['limit']) ) {
3684
- $query .= " " . $params['limit'];
3685
- }
3686
-
3687
- return $wpdb->query($query);
3688
- }
3689
-
3690
- /**
3691
- * Get row(s) from db.
3692
- *
3693
- * @param string $get_type
3694
- * @param array $params
3695
- * params = [selection, table, where, order_by, limit]
3696
- *
3697
- * @return array
3698
- */
3699
- public function select_rows( $get_type, $params ) {
3700
- global $wpdb;
3701
- $query = "SELECT " . $params['selection'] . " FROM " . $wpdb->prefix . $params['table'];
3702
- if ( isset($params['where']) ) {
3703
- $query .= " WHERE " . $params['where'];
3704
- }
3705
- if ( isset($params['order_by']) ) {
3706
- $query .= " " . $params['order_by'];
3707
- }
3708
- if ( isset($params['limit']) ) {
3709
- $query .= " " . $params['limit'];
3710
- }
3711
- if ( $get_type == "get_col" ) {
3712
- return $wpdb->get_col($query);
3713
- }
3714
- elseif ( $get_type == "get_var" ) {
3715
- return $wpdb->get_var($query);
3716
- }
3717
-
3718
- return $wpdb->get_row($query);
3719
- }
3720
-
3721
- public function create_js( $form_id ) {
3722
- WDW_FM_Library::create_js($form_id, true);
3723
- $jsversion = rand();
3724
- global $wpdb;
3725
- $wpdb->update($wpdb->prefix . 'formmaker', array(
3726
- 'jsversion' => $jsversion,
3727
- ), array( 'id' => $form_id ));
3728
- }
3729
-
3730
- /**
3731
- * Insert to DB.
3732
- *
3733
- * @param int $backup_id
3734
- * @param int $id
3735
- *
3736
- * @return bool
3737
- */
3738
- public function insert_formmaker_backup( $backup_id, $id ) {
3739
- global $wpdb;
3740
- $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;
3741
-
3742
- return $wpdb->query($query);
3743
- }
3744
-
3745
- /**
3746
- * Update mail_verification_post_id in formmaker table
3747
- *
3748
- * @param int $id
3749
- *
3750
- * @return bool
3751
- */
3752
- public function update_emailverification_id( $id ) {
3753
- global $wpdb;
3754
- $sql = "UPDATE " . $wpdb->prefix . "formmaker SET mail_verification_post_id = " . $id . " WHERE mail_verification_post_id != 0";
3755
-
3756
- return $wpdb->query($sql);
3757
- }
3758
-
3759
- /**
3760
- * Check if mail_verification_post_id the same in table posts and formmaker
3761
- *
3762
- * @param int $id
3763
- *
3764
- * @return bool
3765
- */
3766
- public function check_mailverification_id_posts_vs_fm( $id ) {
3767
- global $wpdb;
3768
- $rows = $wpdb->get_results('SELECT mail_verification_post_id FROM ' . $wpdb->prefix . 'formmaker WHERE mail_verification_post_id = ' . $id);
3769
- if ( $rows ) {
3770
- return TRUE;
3771
- }
3772
-
3773
- return FALSE;
3774
- }
3775
-
3776
- /**
3777
- * Get email verification post id
3778
- *
3779
- * @return int
3780
- */
3781
- public function get_emailverification_post_id() {
3782
- global $wpdb;
3783
- $post_type = 'fmemailverification';
3784
- $row = get_posts(array('post_type' => $post_type));
3785
- if (!empty($row[0])) {
3786
- $id = $row[0]->ID;
3787
- if (!$this->check_mailverification_id_posts_vs_fm($id)) {
3788
- $this->update_emailverification_id($id);
3789
- }
3790
- return $id;
3791
- }
3792
- else {
3793
- $post_params = array(
3794
- 'post_author' => 1,
3795
- 'post_content' => '[email_verification]',
3796
- 'post_title' => 'Email Verification',
3797
- 'post_status' => 'publish',
3798
- 'post_type' => $post_type,
3799
- 'comment_status' => 'closed',
3800
- 'ping_status' => 'closed',
3801
- 'post_parent' => 0,
3802
- 'menu_order' => 0,
3803
- 'import_id' => 0,
3804
- );
3805
- $insert_id = wp_insert_post($post_params);
3806
- if (!is_wp_error($insert_id)) { // create new post by fmemailverification type
3807
- $this->update_emailverification_id($insert_id);
3808
-
3809
- return $insert_id;
3810
- }
3811
- }
3812
- }
3813
-
3814
- /**
3815
- * Create Preview Form post.
3816
- *
3817
- * @return string $guid
3818
- */
3819
- public function get_form_preview_post() {
3820
- $post_type = 'form-maker' . WDFM()->plugin_postfix;
3821
- $row = get_posts(array( 'post_type' => $post_type ));
3822
- if ( !empty($row[0]) ) {
3823
- return get_post_permalink($row[0]->ID);
3824
- }
3825
- else {
3826
- $post_params = array(
3827
- 'post_author' => 1,
3828
- 'post_status' => 'publish',
3829
- 'post_content' => '[FormPreview' . WDFM()->plugin_postfix . ']',
3830
- 'post_title' => 'Preview',
3831
- 'post_type' => 'form-maker' . WDFM()->plugin_postfix,
3832
- 'comment_status' => 'closed',
3833
- 'ping_status' => 'closed',
3834
- 'post_parent' => 0,
3835
- 'menu_order' => 0,
3836
- 'import_id' => 0,
3837
- );
3838
- // Create new post by fmformpreview type.
3839
- $insert_id = wp_insert_post($post_params);
3840
- if ( !is_wp_error($insert_id) ) {
3841
- flush_rewrite_rules();
3842
-
3843
- return get_post_permalink($insert_id);
3844
- }
3845
- else {
3846
- return "";
3847
- }
3848
- }
3849
- }
3850
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/Options_fm.php DELETED
@@ -1,27 +0,0 @@
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 DELETED
@@ -1,934 +0,0 @@
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_free ? '' : ' WHERE id' . (WDFM()->is_free == 1 ? ' 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
- $form_labels = array();
98
- $sorted_labels_id = array();
99
- $label_names = array();
100
- $label_types = array();
101
- $sorted_label_types = array();
102
- $label_names_original = array();
103
- $labels_parameters = array();
104
- $join_query = array();
105
- $join_where = array();
106
- $join_verified = array();
107
- $rows_ord = array();
108
- $join = '';
109
- $query = $wpdb->prepare("SELECT `group_id`,`element_value` FROM " . $wpdb->prefix . "formmaker_submits WHERE `form_id`='%d' and `element_label` = 'verifyinfo' ", $form_id);
110
- $ver_emails_data = $wpdb->get_results($query);
111
- $ver_emails_array = array();
112
- if ( $ver_emails_data ) {
113
- foreach ( $ver_emails_data as $ver_email ) {
114
- $elem_label = str_replace('verified**', '', $ver_email->element_value);
115
- $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);
116
- if ( !isset($ver_emails_array[$elem_label]) ) {
117
- $ver_emails_array[$elem_label] = array();
118
- }
119
- if ( !in_array($wpdb->get_var($query), $ver_emails_array[$elem_label]) ) {
120
- $ver_emails_array[$elem_label][] = $wpdb->get_var($query);
121
- }
122
- }
123
- }
124
- for ( $i = 0; $i < 9; $i++ ) {
125
- array_push($labels_parameters, NULL);
126
- }
127
- $sorted_label_names = array();
128
- $sorted_label_names_original = array();
129
- $where_labels = array();
130
- $where2 = array();
131
- $order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
132
- $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc') ? 'asc' : 'desc');
133
-
134
- $lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : '');
135
- $lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : '');
136
- $lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : '');
137
- $lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : '');
138
- $lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : '');
139
- $lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : '');
140
- $lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : '');
141
- if ( $lists['ip_search'] ) {
142
- $where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"';
143
- }
144
- if ( $lists['startdate'] != '' ) {
145
- $where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' ";
146
- }
147
- if ( $lists['enddate'] != '' ) {
148
- $where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' ";
149
- }
150
- if ( $lists['username_search'] ) {
151
- $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%' . $lists['username_search'] . '%")';
152
- }
153
- if ( $lists['useremail_search'] ) {
154
- $where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%' . $lists['useremail_search'] . '%")';
155
- }
156
- if ( $lists['id_search'] ) {
157
- $where[] = 'group_id =' . (int) $lists['id_search'];
158
- }
159
- $where[] = 'form_id=' . $form_id . '';
160
- $where = (count($where) ? ' ' . implode(' AND ', $where) : '');
161
- if ( $order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip' ) {
162
- $orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . '';
163
- }
164
- elseif ( $order_by == 'display_name' or $order_by == 'user_email' ) {
165
- $orderby = ' ORDER BY (SELECT ' . $order_by . ' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) ' . $asc_or_desc . '';
166
- }
167
- else {
168
- $orderby = "";
169
- }
170
- if ( $form_id ) {
171
- for ( $i = 0; $i < 9; $i++ ) {
172
- array_pop($labels_parameters);
173
- }
174
- $query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where;
175
- $results = $wpdb->get_results($query);
176
- for ( $i = 0; $i < count($results); $i++ ) {
177
- array_push($labels, $results[$i]->element_label);
178
- }
179
- $form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id));
180
- if ( !empty($form->label_order) && strpos($form->label_order, 'type_paypal_') ) {
181
- $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#****#";
182
- }
183
- if ( !empty($form->label_order)) {
184
- $form_labels = explode('#****#', $form->label_order);
185
- }
186
- $form_labels = array_slice($form_labels, 0, count($form_labels) - 1);
187
- foreach ( $form_labels as $key => $form_label ) {
188
- $label_id = explode('#**id**#', $form_label);
189
- array_push($labels_id, $label_id[0]);
190
- $label_name_type = explode('#**label**#', $label_id[1]);
191
- array_push($label_names_original, $label_name_type[0]);
192
- $ptn = "/[^a-zA-Z0-9_]/";
193
- $rpltxt = "";
194
- $label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]);
195
- array_push($label_names, $label_name);
196
- array_push($label_types, $label_name_type[1]);
197
- }
198
- foreach ( $labels_id as $key => $label_id ) {
199
- if ( in_array($label_id, $labels) ) {
200
- if ( !in_array($label_id, $sorted_labels_id) ) {
201
- array_push($sorted_labels_id, $label_id);
202
- }
203
- array_push($sorted_label_names, $label_names[$key]);
204
- array_push($sorted_label_types, $label_types[$key]);
205
- array_push($sorted_label_names_original, $label_names_original[$key]);
206
- if ( isset($_POST[$form_id . '_' . $label_id . '_search']) ) {
207
- $search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']);
208
- }
209
- else {
210
- $search_temp = '';
211
- }
212
- $search_temp = strtolower($search_temp);
213
- $lists[$form_id . '_' . $label_id . '_search'] = $search_temp;
214
- if ( $search_temp ) {
215
- $join_query[] = 'search';
216
- $join_where[] = array( 'label' => $label_id, 'search' => $search_temp );
217
- }
218
- if ( isset($_POST[$form_id . '_' . $label_id . '_search_verified']) ) {
219
- $search_verified = $_POST[$form_id . '_' . $label_id . '_search_verified'];
220
- $lists[$form_id . '_' . $label_id . '_search_verified'] = $search_verified;
221
- }
222
- else {
223
- $search_verified = '';
224
- }
225
- if ( $search_verified && isset($ver_emails_array[$label_id]) ) {
226
- $join_query[] = 'search';
227
- $join_where[] = NULL;
228
- $join_verified[] = array(
229
- 'label' => $label_id,
230
- 'ver_search' => implode('|', $ver_emails_array[$label_id]),
231
- );
232
- }
233
- }
234
- }
235
- if ( strpos($order_by, "_field") ) {
236
- if ( in_array(str_replace("_field", "", $order_by), $labels) ) {
237
- $join_query[] = 'sort';
238
- $join_where[] = array( 'label' => str_replace("_field", "", $order_by) );
239
- }
240
- }
241
- $cols = 'group_id';
242
- if ( $order_by == 'date' or $order_by == 'ip' ) {
243
- $cols = 'group_id, date, ip';
244
- }
245
- $ver_where = '';
246
- if ( !empty($join_verified) ) {
247
- foreach ( $join_verified as $key_ver => $join_ver ) {
248
- $ver_where .= '(element_label="' . $join_ver['label'] . '" AND element_value REGEXP "' . $join_ver['ver_search'] . '" ) AND';
249
- }
250
- }
251
- switch ( count($join_query) ) {
252
- case 0:
253
- $join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where;
254
- break;
255
- case 1:
256
- if ( $join_query[0] == 'sort' ) {
257
- $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" ';
258
- $join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" ';
259
- $orderby = ' ORDER BY `element_value` ' . $asc_or_desc;
260
- }
261
- else {
262
- if ( isset($join_where[0]['search']) ) {
263
- $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;
264
- }
265
- else {
266
- $join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where;
267
- }
268
- }
269
- break;
270
- default:
271
- if ( !empty($join_verified) ) {
272
- if ( isset($join_where[0]['search']) ) {
273
- $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 ';
274
- }
275
- else {
276
- $join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $ver_where . $where . ') as t ';
277
- }
278
- }
279
- else {
280
- $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 ';
281
- }
282
- for ( $key = 1; $key < count($join_query); $key++ ) {
283
- if ( $join_query[$key] == 'sort' ) {
284
- if ( isset($join_where[$key]) ) {
285
- $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 ';
286
- $orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . '';
287
- }
288
- }
289
- else {
290
- if ( isset($join_where[$key]) ) {
291
- $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 ';
292
- }
293
- }
294
- }
295
- break;
296
- }
297
- $pos = strpos($join, 'SELECT t.group_id');
298
- if ( $pos === FALSE ) {
299
- $query = str_replace(array(
300
- 'SELECT group_id',
301
- 'SELECT distinct group_id',
302
- ), array( 'SELECT count(distinct group_id)', 'SELECT count(distinct group_id)' ), $join);
303
- }
304
- else {
305
- $query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join);
306
- }
307
- $total = $wpdb->get_var($query);
308
- $query_sub_count = "SELECT count(distinct group_id) from " . $wpdb->prefix . "formmaker_submits";
309
- $sub_count = (int) $wpdb->get_var($query_sub_count);
310
- $query = $join . ' ' . $orderby . ' LIMIT ' . $page_num . ', '.$per_num;
311
- $results = $wpdb->get_results($query);
312
- for ( $i = 0; $i < count($results); $i++ ) {
313
- array_push($rows_ord, $results[$i]->group_id);
314
- }
315
- $query1 = $join . ' ' . $orderby;
316
- $searched_group_ids = $wpdb->get_results($query1);
317
- $searched_ids = array();
318
- for ( $i = 0; $i < count($searched_group_ids); $i++ ) {
319
- array_push($searched_ids, $searched_group_ids[$i]->group_id);
320
- }
321
- $where2 = array();
322
- $where2[] = "group_id='0'";
323
- foreach ( $rows_ord as $rows_ordd ) {
324
- $where2[] = "group_id='" . $rows_ordd . "'";
325
- }
326
- $where2 = (count($where2) ? ' WHERE ' . implode(' OR ', $where2) . '' : '');
327
- $query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
328
- $rows = $wpdb->get_results($query);
329
- $group_ids = $rows_ord;
330
- $lists['total'] = $total;
331
- $lists['limit'] = $per_num;
332
- $where_choices = $where;
333
- array_push($labels_parameters, $sorted_labels_id);
334
- array_push($labels_parameters, $sorted_label_types);
335
- array_push($labels_parameters, $lists);
336
- array_push($labels_parameters, $sorted_label_names);
337
- array_push($labels_parameters, $sorted_label_names_original);
338
- array_push($labels_parameters, $rows);
339
- array_push($labels_parameters, $group_ids);
340
- array_push($labels_parameters, $where_choices);
341
- array_push($labels_parameters, $searched_ids);
342
- }
343
-
344
- return $labels_parameters;
345
- }
346
-
347
- public function get_type_address( $sorted_label_type, $sorted_label_name_original ) {
348
- if ( $sorted_label_type == 'type_address' ) {
349
- switch ( $sorted_label_name_original ) {
350
- case 'Street Line':
351
- $field_title = __('Street Address', 'form_maker');
352
- break;
353
- case 'Street Line2':
354
- $field_title = __('Street Address Line 2', 'form_maker');
355
- break;
356
- case 'City':
357
- $field_title = __('City', 'form_maker');
358
- break;
359
- case 'State':
360
- $field_title = __('State / Province / Region', 'form_maker');
361
- break;
362
- case 'Postal':
363
- $field_title = __('Postal / Zip Code', 'form_maker');
364
- break;
365
- case 'Country':
366
- $field_title = __('Country', 'form_maker');
367
- break;
368
- default :
369
- $field_title = stripslashes($sorted_label_name_original);
370
- break;
371
- }
372
- }
373
- else {
374
- $field_title = stripslashes($sorted_label_name_original);
375
- }
376
-
377
- return $field_title;
378
- }
379
-
380
- public function hide_or_not( $hide_strings, $hide_string ) {
381
- if ( strpos($hide_string, '@') === FALSE ) {
382
- if ( strpos($hide_strings, '@' . $hide_string . '@') === FALSE ) {
383
- $style = '';
384
- }
385
- else {
386
- $style = 'style="display:none"';
387
- }
388
- }
389
- else {
390
- if ( strpos($hide_strings, $hide_string) === FALSE ) {
391
- $style = '';
392
- }
393
- else {
394
- $style = 'style="display:none"';
395
- }
396
- }
397
-
398
- return $style;
399
- }
400
-
401
- public function sort_group_ids( $sorted_label_names_count, $group_ids ) {
402
- $count_labe = $sorted_label_names_count;
403
- $group_id_s = array();
404
- $l = 0;
405
- if ( count($group_ids) > 0 and $count_labe ) {
406
- for ( $i = 0; $i < count($group_ids); $i++ ) {
407
- if ( !in_array($group_ids[$i], $group_id_s) ) {
408
- array_push($group_id_s, $group_ids[$i]);
409
- }
410
- }
411
- }
412
-
413
- return $group_id_s;
414
- }
415
-
416
- public function array_for_group_id( $group, $rows ) {
417
- $i = $group;
418
- $count_rows = count($rows);
419
- $temp = array();
420
- for ( $j = 0; $j < $count_rows; $j++ ) {
421
- $row = $rows[$j];
422
- if ( $row->group_id == $i ) {
423
- array_push($temp, $row);
424
- }
425
- }
426
-
427
- return $temp;
428
- }
429
-
430
- public function check_radio_type( $sorted_label_type ) {
431
- 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" ) {
432
- return TRUE;
433
- }
434
- else {
435
- return FALSE;
436
- }
437
- }
438
-
439
- public function statistic_for_radio( $where_choices, $sorted_label_id ) {
440
- global $wpdb;
441
- $choices_params = array();
442
- $query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where_choices . " AND element_label='" . $sorted_label_id . "'";
443
- $choices = $wpdb->get_results($query);
444
- $colors = array( '#5FE2FF', '#F9E89C' );
445
- $choices_colors = array( '#4EC0D9', '#DDCC7F' );
446
- $choices_labels = array();
447
- $choices_count = array();
448
- $all = count($choices);
449
- $unanswered = 0;
450
- foreach ( $choices as $key => $choice ) {
451
- if ( $choice->element_value == '' ) {
452
- $unanswered++;
453
- }
454
- else {
455
- if ( !in_array($choice->element_value, $choices_labels) ) {
456
- array_push($choices_labels, $choice->element_value);
457
- array_push($choices_count, 0);
458
- }
459
- $choices_count[array_search($choice->element_value, $choices_labels)]++;
460
- }
461
- }
462
- array_multisort($choices_count, SORT_DESC, $choices_labels);
463
- array_push($choices_params, $choices_count);
464
- array_push($choices_params, $choices_labels);
465
- array_push($choices_params, $unanswered);
466
- array_push($choices_params, $all);
467
- array_push($choices_params, $colors);
468
- array_push($choices_params, $choices_colors);
469
- return $choices_params;
470
- }
471
-
472
- public function get_data_of_group_id( $id ) {
473
- global $wpdb;
474
- $query = "SELECT * FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id=" . $id;
475
- $rows = $wpdb->get_results($query);
476
- $form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=" . $rows[0]->form_id);
477
- $params = array();
478
- $label_id = array();
479
- $label_order_original = array();
480
- $label_type = array();
481
- $ispaypal = strpos($form->label_order, 'type_paypal_');
482
- if ( $form->paypal_mode == 1 ) {
483
- if ( $ispaypal ) {
484
- $form->label_order = $form->label_order . "0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
485
- }
486
- }
487
- $label_all = explode('#****#', $form->label_order);
488
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
489
- foreach ( $label_all as $key => $label_each ) {
490
- $label_id_each = explode('#**id**#', $label_each);
491
- array_push($label_id, $label_id_each[0]);
492
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
493
- array_push($label_order_original, $label_oder_each[0]);
494
- array_push($label_type, $label_oder_each[1]);
495
- }
496
- /*$theme_id = $wpdb->get_var("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form->id . "'");*/
497
- $css = $wpdb->get_var("SELECT css FROM " . $wpdb->prefix . "formmaker_themes");
498
- array_push($params, $rows);
499
- array_push($params, $label_id);
500
- array_push($params, $label_order_original);
501
- array_push($params, $label_type);
502
- array_push($params, $ispaypal);
503
- array_push($params, $form);
504
- array_push($params, $css);
505
-
506
- return $params;
507
- }
508
-
509
- public function check_type_for_edit_function( $label_type ) {
510
- 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' ) {
511
- return TRUE;
512
- }
513
- else {
514
- return FALSE;
515
- }
516
- }
517
-
518
- public function check_for_submited_label( $rows, $label_id ) {
519
- foreach ( $rows as $row ) {
520
- if ( $row->element_label == $label_id ) {
521
- $element_value = $row->element_value;
522
- break;
523
- }
524
- else {
525
- $element_value = 'continue';
526
- }
527
- }
528
-
529
- return $element_value;
530
- }
531
-
532
- /*
533
- * Create array of group by key.
534
- *
535
- * @param array $array
536
- * @param string $key
537
- *
538
- * @return array $data
539
- */
540
- public function _group_by($array, $key) {
541
- $data = array();
542
- foreach($array as $val) {
543
- $by_key = '';
544
- if( is_object($val) ) {
545
- $by_key = $val->$key;
546
- }
547
- if( is_array($val) ) {
548
- $by_key = $val[$key];
549
- }
550
-
551
- if( $by_key ){
552
- $data[$by_key][] = $val;
553
- }
554
- }
555
- return $data;
556
- }
557
-
558
- public function view_for_star_rating( $element_value, $element_label ) {
559
- $view_star_rating_array = array();
560
- $new_filename = str_replace("***star_rating***", '', $element_value);
561
- $stars = "";
562
- $new_filename = explode('***', $new_filename);
563
- for ( $j = 0; $j < $new_filename[1]; $j++ ) {
564
- $stars .= '<img id="' . $element_label . '_star_' . $j . '" src="' . WDFM()->plugin_url . '/images/star_' . $new_filename[2] . '.png?ver=' . WDFM()->plugin_version . '" /> ';
565
- }
566
- for ( $k = $new_filename[1]; $k < $new_filename[0]; $k++ ) {
567
- $stars .= '<img id="' . $element_label . '_star_' . $k . '" src="' . WDFM()->plugin_url . '/images/star.png?ver=' . WDFM()->plugin_version . '" /> ';
568
- }
569
- array_push($view_star_rating_array, $stars);
570
-
571
- return $view_star_rating_array;
572
- }
573
-
574
- public function view_for_grading( $element_value ) {
575
- $view_grading_array = array();
576
- $new_filename = str_replace("***grading***", '', $element_value);
577
- $grading = explode(":", $new_filename);
578
- $items_count = sizeof($grading) - 1;
579
- $items = "";
580
- $total = 0;
581
- for ( $k = 0; $k < $items_count / 2; $k++ ) {
582
- $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
583
- $total += (is_numeric($grading[$k])) ? $grading[$k] : 0;
584
- }
585
- $items .= "Total: " . $total;
586
- array_push($view_grading_array, $items);
587
-
588
- return $view_grading_array;
589
- }
590
-
591
- public function images_for_star_rating( $element_value, $label_id ) {
592
- $edit_stars = "";
593
- $star_rating_array = array();
594
- $element_value1 = str_replace("***star_rating***", '', $element_value);
595
- $stars_value = explode('/', $element_value1);
596
- for ( $j = 0; $j < $stars_value[0]; $j++ ) {
597
- $edit_stars .= '<img id="' . $label_id . '_star_' . $j . '" onclick="edit_star_rating(' . $j . ',' . $label_id . ')" src="' . WDFM()->plugin_url . '/images/star_yellow.png?ver=' . WDFM()->plugin_version . '" /> ';
598
- }
599
- for ( $k = $stars_value[0]; $k < $stars_value[1]; $k++ ) {
600
- $edit_stars .= '<img id="' . $label_id . '_star_' . $k . '" onclick="edit_star_rating(' . $k . ',' . $label_id . ')" src="' . WDFM()->plugin_url . '/images/star.png?ver=' . WDFM()->plugin_version . '" /> ';
601
- }
602
- array_push($star_rating_array, $edit_stars);
603
- array_push($star_rating_array, $stars_value);
604
-
605
- return $star_rating_array;
606
- }
607
-
608
- public function params_for_scale_rating( $element_value, $label_id ) {
609
- $scale_rating_array = array();
610
- $scale_radio = explode('/', $element_value);
611
- $scale_value = $scale_radio[0];
612
- $scale = '<table><tr>';
613
- for ( $k = 1; $k <= $scale_radio[1]; $k++ ) {
614
- $scale .= '<td style="text-align:center"><span>' . $k . '</span></td>';
615
- }
616
- $scale .= '<tr></tr>';
617
- for ( $l = 1; $l <= $scale_radio[1]; $l++ ) {
618
- if ( $l == $scale_radio[0] ) {
619
- $checked = "checked";
620
- }
621
- else {
622
- $checked = "";
623
- }
624
- $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>';
625
- }
626
- $scale .= '</tr></table>';
627
- array_push($scale_rating_array, $scale);
628
- array_push($scale_rating_array, $scale_radio);
629
- array_push($scale_rating_array, $checked);
630
-
631
- return $scale_rating_array;
632
- }
633
-
634
- public function params_for_type_range( $element_value, $label_id ) {
635
- $range_value = explode('-', $element_value);
636
- $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"/>';
637
-
638
- return $range;
639
- }
640
-
641
- public function params_for_type_grading( $element_value, $label_id ) {
642
- $type_grading_array = array();
643
- $element_value1 = str_replace("***grading***", '', $element_value);
644
- $garding_value = explode(':', $element_value1);
645
- $items_count = sizeof($garding_value) - 1;
646
- $garding = '<div class="grading-inputs">';
647
- $sum = 0;
648
- for ( $k = 0; $k < $items_count / 2; $k++ ) {
649
- $garding .= '<div><label for="' . $label_id . '_element' . $k . '">' . $garding_value[$items_count / 2 + $k] . '</label><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"/></div>';
650
- $sum += (is_numeric($garding_value[$k])) ? $garding_value[$k] : 0;
651
- }
652
- $garding .='</div>';
653
- array_push($type_grading_array, $garding);
654
- array_push($type_grading_array, $garding_value);
655
- array_push($type_grading_array, $sum);
656
- array_push($type_grading_array, $items_count);
657
- array_push($type_grading_array, $element_value1);
658
-
659
- return $type_grading_array;
660
- }
661
-
662
- public function params_for_type_matrix( $element_value, $label_id ) {
663
- $type_matrix_array = array();
664
- $new_filename = str_replace("***matrix***", '', $element_value);
665
- $matrix_value = explode('***', $new_filename);
666
- $matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
667
- $mat_rows = $matrix_value[0];
668
- $mat_columns = $matrix_value[$mat_rows + 1];
669
- $matrix = "<table>";
670
- $matrix .= '<tr><td></td>';
671
- for ( $k = 1; $k <= $mat_columns; $k++ ) {
672
- $matrix .= '<td style="background-color:#BBBBBB; padding:5px; border:1px; ">' . $matrix_value[$mat_rows + 1 + $k] . '</td>';
673
- }
674
- $matrix .= '</tr>';
675
- $aaa = Array();
676
- $var_checkbox = 1;
677
- $selected_value = "";
678
- $selected_value_yes = "";
679
- $selected_value_no = "";
680
- for ( $k = 1; $k <= $mat_rows; $k++ ) {
681
- $matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px; border:1px;">' . $matrix_value[$k] . '</td>';
682
- if ( $matrix_value[$mat_rows + $mat_columns + 2] == "radio" ) {
683
- if ( $matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0 ) {
684
- $checked = "";
685
- $aaa[1] = "";
686
- }
687
- else {
688
- $aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
689
- }
690
- for ( $l = 1; $l <= $mat_columns; $l++ ) {
691
- if ( $aaa[