Metform Elementor Contact Form Builder – Flexible and Design-Friendly Contact Form builder plugin for WordPress - Version 1.2.1

Version Description

Download this release

Release Info

Developer ataurr
Plugin Icon 128x128 Metform Elementor Contact Form Builder – Flexible and Design-Friendly Contact Form builder plugin for WordPress
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2.0 to 1.2.1

core/entries/action.php CHANGED
@@ -1,8 +1,11 @@
1
  <?php
 
2
  namespace MetForm\Core\Entries;
3
- defined( 'ABSPATH' ) || exit;
4
 
5
- Class Action{
 
 
 
6
  use \MetForm\Traits\Singleton;
7
 
8
  private $key_form_id;
@@ -22,6 +25,7 @@ Class Action{
22
  private $title;
23
  private $entry_count;
24
  private $email_name;
 
25
 
26
  private $inserted_form_data;
27
 
@@ -29,10 +33,10 @@ Class Action{
29
 
30
  public function __construct()
31
  {
32
- $this->response = (object)[
33
  'status' => 0,
34
  'error' => [
35
- esc_html__('Some thing went wrong.','metrom'),
36
  ],
37
  'data' => [
38
  'message' => '',
@@ -47,11 +51,11 @@ Class Action{
47
  $this->key_form_file = 'metform_entries__file_upload';
48
  $this->key_payment_status = 'metform_entries__payment_status';
49
  $this->post_type = Base::instance()->cpt->get_name();
50
-
51
  }
52
 
53
- public function submit($form_id, $form_data, $file_data){
54
-
 
55
  $this->form_id = $form_id;
56
  //$this->form_settings = $this->get_form_settings($form_id);
57
  $this->form_settings = \MetForm\Core\Forms\Action::instance()->get_all_data($form_id);
@@ -60,60 +64,60 @@ Class Action{
60
  $this->response->data['redirect_to'] = (!isset($this->form_settings['redirect_to'])) ? '' : $this->form_settings['redirect_to'];
61
  $this->response->data['hide_form'] = (!isset($this->form_settings['hide_form_after_submission']) ? '' : $this->form_settings['hide_form_after_submission']);
62
  $this->response->data['form_data'] = $form_data;
63
- $this->response->data['map_data'] = $this->fields;
64
 
65
  $email_name = $this->get_input_name_by_widget_type('mf-email');
66
  $this->email_name = (isset($email_name[0]) ? $email_name[0] : null);
67
 
68
  // nonce check
69
- if( !isset( $form_data['form_nonce'] ) || !wp_verify_nonce( $form_data['form_nonce'], 'form_nonce' ) ){
70
  $this->response->status = 0;
71
- $this->response->error[] = esc_html__('Unauthorized submission.','metform');
72
  return $this->response;
73
  }
74
-
75
  // validate form with max length, min length, length type and expression
76
  $validate = $this->validate_form_data($form_data);
77
- if($validate == false){
78
  $this->response->status = 0;
79
  return $this->response;
80
  }
81
 
82
  // google recaptcha condition and action
83
- if(isset($this->form_settings['mf_recaptcha']) && (isset($form_data['g-recaptcha-response']) || isset($form_data['g-recaptcha-response-v3'])) && (isset($this->fields['mf-recaptcha'])) && (isset($this->form_settings['mf_recaptcha_site_key'])) && $this->form_settings['mf_recaptcha_site_key'] != ''){
84
- if( isset($form_data['g-recaptcha-response'] ) && ( $form_data['g-recaptcha-response'] == "" ) ){
85
  $this->response->status = 0;
86
- $this->response->error[] = esc_html__('Please solve the recaptcha.','metform');
87
  return $this->response;
88
  }
89
 
90
- if( isset($form_data['g-recaptcha-response-v3'] ) && ( $form_data['g-recaptcha-response-v3'] == "" ) ){
91
  $this->response->status = 0;
92
- $this->response->error[] = esc_html__('Google captcha token not found.','metform');
93
  return $this->response;
94
  }
95
 
96
- if( isset($form_data['g-recaptcha-response']) ){
97
- $response = \MetForm\Core\Integrations\Google_Recaptcha::instance()->verify_captcha_v2( $form_data, $this->form_settings );
98
  }
99
 
100
- if( isset($form_data['g-recaptcha-response-v3']) ){
101
- $response = \MetForm\Core\Integrations\Google_Recaptcha::instance()->verify_captcha_v3( $form_data, $this->form_settings );
102
  }
103
 
104
- $this->response->data['responseKeys'] = $response['responseKeys'];
105
  $this->response->status = $response['status'];
106
- if($response['status'] == 0){
107
- $this->response->error[] = ( isset($response['error']) ? $response['error'] : '' );
108
  return $this->response;
109
  }
110
  }
111
 
112
  // Captcha solve conditiona and action
113
- if(isset($form_data['mf-captcha-challenge'])){
114
- if(($form_data['mf-captcha-challenge']) == ""){
115
  $this->response->status = 0;
116
- $this->response->error[] = esc_html__('Please solve the recaptcha.','metform');
117
  return $this->response;
118
  }
119
 
@@ -123,8 +127,9 @@ Class Action{
123
 
124
  $timeout_duration = 1800;
125
 
126
- if (isset($_SESSION['LAST_ACTIVITY']) &&
127
- ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration) {
 
128
  session_unset();
129
  session_destroy();
130
  session_start();
@@ -132,173 +137,183 @@ Class Action{
132
 
133
  $_SESSION['LAST_ACTIVITY'] = $time;
134
 
135
- if(!isset($_SESSION['mf_captcha_text'])){
136
  $this->response->status = 0;
137
- $this->response->error[] = esc_html__('Time out of this captcha. Please reload or choose another one.','metform');
138
  return $this->response;
139
  }
140
 
141
- if( isset( $form_data['mf-captcha-challenge'] ) && isset( $_SESSION['mf_captcha_text'] ) && ( $form_data['mf-captcha-challenge'] == $_SESSION['mf_captcha_text'] ) ) {
142
  $this->response->status = 1;
143
- $this->response->data['captcha'] = esc_html__('Captcha is verified.','metform');
144
  } else {
145
  $this->response->status = 0;
146
- $this->response->error[] = esc_html__('Enter correct captcha.','metform');
147
  return $this->response;
148
  }
149
-
150
  }
151
-
152
  // user login check and action
153
- $required_loggin = isset($this->form_settings['require_login']) ? ((int)($this->form_settings['require_login'])) : 0;
154
 
155
- if(($required_loggin == 1) && (!is_user_logged_in())){
156
  $this->response->status = 0;
157
- $this->response->error[] = esc_html__('You must be logged in to submit form.','metform');
158
  return $this->response;
159
  }
160
 
161
  // Total entry limit check and prevent
162
- if(isset($this->form_settings['limit_total_entries_status'])){
163
- $entry_limit = ((int)($this->form_settings['limit_total_entries_status']));
164
 
165
- if(($entry_limit == 1) && ($this->get_entry_count() >= $this->form_settings['limit_total_entries'])){
166
  $this->response->status = 0;
167
- $this->response->error[] = esc_html__('Form submission limit execed.','metform');
168
-
169
  return $this->response;
170
  }
171
  }
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  // mailchimp email store action
174
  if (class_exists('\MetForm\Core\Integrations\Mail_Chimp')) {
175
- if(isset($this->form_settings['mf_mail_chimp']) && $this->form_settings['mf_mail_chimp'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
176
 
177
  $mail_chimp = new \MetForm\Core\Integrations\Mail_Chimp();
178
-
179
- if(array_key_exists("mf-listing-optin", $this->fields) && isset($form_data['mf-listing-optin'])){
180
- $response = $mail_chimp->call_api( $form_data, ['auth' => $this->form_settings, 'email_name' => $this->email_name] );
181
- }elseif(!array_key_exists('mf-listing-optin', $this->fields)){
182
- $response = $mail_chimp->call_api( $form_data, ['auth' => $this->form_settings, 'email_name' => $this->email_name] );
183
  }
184
-
185
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
186
-
187
- }
188
  }
189
 
190
  // data submit to zapier action and check
191
- if(class_exists('\MetForm_Pro\Core\Integrations\Zapier')){
192
- if(isset($this->form_settings['mf_zapier']) && $this->form_settings['mf_zapier'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
193
-
194
  $url = $this->form_settings['mf_zapier_webhook'];
195
-
196
- if(array_key_exists('mf-listing-optin', $this->fields) && isset($form_data['mf-listing-optin'])){
197
-
198
  $zapier = new \MetForm_Pro\Core\Integrations\Zapier();
199
- $response = $zapier->call_webhook( $form_data, ['url' => $url, 'email_name' => $this->email_name] );
200
-
201
- }elseif(!array_key_exists('mf-listing-optin', $this->fields)){
202
-
203
  $zapier = new \MetForm_Pro\Core\Integrations\Zapier();
204
- $response = $zapier->call_webhook( $form_data, ['url' => $url, 'email_name' => $this->email_name] );
205
-
206
  }
207
-
208
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
209
  }
210
  }
211
 
212
  // data submit to slack check and action
213
- if(class_exists('\MetForm\Core\Integrations\Slack')){
214
- if(isset($this->form_settings['mf_slack']) && $this->form_settings['mf_slack'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
215
-
216
  $url = $this->form_settings['mf_slack_webhook'];
217
-
218
- $this->response->data['slack_hook'] = $url;
219
-
220
- if(array_key_exists('mf-listing-optin', $this->fields) && isset($form_data['mf-listing-optin'])){
221
-
222
  $slack = new \MetForm\Core\Integrations\Slack();
223
- $response = $slack->call_webhook( $form_data, ['url' => $url, 'email_name' => $this->email_name] );
224
-
225
- }elseif(!array_key_exists('mf-listing-optin', $this->fields)){
226
-
227
  $slack = new \MetForm\Core\Integrations\Slack();
228
- $response = $slack->call_webhook( $form_data, ['url' => $url, 'email_name' => $this->email_name] );
229
  }
230
-
231
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
232
  }
233
  }
234
 
 
 
 
 
 
 
 
235
  // Store data in database
236
- $this->store( $form_id, $form_data );
237
 
238
  // data submit to a rest api check and action
239
- if(class_exists('\MetForm_Pro\Core\Integrations\Rest_Api') && isset($this->form_settings['mf_rest_api']) && ($this->form_settings['mf_rest_api_url'] != '')){
240
  $url = $this->form_settings['mf_rest_api_url'];
241
  $method = $this->form_settings['mf_rest_api_method'];
242
  $rest_api = new \MetForm_Pro\Core\Integrations\Rest_Api();
243
  $response = $rest_api->call_api(
244
  [
245
- 'entries' => json_encode($this->form_data),
246
- 'entry_id' => ( ( $this->entry_id != null ) ? $this->entry_id : ''),
247
- 'form_id' => $form_data['id'],
248
  'version' => \MetForm\Plugin::instance()->version()
249
  ],
250
  [
251
  'url' => $url,
252
  'method' => $method
253
- ]
254
  );
255
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
256
  }
257
 
258
- // file upload check and action
259
- $file_input_names = $this->get_input_name_by_widget_type('mf-file-upload');
260
-
261
- if( (!empty($file_data)) && ($file_input_names != null)){
262
- $this->upload_file($file_data, $file_input_names);
263
- }
264
-
265
  // send confirmation email to user
266
- if(isset($this->form_settings['enable_user_notification']) && $this->form_settings['enable_user_notification'] == 1){
267
-
268
- $this->send_user_email($this->form_data);
269
 
 
270
  }
271
 
272
  // send notification email to admins
273
- if(isset($this->form_settings['enable_admin_notification']) && $this->form_settings['enable_admin_notification'] == 1){
274
 
275
- $this->send_admin_email($this->form_data);
276
  }
277
 
278
  $this->response->data['message'] = $this->form_settings['success_message'];
279
-
280
  $paymet_method = $this->get_input_name_by_widget_type('mf-payment-method');
281
 
282
- if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal') && isset($this->form_settings['mf_paypal']) && isset($this->form_settings['mf_paypal_email']) && ($this->form_settings['mf_paypal_email'] != '') && ($paymet_method[0] != null) ){
283
- if(isset($this->form_data[$paymet_method[0]]) && $this->form_data[$paymet_method[0]] == 'paypal'){
284
- update_post_meta( $this->entry_id, $this->key_payment_status, 'unpaid');
285
- $rest_url = get_rest_url( null, 'metform/v1/entries/');
286
- $this->response->data['redirect_to'] = $rest_url."paypal/pay?entry_id=".$this->entry_id;
287
- $this->response->data['message'] = $this->form_settings['success_message']. esc_html__(' Please wait... Redirecting to paypal.', 'metform');
288
  }
289
  }
290
 
291
- if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe') && ($paymet_method[0] != null) ){
292
- if(isset($this->form_data[$paymet_method[0]]) && $this->form_data[$paymet_method[0]] == 'stripe'){
293
- update_post_meta( $this->entry_id, $this->key_payment_status, 'unpaid');
294
-
295
  $payment_widget_name = \MetForm\Core\Entries\Action::instance()->get_input_name_by_widget_type('mf-payment-method', $this->fields);
296
  $widget = is_array($payment_widget_name) ? current($payment_widget_name) : '';
297
-
298
  $amount_filed = isset($this->fields[$widget]->mf_input_payment_field_name) ? $this->fields[$widget]->mf_input_payment_field_name : '';
299
  $amount = isset($this->form_data[$amount_filed]) ? $this->form_data[$amount_filed] : 0;
300
-
301
- $this->response->data['payment_method'] = $this->form_data[$paymet_method[0]];
302
 
303
  $icon_url = !empty($this->form_settings['mf_stripe_image_url']) ? $this->form_settings['mf_stripe_image_url'] : 'https://stripe.com/img/documentation/checkout/marketplace.png';
304
 
@@ -306,165 +321,167 @@ Class Action{
306
  $livekey = isset($this->form_settings['mf_stripe_live_publishiable_key']) ? $this->form_settings['mf_stripe_live_publishiable_key'] : '';
307
  $livekey_test = isset($this->form_settings['mf_stripe_test_publishiable_key']) ? $this->form_settings['mf_stripe_test_publishiable_key'] : '';
308
  $sandbox = isset($this->form_settings['mf_stripe_sandbox']) ? true : false;
309
-
310
  $live_keys = ($sandbox) ? $livekey_test : $livekey;
311
-
312
- $payment['name_post'] = $this->form_settings['form_title'];
313
- $payment['description'] = $this->form_id;
314
  $payment['amount'] = $amount;
315
  $payment['currency_code'] = 'USD';
316
- $payment['keys'] = $live_keys;
317
  $payment['image_url'] = $icon_url;
318
  $payment['entry_id'] = $this->entry_id;
319
  $payment['form_id'] = $this->form_id;
320
  $payment['sandbox'] = $sandbox;
321
 
322
- $this->response->data['payment_data'] = (Object) $payment;
323
- $rest_url = get_rest_url( null, 'metform/v1/entries/');
324
- $this->response->data['ajax_stripe'] = $rest_url."stripe/pay?entry_id=".$this->entry_id;
325
- $this->response->data['message'] = $this->form_settings['success_message']. esc_html__(' Please wait... Open a Stripe Popup Box.', 'metform');
326
  }
327
  }
328
 
329
  return $this->response;
330
-
331
  }
332
 
333
- public function validate_form_data( $form_data ){
 
334
 
335
  $field_count = 0;
336
  $errors = 0;
337
 
338
- foreach( $form_data as $key => $value ){
339
- if(!is_array($value)){
340
  $field_count++;
341
- $min = ( ( isset( $this->fields[$key]->mf_input_min_length ) && $this->fields[$key]->mf_input_min_length != '' ) ? $this->fields[$key]->mf_input_min_length : '' );
342
- $max = ( ( isset( $this->fields[$key]->mf_input_max_length ) && $this->fields[$key]->mf_input_max_length != '' ) ? $this->fields[$key]->mf_input_max_length : '' );
343
- $validation_type = ( (isset( $this->fields[$key]->mf_input_validation_type ) && $this->fields[$key]->mf_input_validation_type != '' ) ? $this->fields[$key]->mf_input_validation_type : 'none' );
344
- $expression = ( (isset( $this->fields[$key]->mf_input_validation_expression ) && $this->fields[$key]->mf_input_validation_expression != '' ) ? $this->fields[$key]->mf_input_validation_expression : '' );
345
  $type = str_replace(['by_', '_length'], '', $validation_type);
346
- $str_length = ( ( $validation_type == 'by_word_length' ) ? str_word_count( $value ) : ( ( $validation_type == 'by_character_length' ) ? strlen( $value ) : '' ) );
347
-
348
- if( ( !in_array($validation_type, ['none', 'by_expresssion_based']) ) && ( $min != '' ) && ( $min > $str_length ) ){
349
  $errors++;
350
  $this->response->status = 0;
351
- $this->response->error[] = esc_html( ( ( $this->fields[$key]->mf_input_label != '' ) ? $this->fields[$key]->mf_input_label : $key ). " minimum input ". $min ." ".$type );
352
  }
353
- if( ( !in_array($validation_type, ['none', 'by_expresssion_based']) ) && ( $max != '' ) && ( $max < $str_length ) ){
354
  $errors++;
355
  $this->response->status = 0;
356
- $this->response->error[] = esc_html( ( ( $this->fields[$key]->mf_input_label != '' ) ? $this->fields[$key]->mf_input_label : $key ). " maximum input ". $max ." ".$type );
357
  }
358
- if( ($validation_type == 'by_expresssion_based') && ( $expression != '' ) && ( !preg_match( "/".$expression."/", $value ) ) ){
359
  $errors++;
360
  $this->response->status = 0;
361
- $this->response->error[] = esc_html( ( ( $this->fields[$key]->mf_input_label != '' ) ? $this->fields[$key]->mf_input_label : $key ). " input criteria is not matched.");
362
  }
363
  }
364
  }
365
 
366
- return ( ( $errors > 0 ) ? false : true );
367
  }
368
 
369
- public function store($form_id, $form_data, $entry_id = null){
370
-
 
371
  $this->form_id = $form_id;
372
  $this->sanitize($form_data);
373
  $this->entry_id = $entry_id;
374
 
375
- if(isset($this->form_settings['store_entries']) && $this->form_settings['store_entries'] == 1){
376
- if( $this->entry_id == null ){
377
  $this->insert();
378
- }
379
- else {
380
  $this->update();
381
  }
382
  }
383
-
384
  }
385
 
386
- private function insert(){
387
-
 
388
  $form_settings = $this->form_settings;
389
  $form_id = $this->form_id;
390
 
391
  $this->title = get_the_title($this->form_id);
392
-
393
  $defaults = array(
394
- 'post_title' => 'Entry data # '.$this->title,
395
  'post_status' => 'publish',
396
  'post_content' => '',
397
  'post_type' => $this->post_type,
398
  );
399
-
400
  $this->entry_id = wp_insert_post($defaults);
401
 
402
  $update = [
403
  'ID' => $this->entry_id,
404
- 'post_title' => 'Entry # '.$this->entry_id,
405
  ];
406
- wp_update_post( $update );
407
 
408
  $this->response->data['form_id'] = $form_id;
409
- $this->response->data['form_settings'] = $form_settings;
410
 
411
  $entry_count = $this->get_entry_count();
412
  $entry_count++;
413
 
414
- update_post_meta( $form_id, $this->key_form_total_entries, $entry_count );
415
- update_post_meta( $this->entry_id, $this->key_form_id, $form_id );
416
- update_post_meta( $this->entry_id, $this->key_form_data, $this->form_data );
417
 
418
- if(isset($form_settings['capture_user_browser_data']) && $form_settings['capture_user_browser_data'] == '1'){
419
- update_post_meta( $this->entry_id, $this->key_browser_data, $this->get_browser_data() );
 
 
420
  $this->response->status = 1;
421
  }
422
 
423
  $this->response->status = 1;
424
  $this->response->data['store'] = $this->form_data;
425
-
426
  }
427
-
428
- private function update(){
429
 
430
- update_post_meta( $this->entry_id, $this->key_form_id, $this->form_id );
431
- update_post_meta( $this->entry_id, $this->key_form_data, $this->form_data );
432
 
433
- $this->response->status = 1;
 
434
 
 
435
  }
436
 
437
- public function send_user_email($form_data){
 
438
 
439
  $user_mail = (isset($form_data[$this->email_name]) ? $form_data[$this->email_name] : null);
440
- $subject = isset($this->form_settings['user_email_subject']) ? $this->form_settings['user_email_subject'] : get_bloginfo( 'name' );
441
  $from = isset($this->form_settings['user_email_from']) ? $this->form_settings['user_email_from'] : null;
442
  $reply_to = isset($this->form_settings['user_email_reply_to']) ? $this->form_settings['user_email_reply_to'] : null;
443
  $body = isset($this->form_settings['user_email_body']) ? $this->form_settings['user_email_body'] : null;
444
  $user_email_attached_submision_copy = isset($this->form_settings['user_email_attach_submission_copy']) ? $this->form_settings['user_email_attach_submission_copy'] : null;
445
 
446
- $body = "<html><body><h4 style='text-align: center;'>".$body."</h4>";
447
- $form_html = \MetForm\Core\Entries\Form_Data::format_data_for_mail_style_2($this->form_id, $form_data);
448
- $body .= $form_html."</body></html>";
449
 
450
  $headers = 'MIME-Version: 1.0' . "\r\n";
451
  $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
452
-
453
- $headers .= 'From: '.$from."\r\n".
454
- 'Reply-To: '.$reply_to."\r\n" .
455
  'X-Mailer: PHP/' . phpversion();
456
 
457
- if(!$user_mail){
458
  $this->response->status = 0;
459
  $this->response->error[] = esc_html__('Mail not found.', 'metform');
460
- }else{
461
  $status = wp_mail($user_mail, $subject, $body, $headers);
462
  $this->response->status = ($status) ? 1 : 0;
463
  }
464
-
465
  }
466
 
467
- public function send_admin_email($form_data){
 
468
 
469
  $subject = isset($this->form_settings['admin_email_subject']) ? $this->form_settings['admin_email_subject'] : null;
470
  $from = isset($this->form_settings['admin_email_from']) ? $this->form_settings['admin_email_from'] : null;
@@ -472,121 +489,157 @@ Class Action{
472
  $body = isset($this->form_settings['admin_email_body']) ? $this->form_settings['admin_email_body'] : null;
473
  $admin_email_attached_submision_copy = isset($this->form_settings['admin_email_attach_submission_copy']) ? $this->form_settings['admin_email_attach_submission_copy'] : null;
474
 
475
- $body = "<html><body><h4 style='text-align: center;'>".$body."</h4>";
476
- $form_html = \MetForm\Core\Entries\Form_Data::format_data_for_mail_style_2($this->form_id, $form_data);
477
- $body .= $form_html."</body></html>";
478
 
479
  $headers = 'MIME-Version: 1.0' . "\r\n";
480
  $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
481
-
482
- $headers .= 'From: '.$from."\r\n".
483
- 'Reply-To: '.$reply_to."\r\n" .
484
  'X-Mailer: PHP/' . phpversion();
485
 
486
  $mail = isset($this->form_settings['admin_email_to']) ? $this->form_settings['admin_email_to'] : null;
487
 
488
- if(!$mail){
489
  $this->response->status = 0;
490
  $this->response->error[] = esc_html__('Admin mail not found to send email.', 'metform');
491
- }else{
492
  $admin_email = preg_replace('/\s+/', '', $mail);
493
- $admin_emails = explode (",", $admin_email);
494
- foreach($admin_emails as $email){
495
  $status = wp_mail($email, $subject, $body, $headers);
496
  }
497
 
498
  $this->response->status = ($status) ? 1 : 0;
499
-
500
  }
501
-
502
  }
503
 
504
- public function get_fields($form_id = null){
505
- if($form_id != null){
 
506
  $this->form_id = $form_id;
507
  }
508
-
509
  $input_widgets = \Metform\Widgets\Manifest::instance()->get_input_widgets();
510
-
511
  $widget_input_data = get_post_meta($this->form_id, '_elementor_data', true);
512
  $widget_input_data = json_decode($widget_input_data);
513
-
514
  return Map_El::data($widget_input_data, $input_widgets)->get_el();
515
-
516
  }
517
 
518
- public function sanitize($form_data, $fields = null){
519
- if($fields == null){
 
520
  $fields = $this->fields;
521
  }
522
 
523
- foreach($form_data as $key => $value){
524
 
525
- if(isset($fields[$key])){
526
- $this->form_data[ $key ] = $value;
527
  }
528
-
529
  }
530
 
531
  $repeaters = $this->get_input_name_by_widget_type('mf-simple-repeater');
532
 
533
  $repeaters = (is_array($repeaters) ? $repeaters : []);
534
 
535
- foreach( $repeaters as $repeater ){
536
- $repeater_process_data = $this->process_repeater_data( $this->form_data[$repeater] );
537
  $this->form_data[$repeater] = $repeater_process_data;
538
  }
539
-
540
  }
541
 
542
- public function upload_file($file_data, $file_input_names){
 
543
 
544
- foreach($file_input_names as $i => $input_name){
545
  // initial upload status, status use as array for multiple file
546
  $upload[$input_name]['status'] = false;
547
  // empty file upload check by file name
548
- if($file_data[$input_name]['name'] != ''){
549
- $file_data[$input_name]['name'] = time()."-".$file_data[$input_name]['name'];
550
  $upload[$input_name] = wp_upload_bits($file_data[$input_name]['name'], null, file_get_contents($file_data[$input_name]['tmp_name']), time());
551
  // status updated as true if file uploaded
552
- $upload[$input_name]['status'] = true;
553
- }else{
554
  // status updated as false for showing file not uploaded
555
  $upload[$input_name]['status'] = false;
556
  }
557
- if ( isset( $upload['error'] ) && $upload['error'] != 0 ) {
558
  $this->response->status = 0;
559
  $this->response->error[] = esc_html__('There was an error uploading your file. The error is: ', 'metform') . $upload['error'];
560
  } else {
561
- update_post_meta( $this->entry_id, $this->key_form_file, $upload );
562
  $this->response->status = 1;
563
  }
564
  }
 
 
565
  }
566
 
567
- public function get_entry_count($form_id = null){
568
-
569
- if($form_id != null){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  $this->form_id = $form_id;
571
  }
572
  global $wpdb;
573
- $entry_count = $wpdb->get_results( " SELECT COUNT( `post_id` ) as `count` FROM `".$wpdb->prefix."postmeta` WHERE `meta_key` LIKE 'metform_entries__form_id' AND `meta_value` = $this->form_id ", OBJECT );
574
-
575
  $entry_count = $entry_count[0]->count;
576
 
577
  $this->entry_count = $entry_count;
578
 
579
  return $entry_count;
580
-
581
  }
582
 
583
- public function get_browser_data(){
 
584
 
585
- if(!empty($_SERVER['HTTP_CLIENT_IP'])){
586
  $ip = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
587
- }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
588
  $ip = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
589
- }else{
590
  $ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
591
  }
592
 
@@ -602,40 +655,42 @@ Class Action{
602
  // return get_post_meta($form_id, $this->key_form_settings, true);
603
  // }
604
 
605
- public function get_input_name_by_widget_type( $widget_type, $fields = null ){
 
606
  global $w;
607
- if($fields != null){
608
  $this->fields = $fields;
609
  }
610
  $response = [];
611
 
612
  $w = $widget_type;
613
- $files = array_values(array_filter($this->fields, function($v){
614
  global $w;
615
- if($v->widgetType == $w){
616
  return $v;
617
  }
618
  }));
619
- foreach($files as $file){
620
- $response [] = $file->mf_input_name;
621
  }
622
 
623
- if(!empty($response)){
624
  return $response;
625
- }else{
626
  return null;
627
  }
628
  }
629
 
630
- public function process_repeater_data($repeater_data){
 
631
  $data = [];
632
- foreach($repeater_data as $index => $value){
633
- if(is_array($value)){
634
- foreach($value as $input_name => $input_value){
635
- $proc_key = $input_name."-".($index+1);
636
- if(is_array($input_value)){
637
  $data[$proc_key] = implode(', ', $input_value);
638
- }else{
639
  $data[$proc_key] = $input_value;
640
  }
641
  }
@@ -643,5 +698,4 @@ Class Action{
643
  }
644
  return $data;
645
  }
646
-
647
  }
1
  <?php
2
+
3
  namespace MetForm\Core\Entries;
 
4
 
5
+ defined('ABSPATH') || exit;
6
+
7
+ class Action
8
+ {
9
  use \MetForm\Traits\Singleton;
10
 
11
  private $key_form_id;
25
  private $title;
26
  private $entry_count;
27
  private $email_name;
28
+ private $file_upload_info;
29
 
30
  private $inserted_form_data;
31
 
33
 
34
  public function __construct()
35
  {
36
+ $this->response = (object) [
37
  'status' => 0,
38
  'error' => [
39
+ esc_html__('Some thing went wrong.', 'metrom'),
40
  ],
41
  'data' => [
42
  'message' => '',
51
  $this->key_form_file = 'metform_entries__file_upload';
52
  $this->key_payment_status = 'metform_entries__payment_status';
53
  $this->post_type = Base::instance()->cpt->get_name();
 
54
  }
55
 
56
+ public function submit($form_id, $form_data, $file_data)
57
+ {
58
+
59
  $this->form_id = $form_id;
60
  //$this->form_settings = $this->get_form_settings($form_id);
61
  $this->form_settings = \MetForm\Core\Forms\Action::instance()->get_all_data($form_id);
64
  $this->response->data['redirect_to'] = (!isset($this->form_settings['redirect_to'])) ? '' : $this->form_settings['redirect_to'];
65
  $this->response->data['hide_form'] = (!isset($this->form_settings['hide_form_after_submission']) ? '' : $this->form_settings['hide_form_after_submission']);
66
  $this->response->data['form_data'] = $form_data;
67
+ //$this->response->data['map_data'] = $this->fields;
68
 
69
  $email_name = $this->get_input_name_by_widget_type('mf-email');
70
  $this->email_name = (isset($email_name[0]) ? $email_name[0] : null);
71
 
72
  // nonce check
73
+ if (!isset($form_data['form_nonce']) || !wp_verify_nonce($form_data['form_nonce'], 'form_nonce')) {
74
  $this->response->status = 0;
75
+ $this->response->error[] = esc_html__('Unauthorized submission.', 'metform');
76
  return $this->response;
77
  }
78
+
79
  // validate form with max length, min length, length type and expression
80
  $validate = $this->validate_form_data($form_data);
81
+ if ($validate == false) {
82
  $this->response->status = 0;
83
  return $this->response;
84
  }
85
 
86
  // google recaptcha condition and action
87
+ if ( (isset($form_data['g-recaptcha-response']) || isset($form_data['g-recaptcha-response-v3'])) && (isset($this->fields['mf-recaptcha'])) && (isset($this->form_settings['mf_recaptcha_site_key'])) && $this->form_settings['mf_recaptcha_site_key'] != '') {
88
+ if (isset($form_data['g-recaptcha-response']) && ($form_data['g-recaptcha-response'] == "")) {
89
  $this->response->status = 0;
90
+ $this->response->error[] = esc_html__('Please solve the recaptcha.', 'metform');
91
  return $this->response;
92
  }
93
 
94
+ if (isset($form_data['g-recaptcha-response-v3']) && ($form_data['g-recaptcha-response-v3'] == "")) {
95
  $this->response->status = 0;
96
+ $this->response->error[] = esc_html__('Google captcha token not found.', 'metform');
97
  return $this->response;
98
  }
99
 
100
+ if (isset($form_data['g-recaptcha-response'])) {
101
+ $response = \MetForm\Core\Integrations\Google_Recaptcha::instance()->verify_captcha_v2($form_data, $this->form_settings);
102
  }
103
 
104
+ if (isset($form_data['g-recaptcha-response-v3'])) {
105
+ $response = \MetForm\Core\Integrations\Google_Recaptcha::instance()->verify_captcha_v3($form_data, $this->form_settings);
106
  }
107
 
108
+ //$this->response->data['responseKeys'] = $response['responseKeys'];
109
  $this->response->status = $response['status'];
110
+ if ($response['status'] == 0) {
111
+ $this->response->error[] = (isset($response['error']) ? $response['error'] : '');
112
  return $this->response;
113
  }
114
  }
115
 
116
  // Captcha solve conditiona and action
117
+ if (isset($form_data['mf-captcha-challenge'])) {
118
+ if (($form_data['mf-captcha-challenge']) == "") {
119
  $this->response->status = 0;
120
+ $this->response->error[] = esc_html__('Please solve the recaptcha.', 'metform');
121
  return $this->response;
122
  }
123
 
127
 
128
  $timeout_duration = 1800;
129
 
130
+ if (
131
+ isset($_SESSION['LAST_ACTIVITY']) && ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration
132
+ ) {
133
  session_unset();
134
  session_destroy();
135
  session_start();
137
 
138
  $_SESSION['LAST_ACTIVITY'] = $time;
139
 
140
+ if (!isset($_SESSION['mf_captcha_text'])) {
141
  $this->response->status = 0;
142
+ $this->response->error[] = esc_html__('Time out of this captcha. Please reload or choose another one.', 'metform');
143
  return $this->response;
144
  }
145
 
146
+ if (isset($form_data['mf-captcha-challenge']) && isset($_SESSION['mf_captcha_text']) && ($form_data['mf-captcha-challenge'] == $_SESSION['mf_captcha_text'])) {
147
  $this->response->status = 1;
148
+ //$this->response->data['captcha'] = esc_html__('Captcha is verified.', 'metform');
149
  } else {
150
  $this->response->status = 0;
151
+ $this->response->error[] = esc_html__('Enter correct captcha.', 'metform');
152
  return $this->response;
153
  }
 
154
  }
155
+
156
  // user login check and action
157
+ $required_loggin = isset($this->form_settings['require_login']) ? ((int) ($this->form_settings['require_login'])) : 0;
158
 
159
+ if (($required_loggin == 1) && (!is_user_logged_in())) {
160
  $this->response->status = 0;
161
+ $this->response->error[] = esc_html__('You must be logged in to submit form.', 'metform');
162
  return $this->response;
163
  }
164
 
165
  // Total entry limit check and prevent
166
+ if (isset($this->form_settings['limit_total_entries_status'])) {
167
+ $entry_limit = ((int) ($this->form_settings['limit_total_entries_status']));
168
 
169
+ if (($entry_limit == 1) && ($this->get_entry_count() >= $this->form_settings['limit_total_entries'])) {
170
  $this->response->status = 0;
171
+ $this->response->error[] = esc_html__('Form submission limit execed.', 'metform');
172
+
173
  return $this->response;
174
  }
175
  }
176
 
177
+ // signature input upload as image from base64
178
+ if(class_exists('\MetForm_Pro\Base\Package')){
179
+
180
+ $signature_input = $this->get_input_name_by_widget_type('mf-signature');
181
+
182
+ if ($signature_input != null) {
183
+ $inputs = (is_array($signature_input) ? $signature_input : []);
184
+ foreach ($inputs as $input) {
185
+ $b64string = isset($form_data[$input]) ? $form_data[$input] : '';
186
+ $status = $this->covert_base64_to_png($input, $b64string);
187
+ $form_data[$input] = (isset($status['url']) ? $status['url'] : '');
188
+ }
189
+ }
190
+ //$this->response->data['signature_input'] = $signature_input;
191
+ }
192
+
193
  // mailchimp email store action
194
  if (class_exists('\MetForm\Core\Integrations\Mail_Chimp')) {
195
+ if (isset($this->form_settings['mf_mail_chimp']) && $this->form_settings['mf_mail_chimp'] == '1' && $this->email_name != null && $form_data[$this->email_name] != '') {
196
 
197
  $mail_chimp = new \MetForm\Core\Integrations\Mail_Chimp();
198
+
199
+ if (array_key_exists("mf-listing-optin", $this->fields) && isset($form_data['mf-listing-optin'])) {
200
+ $response = $mail_chimp->call_api($form_data, ['auth' => $this->form_settings, 'email_name' => $this->email_name]);
201
+ } elseif (!array_key_exists('mf-listing-optin', $this->fields)) {
202
+ $response = $mail_chimp->call_api($form_data, ['auth' => $this->form_settings, 'email_name' => $this->email_name]);
203
  }
204
+
205
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
206
+ }
 
207
  }
208
 
209
  // data submit to zapier action and check
210
+ if (class_exists('\MetForm_Pro\Core\Integrations\Zapier')) {
211
+ if (isset($this->form_settings['mf_zapier']) && $this->form_settings['mf_zapier'] == '1' && $this->email_name != null && $form_data[$this->email_name] != '') {
212
+
213
  $url = $this->form_settings['mf_zapier_webhook'];
214
+
215
+ if (array_key_exists('mf-listing-optin', $this->fields) && isset($form_data['mf-listing-optin'])) {
216
+
217
  $zapier = new \MetForm_Pro\Core\Integrations\Zapier();
218
+ $response = $zapier->call_webhook($form_data, ['url' => $url, 'email_name' => $this->email_name]);
219
+ } elseif (!array_key_exists('mf-listing-optin', $this->fields)) {
220
+
 
221
  $zapier = new \MetForm_Pro\Core\Integrations\Zapier();
222
+ $response = $zapier->call_webhook($form_data, ['url' => $url, 'email_name' => $this->email_name]);
 
223
  }
224
+
225
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
226
  }
227
  }
228
 
229
  // data submit to slack check and action
230
+ if (class_exists('\MetForm\Core\Integrations\Slack')) {
231
+ if (isset($this->form_settings['mf_slack']) && $this->form_settings['mf_slack'] == '1' && $this->email_name != null && $form_data[$this->email_name] != '') {
232
+
233
  $url = $this->form_settings['mf_slack_webhook'];
234
+
235
+ //$this->response->data['slack_hook'] = $url;
236
+
237
+ if (array_key_exists('mf-listing-optin', $this->fields) && isset($form_data['mf-listing-optin'])) {
238
+
239
  $slack = new \MetForm\Core\Integrations\Slack();
240
+ $response = $slack->call_webhook($form_data, ['url' => $url, 'email_name' => $this->email_name]);
241
+ } elseif (!array_key_exists('mf-listing-optin', $this->fields)) {
242
+
 
243
  $slack = new \MetForm\Core\Integrations\Slack();
244
+ $response = $slack->call_webhook($form_data, ['url' => $url, 'email_name' => $this->email_name]);
245
  }
246
+
247
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
248
  }
249
  }
250
 
251
+ // file upload check and action
252
+ $file_input_names = $this->get_input_name_by_widget_type('mf-file-upload');
253
+
254
+ if ((!empty($file_data)) && ($file_input_names != null)) {
255
+ $this->upload_file($file_data, $file_input_names);
256
+ }
257
+
258
  // Store data in database
259
+ $this->store($form_id, $form_data);
260
 
261
  // data submit to a rest api check and action
262
+ if (class_exists('\MetForm_Pro\Core\Integrations\Rest_Api') && isset($this->form_settings['mf_rest_api']) && ($this->form_settings['mf_rest_api_url'] != '')) {
263
  $url = $this->form_settings['mf_rest_api_url'];
264
  $method = $this->form_settings['mf_rest_api_method'];
265
  $rest_api = new \MetForm_Pro\Core\Integrations\Rest_Api();
266
  $response = $rest_api->call_api(
267
  [
268
+ 'entries' => json_encode($this->form_data),
269
+ 'entry_id' => (($this->entry_id != null) ? $this->entry_id : ''),
270
+ 'form_id' => $form_data['id'],
271
  'version' => \MetForm\Plugin::instance()->version()
272
  ],
273
  [
274
  'url' => $url,
275
  'method' => $method
276
+ ]
277
  );
278
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
279
  }
280
 
 
 
 
 
 
 
 
281
  // send confirmation email to user
282
+ if (isset($this->form_settings['enable_user_notification']) && $this->form_settings['enable_user_notification'] == 1) {
 
 
283
 
284
+ $this->send_user_email($this->form_data, $this->file_upload_info);
285
  }
286
 
287
  // send notification email to admins
288
+ if (isset($this->form_settings['enable_admin_notification']) && $this->form_settings['enable_admin_notification'] == 1) {
289
 
290
+ $this->send_admin_email($this->form_data, $this->file_upload_info);
291
  }
292
 
293
  $this->response->data['message'] = $this->form_settings['success_message'];
294
+
295
  $paymet_method = $this->get_input_name_by_widget_type('mf-payment-method');
296
 
297
+ if (class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal') && isset($this->form_settings['mf_paypal']) && isset($this->form_settings['mf_paypal_email']) && ($this->form_settings['mf_paypal_email'] != '') && ($paymet_method[0] != null)) {
298
+ if (isset($this->form_data[$paymet_method[0]]) && $this->form_data[$paymet_method[0]] == 'paypal') {
299
+ update_post_meta($this->entry_id, $this->key_payment_status, 'unpaid');
300
+ $rest_url = get_rest_url(null, 'metform/v1/entries/');
301
+ $this->response->data['redirect_to'] = $rest_url . "paypal/pay?entry_id=" . $this->entry_id;
302
+ $this->response->data['message'] = $this->form_settings['success_message'] . esc_html__(' Please wait... Redirecting to paypal.', 'metform');
303
  }
304
  }
305
 
306
+ if (class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe') && ($paymet_method[0] != null)) {
307
+ if (isset($this->form_data[$paymet_method[0]]) && $this->form_data[$paymet_method[0]] == 'stripe') {
308
+ update_post_meta($this->entry_id, $this->key_payment_status, 'unpaid');
309
+
310
  $payment_widget_name = \MetForm\Core\Entries\Action::instance()->get_input_name_by_widget_type('mf-payment-method', $this->fields);
311
  $widget = is_array($payment_widget_name) ? current($payment_widget_name) : '';
312
+
313
  $amount_filed = isset($this->fields[$widget]->mf_input_payment_field_name) ? $this->fields[$widget]->mf_input_payment_field_name : '';
314
  $amount = isset($this->form_data[$amount_filed]) ? $this->form_data[$amount_filed] : 0;
315
+
316
+ //$this->response->data['payment_method'] = $this->form_data[$paymet_method[0]];
317
 
318
  $icon_url = !empty($this->form_settings['mf_stripe_image_url']) ? $this->form_settings['mf_stripe_image_url'] : 'https://stripe.com/img/documentation/checkout/marketplace.png';
319
 
321
  $livekey = isset($this->form_settings['mf_stripe_live_publishiable_key']) ? $this->form_settings['mf_stripe_live_publishiable_key'] : '';
322
  $livekey_test = isset($this->form_settings['mf_stripe_test_publishiable_key']) ? $this->form_settings['mf_stripe_test_publishiable_key'] : '';
323
  $sandbox = isset($this->form_settings['mf_stripe_sandbox']) ? true : false;
324
+
325
  $live_keys = ($sandbox) ? $livekey_test : $livekey;
326
+
327
+ $payment['name_post'] = $this->form_settings['form_title'];
328
+ $payment['description'] = $this->form_id;
329
  $payment['amount'] = $amount;
330
  $payment['currency_code'] = 'USD';
331
+ $payment['keys'] = $live_keys;
332
  $payment['image_url'] = $icon_url;
333
  $payment['entry_id'] = $this->entry_id;
334
  $payment['form_id'] = $this->form_id;
335
  $payment['sandbox'] = $sandbox;
336
 
337
+ $this->response->data['payment_data'] = (object) $payment;
338
+ $rest_url = get_rest_url(null, 'metform/v1/entries/');
339
+ $this->response->data['ajax_stripe'] = $rest_url . "stripe/pay?entry_id=" . $this->entry_id;
340
+ $this->response->data['message'] = $this->form_settings['success_message'] . esc_html__(' Please wait... Open a Stripe Popup Box.', 'metform');
341
  }
342
  }
343
 
344
  return $this->response;
 
345
  }
346
 
347
+ public function validate_form_data($form_data)
348
+ {
349
 
350
  $field_count = 0;
351
  $errors = 0;
352
 
353
+ foreach ($form_data as $key => $value) {
354
+ if (!is_array($value)) {
355
  $field_count++;
356
+ $min = ((isset($this->fields[$key]->mf_input_min_length) && $this->fields[$key]->mf_input_min_length != '') ? $this->fields[$key]->mf_input_min_length : '');
357
+ $max = ((isset($this->fields[$key]->mf_input_max_length) && $this->fields[$key]->mf_input_max_length != '') ? $this->fields[$key]->mf_input_max_length : '');
358
+ $validation_type = ((isset($this->fields[$key]->mf_input_validation_type) && $this->fields[$key]->mf_input_validation_type != '') ? $this->fields[$key]->mf_input_validation_type : 'none');
359
+ $expression = ((isset($this->fields[$key]->mf_input_validation_expression) && $this->fields[$key]->mf_input_validation_expression != '') ? $this->fields[$key]->mf_input_validation_expression : '');
360
  $type = str_replace(['by_', '_length'], '', $validation_type);
361
+ $str_length = (($validation_type == 'by_word_length') ? str_word_count($value) : (($validation_type == 'by_character_length') ? strlen($value) : ''));
362
+
363
+ if ((!in_array($validation_type, ['none', 'by_expresssion_based'])) && ($min != '') && ($min > $str_length)) {
364
  $errors++;
365
  $this->response->status = 0;
366
+ $this->response->error[] = esc_html((($this->fields[$key]->mf_input_label != '') ? $this->fields[$key]->mf_input_label : $key) . " minimum input " . $min . " " . $type);
367
  }
368
+ if ((!in_array($validation_type, ['none', 'by_expresssion_based'])) && ($max != '') && ($max < $str_length)) {
369
  $errors++;
370
  $this->response->status = 0;
371
+ $this->response->error[] = esc_html((($this->fields[$key]->mf_input_label != '') ? $this->fields[$key]->mf_input_label : $key) . " maximum input " . $max . " " . $type);
372
  }
373
+ if (($validation_type == 'by_expresssion_based') && ($expression != '') && (!preg_match("/" . $expression . "/", $value))) {
374
  $errors++;
375
  $this->response->status = 0;
376
+ $this->response->error[] = esc_html((($this->fields[$key]->mf_input_label != '') ? $this->fields[$key]->mf_input_label : $key) . " input criteria is not matched.");
377
  }
378
  }
379
  }
380
 
381
+ return (($errors > 0) ? false : true);
382
  }
383
 
384
+ public function store($form_id, $form_data, $entry_id = null)
385
+ {
386
+
387
  $this->form_id = $form_id;
388
  $this->sanitize($form_data);
389
  $this->entry_id = $entry_id;
390
 
391
+ if (isset($this->form_settings['store_entries']) && $this->form_settings['store_entries'] == 1) {
392
+ if ($this->entry_id == null) {
393
  $this->insert();
394
+ } else {
 
395
  $this->update();
396
  }
397
  }
 
398
  }
399
 
400
+ private function insert()
401
+ {
402
+
403
  $form_settings = $this->form_settings;
404
  $form_id = $this->form_id;
405
 
406
  $this->title = get_the_title($this->form_id);
407
+
408
  $defaults = array(
409
+ 'post_title' => 'Entry data # ' . $this->title,
410
  'post_status' => 'publish',
411
  'post_content' => '',
412
  'post_type' => $this->post_type,
413
  );
414
+
415
  $this->entry_id = wp_insert_post($defaults);
416
 
417
  $update = [
418
  'ID' => $this->entry_id,
419
+ 'post_title' => 'Entry # ' . $this->entry_id,
420
  ];
421
+ wp_update_post($update);
422
 
423
  $this->response->data['form_id'] = $form_id;
424
+ //$this->response->data['form_settings'] = $form_settings;
425
 
426
  $entry_count = $this->get_entry_count();
427
  $entry_count++;
428
 
429
+ update_post_meta($form_id, $this->key_form_total_entries, $entry_count);
430
+ update_post_meta($this->entry_id, $this->key_form_id, $form_id);
431
+ update_post_meta($this->entry_id, $this->key_form_data, $this->form_data);
432
 
433
+ update_post_meta($this->entry_id, $this->key_form_file, $this->file_upload_info);
434
+
435
+ if (isset($form_settings['capture_user_browser_data']) && $form_settings['capture_user_browser_data'] == '1') {
436
+ update_post_meta($this->entry_id, $this->key_browser_data, $this->get_browser_data());
437
  $this->response->status = 1;
438
  }
439
 
440
  $this->response->status = 1;
441
  $this->response->data['store'] = $this->form_data;
 
442
  }
 
 
443
 
444
+ private function update()
445
+ {
446
 
447
+ update_post_meta($this->entry_id, $this->key_form_id, $this->form_id);
448
+ update_post_meta($this->entry_id, $this->key_form_data, $this->form_data);
449
 
450
+ $this->response->status = 1;
451
  }
452
 
453
+ public function send_user_email($form_data, $file_info)
454
+ {
455
 
456
  $user_mail = (isset($form_data[$this->email_name]) ? $form_data[$this->email_name] : null);
457
+ $subject = isset($this->form_settings['user_email_subject']) ? $this->form_settings['user_email_subject'] : get_bloginfo('name');
458
  $from = isset($this->form_settings['user_email_from']) ? $this->form_settings['user_email_from'] : null;
459
  $reply_to = isset($this->form_settings['user_email_reply_to']) ? $this->form_settings['user_email_reply_to'] : null;
460
  $body = isset($this->form_settings['user_email_body']) ? $this->form_settings['user_email_body'] : null;
461
  $user_email_attached_submision_copy = isset($this->form_settings['user_email_attach_submission_copy']) ? $this->form_settings['user_email_attach_submission_copy'] : null;
462
 
463
+ $body = "<html><body><h2 style='text-align: center;'>".get_the_title($this->form_id)."</h2><h4 style='text-align: center;'>" . $body . "</h4>";
464
+ $form_html = \MetForm\Core\Entries\Form_Data::format_data_for_mail($this->form_id, $form_data, $file_info);
465
+ $body .= $form_html . "</body></html>";
466
 
467
  $headers = 'MIME-Version: 1.0' . "\r\n";
468
  $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
469
+
470
+ $headers .= 'From: ' . $from . "\r\n" .
471
+ 'Reply-To: ' . $reply_to . "\r\n" .
472
  'X-Mailer: PHP/' . phpversion();
473
 
474
+ if (!$user_mail) {
475
  $this->response->status = 0;
476
  $this->response->error[] = esc_html__('Mail not found.', 'metform');
477
+ } else {
478
  $status = wp_mail($user_mail, $subject, $body, $headers);
479
  $this->response->status = ($status) ? 1 : 0;
480
  }
 
481
  }
482
 
483
+ public function send_admin_email($form_data, $file_info)
484
+ {
485
 
486
  $subject = isset($this->form_settings['admin_email_subject']) ? $this->form_settings['admin_email_subject'] : null;
487
  $from = isset($this->form_settings['admin_email_from']) ? $this->form_settings['admin_email_from'] : null;
489
  $body = isset($this->form_settings['admin_email_body']) ? $this->form_settings['admin_email_body'] : null;
490
  $admin_email_attached_submision_copy = isset($this->form_settings['admin_email_attach_submission_copy']) ? $this->form_settings['admin_email_attach_submission_copy'] : null;
491
 
492
+ $body = "<html><body><h2 style='text-align: center;'>".get_the_title($this->form_id)."</h2><h4 style='text-align: center;'>" . $body . "</h4>";
493
+ $form_html = \MetForm\Core\Entries\Form_Data::format_data_for_mail($this->form_id, $form_data, $file_info);
494
+ $body .= $form_html . "</body></html>";
495
 
496
  $headers = 'MIME-Version: 1.0' . "\r\n";
497
  $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
498
+
499
+ $headers .= 'From: ' . $from . "\r\n" .
500
+ 'Reply-To: ' . $reply_to . "\r\n" .
501
  'X-Mailer: PHP/' . phpversion();
502
 
503
  $mail = isset($this->form_settings['admin_email_to']) ? $this->form_settings['admin_email_to'] : null;
504
 
505
+ if (!$mail) {
506
  $this->response->status = 0;
507
  $this->response->error[] = esc_html__('Admin mail not found to send email.', 'metform');
508
+ } else {
509
  $admin_email = preg_replace('/\s+/', '', $mail);
510
+ $admin_emails = explode(",", $admin_email);
511
+ foreach ($admin_emails as $email) {
512
  $status = wp_mail($email, $subject, $body, $headers);
513
  }
514
 
515
  $this->response->status = ($status) ? 1 : 0;
 
516
  }
 
517
  }
518
 
519
+ public function get_fields($form_id = null)
520
+ {
521
+ if ($form_id != null) {
522
  $this->form_id = $form_id;
523
  }
524
+
525
  $input_widgets = \Metform\Widgets\Manifest::instance()->get_input_widgets();
526
+
527
  $widget_input_data = get_post_meta($this->form_id, '_elementor_data', true);
528
  $widget_input_data = json_decode($widget_input_data);
529
+
530
  return Map_El::data($widget_input_data, $input_widgets)->get_el();
 
531
  }
532
 
533
+ public function sanitize($form_data, $fields = null)
534
+ {
535
+ if ($fields == null) {
536
  $fields = $this->fields;
537
  }
538
 
539
+ foreach ($form_data as $key => $value) {
540
 
541
+ if (isset($fields[$key])) {
542
+ $this->form_data[$key] = $value;
543
  }
 
544
  }
545
 
546
  $repeaters = $this->get_input_name_by_widget_type('mf-simple-repeater');
547
 
548
  $repeaters = (is_array($repeaters) ? $repeaters : []);
549
 
550
+ foreach ($repeaters as $repeater) {
551
+ $repeater_process_data = $this->process_repeater_data($this->form_data[$repeater]);
552
  $this->form_data[$repeater] = $repeater_process_data;
553
  }
 
554
  }
555
 
556
+ public function upload_file($file_data, $file_input_names)
557
+ {
558
 
559
+ foreach ($file_input_names as $i => $input_name) {
560
  // initial upload status, status use as array for multiple file
561
  $upload[$input_name]['status'] = false;
562
  // empty file upload check by file name
563
+ if ($file_data[$input_name]['name'] != '') {
564
+ $file_data[$input_name]['name'] = time() . "-" . $file_data[$input_name]['name'];
565
  $upload[$input_name] = wp_upload_bits($file_data[$input_name]['name'], null, file_get_contents($file_data[$input_name]['tmp_name']), time());
566
  // status updated as true if file uploaded
567
+ $upload[$input_name]['status'] = true;
568
+ } else {
569
  // status updated as false for showing file not uploaded
570
  $upload[$input_name]['status'] = false;
571
  }
572
+ if (isset($upload['error']) && $upload['error'] != 0) {
573
  $this->response->status = 0;
574
  $this->response->error[] = esc_html__('There was an error uploading your file. The error is: ', 'metform') . $upload['error'];
575
  } else {
576
+ $this->file_upload_info = $upload;
577
  $this->response->status = 1;
578
  }
579
  }
580
+
581
+ //$this->response->data['file_upload_info'] = $this->file_upload_info;
582
  }
583
 
584
+ public function covert_base64_to_png($input, $b64string)
585
+ {
586
+ $status = [];
587
+
588
+ $upload_dir = wp_upload_dir();
589
+ $upload_path = $upload_dir['path'];
590
+ $upload_url = $upload_dir['url'];
591
+
592
+ $bin = str_replace('data:image/png;base64,', '', $b64string);
593
+
594
+ $decoded = base64_decode($bin);
595
+
596
+ $im = imageCreateFromString($decoded);
597
+
598
+ if (!$im) {
599
+ $status['error'] = esc_html__('Base64 value is not a valid image', 'metform');
600
+ }
601
+
602
+ $img_name = '/' . $input . time() . '.png';
603
+
604
+ $img_file = $upload_path . $img_name;
605
+ $img_url = $upload_url . $img_name;
606
+
607
+ $img = imagepng($im, $img_file, 0);
608
+
609
+ if ($img) {
610
+ $status['status'] = true;
611
+ $status['url'] = $img_url;
612
+ } else {
613
+ $status['status'] = false;
614
+ }
615
+
616
+ return $status;
617
+ }
618
+
619
+ public function get_entry_count($form_id = null)
620
+ {
621
+
622
+ if ($form_id != null) {
623
  $this->form_id = $form_id;
624
  }
625
  global $wpdb;
626
+ $entry_count = $wpdb->get_results(" SELECT COUNT( `post_id` ) as `count` FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` LIKE 'metform_entries__form_id' AND `meta_value` = $this->form_id ", OBJECT);
627
+
628
  $entry_count = $entry_count[0]->count;
629
 
630
  $this->entry_count = $entry_count;
631
 
632
  return $entry_count;
 
633
  }
634
 
635
+ public function get_browser_data()
636
+ {
637
 
638
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
639
  $ip = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
640
+ } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
641
  $ip = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
642
+ } else {
643
  $ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
644
  }
645
 
655
  // return get_post_meta($form_id, $this->key_form_settings, true);
656
  // }
657
 
658
+ public function get_input_name_by_widget_type($widget_type, $fields = null)
659
+ {
660
  global $w;
661
+ if ($fields != null) {
662
  $this->fields = $fields;
663
  }
664
  $response = [];
665
 
666
  $w = $widget_type;
667
+ $files = array_values(array_filter($this->fields, function ($v) {
668
  global $w;
669
+ if ($v->widgetType == $w) {
670
  return $v;
671
  }
672
  }));
673
+ foreach ($files as $file) {
674
+ $response[] = $file->mf_input_name;
675
  }
676
 
677
+ if (!empty($response)) {
678
  return $response;
679
+ } else {
680
  return null;
681
  }
682
  }
683
 
684
+ public function process_repeater_data($repeater_data)
685
+ {
686
  $data = [];
687
+ foreach ($repeater_data as $index => $value) {
688
+ if (is_array($value)) {
689
+ foreach ($value as $input_name => $input_value) {
690
+ $proc_key = $input_name . "-" . ($index + 1);
691
+ if (is_array($input_value)) {
692
  $data[$proc_key] = implode(', ', $input_value);
693
+ } else {
694
  $data[$proc_key] = $input_value;
695
  }
696
  }
698
  }
699
  return $data;
700
  }
 
701
  }
core/entries/form-data.php CHANGED
@@ -1,197 +1,140 @@
1
  <?php
 
2
  namespace MetForm\Core\Entries;
3
- defined( 'ABSPATH' ) || exit;
4
 
5
- Class Form_Data{
6
- public static function format_form_data( $form_id, $form_data ){
7
- $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
8
- $map_data = json_decode(json_encode($map_data), true);
9
- ob_start();
10
- ?>
11
- <div class="metform-entry-data container">
12
- <table class='attr-table attr-table-hover'>
13
- <thead>
14
- <tr>
15
- <th scope="attr-col"><?php esc_html_e('Name', 'metform')?></th>
16
- <th scope="attr-col"><?php esc_html_e('Value', 'metform')?></th>
17
- </tr>
18
- </thead>
19
- <tbody>
20
- <?php
21
- foreach($map_data as $key => $value){
22
- if( ( $value['widgetType'] != 'mf-file-upload' ) && ( $value['widgetType'] != 'mf-simple-repeater' ) ){
23
- echo "<tr>";
24
- echo "<th scope='attr-row'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></th>";
25
- echo "<td>".esc_html((array_key_exists($key, $form_data) ? ((is_array($form_data[$key])) ? implode(', ', $form_data[$key]) : $form_data[$key]) : ' '))."</td>";
26
- echo "</tr>";
27
- }
28
-
29
- if( $value['widgetType'] == 'mf-simple-repeater' ){
30
- echo "<tr>";
31
- echo "<th scope='attr-row'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></th>";
32
- echo "<td>";
33
- $repeater_data = ((array_key_exists($key, $form_data)) ? $form_data[$key] : []);
34
- foreach($repeater_data as $key => $value){
35
- echo "<strong>".esc_html($key).": </strong>";
36
- echo "<span>".esc_html($value)."</span>";
37
- echo "<br>";
38
- }
39
- echo "</td>";
40
- echo "</tr>";
41
- }
42
-
43
- }
44
- ?>
45
- </tbody>
46
- </table>
47
- </div>
48
- <?php
49
- $data_html = ob_get_contents();
50
- ob_end_clean();
51
- return $data_html;
52
- }
53
 
54
- public static function format_data_for_mail( $form_id, $form_data ){
55
- $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
56
- $map_data = json_decode(json_encode($map_data), true);
57
- ob_start();
58
- ?>
59
- <div>
60
- <table style="width: 100%; max-width: 100%; margin-bottom: 20px;">
61
- <thead style="text-align: left;">
62
- <tr style="display: table-row;">
63
- <th style="border-top: 0;vertical-align: bottom; border-bottom: 2px solid #ddd; padding: 8px; line-height: 1.42857143;"><?php esc_html_e('Name', 'metform')?></th>
64
- <th style="border-top: 0;vertical-align: bottom; border-bottom: 2px solid #ddd; padding: 8px; line-height: 1.42857143;"><?php esc_html_e('Value', 'metform')?></th>
65
- </tr>
66
- </thead>
67
- <tbody style="text-align: left;">
68
- <?php
69
- foreach($map_data as $key => $value){
70
- if( ( $value['widgetType'] != 'mf-file-upload' ) && ( $value['widgetType'] != 'mf-simple-repeater' ) && ( $value['widgetType'] != 'mf-recaptcha' ) ){
71
- echo "<tr style='text-align: left;'>";
72
- echo "<th style='padding: 8px;line-height: 1.42857143;vertical-align: top;border-top: 1px solid #ddd;'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></th>";
73
- echo "<td style='padding: 8px;line-height: 1.42857143;vertical-align: top;border-top: 1px solid #ddd;'>".esc_html((array_key_exists($key, $form_data) ? ((is_array($form_data[$key])) ? implode(', ', $form_data[$key]) : $form_data[$key]) : ' '))."</td>";
74
- echo "</tr>";
75
- }
76
-
77
- if( $value['widgetType'] == 'mf-simple-repeater' ){
78
- echo "<tr style='text-align: left;'>";
79
- echo "<th style='padding: 8px;line-height: 1.42857143;vertical-align: top;border-top: 1px solid #ddd;'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></th>";
80
- echo "<td style='padding: 8px;line-height: 1.42857143;vertical-align: top;border-top: 1px solid #ddd;'>";
81
- $repeater_data = ((array_key_exists($key, $form_data)) ? $form_data[$key] : []);
82
- foreach($repeater_data as $key => $value){
83
- echo "<strong style='color: #000;'>".esc_html($key).": </strong>";
84
- echo "<span style='color: #000;'>".esc_html($value)."</span>";
85
- echo "<br>";
86
- }
87
- echo "</td>";
88
- echo "</tr>";
89
- }
90
-
91
- }
92
- ?>
93
- </tbody>
94
- </table>
95
- </div>
96
- <?php
97
- $data_html = ob_get_contents();
98
- ob_end_clean();
99
- return $data_html;
100
- }
101
 
102
- public static function format_form_data_style_2( $form_id, $form_data ){
 
103
  $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
104
  $map_data = json_decode(json_encode($map_data), true);
105
  ob_start();
106
  ?>
107
  <div class="metform-entry-data container">
108
  <table class='mf-entry-data' cellpadding="5" cellspacing="0">
109
- <tbody>
110
- <?php
111
- foreach($map_data as $key => $value){
112
- if( ( $value['widgetType'] != 'mf-file-upload' ) && ( $value['widgetType'] != 'mf-simple-repeater' ) ){
113
- echo "<tr class='mf-data-label'>";
114
- echo "<td colspan='2'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></td>";
115
- echo "</tr>";
116
- echo "<tr class='mf-data-value'>";
117
- echo "<td class='mf-value-space'>&nbsp;</td>";
118
- echo "<td>".esc_html((array_key_exists($key, $form_data) ? ((is_array($form_data[$key])) ? implode(', ', $form_data[$key]) : $form_data[$key]) : ' '))."</td>";
119
- echo "</tr>";
120
- }
121
-
122
- if( $value['widgetType'] == 'mf-simple-repeater' ){
123
- echo "<tr class='mf-data-label'>";
124
- echo "<td colspan='2'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></td>";
125
- echo "</tr>";
126
- echo "<tr class='mf-data-value'>";
127
- echo "<td class='mf-value-space'>&nbsp;</td>";
128
- echo "<td>";
129
- $repeater_data = ((array_key_exists($key, $form_data)) ? $form_data[$key] : []);
130
- foreach($repeater_data as $key => $value){
131
- echo "<strong>".esc_html($key).": </strong>";
132
- echo "<span>".esc_html($value)."</span>";
133
- echo "<br>";
134
- }
135
- echo "</td>";
136
- echo "</tr>";
137
- }
138
-
139
- }
140
- ?>
141
- </tbody>
 
 
 
 
 
 
 
 
 
 
 
 
142
  </table>
143
  </div>
144
- <?php
145
- $data_html = ob_get_contents();
146
- ob_end_clean();
147
- return $data_html;
148
- }
149
 
150
- public static function format_data_for_mail_style_2( $form_id, $form_data ){
151
- $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
152
- $map_data = json_decode(json_encode($map_data), true);
153
- ob_start();
154
- ?>
 
 
 
 
 
155
  <div>
156
  <table width="100%" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF" style="border: 1px solid #EAF2FA">
157
- <tbody>
158
- <?php
159
- foreach($map_data as $key => $value){
160
- if( ( $value['widgetType'] != 'mf-file-upload' ) && ( $value['widgetType'] != 'mf-simple-repeater' ) && ( $value['widgetType'] != 'mf-recaptcha' ) ){
161
- echo "<tr bgcolor='#EAF2FA'>";
162
- echo "<td colspan='2'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></td>";
163
- echo "</tr>";
164
- echo "<tr bgcolor='#FFFFFF'>";
165
- echo "<td width='20'>&nbsp;</td>";
166
- echo "<td>".esc_html((array_key_exists($key, $form_data) ? ((is_array($form_data[$key])) ? implode(', ', $form_data[$key]) : $form_data[$key]) : ' '))."</td>";
167
- echo "</tr>";
168
- }
169
-
170
- if( $value['widgetType'] == 'mf-simple-repeater' ){
171
- echo "<tr bgcolor='#EAF2FA'>";
172
- echo "<td colspan='2'><strong>".esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key)."</strong></td>";
173
- echo "</tr>";
174
- echo "<tr bgcolor='#FFFFFF'>";
175
- echo "<td width='20'>&nbsp;</td>";
176
- echo "<td>";
177
- $repeater_data = ((array_key_exists($key, $form_data)) ? $form_data[$key] : []);
178
- foreach($repeater_data as $key => $value){
179
- echo "<strong>".esc_html($key).": </strong>";
180
- echo "<span>".esc_html($value)."</span>";
181
- echo "<br>";
182
- }
183
- echo "</td>";
184
- echo "</tr>";
185
- }
186
-
187
- }
188
- ?>
189
- </tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  </table>
191
  </div>
192
- <?php
193
  $data_html = ob_get_contents();
194
  ob_end_clean();
195
  return $data_html;
196
  }
197
- }
1
  <?php
2
+
3
  namespace MetForm\Core\Entries;
 
4
 
5
+ defined('ABSPATH') || exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ class Form_Data
8
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ public static function format_form_data($form_id, $form_data)
11
+ {
12
  $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
13
  $map_data = json_decode(json_encode($map_data), true);
14
  ob_start();
15
  ?>
16
  <div class="metform-entry-data container">
17
  <table class='mf-entry-data' cellpadding="5" cellspacing="0">
18
+ <tbody>
19
+ <?php
20
+ foreach ($map_data as $key => $value) {
21
+
22
+ if (in_array($value['widgetType'], ['mf-simple-captcha', 'mf-recaptcha'])) {
23
+ continue;
24
+ }
25
+
26
+ echo "<tr class='mf-data-label'>";
27
+ echo "<td colspan='2'><strong>" . esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key) . "</strong></td>";
28
+ echo "</tr>";
29
+ echo "<tr class='mf-data-value'>";
30
+ echo "<td class='mf-value-space'>&nbsp;</td>";
31
+
32
+ if (!in_array($value['widgetType'], ['mf-file-upload', 'mf-simple-repeater', 'mf-signature', 'mf-like-dislike'])) {
33
+ echo "<td>" . esc_html((array_key_exists($key, $form_data) ? ((is_array($form_data[$key])) ? implode(', ', $form_data[$key]) : $form_data[$key]) : ' ')) . "</td>";
34
+ }
35
+
36
+ if ($value['widgetType'] == 'mf-signature') {
37
+ echo "<td><img class='signature-img' src='" . (isset($form_data[$key]) ? $form_data[$key] : '') . "'></td>";
38
+ }
39
+
40
+ if ($value['widgetType'] == 'mf-simple-repeater') {
41
+ echo "<td>";
42
+ $repeater_data = ((array_key_exists($key, $form_data)) ? $form_data[$key] : []);
43
+ foreach ($repeater_data as $key => $value) {
44
+ echo "<strong>" . esc_html($key) . ": </strong>";
45
+ echo "<span>" . esc_html($value) . "</span>";
46
+ echo "<br>";
47
+ }
48
+ echo "</td>";
49
+ }
50
+
51
+ if ($value['widgetType'] == 'mf-like-dislike') {
52
+ $like_dislike = (isset($form_data[$key]) ? $form_data[$key] : '');
53
+ echo "<td>";
54
+ echo (($like_dislike == '1') ? "<span class='dashicons dashicons-thumbs-up'></span>" : "");
55
+ echo (($like_dislike == '0') ? "<span class='dashicons dashicons-thumbs-down'></span>" : "");
56
+ echo "</td>";
57
+ }
58
+
59
+ echo "</tr>";
60
+ }
61
+ ?>
62
+ </tbody>
63
  </table>
64
  </div>
65
+ <?php
66
+ $data_html = ob_get_contents();
67
+ ob_end_clean();
68
+ return $data_html;
69
+ }
70
 
71
+ public static function format_data_for_mail($form_id, $form_data, $file_info)
72
+ {
73
+ $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
74
+ $map_data = json_decode(json_encode($map_data), true);
75
+
76
+ //$file_meta_data = get_post_meta( $post_id, 'metform_entries__file_upload', true );
77
+
78
+ ob_start();
79
+
80
+ ?>
81
  <div>
82
  <table width="100%" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF" style="border: 1px solid #EAF2FA">
83
+ <tbody>
84
+ <?php
85
+ foreach ($map_data as $key => $value) {
86
+
87
+ if (in_array($value['widgetType'], ['mf-simple-captcha', 'mf-recaptcha'])) {
88
+ continue;
89
+ }
90
+
91
+ echo "<tr bgcolor='#EAF2FA'>";
92
+ echo "<td colspan='2'><strong>" . esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key) . "</strong></td>";
93
+ echo "</tr>";
94
+ echo "<tr bgcolor='#FFFFFF'>";
95
+ echo "<td width='20'>&nbsp;</td>";
96
+
97
+ if (!in_array($value['widgetType'], ['mf-file-upload', 'mf-simple-repeater', 'mf-signature'])) {
98
+ echo "<td>" . esc_html((array_key_exists($key, $form_data) ? ((is_array($form_data[$key])) ? implode(', ', $form_data[$key]) : $form_data[$key]) : ' ')) . "</td>";
99
+ }
100
+
101
+ if ($value['widgetType'] == 'mf-signature') {
102
+ echo "<td><img width='200' height='100' src='" . (isset($form_data[$key]) ? $form_data[$key] : '') . "'></td>";
103
+ }
104
+
105
+ if ($value['widgetType'] == 'mf-simple-repeater') {
106
+ echo "<td>";
107
+ $repeater_data = ((array_key_exists($key, $form_data)) ? $form_data[$key] : []);
108
+ foreach ($repeater_data as $key => $value) {
109
+ echo "<strong>" . esc_html($key) . ": </strong>";
110
+ echo "<span>" . esc_html($value) . "</span>";
111
+ echo "<br>";
112
+ }
113
+ echo "</td>";
114
+ }
115
+
116
+ echo "</tr>";
117
+ }
118
+
119
+ if (!empty($file_info)) {
120
+ foreach ($file_info as $key => $file) {
121
+ echo "<tr bgcolor='#EAF2FA'>";
122
+ echo "<td colspan='2'><strong>" . esc_html(($map_data[$key]['mf_input_label'] != '') ? $map_data[$key]['mf_input_label'] : $key) . "</strong></td>";
123
+ echo "</tr>";
124
+ echo "<tr bgcolor='#FFFFFF'>";
125
+ echo "<td width='20'>&nbsp;</td>";
126
+ echo "<td><a href='" . (isset($file['url']) ? $file['url'] : '') . "'>Download</a></td>";
127
+ echo "</tr>";
128
+ }
129
+ }
130
+
131
+ ?>
132
+ </tbody>
133
  </table>
134
  </div>
135
+ <?php
136
  $data_html = ob_get_contents();
137
  ob_end_clean();
138
  return $data_html;
139
  }
140
+ }
core/entries/meta-data.php CHANGED
@@ -153,7 +153,7 @@ Class Meta_Data{
153
  $this->form_data = (isset($this->form_data)) ? $this->form_data : "";
154
  // format all form data into html table
155
  if($this->form_data != ''){
156
- $form_html = \MetForm\Core\Entries\Form_Data::format_form_data_style_2($this->form_id, $this->form_data);
157
  echo $form_html;
158
  }
159
  }
153
  $this->form_data = (isset($this->form_data)) ? $this->form_data : "";
154
  // format all form data into html table
155
  if($this->form_data != ''){
156
+ $form_html = \MetForm\Core\Entries\Form_Data::format_form_data($this->form_id, $this->form_data);
157
  echo $form_html;
158
  }
159
  }
core/forms/views/modal-editor.php CHANGED
@@ -274,14 +274,6 @@
274
  <br>
275
  <?php endif ?>
276
 
277
- <div class="mf-input-group">
278
- <label class="attr-input-label">
279
- <input type="checkbox" value="1" name="mf_recaptcha" class="mf-admin-control-input mf-form-modalinput-recaptcha">
280
- <span><?php esc_html_e('reCAPTCHA:', 'metform'); ?></span>
281
- </label>
282
- <span class='mf-input-help'><?php esc_html_e('reCAPTCHA protects you against spam and other types of automated abuse. ','metform'); ?><strong><?php esc_html_e('The form must have reCAPTCHA widget to use this feature. ', 'metform'); ?></strong><a target="_blank" href="<?php echo get_dashboard_url().'admin.php?page=metform-menu-settings'; ?>"><?php esc_html_e('Configure reCAPTCHA.', 'metform'); ?></a></span>
283
- </div>
284
-
285
  </div>
286
 
287
  </div>
274
  <br>
275
  <?php endif ?>
276
 
 
 
 
 
 
 
 
 
277
  </div>
278
 
279
  </div>
core/integrations/slack.php CHANGED
@@ -46,7 +46,7 @@ Class Slack{
46
  $msg['msg'] = "Something went wrong : ".$status->get_error_message();
47
  }else{
48
  $msg['status'] = 1;
49
- $msg['msg'] = esc_html__('Your data inserted on zapier.', 'metform');
50
  }
51
  return $msg;
52
  }
46
  $msg['msg'] = "Something went wrong : ".$status->get_error_message();
47
  }else{
48
  $msg['status'] = 1;
49
+ $msg['msg'] = esc_html__('Your data inserted on slack.', 'metform');
50
  }
51
  return $msg;
52
  }
metform.php CHANGED
@@ -5,7 +5,7 @@ defined( 'ABSPATH' ) || exit;
5
  * Plugin Name: MetForm
6
  * Plugin URI: http://products.wpmet.com/metform/
7
  * Description: Most flexible and design friendly form builder for Elementor
8
- * Version: 1.2.0
9
  * Author: Wpmet
10
  * Author URI: https://wpmet.com
11
  * Text Domain: metform
5
  * Plugin Name: MetForm
6
  * Plugin URI: http://products.wpmet.com/metform/
7
  * Description: Most flexible and design friendly form builder for Elementor
8
+ * Version: 1.2.1
9
  * Author: Wpmet
10
  * Author URI: https://wpmet.com
11
  * Text Domain: metform
plugin.php CHANGED
@@ -14,7 +14,7 @@ final class Plugin{
14
  }
15
 
16
  public function version(){
17
- return '1.2.0';
18
  }
19
 
20
  public function package_type(){
14
  }
15
 
16
  public function version(){
17
+ return '1.2.1';
18
  }
19
 
20
  public function package_type(){
public/assets/css/admin-style.css CHANGED
@@ -1,433 +1 @@
1
- .mf-settings-tab {
2
- margin-bottom: 25px; }
3
- .mf-settings-tab .nav-tab {
4
- outline: none; }
5
- .mf-settings-tab .nav-tab:focus {
6
- outline: none;
7
- -webkit-box-shadow: none;
8
- box-shadow: none; }
9
-
10
- .mf-settings-section {
11
- opacity: 0;
12
- visibility: hidden;
13
- -webkit-transition: opacity .4s;
14
- -o-transition: opacity .4s;
15
- transition: opacity .4s;
16
- position: absolute;
17
- top: -9999px; }
18
- .mf-settings-section.active {
19
- opacity: 1;
20
- position: static;
21
- visibility: visible; }
22
-
23
- .metform-admin-container {
24
- padding: 30px; }
25
- .metform-admin-container--body {
26
- max-width: 50%; }
27
- .metform-admin-container--body .mf-settings-single-section {
28
- margin-bottom: 30px; }
29
- .metform-admin-container--body .mf-settings-single-section--title {
30
- margin: 0;
31
- margin-bottom: 15px; }
32
- .metform-admin-container--body .mf-setting-input {
33
- width: 100%;
34
- max-width: 100%;
35
- margin: 0;
36
- -webkit-box-sizing: border-box;
37
- box-sizing: border-box; }
38
- .metform-admin-container--body .mf-setting-label {
39
- display: block;
40
- margin-bottom: 5px;
41
- font-weight: 600; }
42
- .metform-admin-container--body .mf-setting-label .description {
43
- font-weight: normal; }
44
- .metform-admin-container--body .mf-admin-control-input {
45
- margin: 0; }
46
-
47
- .mf-recaptcha-settings {
48
- display: none; }
49
-
50
- .loading .attr-modal-content::before {
51
- opacity: .8;
52
- position: absolute;
53
- content: "";
54
- top: 0;
55
- left: 0;
56
- height: 100%;
57
- width: 100%;
58
- background-color: #fff;
59
- -webkit-transition: opaicty .5s ease;
60
- -o-transition: opaicty .5s ease;
61
- transition: opaicty .5s ease;
62
- z-index: 5;
63
- border-radius: inherit; }
64
-
65
- .loading .mf-spinner {
66
- display: block; }
67
-
68
- .elementor-editor-active .metform-form-save-btn-editor {
69
- display: none !important; }
70
-
71
- .attr-modal-dialog-centered {
72
- display: -webkit-box;
73
- display: -ms-flexbox;
74
- display: flex;
75
- -webkit-box-align: center;
76
- -ms-flex-align: center;
77
- align-items: center;
78
- padding-top: 30px;
79
- width: 565px; }
80
- .attr-modal-dialog-centered .attr-modal-header {
81
- padding: 36px 50px;
82
- border-bottom: none; }
83
- .attr-modal-dialog-centered .attr-modal-header .attr-modal-title {
84
- font-size: 20px;
85
- font-weight: bold;
86
- color: #111111;
87
- text-transform: capitalize;
88
- margin-bottom: 38px;
89
- line-height: 1; }
90
- .attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs {
91
- border: none;
92
- display: -webkit-box;
93
- display: -ms-flexbox;
94
- display: flex;
95
- -webkit-box-pack: justify;
96
- -ms-flex-pack: justify;
97
- justify-content: space-between;
98
- -ms-flex-wrap: wrap;
99
- flex-wrap: wrap; }
100
- .attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs li {
101
- margin: 0;
102
- float: none; }
103
- .attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs a {
104
- text-decoration: none;
105
- text-align: center;
106
- color: #111111;
107
- font-size: 14px;
108
- text-transform: capitalize;
109
- font-weight: 600;
110
- padding: 8px 14px;
111
- border: none;
112
- margin-right: 0;
113
- border: none; }
114
- .attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs a:hover {
115
- border: none;
116
- background-color: transparent; }
117
- .attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs a:focus {
118
- outline: none;
119
- -webkit-box-shadow: none;
120
- box-shadow: none;
121
- border: none; }
122
- .attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs li.attr-active a {
123
- border: none;
124
- color: #ffffff;
125
- background-color: #1F55F8;
126
- border-radius: 4px; }
127
- .attr-modal-dialog-centered .attr-modal-header button.attr-close {
128
- opacity: .8;
129
- font-size: inherit;
130
- outline: none;
131
- margin-top: -15px;
132
- margin-right: -25px; }
133
- .attr-modal-dialog-centered .attr-modal-header button.attr-close span {
134
- color: #e81123;
135
- font-size: 35px;
136
- font-weight: 100;
137
- background-color: #FCE7E9;
138
- height: 36px;
139
- width: 36px;
140
- display: inline-block;
141
- line-height: 36px;
142
- border-radius: 100px;
143
- outline: none;
144
- margin-top: 5px;
145
- font-family: initial; }
146
- .attr-modal-dialog-centered .attr-tab-content .attr-modal-body {
147
- padding: 40px 50px;
148
- padding-top: 0; }
149
- .attr-modal-dialog-centered .attr-tab-content div#limit_status.hide_input {
150
- display: none; }
151
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group label.attr-input-label {
152
- color: #111111;
153
- font-size: 16px;
154
- margin-bottom: 7px;
155
- display: block;
156
- font-weight: 500; }
157
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group {
158
- margin-bottom: 14px; }
159
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input, .attr-modal-dialog-centered .attr-tab-content .mf-input-group .attr-form-control {
160
- color: #555;
161
- font-size: 14px;
162
- height: 48px;
163
- padding: 0 22px;
164
- border-color: #ededed;
165
- -webkit-box-shadow: 0px 2px 5px rgba(153, 153, 153, 0.2);
166
- box-shadow: 0px 2px 5px rgba(153, 153, 153, 0.2);
167
- margin-top: 12px;
168
- max-width: 100%; }
169
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="checkbox"] {
170
- display: none; }
171
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="checkbox"] + span {
172
- position: relative;
173
- display: block; }
174
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="checkbox"] + span:before {
175
- content: "No";
176
- width: 55px;
177
- height: 25px;
178
- background-color: #EDEDED;
179
- left: 0;
180
- border-radius: 15px;
181
- text-align: right;
182
- color: #fff;
183
- text-transform: uppercase;
184
- font-weight: bold;
185
- font-size: 10px;
186
- padding: 3px;
187
- -webkit-box-sizing: border-box;
188
- box-sizing: border-box;
189
- padding-right: 10px;
190
- -webkit-transition: all .4s;
191
- -o-transition: all .4s;
192
- transition: all .4s;
193
- float: right;
194
- line-height: 18px;
195
- cursor: pointer; }
196
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="checkbox"] + span:after {
197
- content: "";
198
- width: 20px;
199
- height: 20px;
200
- background-color: #fff;
201
- border-radius: 100px;
202
- display: inline-block;
203
- position: absolute;
204
- right: 31px;
205
- top: 2px;
206
- -webkit-transition: all .4s;
207
- -o-transition: all .4s;
208
- transition: all .4s; }
209
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="checkbox"]:checked + span:before {
210
- content: "Yes";
211
- width: 55px;
212
- height: 25px;
213
- background-color: #1F55F8;
214
- left: 0;
215
- border-radius: 15px;
216
- display: inline-block;
217
- text-align: left;
218
- color: #fff;
219
- text-transform: uppercase;
220
- font-weight: bold;
221
- font-size: 10px;
222
- padding: 3px;
223
- -webkit-box-sizing: border-box;
224
- box-sizing: border-box;
225
- padding-left: 10px; }
226
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="checkbox"]:checked + span:after {
227
- content: "";
228
- width: 20px;
229
- height: 20px;
230
- background-color: #fff;
231
- border-radius: 100px;
232
- display: inline-block;
233
- position: absolute;
234
- right: 2px;
235
- top: 2px; }
236
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-rest-api-method {
237
- padding: 0 18px;
238
- margin: 0; }
239
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group span.mf-input-help {
240
- color: #b7b7b7;
241
- font-style: italic;
242
- font-size: 12px; }
243
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group span.mf-input-help strong {
244
- color: red; }
245
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner label.attr-input-label {
246
- display: inline-block; }
247
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner #limit_status {
248
- width: 100px;
249
- margin: 0;
250
- position: relative;
251
- margin-left: 15px;
252
- float: right;
253
- margin-top: -2px; }
254
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input {
255
- margin: 0; }
256
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input[type="checkbox"] + span:before {
257
- position: relative;
258
- top: -2px;
259
- left: 5px; }
260
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input[type="checkbox"] + span:after {
261
- right: 28px;
262
- top: 0px; }
263
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input[type="checkbox"]:checked + span:after {
264
- right: -2px;
265
- top: 0; }
266
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="text"] + span,
267
- .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type="number"] + span {
268
- display: block;
269
- margin-top: 5px; }
270
- .attr-modal-dialog-centered .attr-tab-content #limit_status.show_input {
271
- margin-top: 32px; }
272
- .attr-modal-dialog-centered .attr-modal-footer {
273
- padding: 30px 50px; }
274
- .attr-modal-dialog-centered .attr-modal-footer button {
275
- color: #fff;
276
- background-color: #1F55F8;
277
- font-size: 16px;
278
- font-weight: bold;
279
- -webkit-box-sizing: border-box;
280
- box-sizing: border-box;
281
- padding: 12px 20px;
282
- -webkit-box-shadow: none;
283
- box-shadow: none;
284
- border: 1px solid transparent;
285
- -webkit-transition: all .4s;
286
- -o-transition: all .4s;
287
- transition: all .4s;
288
- outline: none; }
289
- .attr-modal-dialog-centered .attr-modal-footer button:focus {
290
- border: none;
291
- outline: none; }
292
- .attr-modal-dialog-centered .attr-modal-footer button.metform-form-save-btn-editor {
293
- background-color: #d8d8d8;
294
- color: #111111; }
295
- .attr-modal-dialog-centered > form {
296
- width: 100%; }
297
-
298
- .modal-backdrop {
299
- position: fixed;
300
- top: 0;
301
- left: 0;
302
- width: 100vw;
303
- height: 100vh;
304
- background-color: rgba(0, 0, 0, 0.5); }
305
-
306
- .modal-backdrop {
307
- z-index: 9999; }
308
-
309
- .attr-modal {
310
- z-index: 10000; }
311
-
312
- .mf_multipile_ajax_search_filed .select2-container--default .select2-selection--multiple .select2-selection__choice {
313
- line-height: 1.5;
314
- font-size: .9em;
315
- border: none;
316
- border-radius: 0;
317
- color: #6d7882; }
318
-
319
- .mf-headerfooter-status {
320
- display: inline-block;
321
- margin-left: 5px;
322
- padding: 2px 5px 3px;
323
- color: #FFFFFF;
324
- background-color: #9a9a9a;
325
- border-radius: 3px;
326
- font-size: 10px;
327
- line-height: 1;
328
- font-weight: 700; }
329
- .mf-headerfooter-status-active {
330
- background-color: #00cd00; }
331
-
332
- .irs--round .irs-min, .irs--round .irs-max {
333
- display: none; }
334
-
335
- .irs--round .irs-handle {
336
- cursor: pointer; }
337
-
338
- .mf-success-msg {
339
- position: fixed;
340
- z-index: 9;
341
- text-align: center;
342
- top: 50%;
343
- left: 50%;
344
- -webkit-transform: translate(-50%, -50%);
345
- -ms-transform: translate(-50%, -50%);
346
- transform: translate(-50%, -50%);
347
- -webkit-box-shadow: 0px 2px 5px rgba(153, 153, 153, 0.2);
348
- box-shadow: 0px 2px 5px rgba(153, 153, 153, 0.2);
349
- min-width: 300px; }
350
-
351
- textarea.attr-form-control {
352
- height: auto !important; }
353
-
354
- .post-type-metform-form .row-actions .inline {
355
- display: none !important; }
356
-
357
- div.metform-entry-data table thead,
358
- div.metform-entry-data table tbody,
359
- div.metform-entry-browser-data table thead,
360
- div.metform-entry-browser-data table tbody {
361
- text-align: left; }
362
-
363
- img.form-editor-icon {
364
- height: 20px;
365
- width: 20px;
366
- margin-right: 5px;
367
- vertical-align: middle; }
368
-
369
- div.mf-file-show button.attr-btn.attr-btn-primary {
370
- margin-left: 10px; }
371
-
372
- .mf-file-show a {
373
- text-decoration: none; }
374
-
375
- .mf-modal-container {
376
- margin-top: 50px; }
377
- .mf-modal-container .attr-modal-body img {
378
- margin: 0 auto; }
379
-
380
- .mf-entry-label,
381
- .mf-entry-input {
382
- -webkit-box-sizing: border-box;
383
- box-sizing: border-box; }
384
-
385
- .mf-entry-filter {
386
- margin-right: 10px; }
387
-
388
- .mf-entry-filter {
389
- min-width: 15%; }
390
-
391
- .mf-entry-export-csv {
392
- min-width: 20%; }
393
-
394
- .metform_open_content_editor_modal .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox] + span:before {
395
- line-height: 20px; }
396
-
397
- /* HIDE RADIO */
398
- .mf-image-select-input,
399
- .mf-toggle-select-input {
400
- position: absolute;
401
- opacity: 0;
402
- width: 0;
403
- height: 0; }
404
-
405
- /* IMAGE STYLES */
406
- .mf-image-select-input + img,
407
- .mf-toggle-select-input + p {
408
- cursor: pointer; }
409
-
410
- .mf-input-rest-api-group .mf-rest-api-key {
411
- width: 100px;
412
- display: inline-block;
413
- position: relative;
414
- top: -1px; }
415
-
416
- .mf-input-rest-api-group .mf-rest-api {
417
- width: calc(100% - 110px);
418
- vertical-align: middle;
419
- display: inline-block !important; }
420
-
421
- .metform_open_content_editor_modal .mf-rest-api-key {
422
- top: 0; }
423
-
424
- .metform-entry-data table.mf-entry-data {
425
- width: 100%;
426
- background-color: #FFFFFF;
427
- border: 1px solid #EAF2FA; }
428
- .metform-entry-data table.mf-entry-data tbody tr.mf-data-label {
429
- background-color: #EAF2FA; }
430
- .metform-entry-data table.mf-entry-data tbody tr.mf-data-value {
431
- background-color: #FFFFFF; }
432
- .metform-entry-data table.mf-entry-data tbody tr.mf-data-value td.mf-value-space {
433
- width: 20px; }
1
+ .mf-settings-tab{margin-bottom:25px}.mf-settings-tab .nav-tab{outline:none}.mf-settings-tab .nav-tab:focus{outline:none;-webkit-box-shadow:none;box-shadow:none}.mf-settings-section{opacity:0;visibility:hidden;-webkit-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s;position:absolute;top:-9999px}.mf-settings-section.active{opacity:1;position:static;visibility:visible}.metform-admin-container{padding:30px}.metform-admin-container--body{max-width:50%}.metform-admin-container--body .mf-settings-single-section{margin-bottom:30px}.metform-admin-container--body .mf-settings-single-section--title{margin:0;margin-bottom:15px}.metform-admin-container--body .mf-setting-input{width:100%;max-width:100%;margin:0;-webkit-box-sizing:border-box;box-sizing:border-box}.metform-admin-container--body .mf-setting-label{display:block;margin-bottom:5px;font-weight:600}.metform-admin-container--body .mf-setting-label .description{font-weight:normal}.metform-admin-container--body .mf-admin-control-input{margin:0}.mf-recaptcha-settings{display:none}.loading .attr-modal-content:before{opacity:.8;position:absolute;content:"";top:0;left:0;height:100%;width:100%;background-color:#fff;-webkit-transition:opaicty .5s ease;-o-transition:opaicty .5s ease;transition:opaicty .5s ease;z-index:5;border-radius:inherit}.loading .mf-spinner{display:block}.elementor-editor-active .metform-form-save-btn-editor{display:none!important}.attr-modal-dialog-centered{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-top:30px;width:565px}.attr-modal-dialog-centered .attr-modal-header{padding:36px 50px;border-bottom:none}.attr-modal-dialog-centered .attr-modal-header .attr-modal-title{font-size:20px;font-weight:bold;color:#111111;text-transform:capitalize;margin-bottom:38px;line-height:1}.attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs{border:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-wrap:wrap;flex-wrap:wrap}.attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs li{margin:0;float:none}.attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs a{text-decoration:none;text-align:center;color:#111111;font-size:14px;text-transform:capitalize;font-weight:600;padding:8px 14px;border:none;margin-right:0;border:none}.attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs a:hover{border:none;background-color:transparent}.attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs a:focus{outline:none;-webkit-box-shadow:none;box-shadow:none;border:none}.attr-modal-dialog-centered .attr-modal-header .attr-nav-tabs li.attr-active a{border:none;color:#ffffff;background-color:#1F55F8;border-radius:4px}.attr-modal-dialog-centered .attr-modal-header button.attr-close{opacity:.8;font-size:inherit;outline:none;margin-top:-15px;margin-right:-25px}.attr-modal-dialog-centered .attr-modal-header button.attr-close span{color:#e81123;font-size:35px;font-weight:100;background-color:#FCE7E9;height:36px;width:36px;display:inline-block;line-height:36px;border-radius:100px;outline:none;margin-top:5px;font-family:initial}.attr-modal-dialog-centered .attr-tab-content .attr-modal-body{padding:40px 50px;padding-top:0}.attr-modal-dialog-centered .attr-tab-content div#limit_status.hide_input{display:none}.attr-modal-dialog-centered .attr-tab-content .mf-input-group label.attr-input-label{color:#111111;font-size:16px;margin-bottom:7px;display:block;font-weight:500}.attr-modal-dialog-centered .attr-tab-content .mf-input-group{margin-bottom:14px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .attr-form-control,.attr-modal-dialog-centered .attr-tab-content .mf-input-group input{color:#555;font-size:14px;height:48px;padding:0 22px;border-color:#ededed;-webkit-box-shadow:0px 2px 5px rgba(153, 153, 153, 0.2);box-shadow:0px 2px 5px rgba(153, 153, 153, 0.2);margin-top:12px;max-width:100%}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]{display:none}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]+span{position:relative;display:block}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]+span:before{content:"No";width:55px;height:25px;background-color:#EDEDED;left:0;border-radius:15px;text-align:right;color:#fff;text-transform:uppercase;font-weight:bold;font-size:10px;padding:3px;-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:10px;-webkit-transition:all .4s;-o-transition:all .4s;transition:all .4s;float:right;line-height:18px;cursor:pointer}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]+span:after{content:"";width:20px;height:20px;background-color:#fff;border-radius:100px;display:inline-block;position:absolute;right:31px;top:2px;-webkit-transition:all .4s;-o-transition:all .4s;transition:all .4s}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]:checked+span:before{content:"Yes";width:55px;height:25px;background-color:#1F55F8;left:0;border-radius:15px;display:inline-block;text-align:left;color:#fff;text-transform:uppercase;font-weight:bold;font-size:10px;padding:3px;-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:10px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]:checked+span:after{content:"";width:20px;height:20px;background-color:#fff;border-radius:100px;display:inline-block;position:absolute;right:2px;top:2px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-rest-api-method{padding:0 18px;margin:0}.attr-modal-dialog-centered .attr-tab-content .mf-input-group span.mf-input-help{color:#b7b7b7;font-style:italic;font-size:12px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group span.mf-input-help strong{color:red}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner label.attr-input-label{display:inline-block}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner #limit_status{width:100px;margin:0;position:relative;margin-left:15px;float:right;margin-top:-2px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input{margin:0}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input[type=checkbox]+span:before{position:relative;top:-2px;left:5px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input[type=checkbox]+span:after{right:28px;top:0px}.attr-modal-dialog-centered .attr-tab-content .mf-input-group .mf-input-group-inner input[type=checkbox]:checked+span:after{right:-2px;top:0}.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=number]+span,.attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=text]+span{display:block;margin-top:5px}.attr-modal-dialog-centered .attr-tab-content #limit_status.show_input{margin-top:32px}.attr-modal-dialog-centered .attr-modal-footer{padding:30px 50px}.attr-modal-dialog-centered .attr-modal-footer button{color:#fff;background-color:#1F55F8;font-size:16px;font-weight:bold;-webkit-box-sizing:border-box;box-sizing:border-box;padding:12px 20px;-webkit-box-shadow:none;box-shadow:none;border:1px solid transparent;-webkit-transition:all .4s;-o-transition:all .4s;transition:all .4s;outline:none}.attr-modal-dialog-centered .attr-modal-footer button:focus{border:none;outline:none}.attr-modal-dialog-centered .attr-modal-footer button.metform-form-save-btn-editor{background-color:#d8d8d8;color:#111111}.attr-modal-dialog-centered>form{width:100%}.modal-backdrop{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(0, 0, 0, 0.5)}.modal-backdrop{z-index:9999}.attr-modal{z-index:10000}.mf_multipile_ajax_search_filed .select2-container--default .select2-selection--multiple .select2-selection__choice{line-height:1.5;font-size:.9em;border:none;border-radius:0;color:#6d7882}.mf-headerfooter-status{display:inline-block;margin-left:5px;padding:2px 5px 3px;color:#FFFFFF;background-color:#9a9a9a;border-radius:3px;font-size:10px;line-height:1;font-weight:700}.mf-headerfooter-status-active{background-color:#00cd00}.irs--round .irs-max,.irs--round .irs-min{display:none}.irs--round .irs-handle{cursor:pointer}.mf-success-msg{position:fixed;z-index:9;text-align:center;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);-webkit-box-shadow:0px 2px 5px rgba(153, 153, 153, 0.2);box-shadow:0px 2px 5px rgba(153, 153, 153, 0.2);min-width:300px}textarea.attr-form-control{height:auto!important}.post-type-metform-form .row-actions .inline{display:none!important}div.metform-entry-browser-data table tbody,div.metform-entry-browser-data table thead,div.metform-entry-data table tbody,div.metform-entry-data table thead{text-align:left}img.form-editor-icon{height:20px;width:20px;margin-right:5px;vertical-align:middle}div.mf-file-show button.attr-btn.attr-btn-primary{margin-left:10px}.mf-file-show a{text-decoration:none}.mf-modal-container{margin-top:50px}.mf-modal-container .attr-modal-body img{margin:0 auto}.mf-entry-input,.mf-entry-label{-webkit-box-sizing:border-box;box-sizing:border-box}.mf-entry-filter{margin-right:10px}.mf-entry-filter{min-width:15%}.mf-entry-export-csv{min-width:20%}.metform_open_content_editor_modal .attr-modal-dialog-centered .attr-tab-content .mf-input-group input[type=checkbox]+span:before{line-height:20px}.mf-image-select-input,.mf-toggle-select-input{position:absolute;opacity:0;width:0;height:0}.mf-image-select-input+img,.mf-toggle-select-input+p{cursor:pointer}.mf-input-rest-api-group .mf-rest-api-key{width:100px;display:inline-block;position:relative;top:-1px}.mf-input-rest-api-group .mf-rest-api{width:calc(100% - 110px);vertical-align:middle;display:inline-block!important}.metform_open_content_editor_modal .mf-rest-api-key{top:0}.metform-entry-data table.mf-entry-data{width:100%;background-color:#FFFFFF;border:1px solid #EAF2FA}.metform-entry-data table.mf-entry-data tbody tr.mf-data-label{background-color:#EAF2FA}.metform-entry-data table.mf-entry-data tbody tr.mf-data-value{background-color:#FFFFFF}.metform-entry-data table.mf-entry-data tbody tr.mf-data-value td.mf-value-space{width:20px}.metform-entry-data table.mf-entry-data tbody tr.mf-data-value .signature-img{height:100px;width:200px}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/assets/js/submission.js CHANGED
@@ -1 +1 @@
1
- var onloadMetFormCallback=function(){jQuery(".recaptcha_site_key").each(function(e){var t=jQuery(this),a=t.parents(".metform-form-content");void 0!==a.data("site-key")&&""!=a.data("site-key")&&(t.attr("id",t.attr("id")+"_"+e),grecaptcha.render("recaptcha_site_key_"+e,{sitekey:a.data("site-key")}))})};function metformSubmision(e){var t,a;t=jQuery,a=!1,t.validator.addMethod("regx",function(e,t,a){return new RegExp(a).test(e)},t.validator.format("Please match the expression {0}")),t.validator.addMethod("wordLength",function(e,t,a){var s=e.trim().split(/\s+/),n=a.min,r=a.max;return!n&&r&&(n=1),s.filter(()=>s.length>=n&&s.length<=r).length},t.validator.format("Please match word length.")),jQuery.validator.addMethod("ratingValidate",function(e,a,s){return!t(a).prop("required")||t(a).parents(".mf-input-wrapper").find(".mf-input-rating li.selected").length},t.validator.format(mf_submission.default_required_message)),t.validator.addClassRules(".mf-input",{required:!0}),e.validate({ignore:[],rules:{"mf-rating":{ratingValidate:!0}},submitHandler:function(e){a=!0},errorPlacement:function(e,t){t.parents(".mf-input-wrapper").append(e)},highlight:function(e){t(e).parents(".mf-input-wrapper").addClass("mf-field-error")},unhighlight:function(e){t(e).parents(".mf-input-wrapper").removeClass("mf-field-error")}}),e.find(".mf-input-do-validate").each(function(){var e=t(this).data("validation"),a=t(this).attr("min"),s=t(this).attr("max"),n={messages:{required:mf_submission.default_required_message,email:mf_submission.default_required_message,url:mf_submission.default_required_message,range:mf_submission.default_required_message,max:mf_submission.default_required_message,min:mf_submission.default_required_message}};void 0!==e&&""!=e&&("none"!==e.validation_type&&(n.required=!0,n.messages.required=e.warning_message),"by_character_length"===e.validation_type?(e.min_length&&(n.minlength=e.min_length,n.messages.minlength=e.warning_message),e.max_length&&(n.maxlength=e.max_length,n.messages.maxlength=e.warning_message),n.messages.email=e.warning_message):"by_word_length"===e.validation_type?(n.wordLength={},n.messages.wordLength=e.warning_message,e.min_length&&(n.wordLength.min=e.min_length),e.max_length&&(n.wordLength.max=e.max_length),n.messages.email=e.warning_message):"by_expresssion_based"===e.validation_type&&(n.messages.regx=e.warning_message,e.expression&&t(this).rules("add",{regx:e.expression}),n.messages.email=e.warning_message)),(a||s)&&(n.range=[a,s]),t(this).rules("add",n)}),e.submit(async function(e){if(e.preventDefault(),a){var s=t(this),n="";s.find('.mf-input[type="tel"]').each(function(){var e,a=t(this),s=a.val();e=a.siblings(".iti__flag-container").find(".iti__selected-dial-code").text(),a.val(e+s)}),s.find(".g-recaptcha-response-v3").length&&(n="undefined"!=grecaptcha?await grecaptcha.execute(s.data("site-key"),{action:"mf_recaptcha_v3"}):"",s.find(".g-recaptcha-response-v3").val(n));var r=s.parent().find(".metform-msg"),i=s.attr("action"),o=new FormData(this),d=s.attr("data-nonce");r.length>1&&s.parent().find(".metform-inx").remove(),t.ajax({url:i,type:"POST",dataType:"JSON",data:o,processData:!1,contentType:!1,headers:{"X-WP-Nonce":d},success:function(e){a=!1;var n=Number(e.status),i="";if(t.each(e.error,function(e,t){i+=t+"<br>"}),i.replace(/<br>+$/,""),1==n?(r.css("display","block"),r.removeClass("attr-alert-warning"),r.addClass("attr-alert-success"),r.html(e.data.message),setTimeout(function(){r.css("display","none")},8e3),s.trigger("reset"),s.find(".metform-step-item").removeClass("active prev next").first().addClass("active").next().addClass("next"),s.find(".elementor-top-section").first().addClass("active").find(".metform-btn").attr("type","submit").end().siblings().removeClass("active"),s.find(".elementor-section-wrap").css({transform:"translateX(0)"}),s.find(".mf-input-select, .mf-input-multiselect").trigger("change"),s.find(".mf-input > li").removeClass("selected"),s.find(".asRange > .asRange-pointer").css("left","0%"),s.find(".asRange > .asRange-selected").css({left:"0%",width:"0%"}),s.find(".mf-refresh-captcha").trigger("click")):(r.css("display","block"),r.removeClass("attr-alert-success"),r.addClass("attr-alert-warning"),r.html(i),setTimeout(function(){r.css("display","none")},8e3)),""!=e.data.hide_form&&setTimeout(function(){s.css("display","none")},2e3),"stripe"==e.data.payment_method){if(res=e.data.payment_data,!res.keys||""==res.keys)return void alert("Please set your Stripe Keys in form settings.");var o=StripeCheckout.configure({key:res.keys,image:res.image_url,locale:"auto",token:function(t){if(t.id){res.stripe_token=t.id;var a={sandbox:res.sandbox};jQuery.ajax({data:a,type:"get",url:e.data.ajax_stripe+"&token="+t.id,headers:{"X-WP-Nonce":d},success:function(e){e.status?window.location.href=e.redirect_url:alert(e)}})}else alert("Sorry!! Payment token invalid")}});return o.open({name:String(res.name_post),description:" Form No.: "+String(res.description),amount:100*Number(res.amount),currency:res.currency_code}),void window.addEventListener("popstate",function(){o.close()})}""!=e.data.redirect_to&&setTimeout(function(){window.location.href=e.data.redirect_to},1500)}})}})}jQuery(document).ready(function(e){(e("body").hasClass("single-metform-form")||e(".mf-form-shortcode").length)&&void 0!==metformSubmision&&e(".metform-form-content").each(function(){metformSubmision(e(this))})});
1
+ var onloadMetFormCallback=function(){jQuery(".recaptcha_site_key").each(function(e){var t=jQuery(this),a=t.parents(".metform-form-content");void 0!==a.data("site-key")&&""!=a.data("site-key")&&(t.attr("id",t.attr("id")+"_"+e),grecaptcha.render("recaptcha_site_key_"+e,{sitekey:a.data("site-key")}))})};function metformSubmision(e){var t,a;t=jQuery,a=!1,t.validator.addMethod("regx",function(e,t,a){return new RegExp(a).test(e)},t.validator.format("Please match the expression {0}")),t.validator.addMethod("wordLength",function(e,t,a){var s=e.trim().split(/\s+/),n=a.min,r=a.max;return!n&&r&&(n=1),s.filter(()=>s.length>=n&&s.length<=r).length},t.validator.format("Please match word length.")),jQuery.validator.addMethod("ratingValidate",function(e,a,s){return!t(a).prop("required")||t(a).parents(".mf-input-wrapper").find(".mf-input-rating li.selected").length},t.validator.format(mf_submission.default_required_message)),t.validator.addClassRules(".mf-input",{required:!0}),e.validate({ignore:[],rules:{"mf-rating":{ratingValidate:!0}},submitHandler:function(e){a=!0},errorPlacement:function(e,t){t.parents(".mf-input-wrapper").append(e)},highlight:function(e){t(e).parents(".mf-input-wrapper").addClass("mf-field-error")},unhighlight:function(e){t(e).parents(".mf-input-wrapper").removeClass("mf-field-error")}}),e.find(".mf-input-do-validate").each(function(){var e=t(this).data("validation"),a=t(this).attr("min"),s=t(this).attr("max"),n={messages:{required:mf_submission.default_required_message,email:mf_submission.default_required_message,url:mf_submission.default_required_message,range:mf_submission.default_required_message,max:mf_submission.default_required_message,min:mf_submission.default_required_message}};void 0!==e&&""!=e&&("none"!==e.validation_type&&(n.required=!0,n.messages.required=e.warning_message),"by_character_length"===e.validation_type?(e.min_length&&(n.minlength=e.min_length,n.messages.minlength=e.warning_message),e.max_length&&(n.maxlength=e.max_length,n.messages.maxlength=e.warning_message),n.messages.email=e.warning_message):"by_word_length"===e.validation_type?(n.wordLength={},n.messages.wordLength=e.warning_message,e.min_length&&(n.wordLength.min=e.min_length),e.max_length&&(n.wordLength.max=e.max_length),n.messages.email=e.warning_message):"by_expresssion_based"===e.validation_type&&(n.messages.regx=e.warning_message,e.expression&&t(this).rules("add",{regx:e.expression}),n.messages.email=e.warning_message)),(a||s)&&(n.range=[a,s]),t(this).rules("add",n)}),e.submit(async function(e){if(e.preventDefault(),a){var s=t(this),n="";s.find('.mf-input[type="tel"]').each(function(){var e,a=t(this),s=a.val();e=a.siblings(".iti__flag-container").find(".iti__selected-dial-code").text(),a.val(e+s)}),s.find(".g-recaptcha-response-v3").length&&(n="undefined"!=grecaptcha?await grecaptcha.execute(s.data("site-key"),{action:"mf_recaptcha_v3"}):"",s.find(".g-recaptcha-response-v3").val(n));var r=s.parent().find(".metform-msg"),i=s.attr("action"),o=new FormData(this),d=s.attr("data-nonce");r.length>1&&s.parent().find(".metform-inx").remove(),t.ajax({url:i,type:"POST",dataType:"JSON",data:o,processData:!1,contentType:!1,headers:{"X-WP-Nonce":d},success:function(e){a=!1;var n=Number(e.status),i="";if(t.each(e.error,function(e,t){i+=t+"<br>"}),i.replace(/<br>+$/,""),1==n?(r.css("display","block"),r.removeClass("attr-alert-warning"),r.addClass("attr-alert-success"),r.html(e.data.message),setTimeout(function(){r.css("display","none")},8e3),s.trigger("reset"),s.find(".metform-step-item").removeClass("active prev next").first().addClass("active").next().addClass("next"),s.find(".elementor-top-section").first().addClass("active").find(".metform-btn").attr("type","submit").end().siblings().removeClass("active"),s.find(".elementor-section-wrap").css({transform:"translateX(0)"}),s.find(".mf-input-select, .mf-input-multiselect").trigger("change"),s.find(".mf-input > li").removeClass("selected"),s.find(".asRange > .asRange-pointer").css("left","0%"),s.find(".asRange > .asRange-selected").css({left:"0%",width:"0%"}),s.find(".mf-refresh-captcha").trigger("click")):(r.css("display","block"),r.removeClass("attr-alert-success"),r.addClass("attr-alert-warning"),r.html(i),setTimeout(function(){r.css("display","none")},8e3)),1==n&&""!=e.data.hide_form&&setTimeout(function(){s.css("display","none")},2e3),"stripe"==e.data.payment_method){if(res=e.data.payment_data,!res.keys||""==res.keys)return void alert("Please set your Stripe Keys in form settings.");var o=StripeCheckout.configure({key:res.keys,image:res.image_url,locale:"auto",token:function(t){if(t.id){res.stripe_token=t.id;var a={sandbox:res.sandbox};jQuery.ajax({data:a,type:"get",url:e.data.ajax_stripe+"&token="+t.id,headers:{"X-WP-Nonce":d},success:function(e){e.status?window.location.href=e.redirect_url:alert(e)}})}else alert("Sorry!! Payment token invalid")}});return o.open({name:String(res.name_post),description:" Form No.: "+String(res.description),amount:100*Number(res.amount),currency:res.currency_code}),void window.addEventListener("popstate",function(){o.close()})}1==n&&""!=e.data.redirect_to&&setTimeout(function(){window.location.href=e.data.redirect_to},1500)}})}})}jQuery(document).ready(function(e){(e("body").hasClass("single-metform-form")||e(".mf-form-shortcode").length)&&void 0!==metformSubmision&&e(".metform-form-content").each(function(){metformSubmision(e(this))})});
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ataurr, wpmet, emrnco, sayedulsayem
3
  Tags: Form builder, Elementor form builder, contact form, custom form, forms, drag & drop form builder
4
  Requires at least: 4.8
5
  Tested up to: 5.3
6
- Stable tag: 1.2.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -22,6 +22,8 @@ MetForm is not only a contact form plugin, but it is also a complete drag & drop
22
  Metform builder contact form gives you full flexibility to build any form on the fly with metform. Want to make any complex from? complex style? no problem you can build any types of from with metform. Like you want to use an image or video under a form and want to show the user, you can do so... use any elementor addons inside metform builder form without any restrictions.
23
  Metform built with elementor. Every field is an elementor widget.
24
 
 
 
25
 
26
  Metform allows you to create any beautiful contact forms, feedback form, subscription forms, and other types of forms for your site in minutes, not hours! Full flexibility on your own hand.
27
 
@@ -44,52 +46,184 @@ Want to Export entries as CSV? Yes, you can do that too with metform elementor a
44
  You can use MailChimp in your contact form also create MailChimp signup forms with custom style and expand your lead list.
45
 
46
  == Features ==
47
- * Built with elementor
48
- * Elementor widgets fields
49
- * User confirmation email
50
- * Admin notification email
51
- * Saved entries in the admin panel
52
- * Export entries as CSV
53
- * Required Login to submit the form
54
- * Capture User Browser Data
55
- * Hide Form After Submission
56
- * Limit Total Entries
57
- * Redirect after successful form submission
58
- * MailChimp integration
59
- * Slack integration
60
- * Google reCAPTCHA integration
61
- * Validate required fields
62
- * Form submission via AJAX without page refreshes.
63
- * Supports multiple-column layout
64
- * Shortcode support
65
- * Editable successful form submission message.
66
- * Translation ready
 
 
 
 
 
67
 
 
68
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
 
71
 
72
  == Supported fields==
73
- * Text field
74
- * Email field
75
- * Number field
76
- * Date field
77
- * Time field
78
- * Select field
79
- * Textarea field
80
- * Checkbox field
81
- * Radio field
82
- * Switcher field
83
- * Range slider field
84
- * URL field
85
- * Password field
86
- * Response Message
87
- * Opt-in
88
- * reCAPTCHA
89
- * Rating
90
- * File Upload
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  == Changelog ==
 
 
 
 
 
 
 
93
  Version 1.2.0
94
  add: Global settings page
95
  fix: Simple captcha
3
  Tags: Form builder, Elementor form builder, contact form, custom form, forms, drag & drop form builder
4
  Requires at least: 4.8
5
  Tested up to: 5.3
6
+ Stable tag: 1.2.1
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
22
  Metform builder contact form gives you full flexibility to build any form on the fly with metform. Want to make any complex from? complex style? no problem you can build any types of from with metform. Like you want to use an image or video under a form and want to show the user, you can do so... use any elementor addons inside metform builder form without any restrictions.
23
  Metform built with elementor. Every field is an elementor widget.
24
 
25
+ ==[Live demo](https://products.wpmet.com/metform/#demo)==
26
+
27
 
28
  Metform allows you to create any beautiful contact forms, feedback form, subscription forms, and other types of forms for your site in minutes, not hours! Full flexibility on your own hand.
29
 
46
  You can use MailChimp in your contact form also create MailChimp signup forms with custom style and expand your lead list.
47
 
48
  == Features ==
49
+ - **Built with Elementor:** With the most powerful Elementor form builder, create your impressive forms without any experience and professional knowledge. Most importantly, it is budget friendly and time consuming. We are providing every possible functionalities that you want to create a form with elementor page builder.
50
+
51
+ - **Elementor Input fields:** To create your desirable forms, We have designed a lot of Elementor widgets fields to build your form and any style you want with Text field, Email field, Number field, Date field Time field, Select field, Textarea field, Checkbox field, Radio field, Switcher field, Range slider field, URL field, Password field, Response Message, Opt-in, reCAPTCHA, Rating, File Upload, and many more.
52
+
53
+ - **User confirmation email:** A confirmation email can be sent when a user registers or enters their data to confirm their registration.
54
+
55
+ - **Admin notification email:** Notify admin after user submission is completed or any type of customer data is processed.
56
+
57
+ - **Saved entries in the admin panel:** Save all the data that users give to fill up the form and displays in the admin panel.
58
+
59
+ - **Export entries as CSV:** Export multiple data from your metform that user entries in a single CSV file and download in a spreadsheet.
60
+
61
+ - **Required Login to submit the form:** This feature will show all the required fields to fill up the form by giving a simple red star icon and provide an error message if needed.
62
+
63
+ - **Capture User Browser Data:** Displays the users browsers information like Web browser, Visited URL, Title, Visit Time, Visit Count, and User Profile etc.
64
+
65
+ - **Hide Form After Submission:** Able to hide your form after the user fills all the necessary fields and hits on the submit button.
66
+
67
+ - **Limit Total Entries:** Enable limit to the number of submission entries to your metform and give an error message after getting crossed.
68
+
69
+ - **Redirect after successful form submission:** Simply add desired destination URL and redirect to that page after successfully submitting the form.
70
+
71
+ - **MailChimp integration:** Easily integrates mailchimp to create and manage mailing list, automated mailing, newsletter, and many other options.
72
+
73
+ - **Slack integration:** Redirect all the form data to integrate with slack and get the customer information in a team faster.
74
 
75
+ - **Google reCAPTCHA integration:** Allow you to integrate Google reCAPTCHA to keep your site safe from unwanted spam and abusive traffiq.
76
 
77
+ - **Validate required fields:** Help you to validate your form’s required field and give an error message if needed for making your form standard and way more professional.
78
+
79
+ - **Form submission via AJAX without page refreshes:** Permit you to submit your form without loading your page via AJAX to make it more user friendly and time consuming.
80
+
81
+ - **Supports multiple-column layout:** Specify multiple column layout as many you would like to display. Simply add the column in just one click.
82
+
83
+ - **Shortcode support:** Add powerful features with a simple Shortcode without any knowledge of technical complicated lengthy code.
84
+
85
+ - **Editable successful form submission message:** Gives access to edit your successful form submission message so you can personalize your own message.
86
+
87
+ - **Translation ready:** Our plugin supports multiple languages that means you can easily translate a language into your languages.
88
 
89
 
90
 
91
  == Supported fields==
92
+ - **Text Input Field:** Display content, links to your form with different styles.
93
+ - **Email Input Field:** Make sure that the user enters the valid email address to your Form with Email Input field.
94
+ - **Number Input Field:** This Input fields will ensure that users enter a valid Number with numeric input.
95
+ - **Telephone Input Field:** Allow users to give their valid Telephone number to make connections.
96
+ - **Date Input Field:** Use this Input field to select Date from pop-down calendar to your form to make it more user friendly.
97
+ - **Time Input Field:**Helps users to pick up their preferred Time from pop-down timer.
98
+ - **Select Input Field:** Simple drop-down function allows you to Select items at your own choice.
99
+ - **Multi-Select Input Field:** Select Multiple items from the drop-down at a time.
100
+ - **Textarea:** Helps to add a large number of content, review, comment to your form.
101
+ - **Checkbox:** Permit users to select multiple items to your form at a time with Checkbox.
102
+ - **RadioButton:** Allow users to select only one exclusive item from the multiple options.
103
+ - **Switch Input Field:** Easily control the Yes/No or On/Off toggle Switch checkbox input just like a light switch.
104
+ - **Range Slider:** Set your max or min range value to your form by using super cool Range slider. All you have to do is just drag both ends until your appropriate value comes.
105
+ - **URL Input Field:** Simply add URL to your form using our URL Input Field. It ensures that users Input a valid URL to the form field.
106
+ - **Password Input Field:** If you want your user to give a strong password, use our Password Input Field. It makes sure that users get a protected password and can be able to change it when needed.
107
+ - **First Name (Listing): **Allow users to give their FirstName to show them in a listing method on the mailchimp list.
108
+ - **Last Name (Listing):** Allow users to give their LastName to show them in a listing method on the mailchimp list.
109
+ - **Opt in (Listing):** Use opt-in field to your form and make your user as a subscribed mailchimp contact user by clicking the checkbox “Subscribe to our newsletter”.
110
+ - **GDPR:** Enable GDPR(General Data Protection Regulation) complaints to your form before collecting user data as it explains how you are usually using the user data to stay safe from action of law.
111
+ - **reCAPTCHA :** Allow you to integrate Google reCAPTCHA to keep your site safe from unwanted spam and abusive traffiq.
112
+ - **Simple Captcha:** Protects your site from unwanted bots and spam.
113
+ - **Rating:** Helps to get customer review and build up a good bonding between owner and customer.
114
+ - **File Upload:** Permits users to upload important files, images, attachments to your form.
115
+ - **Summary:** Provide summary before subscription to build up a good communication with your customer.
116
+
117
+
118
+ ==Our Premium Input fileds==
119
+ - **Phone no Input Field:** Our premium Phone no Input Field permit user to select prefix country code Phone number from the drop down. You can also select your position,enable or disable the level and change the Mobile number if wanted.
120
+ - **Image Select Input Field:** Are you looking for a form which allows users to select Images from multiple Images? By using our premium Image Select Input Field, you can upload your image both vertically or horizontally.
121
+ - Select your Image
122
+ - Show or hide the label section
123
+ - Give title, thumbnail, and preview
124
+ - Select option value that will store/mail to desire person
125
+ - Give option status Active/Disable If want to restrict
126
+ - Customize Label, input, PlaceHolder
127
+ - **Toggle Select Input Field:** With our most powerful Toggle Select, you can activate one section from multiple sections at a time both vertically or horizontally. If you select one section active, then another section will automatically get deactivated.
128
+ - Add/Delete section
129
+ - Show/Hide label
130
+ - Select Position,Input, label
131
+ - Give label name and change if needed
132
+ - Give option value, option status
133
+ - Customizable Label and Toggle
134
+
135
+ - **Simple Repeater Input Field:** If you want to use a group of fields several times, you don’t need to create the field again and again. Our simple Repeater has an easy solution for that. All you have to do is just click the “Add” button and the new field will appear automatically.
136
+ - Add/Delete options
137
+ - Show/Hide label
138
+ - Editable position, layout, label name
139
+ - Enable/Disable icon inside button
140
+ - Add/Remove button text and button icon
141
+ - Styleable Repeater label, Field label, Field input and Button
142
+ - **Google Map Location Input Field:** Do you want to show your location to the user so they can easily get you? Use our premium Google Map Location to pinpoint the exact location which displays on your form with customizable content and styles.
143
+ - **Color Picker Input Field:** Easily select any color from drop down color palette to design your form in an eye-catching way. You just have to click on the choosable color and the color will appear accordingly.
144
+ - Show/Hide label
145
+ - Editable position, layout,name, placeholder
146
+ - Required option toggle
147
+ - Conditional Logic
148
+ - Styles in label, input and placeholder
149
+ - **Calculation Fields List:** Do you want to perform calculations among Form Fields to display automatic calculated value? Our premium calculation Field will help you to perform your calculations and display the results within seconds.
150
+ - Show / Hide section with simple radio button
151
+ - Select position with drop down
152
+ - Editable level, name, placeholder, help text section
153
+ - You can use Prefix before the calculation total
154
+ - Enable or disable the required field
155
+ - Expression with operation & inputs
156
+
157
+ - **Payment Method Input Field:** Make users payment policy easy using payment method to your form. With our Payment Method input field you can choose your payment gateway like Paypal.
158
+ - Show/Hide label
159
+ - Editable position, layout,name, placeholder
160
+ - Payment display option: Vertical/Horizontal
161
+ - Add/Delete Payment method
162
+ - Required option toggle
163
+ - Conditional Logic
164
+ - Styles in label and Image
165
+ - **Signature Input Field:** Would you like to get users realistic signature to your form before they hit upon the submit button? We offer you our Signature Input Field which will help you to collect realistic signatures for agreement, low-risk transactions and for other contracts.
166
+ - Show/Hide label
167
+ - Editable position, layout,name
168
+ - Display option: Vertical/Horizontal
169
+ - Required option toggle
170
+ - Conditional Logic
171
+ - Styles in Input label and toggle
172
+ - **Like-Dislike Input Field:** It’s really important to get feedback from the user for better improvement. Allow users to provide their reaction using like and dislike input fields.
173
+ Counts Like/Dislike number from user
174
+ - Easy to configure
175
+ - Editable position, layout,name
176
+ - Required option toggle
177
+ - Styles in Input label
178
+
179
+ ==Our Premium Features==
180
+ - **Multi-Step Form:** Divide your large form into multiple sections to make it more user friendly for customers to complete. Use our premium and fully customizable Multi-Step Form with many unique features.
181
+ Drag & Drop form builder
182
+ - Add unlimited step as many as you want
183
+ - Easily understandable functionalities
184
+ - Enable or disable the Multi-Step Form
185
+ - Select your validation type by character length, by word length, or by expression based.
186
+ - Select your position, level, help text at your choice
187
+ - Editable warning message section
188
+ - **Conditional Fields:** Give your questions in category wise. Conditional Logic allows a user to select one category and the given question will appear only for that section otherwise it will remain invisible. Here comes our most unique field is “Conditional Logic”.
189
+ - Enable or Disable Conditional Logic area
190
+ - Select condition match criteria And/OR
191
+ - Select action: Show /Hide your field
192
+
193
+
194
+ - **Calculation Fields List:** Do you want to perform calculations among Form Fields to display automatic calculated value? Our premium calculation Field will help you to perform your calculations and display the results within seconds.
195
+ - Store Entries: Save and Calculate submitted form data
196
+ - Calculate the form views
197
+
198
+
199
+ **REST API Support:** If you want to get data in different third party apps that users give input to fill out your form, use our most premium features Rest API Support. You can get form submission data and submission notification to Third Party API URL or Webhook by integrating our Rest API very easily.
200
+ - Enable/Disable Rest API
201
+ - Give Rest API URL/Webhook
202
+ - Select “Get” from the drop-down for requesting data from specified URL
203
+ - Select “Post” from the drop-down for sending data from specified URL
204
+
205
+ **Zapier Integration:** Introducing our most powerful and awesome features called “Zapier”. With this amazing feature you can integrate your form with thousands of popular apps or webhook without any coding.
206
+ Connect with Gmail, Slack, Mailchimp, and many more.
207
+ - Clickable Enable/Disable Toggle
208
+ - Enter desired Zapier Webhook
209
+ **Payment Method:** Get payments from your form. With our Payment Method features you can choose your payment gateway like Paypal.
210
+ - Redirect to successful URL If passed
211
+ - Redirect to Failure/Cancel URL If failed
212
+ - Integrate Paypal with Yes/No toggle
213
+
214
+
215
+
216
+
217
+
218
 
219
  == Changelog ==
220
+ Verson 1.2.1
221
+ New: GDPR consent input field
222
+ Tweak: Email template included uploaded file
223
+ Tweak: Email template design improvement
224
+ Tweak: Validation options fixed
225
+ Fix: Date store issue
226
+
227
  Version 1.2.0
228
  add: Global settings page
229
  fix: Simple captcha
traits/common-controls.php CHANGED
@@ -135,6 +135,16 @@ trait Common_Controls{
135
  );
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
138
  if( in_array('VALIDATION', $param ) ){
139
  $this->add_control(
140
  'mf_input_validation_type',
@@ -142,12 +152,7 @@ trait Common_Controls{
142
  'label' => esc_html__( 'Validation type', 'metform' ),
143
  'type' => Controls_Manager::SELECT,
144
  'default' => 'none',
145
- 'options' => [
146
- 'none' => esc_html__( 'None', 'metform' ),
147
- 'by_character_length' => esc_html__( 'By character length', 'metform' ),
148
- 'by_word_length' => esc_html__( 'By Word length', 'metform' ),
149
- 'by_expresssion_based' => esc_html__( 'By expression based', 'metform' ),
150
- ],
151
  ]
152
  );
153
  }
135
  );
136
  }
137
 
138
+ $validation_options = [
139
+ 'none' => esc_html__( 'None', 'metform' ),
140
+ 'by_character_length' => esc_html__( 'By character length', 'metform' ),
141
+ 'by_word_length' => esc_html__( 'By Word length', 'metform' ),
142
+ ];
143
+
144
+ if( class_exists('\MetForm_Pro\Base\Package') ){
145
+ $validation_options['by_expresssion_based'] = esc_html__( 'By expression based', 'metform' );
146
+ }
147
+
148
  if( in_array('VALIDATION', $param ) ){
149
  $this->add_control(
150
  'mf_input_validation_type',
152
  'label' => esc_html__( 'Validation type', 'metform' ),
153
  'type' => Controls_Manager::SELECT,
154
  'default' => 'none',
155
+ 'options' => $validation_options,
 
 
 
 
 
156
  ]
157
  );
158
  }
utils/util.php CHANGED
@@ -218,9 +218,9 @@ class Util{
218
  //$form_settings = \MetForm\Core\Entries\Action::instance()->get_form_settings($form_id);
219
  $form_settings = \MetForm\Core\Forms\Action::instance()->get_all_data($form_id);
220
 
221
- $site_key = ((isset($form_settings['mf_recaptcha']) && isset($form_settings['mf_recaptcha_version']) && $form_settings['mf_recaptcha_version'] == 'recaptcha-v3') ? $form_settings['mf_recaptcha_site_key_v3'] :
222
- ((isset($form_settings['mf_recaptcha']) && isset($form_settings['mf_recaptcha_version']) && $form_settings['mf_recaptcha_version'] == 'recaptcha-v2') ? $form_settings['mf_recaptcha_site_key'] :
223
- ((isset($form_settings['mf_recaptcha']) && $form_settings['mf_recaptcha_site_key'] != '') ? $form_settings['mf_recaptcha_site_key'] : '')
224
  ) );
225
 
226
  ob_start();
218
  //$form_settings = \MetForm\Core\Entries\Action::instance()->get_form_settings($form_id);
219
  $form_settings = \MetForm\Core\Forms\Action::instance()->get_all_data($form_id);
220
 
221
+ $site_key = (( isset($form_settings['mf_recaptcha_version']) && $form_settings['mf_recaptcha_version'] == 'recaptcha-v3') ? $form_settings['mf_recaptcha_site_key_v3'] :
222
+ (( isset($form_settings['mf_recaptcha_version']) && $form_settings['mf_recaptcha_version'] == 'recaptcha-v2') ? $form_settings['mf_recaptcha_site_key'] :
223
+ (( isset($form_settings['mf_recaptcha_site_key']) && $form_settings['mf_recaptcha_site_key'] != '') ? $form_settings['mf_recaptcha_site_key'] : '')
224
  ) );
225
 
226
  ob_start();
widgets/date/date.php CHANGED
@@ -387,6 +387,7 @@ Class MetForm_Input_Date extends Widget_Base{
387
  }
388
  ?>
389
  <input type="text" class="mf-input mf-date-input <?php echo ((isset($mf_input_validation_type) && $mf_input_validation_type !='none') || isset($mf_input_required) && $mf_input_required === 'yes') ? 'mf-input-do-validate' : ''; ?> <?php echo $class; ?>"
 
390
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
391
  data-mfMinDate = "<?php echo esc_attr($mf_input_min_date); ?>"
392
  data-mfMaxDate= "<?php echo esc_attr($mf_input_max_date); ?>"
387
  }
388
  ?>
389
  <input type="text" class="mf-input mf-date-input <?php echo ((isset($mf_input_validation_type) && $mf_input_validation_type !='none') || isset($mf_input_required) && $mf_input_required === 'yes') ? 'mf-input-do-validate' : ''; ?> <?php echo $class; ?>"
390
+ name="<?php echo esc_attr($mf_input_name); ?>"
391
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
392
  data-mfMinDate = "<?php echo esc_attr($mf_input_min_date); ?>"
393
  data-mfMaxDate= "<?php echo esc_attr($mf_input_max_date); ?>"
widgets/gdpr-consent/gdpr-consent.php ADDED
@@ -0,0 +1,456 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Elementor;
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ Class MetForm_Input_Gdpr_Consent extends Widget_Base{
6
+
7
+ use \MetForm\Traits\Common_Controls;
8
+ use \MetForm\Traits\Conditional_Controls;
9
+
10
+ public function get_name() {
11
+ return 'mf-gdpr-consent';
12
+ }
13
+
14
+ public function get_title() {
15
+ return esc_html__( 'GDPR Consent', 'metform' );
16
+ }
17
+
18
+ public function show_in_panel() {
19
+ return 'metform-form' == get_post_type();
20
+ }
21
+
22
+ public function get_categories() {
23
+ return [ 'metform' ];
24
+ }
25
+
26
+ public function get_keywords() {
27
+ return ['metform', 'input', 'GDPR', 'gdpr', 'consent'];
28
+ }
29
+
30
+ protected function _register_controls() {
31
+
32
+ $this->start_controls_section(
33
+ 'content_section',
34
+ [
35
+ 'label' => esc_html__( 'Content', 'metform' ),
36
+ 'tab' => Controls_Manager::TAB_CONTENT,
37
+ ]
38
+ );
39
+
40
+ $this->add_control(
41
+ 'mf_input_label_status',
42
+ [
43
+ 'label' => esc_html__( 'Show Label', 'metform' ),
44
+ 'type' => Controls_Manager::SWITCHER,
45
+ 'on' => esc_html__( 'Show', 'metform' ),
46
+ 'off' => esc_html__( 'Hide', 'metform' ),
47
+ 'return_value' => 'yes',
48
+ 'default' => 'yes',
49
+ 'description' => esc_html__('for adding label on input turn it on. Don\'t want to use label? turn it off.', 'metform'),
50
+ ]
51
+ );
52
+
53
+ $this->add_control(
54
+ 'mf_gdpr_consent_label_display_property',
55
+ [
56
+ 'label' => esc_html__( 'Position', 'metform' ),
57
+ 'type' => Controls_Manager::SELECT,
58
+ 'default' => 'block',
59
+ 'options' => [
60
+ 'block' => esc_html__( 'Top', 'metform' ),
61
+ 'inline-block' => esc_html__( 'Left', 'metform' ),
62
+ ],
63
+ 'selectors' => [
64
+ '{{WRAPPER}} .mf-checkbox-label' => 'display: {{VALUE}}; vertical-align: top',
65
+ '{{WRAPPER}} .mf-checkbox' => 'display: inline-block',
66
+ ],
67
+ 'condition' => [
68
+ 'mf_input_label_status' => 'yes',
69
+ ],
70
+ 'description' => esc_html__('Select label position. where you want to see it. top of the input or left of the input.', 'metform'),
71
+
72
+ ]
73
+ );
74
+
75
+ $this->add_control(
76
+ 'mf_input_label',
77
+ [
78
+ 'label' => esc_html__( 'Input Label : ', 'metform' ),
79
+ 'type' => Controls_Manager::TEXT,
80
+ 'default' => $this->get_title(),
81
+ 'title' => esc_html__( 'Enter here label of input', 'metform' ),
82
+ 'condition' => [
83
+ 'mf_input_label_status' => 'yes',
84
+ ],
85
+ ]
86
+ );
87
+
88
+ $this->add_control(
89
+ 'mf_input_name',
90
+ [
91
+ 'label' => esc_html__( 'Name : ', 'metform' ),
92
+ 'type' => Controls_Manager::HIDDEN,
93
+ 'default' => $this->get_name(),
94
+ ]
95
+ );
96
+
97
+ $this->add_control(
98
+ 'mf_gdpr_consent_display_option',
99
+ [
100
+ 'label' => esc_html__( 'Option Display : ', 'metform' ),
101
+ 'type' => Controls_Manager::SELECT,
102
+ 'default' => 'solid',
103
+ 'options' => [
104
+ 'inline-block' => esc_html__( 'Horizontal', 'metform' ),
105
+ 'block' => esc_html__( 'Vertical', 'metform' ),
106
+ ],
107
+ 'default' => 'inline-block',
108
+ 'selectors' => [
109
+ '{{WRAPPER}} .mf-checkbox-option' => 'display: {{VALUE}};',
110
+ ],
111
+ 'description' => esc_html__('Checkbox option display style. ', 'metform'),
112
+ ]
113
+ );
114
+
115
+ $this->add_control(
116
+ 'mf_gdpr_consent_option_text_position',
117
+ [
118
+ 'label' => esc_html__( 'Option Text Position : ', 'metform' ),
119
+ 'type' => Controls_Manager::SELECT,
120
+ 'options' => [
121
+ 'after' => esc_html__( 'After Checkbox', 'metform' ),
122
+ 'before' => esc_html__( 'Before Checkbox', 'metform' ),
123
+ ],
124
+ 'default' => 'after',
125
+ 'description' => esc_html__('Where do you want to label?', 'metform'),
126
+ ]
127
+ );
128
+
129
+ $this->add_control(
130
+ 'mf_gdpr_consent_option_text', [
131
+ 'label' => esc_html__( 'Checkbox Option Text', 'metform' ),
132
+ 'type' => Controls_Manager::TEXTAREA,
133
+ 'rows' => 10,
134
+ 'default' => \MetForm\Utils\Util::kses( 'Agree on our <a href="#">terms and condition</a> for using your submitted data?' , 'metform' ),
135
+ 'label_block' => true,
136
+ 'description' => esc_html__('Select option name that will be show to user.', 'metform'),
137
+ ]
138
+ );
139
+
140
+ $this->add_control(
141
+ 'mf_input_help_text',
142
+ [
143
+ 'label' => esc_html__( 'Help Text : ', 'metform' ),
144
+ 'type' => Controls_Manager::TEXTAREA,
145
+ 'rows' => 3,
146
+ 'placeholder' => esc_html__( 'Type your help text here', 'metform' ),
147
+ ]
148
+ );
149
+
150
+ $this->end_controls_section();
151
+
152
+ if(class_exists('\MetForm_Pro\Base\Package')){
153
+ $this->input_conditional_control();
154
+ }
155
+
156
+ $this->start_controls_section(
157
+ 'label_section',
158
+ [
159
+ 'label' => esc_html__( 'Input Label', 'metform' ),
160
+ 'tab' => Controls_Manager::TAB_STYLE,
161
+ 'condition' => [
162
+ 'mf_input_label_status' => 'yes',
163
+ ],
164
+ ]
165
+ );
166
+
167
+ $this->add_control(
168
+ 'mf_gdpr_consent__label_color',
169
+ [
170
+ 'label' => esc_html__( 'Color', 'metform' ),
171
+ 'type' => Controls_Manager::COLOR,
172
+ 'scheme' => [
173
+ 'type' => Scheme_Color::get_type(),
174
+ 'value' => Scheme_Color::COLOR_1,
175
+ ],
176
+ 'selectors' => [
177
+ '{{WRAPPER}} .mf-checkbox-label, {{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span:before' => 'color: {{VALUE}}',
178
+ ],
179
+ 'default' => '#000000',
180
+ 'condition' => [
181
+ 'mf_input_label_status' => 'yes',
182
+ ],
183
+ ]
184
+ );
185
+ $this->add_group_control(
186
+ Group_Control_Typography::get_type(),
187
+ [
188
+ 'name' => 'mf_gdpr_consent__label_typography',
189
+ 'label' => esc_html__( 'Typography', 'metform' ),
190
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
191
+ 'selector' => '{{WRAPPER}} .mf-checkbox-label',
192
+ 'condition' => [
193
+ 'mf_input_label_status' => 'yes',
194
+ ],
195
+ ]
196
+ );
197
+ $this->add_responsive_control(
198
+ 'mf_gdpr_consent__label_padding',
199
+ [
200
+ 'label' => esc_html__( 'Padding', 'metform' ),
201
+ 'type' => Controls_Manager::DIMENSIONS,
202
+ 'size_units' => [ 'px', '%', 'em' ],
203
+ 'selectors' => [
204
+ '{{WRAPPER}} .mf-checkbox-label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
205
+ ],
206
+ 'condition' => [
207
+ 'mf_input_label_status' => 'yes',
208
+ ],
209
+ ]
210
+ );
211
+ $this->add_responsive_control(
212
+ 'mf_gdpr_consent__label_margin',
213
+ [
214
+ 'label' => esc_html__( 'Margin', 'metform' ),
215
+ 'type' => Controls_Manager::DIMENSIONS,
216
+ 'size_units' => [ 'px', '%', 'em' ],
217
+ 'selectors' => [
218
+ '{{WRAPPER}} .mf-checkbox-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
219
+ ],
220
+ 'condition' => [
221
+ 'mf_input_label_status' => 'yes',
222
+ ],
223
+ ]
224
+ );
225
+
226
+ $this->add_group_control(
227
+ Group_Control_Box_Shadow::get_type(),
228
+ [
229
+ 'name' => 'mf_gdpr_consent__label_box_shadow',
230
+ 'label' => esc_html__( 'Box Shadow', 'metform' ),
231
+ 'selector' => '{{WRAPPER}} .mf-checkbox-label',
232
+ 'condition' => [
233
+ 'mf_input_label_status' => 'yes',
234
+ ],
235
+ ]
236
+ );
237
+
238
+ $this->add_control(
239
+ 'mf_input_required_indicator_color',
240
+ [
241
+ 'label' => esc_html__( 'Required indicator color:', 'metform' ),
242
+ 'type' => Controls_Manager::COLOR,
243
+ 'scheme' => [
244
+ 'type' => Scheme_Color::get_type(),
245
+ 'value' => Scheme_Color::COLOR_1,
246
+ ],
247
+ 'default' => '#FF0000',
248
+ 'selectors' => [
249
+ '{{WRAPPER}} .mf-input-label .mf-input-required-indicator,{{WRAPPER}} .mf-input-wrapper.mf-field-error .mf-checkbox-option, {{WRAPPER}} .mf-input-wrapper .error' => 'color: {{VALUE}}',
250
+ ],
251
+ ]
252
+ );
253
+
254
+ $this->end_controls_section();
255
+
256
+ $this->start_controls_section(
257
+ 'gdpr_consentoption_section',
258
+ [
259
+ 'label' => esc_html__('Checkbox', 'metform'),
260
+ 'tab' => Controls_Manager::TAB_STYLE,
261
+ ]
262
+ );
263
+
264
+ $this->add_responsive_control(
265
+ 'mf_gdpr_consent_option_padding',
266
+ [
267
+ 'label' => esc_html__( 'Padding', 'metform' ),
268
+ 'type' => Controls_Manager::DIMENSIONS,
269
+ 'size_units' => [ 'px', '%', 'em' ],
270
+ 'selectors' => [
271
+ '{{WRAPPER}} .mf-checkbox-option' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
272
+ ],
273
+ ]
274
+ );
275
+ $this->add_responsive_control(
276
+ 'mf_gdpr_consent_option_margin',
277
+ [
278
+ 'label' => esc_html__( 'Margin', 'metform' ),
279
+ 'type' => Controls_Manager::DIMENSIONS,
280
+ 'size_units' => [ 'px', '%', 'em' ],
281
+ 'selectors' => [
282
+ '{{WRAPPER}} .mf-checkbox-option' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
283
+ ],
284
+ ]
285
+ );
286
+
287
+ $this->add_control(
288
+ 'mf_gdpr_consent_option_color',
289
+ [
290
+ 'label' => esc_html__( 'Text Color', 'metform' ),
291
+ 'type' => Controls_Manager::COLOR,
292
+ 'scheme' => [
293
+ 'type' => Scheme_Color::get_type(),
294
+ 'value' => Scheme_Color::COLOR_1,
295
+ ],
296
+ 'selectors' => [
297
+ '{{WRAPPER}} .mf-checkbox-option' => 'color: {{VALUE}}',
298
+ '{{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span:before' => 'color: {{VALUE}}',
299
+ ],
300
+ 'default' => '#000000',
301
+ ]
302
+ );
303
+
304
+ $this->start_controls_tabs('mf_gdpr_consent_option_icon_color_control');
305
+
306
+ $this->start_controls_tab(
307
+ 'mf_gdpr_consent_option_icon_color_tabnormal',
308
+ [
309
+ 'label' => esc_html__( 'Normal', 'metform' ),
310
+ ]
311
+ );
312
+
313
+ $this->add_control(
314
+ 'mf_gdpr_consent_option_icon_color',
315
+ [
316
+ 'label' => esc_html__( 'Checkbox Color', 'metform' ),
317
+ 'type' => Controls_Manager::COLOR,
318
+ 'scheme' => [
319
+ 'type' => Scheme_Color::get_type(),
320
+ 'value' => Scheme_Color::COLOR_1,
321
+ ],
322
+ 'selectors' => [
323
+ '{{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span:before' => 'color: {{VALUE}}'
324
+ ],
325
+ 'default' => '#747474',
326
+ ]
327
+ );
328
+
329
+ $this->end_controls_tab();
330
+
331
+ $this->start_controls_tab(
332
+ 'mf_gdpr_consent_option_icon_color_tabchecked',
333
+ [
334
+ 'label' => esc_html__( 'Checked', 'metform' ),
335
+ ]
336
+ );
337
+
338
+ $this->add_control(
339
+ 'mf_gdpr_consent_option_icon_color_checked',
340
+ [
341
+ 'label' => esc_html__( 'Checkbox Color', 'metform' ),
342
+ 'type' => Controls_Manager::COLOR,
343
+ 'scheme' => [
344
+ 'type' => Scheme_Color::get_type(),
345
+ 'value' => Scheme_Color::COLOR_1,
346
+ ],
347
+ 'selectors' => [
348
+ '{{WRAPPER}} .mf-checkbox-option input[type="checkbox"]:checked + span:before' => 'color: {{VALUE}}'
349
+ ],
350
+ 'default' => '#4285F4',
351
+ ]
352
+ );
353
+
354
+ $this->end_controls_tab();
355
+
356
+ $this->end_controls_tabs();
357
+
358
+ $this->add_responsive_control(
359
+ 'mf_input_option_icon_horizontal_position',
360
+ [
361
+ 'label' => esc_html__( 'Horizontal position of icon', 'metform' ),
362
+ 'type' => Controls_Manager::SLIDER,
363
+ 'size_units' => [ 'px'],
364
+ 'range' => [
365
+ 'px' => [
366
+ 'min' => -50,
367
+ 'max' => 50,
368
+ 'step' => 1,
369
+ ],
370
+ ],
371
+ 'default' => [
372
+ 'unit' => 'px',
373
+ 'size' => 2,
374
+ ],
375
+ 'selectors' => [
376
+ '{{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span:before' => 'top: {{SIZE}}{{UNIT}}',
377
+ ]
378
+ ]
379
+ );
380
+
381
+ $this->add_control(
382
+ 'mf_gdpr_consent_option_space_after_icon',
383
+ [
384
+ 'label' => esc_html__( 'Add space after checkbox', 'metform' ),
385
+ 'type' => Controls_Manager::SLIDER,
386
+ 'default' => [
387
+ 'unit' => 'px',
388
+ 'size' => 25,
389
+ ],
390
+ 'selectors' => [
391
+ '{{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span:before' => 'width: {{SIZE}}{{UNIT}}',
392
+ ]
393
+ ]
394
+ );
395
+
396
+ $this->add_group_control(
397
+ Group_Control_Typography::get_type(),
398
+ [
399
+ 'name' => 'mf_gdpr_consent_typgraphy',
400
+ 'label' => esc_html__( 'Typography for icon', 'metform' ),
401
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
402
+ 'exclude' => [ 'font_family', 'text_transform', 'font_style', 'text_decoration', 'letter_spacing' ],
403
+ 'selector' => '{{WRAPPER}} .mf-checkbox, {{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span:before',
404
+ ]
405
+ );
406
+
407
+ $this->add_group_control(
408
+ Group_Control_Typography::get_type(),
409
+ [
410
+ 'name' => 'mf_gdpr_consent_typgraphy_text',
411
+ 'label' => esc_html__( 'Typography for text', 'metform' ),
412
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
413
+ 'selector' => '{{WRAPPER}} .mf-checkbox, {{WRAPPER}} .mf-checkbox-option input[type="checkbox"] + span',
414
+ ]
415
+ );
416
+
417
+ $this->end_controls_section();
418
+
419
+
420
+ }
421
+
422
+ protected function render($instance = []){
423
+ $settings = $this->get_settings_for_display();
424
+ extract($settings);
425
+
426
+ $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
427
+
428
+ echo "<div class='mf-input-wrapper'>";
429
+
430
+ if($mf_input_label_status == 'yes'){
431
+ ?>
432
+ <label class="mf-checkbox-label mf-input-label" for="mf-input-gdpr-<?php echo esc_attr($this->get_id()); ?>"><?php echo esc_html($mf_input_label); ?>
433
+ <span class="mf-input-required-indicator"><?php esc_html_e( '*', 'metform' ); ?></span>
434
+ </label>
435
+ <?php
436
+ }
437
+ ?>
438
+ <div class="mf-checkbox" id="mf-input-gdpr-<?php echo esc_attr($this->get_id()); ?>">
439
+ <div class="mf-checkbox-option">
440
+ <label><?php echo \MetForm\Utils\Util::kses(($mf_gdpr_consent_option_text_position == 'before') ? $mf_gdpr_consent_option_text :''); ?>
441
+ <input type="checkbox" class="mf-input mf-checkbox-input <?php echo ((isset($mf_input_validation_type) && $mf_input_validation_type !='none') || isset($mf_input_required) && $mf_input_required === 'yes') ? 'mf-input-do-validate' : ''; ?> <?php echo $class; ?>" name="<?php echo esc_attr($mf_input_name); ?>"
442
+ value="1"
443
+ <?php echo esc_attr('required')?>
444
+ >
445
+ <span><?php echo \MetForm\Utils\Util::kses(($mf_gdpr_consent_option_text_position == 'after') ? $mf_gdpr_consent_option_text :''); ?></span>
446
+ </label>
447
+ </div>
448
+ </div>
449
+ <?php
450
+ if($mf_input_help_text != ''){
451
+ echo "<span class='mf-input-help'>".esc_html($mf_input_help_text)."</span>";
452
+ }
453
+ echo "</div>";
454
+ }
455
+
456
+ }
widgets/listing-optin/listing-optin.php CHANGED
@@ -40,10 +40,10 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
40
  $this->add_control(
41
  'mf_input_label_status',
42
  [
43
- 'label' =>esc_html__( 'Show Label', 'metform' ),
44
  'type' => Controls_Manager::SWITCHER,
45
- 'on' =>esc_html__( 'Show', 'metform' ),
46
- 'off' =>esc_html__( 'Hide', 'metform' ),
47
  'return_value' => 'yes',
48
  'default' => 'yes',
49
  'description' => esc_html__('for adding label on input turn it on. Don\'t want to use label? turn it off.', 'metform'),
@@ -97,12 +97,12 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
97
  $this->add_control(
98
  'mf_listing_optin_display_option',
99
  [
100
- 'label' =>esc_html__( 'Option Display : ', 'metform' ),
101
  'type' => Controls_Manager::SELECT,
102
  'default' => 'solid',
103
  'options' => [
104
- 'inline-block' =>esc_html__( 'Horizontal', 'metform' ),
105
- 'block' =>esc_html__( 'Vertical', 'metform' ),
106
  ],
107
  'default' => 'inline-block',
108
  'selectors' => [
@@ -115,11 +115,11 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
115
  $this->add_control(
116
  'mf_listing_optin_option_text_position',
117
  [
118
- 'label' =>esc_html__( 'Option Text Position : ', 'metform' ),
119
  'type' => Controls_Manager::SELECT,
120
  'options' => [
121
- 'after' =>esc_html__( 'After Checkbox', 'metform' ),
122
- 'before' =>esc_html__( 'Before Checkbox', 'metform' ),
123
  ],
124
  'default' => 'after',
125
  'description' => esc_html__('Where do you want to label?', 'metform'),
@@ -128,9 +128,9 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
128
 
129
  $this->add_control(
130
  'mf_listing_optin_option_text', [
131
- 'label' =>esc_html__( 'Checkbox Option Text', 'metform' ),
132
  'type' => Controls_Manager::TEXT,
133
- 'default' =>esc_html__( 'Subscribe to ours newsletter.' , 'metform' ),
134
  'label_block' => true,
135
  'description' => esc_html__('Select option name that will be show to user.', 'metform'),
136
  ]
@@ -139,10 +139,10 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
139
  $this->add_control(
140
  'mf_input_help_text',
141
  [
142
- 'label' =>esc_html__( 'Help Text : ', 'metform' ),
143
  'type' => Controls_Manager::TEXTAREA,
144
  'rows' => 3,
145
- 'placeholder' =>esc_html__( 'Type your help text here', 'metform' ),
146
  ]
147
  );
148
 
@@ -301,7 +301,7 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
301
  $this->add_control(
302
  'mf_listing_optin_option_color',
303
  [
304
- 'label' =>esc_html__( 'Text Color', 'metform' ),
305
  'type' => Controls_Manager::COLOR,
306
  'scheme' => [
307
  'type' => Scheme_Color::get_type(),
@@ -320,7 +320,7 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
320
  $this->start_controls_tab(
321
  'mf_listing_optin_option_icon_color_tabnormal',
322
  [
323
- 'label' =>esc_html__( 'Normal', 'metform' ),
324
  ]
325
  );
326
 
@@ -345,7 +345,7 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
345
  $this->start_controls_tab(
346
  'mf_listing_optin_option_icon_color_tabchecked',
347
  [
348
- 'label' =>esc_html__( 'Checked', 'metform' ),
349
  ]
350
  );
351
 
40
  $this->add_control(
41
  'mf_input_label_status',
42
  [
43
+ 'label' => esc_html__( 'Show Label', 'metform' ),
44
  'type' => Controls_Manager::SWITCHER,
45
+ 'on' => esc_html__( 'Show', 'metform' ),
46
+ 'off' => esc_html__( 'Hide', 'metform' ),
47
  'return_value' => 'yes',
48
  'default' => 'yes',
49
  'description' => esc_html__('for adding label on input turn it on. Don\'t want to use label? turn it off.', 'metform'),
97
  $this->add_control(
98
  'mf_listing_optin_display_option',
99
  [
100
+ 'label' => esc_html__( 'Option Display : ', 'metform' ),
101
  'type' => Controls_Manager::SELECT,
102
  'default' => 'solid',
103
  'options' => [
104
+ 'inline-block' => esc_html__( 'Horizontal', 'metform' ),
105
+ 'block' => esc_html__( 'Vertical', 'metform' ),
106
  ],
107
  'default' => 'inline-block',
108
  'selectors' => [
115
  $this->add_control(
116
  'mf_listing_optin_option_text_position',
117
  [
118
+ 'label' => esc_html__( 'Option Text Position : ', 'metform' ),
119
  'type' => Controls_Manager::SELECT,
120
  'options' => [
121
+ 'after' => esc_html__( 'After Checkbox', 'metform' ),
122
+ 'before' => esc_html__( 'Before Checkbox', 'metform' ),
123
  ],
124
  'default' => 'after',
125
  'description' => esc_html__('Where do you want to label?', 'metform'),
128
 
129
  $this->add_control(
130
  'mf_listing_optin_option_text', [
131
+ 'label' => esc_html__( 'Checkbox Option Text', 'metform' ),
132
  'type' => Controls_Manager::TEXT,
133
+ 'default' => esc_html__( 'Subscribe to ours newsletter.' , 'metform' ),
134
  'label_block' => true,
135
  'description' => esc_html__('Select option name that will be show to user.', 'metform'),
136
  ]
139
  $this->add_control(
140
  'mf_input_help_text',
141
  [
142
+ 'label' => esc_html__( 'Help Text : ', 'metform' ),
143
  'type' => Controls_Manager::TEXTAREA,
144
  'rows' => 3,
145
+ 'placeholder' => esc_html__( 'Type your help text here', 'metform' ),
146
  ]
147
  );
148
 
301
  $this->add_control(
302
  'mf_listing_optin_option_color',
303
  [
304
+ 'label' => esc_html__( 'Text Color', 'metform' ),
305
  'type' => Controls_Manager::COLOR,
306
  'scheme' => [
307
  'type' => Scheme_Color::get_type(),
320
  $this->start_controls_tab(
321
  'mf_listing_optin_option_icon_color_tabnormal',
322
  [
323
+ 'label' => esc_html__( 'Normal', 'metform' ),
324
  ]
325
  );
326
 
345
  $this->start_controls_tab(
346
  'mf_listing_optin_option_icon_color_tabchecked',
347
  [
348
+ 'label' => esc_html__( 'Checked', 'metform' ),
349
  ]
350
  );
351
 
widgets/manifest.php CHANGED
@@ -34,6 +34,7 @@ Class Manifest{
34
  'mf-listing-fname',
35
  'mf-listing-lname',
36
  'mf-listing-optin',
 
37
  'mf-recaptcha',
38
  'mf-simple-captcha',
39
  'mf-rating',
@@ -67,6 +68,7 @@ Class Manifest{
67
  require_once plugin_dir_path(__FILE__) . 'listing-fname/listing-fname.php';
68
  require_once plugin_dir_path(__FILE__) . 'listing-lname/listing-lname.php';
69
  require_once plugin_dir_path(__FILE__) . 'listing-optin/listing-optin.php';
 
70
  require_once plugin_dir_path(__FILE__) . 'recaptcha/recaptcha.php';
71
  require_once plugin_dir_path(__FILE__) . 'simple-captcha/simple-captcha.php';
72
  require_once plugin_dir_path(__FILE__) . 'rating/rating.php';
@@ -99,7 +101,8 @@ Class Manifest{
99
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Response() );
100
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Fname() );
101
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Lname() );
102
- \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Optin );
 
103
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Recaptcha() );
104
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Simple_Captcha() );
105
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Rating() );
34
  'mf-listing-fname',
35
  'mf-listing-lname',
36
  'mf-listing-optin',
37
+ 'mf-gdpr-consent',
38
  'mf-recaptcha',
39
  'mf-simple-captcha',
40
  'mf-rating',
68
  require_once plugin_dir_path(__FILE__) . 'listing-fname/listing-fname.php';
69
  require_once plugin_dir_path(__FILE__) . 'listing-lname/listing-lname.php';
70
  require_once plugin_dir_path(__FILE__) . 'listing-optin/listing-optin.php';
71
+ require_once plugin_dir_path(__FILE__) . 'gdpr-consent/gdpr-consent.php';
72
  require_once plugin_dir_path(__FILE__) . 'recaptcha/recaptcha.php';
73
  require_once plugin_dir_path(__FILE__) . 'simple-captcha/simple-captcha.php';
74
  require_once plugin_dir_path(__FILE__) . 'rating/rating.php';
101
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Response() );
102
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Fname() );
103
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Lname() );
104
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Optin() );
105
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Gdpr_Consent() );
106
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Recaptcha() );
107
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Simple_Captcha() );
108
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Rating() );
widgets/simple-captcha/generate-captcha.php CHANGED
@@ -1,11 +1,15 @@
1
  <?php
2
 
 
3
  session_start();
4
 
 
5
  $time = $_SERVER['REQUEST_TIME'];
6
 
 
7
  $timeout_duration = 1800;
8
 
 
9
  if (isset($_SESSION['LAST_ACTIVITY']) &&
10
  ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration) {
11
  session_unset();
@@ -13,10 +17,13 @@ if (isset($_SESSION['LAST_ACTIVITY']) &&
13
  session_start();
14
  }
15
 
 
16
  $_SESSION['LAST_ACTIVITY'] = $time;
17
 
 
18
  $permitted_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
19
 
 
20
  function generate_string($input, $strength = 10) {
21
  $input_length = strlen($input);
22
  $random_string = '';
@@ -27,7 +34,8 @@ function generate_string($input, $strength = 10) {
27
 
28
  return $random_string;
29
  }
30
-
 
31
  $image = imagecreatetruecolor(200, 50);
32
 
33
  imageantialias($image, true);
@@ -53,17 +61,23 @@ for($i = 0; $i < 10; $i++) {
53
  $black = imagecolorallocate($image, 0, 0, 0);
54
  $white = imagecolorallocate($image, 255, 255, 255);
55
  $textcolors = [$black, $white];
56
-
 
 
 
57
  $fonts = [
58
- dirname( __FILE__ ).'/fonts/PermanentMarker.ttf',
59
  dirname( __FILE__ ).'/fonts/SourceCodePro.ttf',
60
  ];
61
 
 
62
  $string_length = 6;
 
63
  $captcha_string = generate_string($permitted_chars, $string_length);
64
-
65
  $_SESSION['mf_captcha_text'] = $captcha_string;
66
 
 
67
  for($i = 0; $i < $string_length; $i++) {
68
  $letter_space = 170/$string_length;
69
  $initial = 15;
@@ -75,5 +89,6 @@ header('Content-type: image/png');
75
  imagepng($image);
76
  imagedestroy($image);
77
 
 
78
 
79
  ?>
1
  <?php
2
 
3
+ // session start for tracking
4
  session_start();
5
 
6
+ // current server time take
7
  $time = $_SERVER['REQUEST_TIME'];
8
 
9
+ // captcha validity timeout 60s*30m = 1800 sec
10
  $timeout_duration = 1800;
11
 
12
+ // check previous session and do necessary action
13
  if (isset($_SESSION['LAST_ACTIVITY']) &&
14
  ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration) {
15
  session_unset();
17
  session_start();
18
  }
19
 
20
+ // set current activity as last activity
21
  $_SESSION['LAST_ACTIVITY'] = $time;
22
 
23
+ // permitted charecters for generating captcha
24
  $permitted_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
25
 
26
+ // generate random string from permitted chars
27
  function generate_string($input, $strength = 10) {
28
  $input_length = strlen($input);
29
  $random_string = '';
34
 
35
  return $random_string;
36
  }
37
+
38
+ // background image create start
39
  $image = imagecreatetruecolor(200, 50);
40
 
41
  imageantialias($image, true);
61
  $black = imagecolorallocate($image, 0, 0, 0);
62
  $white = imagecolorallocate($image, 255, 255, 255);
63
  $textcolors = [$black, $white];
64
+
65
+ // background image create end
66
+
67
+ // include font for using in captcha
68
  $fonts = [
69
+ //dirname( __FILE__ ).'/fonts/PermanentMarker.ttf',
70
  dirname( __FILE__ ).'/fonts/SourceCodePro.ttf',
71
  ];
72
 
73
+ // limit captcha length
74
  $string_length = 6;
75
+ // captcha generate
76
  $captcha_string = generate_string($permitted_chars, $string_length);
77
+ // store captcha on session
78
  $_SESSION['mf_captcha_text'] = $captcha_string;
79
 
80
+ // create image with generated captcha start
81
  for($i = 0; $i < $string_length; $i++) {
82
  $letter_space = 170/$string_length;
83
  $initial = 15;
89
  imagepng($image);
90
  imagedestroy($image);
91
 
92
+ // create image with generated captcha end
93
 
94
  ?>
widgets/summary/summary.php CHANGED
@@ -118,6 +118,9 @@ Class MetForm_Input_Summary extends Widget_Base{
118
  </label>
119
  <?php
120
  }
 
 
 
121
  ?>
122
  <div class="mf-input mf-input-summary metform-entry-data container">
123
  <table class='mf-entry-data' cellpadding="5" cellspacing="0">
118
  </label>
119
  <?php
120
  }
121
+ if(('metform-form' == get_post_type() || 'page' == get_post_type()) && \Elementor\Plugin::$instance->editor->is_edit_mode()){
122
+ echo "<div class='attr-alert attr-alert-warning'>".esc_html__('Summary will be shown on preview.', 'metform')."</div>";
123
+ }
124
  ?>
125
  <div class="mf-input mf-input-summary metform-entry-data container">
126
  <table class='mf-entry-data' cellpadding="5" cellspacing="0">