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

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.0
Comparing to
See all releases

Code changes from version 1.1.9 to 1.2.0

base/shortcode.php CHANGED
@@ -13,7 +13,7 @@ Class Shortcode {
13
  $attributes = shortcode_atts( array(
14
  'form_id' => 'test',
15
  ), $atts );
16
- return \MetForm\Utils\Util::render_form_content($attributes['form_id'], $attributes['form_id']);
17
  }
18
 
19
  }
13
  $attributes = shortcode_atts( array(
14
  'form_id' => 'test',
15
  ), $atts );
16
+ return '<div class="mf-form-shortcode">'. \MetForm\Utils\Util::render_form_content($attributes['form_id'], $attributes['form_id']) .'</div>';
17
  }
18
 
19
  }
core/admin/base.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MetForm\Core\Admin;
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ /**
6
+ * Metform settings related all functionalities.
7
+ *
8
+ * @version 1.1.8
9
+ */
10
+ class Base {
11
+ use \MetForm\Traits\Singleton;
12
+ private $key_settings_option;
13
+
14
+ public function __construct(){
15
+ $this->key_settings_option = 'metform_option__settings';
16
+ }
17
+
18
+ public static function parent_slug(){
19
+ return 'metform-menu';
20
+ }
21
+
22
+ public function init(){
23
+ add_action('admin_menu', [$this, 'register_settings'], 999);
24
+ add_action('admin_init', [$this, 'register_actions'], 999);
25
+ }
26
+
27
+ public function register_settings(){
28
+ add_submenu_page( self::parent_slug(), esc_html__( 'Settings', 'metform' ), esc_html__( 'Settings', 'metform' ), 'manage_options', self::parent_slug().'-settings', [$this, 'register_settings_contents__settings'], 11);
29
+ }
30
+
31
+ public function register_settings_contents__settings(){
32
+ include('views/settings.php');
33
+ }
34
+
35
+ public function get_settings_option($key = null , $default = null){
36
+ if($key != null){
37
+ $this->key_settings_option = $key;
38
+ }
39
+ return get_option($this->key_settings_option);
40
+ }
41
+
42
+ public function set_option($key, $default = null){
43
+
44
+ }
45
+
46
+ public function register_actions(){
47
+
48
+ if(isset( $_POST['mf_settings_page_action'])) {
49
+ // run a quick security check
50
+ //$key = !isset($_POST['metform-settings-page-key']) ? '' : sanitize_text_field($_POST['metform-settings-page-key']);
51
+ $request = $_POST;
52
+
53
+ if( !check_admin_referer('metform-settings-page', 'metform-settings-page')){
54
+ return;
55
+ }
56
+
57
+ $status = \MetForm\Core\Forms\Action::instance()->store( -1, $request);
58
+
59
+ return $status;
60
+
61
+ }
62
+ }
63
+
64
+ }
core/admin/views/settings.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $settings = \MetForm\Core\Admin\Base::instance()->get_settings_option();
3
+ ?>
4
+ <div class="wrap">
5
+ <h2><?php esc_html_e('MetForm Settings', 'metform');?></h2>
6
+ <div class="mf-settings-tab">
7
+ <h2 class="nav-tab-wrapper">
8
+ <a href="#mf-general_options" class="nav-tab"><?php echo esc_html__('General', 'metform'); ?></a>
9
+ <?php if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal') || class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe')): ?>
10
+ <a href="#mf-payment_options" class="nav-tab"><?php echo esc_html__('Payment', 'metform'); ?></a>
11
+ <?php endif; ?>
12
+ <a href="#mf-mail_integration" class="nav-tab"><?php echo esc_html__('Mail Integration', 'metform'); ?></a>
13
+ </h2>
14
+ </div>
15
+ <div class="metform-admin-container stuffbox">
16
+ <div class="attr-card-body metform-admin-container--body">
17
+ <form action="" method="post" class="form-group mf-admin-input-text mf-admin-input-text--metform-license-key">
18
+
19
+ <!-- General Tab -->
20
+ <div class="mf-settings-section" id="mf-general_options">
21
+ <div class="mf-settings-single-section">
22
+ <h3 class="mf-settings-single-section--title"><?php esc_html_e('reCaptcha', 'metform');?></h3>
23
+ <div class="attr-form-group">
24
+ <label class="mf-setting-label" for="captcha-method"><?php esc_html_e('Select version:', 'metform');?></label>
25
+ <select name="mf_recaptcha_version" class="mf-setting-input attr-form-control mf-recaptcha-version" id="captcha-method">
26
+ <option <?php echo esc_attr((isset($settings['mf_recaptcha_version']) && ($settings['mf_recaptcha_version'] == 'recaptcha-v2')) ? 'Selected' : ''); ?> value="recaptcha-v2"><?php esc_html_e('reCAPTCHA V2', 'metform');?></option>
27
+ <option <?php echo esc_attr((isset($settings['mf_recaptcha_version']) && ($settings['mf_recaptcha_version'] == 'recaptcha-v3')) ? 'Selected' : ''); ?> value="recaptcha-v3"><?php esc_html_e('reCAPTCHA V3', 'metform');?></option>
28
+ </select>
29
+ <p class="description"><?php esc_html_e('Select google reCaptcha version which one want to use.', 'metform');?></p>
30
+ </div>
31
+
32
+ <div class="mf-recaptcha-settings-wrapper">
33
+ <div class="mf-recaptcha-settings" id="mf-recaptcha-v2">
34
+ <div class="attr-form-group">
35
+ <label class="mf-setting-label"><?php esc_html_e('Site key:', 'metform');?> </label>
36
+ <input type="text" name="mf_recaptcha_site_key" value="<?php echo esc_attr((isset($settings['mf_recaptcha_site_key'])) ? $settings['mf_recaptcha_site_key'] : ''); ?>" class="mf-setting-input attr-form-control mf-recaptcha-site-key" placeholder="<?php esc_html_e('Insert site key', 'metform');?>">
37
+ <p class="description"><?php esc_html_e('Create google reCaptcha site key from reCaptcha admin panel. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://www.google.com/recaptcha/admin/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
38
+ </div>
39
+ <div class="attr-form-group">
40
+ <label class="mf-setting-label"><?php esc_html_e('Secret key:', 'metform');?> </label>
41
+ <input type="text" name="mf_recaptcha_secret_key" value="<?php echo esc_attr((isset($settings['mf_recaptcha_secret_key'])) ? $settings['mf_recaptcha_secret_key'] : ''); ?>" class="mf-setting-input attr-form-control mf-recaptcha-secret-key" placeholder="<?php esc_html_e('Insert secret key', 'metform');?>">
42
+ <p class="description"><?php esc_html_e('Create google reCaptcha secret key from reCaptcha admin panel. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://www.google.com/recaptcha/admin/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
43
+ </div>
44
+ </div>
45
+
46
+ <div class="mf-recaptcha-settings" id="mf-recaptcha-v3">
47
+ <div class="attr-form-group">
48
+ <label class="mf-setting-label"><?php esc_html_e('Site key:', 'metform');?> </label>
49
+ <input type="text" name="mf_recaptcha_site_key_v3" value="<?php echo esc_attr((isset($settings['mf_recaptcha_site_key_v3'])) ? $settings['mf_recaptcha_site_key_v3'] : ''); ?>" class="mf-setting-input attr-form-control mf-recaptcha-site-key" placeholder="<?php esc_html_e('Insert site key', 'metform');?>">
50
+ <p class="description"><?php esc_html_e('Create google reCaptcha site key from reCaptcha admin panel. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://www.google.com/recaptcha/admin/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
51
+ </div>
52
+ <div class="attr-form-group">
53
+ <label class="mf-setting-label"><?php esc_html_e('Secret key:', 'metform');?> </label>
54
+ <input type="text" name="mf_recaptcha_secret_key_v3" value="<?php echo esc_attr((isset($settings['mf_recaptcha_secret_key_v3'])) ? $settings['mf_recaptcha_secret_key_v3'] : ''); ?>" class="mf-setting-input attr-form-control mf-recaptcha-secret-key" placeholder="<?php esc_html_e('Insert secret key', 'metform');?>">
55
+ <p class="description"><?php esc_html_e('Create google reCaptcha secret key from reCaptcha admin panel. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://www.google.com/recaptcha/admin/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
56
+ </div>
57
+ </div>
58
+ </div>
59
+
60
+ </div>
61
+ <?php if (class_exists('\MetForm_Pro\Base\Package')): ?>
62
+ <div class="mf-settings-single-section">
63
+ <h3 class="mf-settings-single-section--title"><?php esc_html_e('Map', 'metform');?></h3>
64
+ <div class="attr-form-group">
65
+ <label class="mf-setting-label"><?php esc_html_e('Map API:', 'metform');?> </label>
66
+ <input type="text" name="mf_google_map_api_key" value="<?php echo esc_attr((isset($settings['mf_google_map_api_key'])) ? $settings['mf_google_map_api_key'] : ''); ?>" class="mf-setting-input attr-form-control mf-google-map-api-key" placeholder="<?php esc_html_e('Insert map api key', 'metform');?>">
67
+ <p class="description"><?php esc_html_e('Create google map api key from google developer console. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://console.cloud.google.com/google/maps-apis/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
68
+ </div>
69
+ </div>
70
+ <?php endif; ?>
71
+ </div>
72
+ <!-- ./End General Tab -->
73
+
74
+ <!-- Payment Tab -->
75
+ <div class="mf-settings-section" id="mf-payment_options">
76
+ <div class="mf-settings-single-section">
77
+ <?php if (class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal')): ?>
78
+ <h3 class="mf-settings-single-section--title"><?php esc_html_e('Paypal', 'metform');?></h3>
79
+ <div class="attr-form-group">
80
+ <label class="mf-setting-label"><?php esc_html_e('Paypal email:', 'metform');?></label>
81
+ <input type="email" name="mf_paypal_email" value="<?php echo esc_attr((isset($settings['mf_paypal_email'])) ? $settings['mf_paypal_email'] : ''); ?>" class="mf-setting-input mf-paypal-email attr-form-control" placeholder="<?php esc_html_e('Paypal email', 'metform');?>">
82
+ <p class="description"><?php esc_html_e('Enter here your paypal email. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://www.paypal.com/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
83
+ </div>
84
+ <div class="attr-form-group">
85
+ <label class="mf-setting-label"><?php esc_html_e('Paypal token:', 'metform');?></label>
86
+ <input type="text" name="mf_paypal_token" value="<?php echo esc_attr((isset($settings['mf_paypal_token'])) ? $settings['mf_paypal_token'] : ''); ?>" class="mf-setting-input mf-paypal-token attr-form-control" placeholder="<?php esc_html_e('Paypal token', 'metform');?>">
87
+ <p class="description"><?php esc_html_e('Enter here your paypal token. This is optional. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://www.paypal.com/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
88
+ </div>
89
+ <div class="attr-form-group">
90
+ <label class="mf-setting-label"><?php esc_html_e('Enable sandbox mode:', 'metform');?>
91
+ <input type="checkbox" value="1" name="mf_paypal_sandbox" <?php echo esc_attr((isset($settings['mf_paypal_sandbox'])) ? 'Checked' : ''); ?> class="mf-admin-control-input mf-form-modalinput-paypal_sandbox">
92
+ <p class="description"><?php esc_html_e('Enable this for testing payment method. ', 'metform');?></p>
93
+ </label>
94
+ </div>
95
+ <?php endif;?>
96
+ </div>
97
+
98
+ <div class="mf-settings-single-section">
99
+ <?php if (class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe')): ?>
100
+ <h3 class="mf-settings-single-section--title"><?php esc_html_e('Stripe', 'metform');?></h3>
101
+ <div class="attr-form-group">
102
+ <label for="attr-input-label" class="mf-setting-label attr-input-label"><?php esc_html_e('Image url:', 'metform');?></label>
103
+ <input type="text" name="mf_stripe_image_url" value="<?php echo esc_attr((isset($settings['mf_stripe_image_url'])) ? $settings['mf_stripe_image_url'] : ''); ?>" class="mf-setting-input mf-stripe-image-url attr-form-control" placeholder="<?php esc_html_e('Stripe image url', 'metform');?>">
104
+ <p class="description"><?php esc_html_e('Enter here your stripe image url. This image will show on stripe payment pop up modal. ', 'metform');?></p>
105
+ </div>
106
+ <div class="attr-form-group">
107
+ <label for="attr-input-label" class="mf-setting-label attr-input-label"><?php esc_html_e('Live publishiable key:', 'metform');?></label>
108
+ <input type="text" name="mf_stripe_live_publishiable_key" value="<?php echo esc_attr((isset($settings['mf_stripe_live_publishiable_key'])) ? $settings['mf_stripe_live_publishiable_key'] : ''); ?>" class="mf-setting-input mf-stripe-live-publishiable-key attr-form-control" placeholder="<?php esc_html_e('Stripe live publishiable key', 'metform');?>">
109
+ <p class="description"><?php esc_html_e('Enter here your stripe live publishiable key. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://stripe.com/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
110
+ </div>
111
+ <div class="attr-form-group">
112
+ <label for="attr-input-label" class="mf-setting-label attr-input-label"><?php esc_html_e('Live secret key:', 'metform');?></label>
113
+ <input type="text" name="mf_stripe_live_secret_key" value="<?php echo esc_attr((isset($settings['mf_stripe_live_secret_key'])) ? $settings['mf_stripe_live_secret_key'] : ''); ?>" class="mf-setting-input mf-stripe-live-secret-key attr-form-control" placeholder="<?php esc_html_e('Stripe live secret key', 'metform');?>">
114
+ <p class="description"><?php esc_html_e('Enter here your stripe live secret key. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://stripe.com/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
115
+ </div>
116
+ <div class="attr-form-group">
117
+ <label class="mf-setting-label attr-input-label">
118
+ <?php esc_html_e('Enable sandbox mode:', 'metform');?>
119
+ <input type="checkbox" value="1" name="mf_stripe_sandbox" <?php echo esc_attr((isset($settings['mf_stripe_sandbox'])) ? 'Checked' : ''); ?> class="mf-admin-control-input mf-form-modalinput-stripe_sandbox">
120
+ <p class="description"><?php esc_html_e('Enable this for testing your payment system. ', 'metform');?></p>
121
+ </label>
122
+ </div>
123
+ <div class="mf-form-modalinput-stripe_sandbox_keys">
124
+ <div class="attr-form-group">
125
+ <label for="attr-input-label" class="mf-setting-label attr-input-label"><?php esc_html_e('Test publishiable key:', 'metform');?></label>
126
+ <input type="text" name="mf_stripe_test_publishiable_key" value="<?php echo esc_attr((isset($settings['mf_stripe_test_publishiable_key'])) ? $settings['mf_stripe_test_publishiable_key'] : ''); ?>" class="mf-setting-input mf-stripe-test-publishiable-key attr-form-control" placeholder="<?php esc_html_e('Stripe test publishiable key', 'metform');?>">
127
+ <p class="description"><?php esc_html_e('Enter here your test publishiable key. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://stripe.com/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
128
+ </div>
129
+ <div class="attr-form-group">
130
+ <label for="attr-input-label" class="mf-setting-label attr-input-label"><?php esc_html_e('Test secret key:', 'metform');?></label>
131
+ <input type="text" name="mf_stripe_test_secret_key" value="<?php echo esc_attr((isset($settings['mf_stripe_test_secret_key'])) ? $settings['mf_stripe_test_secret_key'] : ''); ?>" class="mf-setting-input mf-stripe-test-secret-key attr-form-control" placeholder="<?php esc_html_e('Stripe test secret key', 'metform');?>">
132
+ <p class="description"><?php esc_html_e('Enter here your test secret key. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://stripe.com/', 'metform'); ?>"><?php esc_html_e('Create from here', 'metform');?></a></p>
133
+ </div>
134
+ </div>
135
+ <?php endif;?>
136
+ </div>
137
+ </div>
138
+ <!-- ./End Payment Tab -->
139
+
140
+ <!-- Mail Integration Tab -->
141
+ <div class="mf-settings-section" id="mf-mail_integration">
142
+ <div class="mf-settings-single-section">
143
+ <h3 class="mf-settings-single-section--title"><?php esc_html_e('Campaign', 'metform');?></h3>
144
+ <?php if (class_exists('\MetForm\Core\Integrations\Mail_Chimp')): ?>
145
+ <div class="attr-form-group">
146
+ <label for="attr-input-label" class="mf-setting-label mf-setting-label attr-input-label"><?php esc_html_e('MailChimp API Key:', 'metform');?></label>
147
+ <input type="text" name="mf_mailchimp_api_key" value="<?php echo esc_attr((isset($settings['mf_mailchimp_api_key'])) ? $settings['mf_mailchimp_api_key'] : ''); ?>" class="mf-setting-input mf-mailchimp-api-key attr-form-control" placeholder="<?php esc_html_e('Mailchimp api key', 'metform');?>">
148
+ <p class="description"><?php esc_html_e('Enter here your Mailchimp api key. ', 'metform');?><a target="__blank" href="<?php echo esc_url('https://admin.mailchimp.com/'); ?>"><?php esc_html_e('Get API.', 'metform'); ?></a></p>
149
+ </div>
150
+ <?php endif;?>
151
+ </div>
152
+ </div>
153
+ <!-- ./End Mail Integration Tab -->
154
+
155
+ <input type="hidden" name="mf_settings_page_action" value="save">
156
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'metform');?>">
157
+
158
+ <?php wp_nonce_field('metform-settings-page', 'metform-settings-page');?>
159
+ </form>
160
+ </div>
161
+ </div>
162
+ </div>
core/entries/action.php CHANGED
@@ -7,7 +7,7 @@ Class Action{
7
 
8
  private $key_form_id;
9
  private $key_form_data;
10
- private $key_form_settings;
11
  private $key_browser_data;
12
  private $key_form_total_entries;
13
  private $key_form_file;
@@ -39,7 +39,7 @@ Class Action{
39
  ],
40
  ];
41
 
42
- $this->key_form_settings = 'metform_form__form_setting';
43
  $this->key_form_total_entries = 'metform_form__form_total_entries';
44
  $this->key_browser_data = 'metform_form__entry_browser_data';
45
  $this->key_form_id = 'metform_entries__form_id';
@@ -53,7 +53,8 @@ Class Action{
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->fields = $this->get_fields($form_id);
58
 
59
  $this->response->data['redirect_to'] = (!isset($this->form_settings['redirect_to'])) ? '' : $this->form_settings['redirect_to'];
@@ -79,44 +80,31 @@ Class Action{
79
  }
80
 
81
  // google recaptcha condition and action
82
- if(isset($this->form_settings['mf_recaptcha']) && (isset($form_data['g-recaptcha-response'])) && (isset($this->fields['mf-recaptcha'])) && $this->form_settings['mf_recaptcha_site_key'] != ''){
83
- if((isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '') == ""){
84
  $this->response->status = 0;
85
  $this->response->error[] = esc_html__('Please solve the recaptcha.','metform');
86
  return $this->response;
87
  }
88
 
89
- $secretKey = (($this->form_settings['mf_recaptcha_secret_key'] != '') ? $this->form_settings['mf_recaptcha_secret_key'] : '');
90
-
91
- $captcha = (isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '');
92
-
93
- $url = 'https://www.google.com/recaptcha/api/siteverify';
94
- $data = array(
95
- 'secret' => $secretKey,
96
- 'response' => $captcha,
97
- 'remoteip' => $_SERVER['REMOTE_ADDR']
98
- );
99
-
100
- $curlConfig = array(
101
- CURLOPT_URL => $url,
102
- CURLOPT_POST => true,
103
- CURLOPT_RETURNTRANSFER => true,
104
- CURLOPT_POSTFIELDS => $data
105
- );
106
-
107
- $ch = curl_init();
108
- curl_setopt_array($ch, $curlConfig);
109
- $response = curl_exec($ch);
110
- curl_close($ch);
111
-
112
- $responseKeys = json_decode($response,true);
113
- $this->response->data['responseKeys'] = $responseKeys;
114
-
115
- if($responseKeys["success"]) {
116
- $this->response->status = 1;
117
- } else {
118
  $this->response->status = 0;
119
- $this->response->error[] = esc_html__('Captcha is not verified.','metform');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  return $this->response;
121
  }
122
  }
@@ -291,7 +279,7 @@ Class Action{
291
 
292
  $paymet_method = $this->get_input_name_by_widget_type('mf-payment-method');
293
 
294
- if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal') && isset($this->form_settings['mf_paypal']) && ($this->form_settings['mf_paypal_email'] != '') && ($paymet_method[0] != null) ){
295
  if(isset($this->form_data[$paymet_method[0]]) && $this->form_data[$paymet_method[0]] == 'paypal'){
296
  update_post_meta( $this->entry_id, $this->key_payment_status, 'unpaid');
297
  $rest_url = get_rest_url( null, 'metform/v1/entries/');
@@ -610,9 +598,9 @@ Class Action{
610
  ];
611
  }
612
 
613
- public function get_form_settings($form_id){
614
- return get_post_meta($form_id, $this->key_form_settings, true);
615
- }
616
 
617
  public function get_input_name_by_widget_type( $widget_type, $fields = null ){
618
  global $w;
7
 
8
  private $key_form_id;
9
  private $key_form_data;
10
+ //private $key_form_settings;
11
  private $key_browser_data;
12
  private $key_form_total_entries;
13
  private $key_form_file;
39
  ],
40
  ];
41
 
42
+ //$this->key_form_settings = 'metform_form__form_setting';
43
  $this->key_form_total_entries = 'metform_form__form_total_entries';
44
  $this->key_browser_data = 'metform_form__entry_browser_data';
45
  $this->key_form_id = 'metform_entries__form_id';
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);
58
  $this->fields = $this->get_fields($form_id);
59
 
60
  $this->response->data['redirect_to'] = (!isset($this->form_settings['redirect_to'])) ? '' : $this->form_settings['redirect_to'];
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
  }
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/');
598
  ];
599
  }
600
 
601
+ // public function get_form_settings($form_id){
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;
core/entries/meta-data.php CHANGED
@@ -83,7 +83,7 @@ Class Meta_Data{
83
  // call browser data meta when browser data present
84
  $post_id = (isset($_GET['post']) ? $_GET['post'] : '');
85
  $form_id = get_post_meta($post_id, 'metform_entries__form_id', true);
86
- $form_settings = Action::instance()->get_form_settings($form_id);
87
 
88
  $this->browser_data = get_post_meta($post_id, 'metform_form__entry_browser_data', true);
89
  if($this->browser_data == '' && !isset($form_settings['capture_user_browser_data'])){
83
  // call browser data meta when browser data present
84
  $post_id = (isset($_GET['post']) ? $_GET['post'] : '');
85
  $form_id = get_post_meta($post_id, 'metform_entries__form_id', true);
86
+ $form_settings = \MetForm\Core\Forms\Action::instance()->get_all_data($form_id);
87
 
88
  $this->browser_data = get_post_meta($post_id, 'metform_form__entry_browser_data', true);
89
  if($this->browser_data == '' && !isset($form_settings['capture_user_browser_data'])){
core/forms/action.php CHANGED
@@ -7,6 +7,7 @@ Class Action{
7
  use \MetForm\Traits\Singleton;
8
 
9
  private $key_form_settings;
 
10
  private $key_form_count_views;
11
  private $post_type;
12
 
@@ -19,6 +20,7 @@ Class Action{
19
  public function __construct(){
20
 
21
  $this->key_form_settings = Base::instance()->form->get_key_form_settings();
 
22
  $this->key_form_count_views = 'metform_form__count_views';
23
  $this->post_type = Base::instance()->form->get_name();
24
 
@@ -39,12 +41,12 @@ Class Action{
39
  $this->sanitize( $form_setting );
40
  $this->form_id = $form_id;
41
 
42
- if(isset($form_setting['mf_zapier']) && $form_setting['mf_zapier'] == '1' && $form_setting['mf_zapier'] != ''){
43
 
44
  $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
45
  $email_name = \MetForm\Core\Entries\Action::instance()->get_input_name_by_widget_type('mf-email', $map_data);
46
 
47
- $existing_settings = \MetForm\Core\Entries\Action::instance()->get_form_settings($this->form_id);
48
  $zapier = new \MetForm_Pro\Core\Integrations\Zapier();
49
 
50
  $url = $form_setting['mf_zapier_webhook'];
@@ -57,15 +59,27 @@ Class Action{
57
 
58
  }
59
 
60
- if($this->form_id == 0){
 
 
61
  $this->insert();
62
- }else{
63
  $this->update();
64
  }
65
 
66
  return $this->response;
67
 
68
  }
 
 
 
 
 
 
 
 
 
 
69
 
70
  public function insert(){
71
  if( !current_user_can( 'manage_options' ) ){
@@ -160,11 +174,25 @@ Class Action{
160
 
161
  $post = get_post( $post_id );
162
 
163
- $data = get_post_meta( $post->ID, $this->key_form_settings, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
165
- $data['form_title'] = get_the_title($post_id);
166
 
167
- return $data;
168
 
169
  }
170
 
7
  use \MetForm\Traits\Singleton;
8
 
9
  private $key_form_settings;
10
+ private $key_option_settings;
11
  private $key_form_count_views;
12
  private $post_type;
13
 
20
  public function __construct(){
21
 
22
  $this->key_form_settings = Base::instance()->form->get_key_form_settings();
23
+ $this->key_option_settings = 'metform_option__settings';
24
  $this->key_form_count_views = 'metform_form__count_views';
25
  $this->post_type = Base::instance()->form->get_name();
26
 
41
  $this->sanitize( $form_setting );
42
  $this->form_id = $form_id;
43
 
44
+ if(isset($form_setting['mf_zapier']) && isset($form_setting['mf_zapier_webhook']) && $form_setting['mf_zapier_webhook'] != ''){
45
 
46
  $map_data = \MetForm\Core\Entries\Action::instance()->get_fields($form_id);
47
  $email_name = \MetForm\Core\Entries\Action::instance()->get_input_name_by_widget_type('mf-email', $map_data);
48
 
49
+ $existing_settings = \MetForm\Core\Forms\Action::instance()->get_all_data($this->form_id);
50
  $zapier = new \MetForm_Pro\Core\Integrations\Zapier();
51
 
52
  $url = $form_setting['mf_zapier_webhook'];
59
 
60
  }
61
 
62
+ if($this->form_id == -1 ){
63
+ $this->update_option_settings();
64
+ } else if($this->form_id == 0){
65
  $this->insert();
66
+ } else{
67
  $this->update();
68
  }
69
 
70
  return $this->response;
71
 
72
  }
73
+
74
+ public function update_option_settings(){
75
+ $status = update_option( $this->key_option_settings, $this->form_setting );
76
+ if($status){
77
+ $this->response['saved'] = true;
78
+ $this->response['status'] = esc_html__('Form settings inserted','metform');
79
+ $this->response['key'] = $this->key_option_settings;
80
+ $this->response['data'] = $this->form_setting;
81
+ }
82
+ }
83
 
84
  public function insert(){
85
  if( !current_user_can( 'manage_options' ) ){
174
 
175
  $post = get_post( $post_id );
176
 
177
+ if( ! property_exists($post, 'ID')){
178
+ return null;
179
+ }
180
+
181
+ $settings = get_post_meta( $post->ID, $this->key_form_settings, true );
182
+ $settings = (is_array($settings) ? $settings : []);
183
+
184
+ $global_settings = \MetForm\Core\Admin\Base::instance()->get_settings_option();
185
+ $global_settings = (is_array($global_settings) ? $global_settings : []);
186
+
187
+ if(empty($global_settings)){
188
+ $all_settings = $settings;
189
+ }else{
190
+ $all_settings = array_merge( $settings, $global_settings );
191
+ }
192
 
193
+ $all_settings['form_title'] = get_the_title($post_id);
194
 
195
+ return $all_settings;
196
 
197
  }
198
 
core/forms/cpt.php CHANGED
@@ -161,15 +161,27 @@ Class Cpt extends \MetForm\Base\Cpt{
161
  'mf_stripe_test_secret_key' => [
162
  'name' => 'mf_stripe_test_secret_key',
163
  ],
 
 
 
164
  'mf_recaptcha' => [
165
  'name' => 'mf_recaptcha',
166
  ],
 
 
 
167
  'mf_recaptcha_site_key' => [
168
  'name' => 'mf_recaptcha_site_key',
169
  ],
170
  'mf_recaptcha_secret_key' => [
171
  'name' => 'mf_recaptcha_secret_key',
172
  ],
 
 
 
 
 
 
173
  ];
174
  }
175
 
161
  'mf_stripe_test_secret_key' => [
162
  'name' => 'mf_stripe_test_secret_key',
163
  ],
164
+ 'mf_google_map_api_key' => [
165
+ 'name' => 'mf_google_map_api_key',
166
+ ],
167
  'mf_recaptcha' => [
168
  'name' => 'mf_recaptcha',
169
  ],
170
+ 'mf_recaptcha_version' => [
171
+ 'name' => 'mf_recaptcha_version',
172
+ ],
173
  'mf_recaptcha_site_key' => [
174
  'name' => 'mf_recaptcha_site_key',
175
  ],
176
  'mf_recaptcha_secret_key' => [
177
  'name' => 'mf_recaptcha_secret_key',
178
  ],
179
+ 'mf_recaptcha_site_key_v3' => [
180
+ 'name' => 'mf_recaptcha_site_key_v3',
181
+ ],
182
+ 'mf_recaptcha_secret_key_v3' => [
183
+ 'name' => 'mf_recaptcha_secret_key_v3',
184
+ ],
185
  ];
186
  }
187
 
core/forms/views/modal-editor.php CHANGED
@@ -229,19 +229,13 @@
229
  <input type="checkbox" value="1" name="mf_mail_chimp" class="mf-admin-control-input mf-form-modalinput-mail_chimp">
230
  <span><?php esc_html_e('Mail Chimp:', 'metform'); ?></span>
231
  </label>
232
- <span class='mf-input-help'><?php esc_html_e('Integrate mailchimp with this form.','metform'); ?><strong><?php esc_html_e('The form must have at least one Email widget and it should be required.', 'metform'); ?></strong></span>
233
- </div>
234
- <br>
235
- <div class="mf-input-group mf-mailchimp">
236
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('MailChimp API Key:', 'metform'); ?></label>
237
- <input type="text" name="mf_mailchimp_api_key" class="mf-mailchimp-api-key attr-form-control" placeholder="<?php esc_html_e('Mailchimp api key', 'metform');?>">
238
- <span class='mf-input-help'><?php esc_html_e('Enter here mailchimp api key.','metform'); ?></span>
239
  </div>
240
  <br>
241
  <div class="mf-input-group mf-mailchimp">
242
  <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('MailChimp List ID:', 'metform'); ?></label>
243
  <input type="text" name="mf_mailchimp_list_id" class="mf-mailchimp-list-id attr-form-control" placeholder="<?php esc_html_e('Mailchimp contact list id', 'metform');?>">
244
- <span class='mf-input-help'><?php esc_html_e('Enter here mailchimp list id.','metform'); ?></span>
245
  </div>
246
  <br>
247
  <?php endif ?>
@@ -285,21 +279,8 @@
285
  <input type="checkbox" value="1" name="mf_recaptcha" class="mf-admin-control-input mf-form-modalinput-recaptcha">
286
  <span><?php esc_html_e('reCAPTCHA:', 'metform'); ?></span>
287
  </label>
288
- <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></span>
289
- </div>
290
- <br>
291
- <div class="mf-input-group mf-recaptcha">
292
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Site Key:', 'metform'); ?></label>
293
- <input type="text" name="mf_recaptcha_site_key" class="mf-recaptcha-site-key attr-form-control" placeholder="<?php esc_html_e('Google recaptcha v2 site key', 'metform');?>">
294
- <span class='mf-input-help'><?php esc_html_e('make your reCAPTCHA from google','metform'); ?><strong><?php esc_html_e(' reCAPTCHA V2. ', 'metform'); ?></strong><a target="_blank"href="https://www.google.com/recaptcha/admin"><?php esc_html_e('Create from here', 'metform')?></a></span>
295
- </div>
296
- <br>
297
- <div class="mf-input-group mf-recaptcha">
298
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Secret Key:', 'metform'); ?></label>
299
- <input type="text" name="mf_recaptcha_secret_key" class="mf-recaptcha-secret-key attr-form-control" placeholder="<?php esc_html_e('Google recaptcha v2 secret key', 'metform');?>">
300
- <span class='mf-input-help'><?php esc_html_e('make your reCAPTCHA from google','metform'); ?><strong><?php esc_html_e(' reCAPTCHA V2. ', 'metform'); ?></strong><a target="_blank"href="https://www.google.com/recaptcha/admin"><?php esc_html_e('Create from here', 'metform')?></a></span>
301
  </div>
302
- <br>
303
 
304
  </div>
305
 
@@ -316,7 +297,7 @@
316
  <br>
317
  <div class="mf-input-group">
318
  <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Failed/ Cancel url:', 'metform'); ?></label>
319
- <input type="text" name="failed_cancel_url" class="mf-form-modalinput-failed_cancel_url attr-form-control" placeholder="<?php esc_html_e('Failed/Cancel url', 'metform'); ?>">
320
  <span class='mf-input-help'><?php esc_html_e('Users will be redirected to the this link after any failure/ cancelation of form submission.','metform'); ?></span>
321
  </div>
322
  <?php if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal')): ?>
@@ -325,29 +306,8 @@
325
  <input type="checkbox" value="1" name="mf_paypal" class="mf-admin-control-input mf-form-modalinput-paypal">
326
  <span><?php esc_html_e('Paypal:', 'metform'); ?></span>
327
  </label>
328
- <span class='mf-input-help'><?php esc_html_e('Integrate paypal payment with this form.','metform'); ?><strong><?php esc_html_e('Paypal payment.', 'metform'); ?></strong></span>
329
- </div>
330
- <br>
331
- <div class="mf-input-group mf-paypal">
332
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Paypal email:', 'metform'); ?></label>
333
- <input type="email" name="mf_paypal_email" class="mf-paypal-email attr-form-control" placeholder="<?php esc_html_e('Paypal email', 'metform');?>">
334
- <span class='mf-input-help'><?php esc_html_e('Enter here paypal email.','metform'); ?><a href="https://www.paypal.com/"><?php esc_html_e('create from here', 'metform');?></a></span>
335
- </div>
336
- <br>
337
- <div class="mf-input-group mf-paypal">
338
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Paypal token:', 'metform'); ?></label>
339
- <input type="text" name="mf_paypal_token" class="mf-paypal-token attr-form-control" placeholder="<?php esc_html_e('Paypal token', 'metform');?>">
340
- <span class='mf-input-help'><?php esc_html_e('Enter here paypal token. This is optional.','metform'); ?></span>
341
- </div>
342
- <br>
343
- <div class="mf-input-group mf-paypal">
344
- <label class="attr-input-label">
345
- <input type="checkbox" value="1" name="mf_paypal_sandbox" class="mf-admin-control-input mf-form-modalinput-paypal_sandbox">
346
- <span><?php esc_html_e('Enable sandbox mode:', 'metform'); ?></span>
347
- </label>
348
- <span class='mf-input-help'><?php esc_html_e('Enable sandbox mode for testing paypal payment','metform'); ?></span>
349
  </div>
350
- <br>
351
  <?php endif ?>
352
  <br>
353
 
@@ -357,47 +317,8 @@
357
  <input type="checkbox" value="1" name="mf_stripe" class="mf-admin-control-input mf-form-modalinput-stripe">
358
  <span><?php esc_html_e('Stripe:', 'metform'); ?></span>
359
  </label>
360
- <span class='mf-input-help'><?php esc_html_e('Integrate stripe payment with this form.','metform'); ?><strong><?php esc_html_e('Stripe payment.', 'metform'); ?></strong></span>
361
- </div>
362
- <br>
363
- <div class="mf-input-group mf-stripe">
364
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Image url:', 'metform'); ?></label>
365
- <input type="text" name="mf_stripe_image_url" class="mf-stripe-image-url attr-form-control" placeholder="<?php esc_html_e('Stripe image url', 'metform');?>">
366
- <span class='mf-input-help'><?php esc_html_e('Enter here stripe image url.','metform'); ?></span>
367
- </div>
368
- <br>
369
- <div class="mf-input-group mf-stripe">
370
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Live publishiable key:', 'metform'); ?></label>
371
- <input type="text" name="mf_stripe_live_publishiable_key" class="mf-stripe-live-publishiable-key attr-form-control" placeholder="<?php esc_html_e('Stripe live publishiable key', 'metform');?>">
372
- <span class='mf-input-help'><?php esc_html_e('Enter here stripe live publishiable key.','metform'); ?></span>
373
- </div>
374
- <br>
375
- <div class="mf-input-group mf-stripe">
376
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Live secret key:', 'metform'); ?></label>
377
- <input type="text" name="mf_stripe_live_secret_key" class="mf-stripe-live-secret-key attr-form-control" placeholder="<?php esc_html_e('Stripe live secret key', 'metform');?>">
378
- <span class='mf-input-help'><?php esc_html_e('Enter here stripe live secret key.','metform'); ?></span>
379
- </div>
380
- <br>
381
- <div class="mf-input-group mf-stripe">
382
- <label class="attr-input-label">
383
- <input type="checkbox" value="1" name="mf_stripe_sandbox" class="mf-admin-control-input mf-form-modalinput-stripe_sandbox">
384
- <span><?php esc_html_e('Enable sandbox mode:', 'metform'); ?></span>
385
- </label>
386
- <span class='mf-input-help'><?php esc_html_e('Enable sandbox mode for testing stripe payment','metform'); ?></span>
387
- </div>
388
- <br>
389
- <div class="mf-input-group mf-stripe mf-stripe-sandbox">
390
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Test publishiable key:', 'metform'); ?></label>
391
- <input type="text" name="mf_stripe_test_publishiable_key" class="mf-stripe-test-publishiable-key attr-form-control" placeholder="<?php esc_html_e('Stripe test publishiable key', 'metform');?>">
392
- <span class='mf-input-help'><?php esc_html_e('Enter here stripe test publishiable key.','metform'); ?></span>
393
- </div>
394
- <br>
395
- <div class="mf-input-group mf-stripe mf-stripe-sandbox">
396
- <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Test secret key:', 'metform'); ?></label>
397
- <input type="text" name="mf_stripe_test_secret_key" class="mf-stripe-test-secret-key attr-form-control" placeholder="<?php esc_html_e('Stripe test secret key', 'metform');?>">
398
- <span class='mf-input-help'><?php esc_html_e('Enter here stripe test secret key.','metform'); ?></span>
399
  </div>
400
- <br>
401
  <?php endif ?>
402
  <br>
403
 
229
  <input type="checkbox" value="1" name="mf_mail_chimp" class="mf-admin-control-input mf-form-modalinput-mail_chimp">
230
  <span><?php esc_html_e('Mail Chimp:', 'metform'); ?></span>
231
  </label>
232
+ <span class='mf-input-help'><?php esc_html_e('Integrate mailchimp with this form.','metform'); ?><strong><?php esc_html_e('The form must have at least one Email widget and it should be required. ', 'metform'); ?><a target="_blank" href="<?php echo get_dashboard_url().'admin.php?page=metform-menu-settings'; ?>"><?php esc_html_e('Configure Mail Chimp.', 'metform'); ?></a></strong></span>
 
 
 
 
 
 
233
  </div>
234
  <br>
235
  <div class="mf-input-group mf-mailchimp">
236
  <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('MailChimp List ID:', 'metform'); ?></label>
237
  <input type="text" name="mf_mailchimp_list_id" class="mf-mailchimp-list-id attr-form-control" placeholder="<?php esc_html_e('Mailchimp contact list id', 'metform');?>">
238
+ <span class='mf-input-help'><?php esc_html_e('Enter here mailchimp list id. ','metform'); ?><a target="__blank" href="<?php echo esc_url('https://admin.mailchimp.com/'); ?>"><?php esc_html_e('Get list id', 'metform'); ?></a></span>
239
  </div>
240
  <br>
241
  <?php endif ?>
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
 
297
  <br>
298
  <div class="mf-input-group">
299
  <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Failed/ Cancel url:', 'metform'); ?></label>
300
+ <input type="text" name="mf_payment_failed_cancel_url" class="mf-form-modalinput-mf_payment_failed_cancel_url attr-form-control" placeholder="<?php esc_html_e('Failed/Cancel url', 'metform'); ?>">
301
  <span class='mf-input-help'><?php esc_html_e('Users will be redirected to the this link after any failure/ cancelation of form submission.','metform'); ?></span>
302
  </div>
303
  <?php if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Paypal')): ?>
306
  <input type="checkbox" value="1" name="mf_paypal" class="mf-admin-control-input mf-form-modalinput-paypal">
307
  <span><?php esc_html_e('Paypal:', 'metform'); ?></span>
308
  </label>
309
+ <span class='mf-input-help'><?php esc_html_e('Integrate paypal payment with this form.','metform'); ?><a target="_blank" href="<?php echo get_dashboard_url().'admin.php?page=metform-menu-settings'; ?>"><?php esc_html_e('Configure paypal payment.', 'metform'); ?></a></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  </div>
 
311
  <?php endif ?>
312
  <br>
313
 
317
  <input type="checkbox" value="1" name="mf_stripe" class="mf-admin-control-input mf-form-modalinput-stripe">
318
  <span><?php esc_html_e('Stripe:', 'metform'); ?></span>
319
  </label>
320
+ <span class='mf-input-help'><?php esc_html_e('Integrate stripe payment with this form. ','metform'); ?><a target="_blank" href="<?php echo get_dashboard_url().'admin.php?page=metform-menu-settings'; ?>"><?php esc_html_e('Configure stripe payment.', 'metform'); ?></a></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  </div>
 
322
  <?php endif ?>
323
  <br>
324
 
core/integrations/google-recaptcha.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MetForm\Core\Integrations;
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ Class Google_Recaptcha{
6
+ use \MetForm\Traits\Singleton;
7
+
8
+ private $return;
9
+
10
+ public function verify_captcha_v2( $form_data, $form_settings ){
11
+
12
+ $secretKey = ((isset($form_settings['mf_recaptcha_secret_key']) && ($form_settings['mf_recaptcha_secret_key'] != '')) ? $form_settings['mf_recaptcha_secret_key'] : '');
13
+
14
+ $captcha = (isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '');
15
+
16
+ $url = 'https://www.google.com/recaptcha/api/siteverify';
17
+ $data = array(
18
+ 'secret' => $secretKey,
19
+ 'response' => $captcha,
20
+ 'remoteip' => $_SERVER['REMOTE_ADDR']
21
+ );
22
+
23
+ $curlConfig = array(
24
+ CURLOPT_URL => $url,
25
+ CURLOPT_POST => true,
26
+ CURLOPT_RETURNTRANSFER => true,
27
+ CURLOPT_POSTFIELDS => $data
28
+ );
29
+
30
+ $ch = curl_init();
31
+ curl_setopt_array($ch, $curlConfig);
32
+ $response = curl_exec($ch);
33
+ curl_close($ch);
34
+
35
+ $responseKeys = json_decode($response,true);
36
+ $this->return['responseKeys'] = $responseKeys;
37
+
38
+ if($responseKeys["success"]) {
39
+ $this->return['status'] = 1;
40
+ } else {
41
+ $this->return['status'] = 0;
42
+ $this->return['error'] = esc_html__('Captcha is not verified.','metform');
43
+ }
44
+
45
+ return $this->return;
46
+ }
47
+
48
+ public function verify_captcha_v3( $form_data, $form_settings ){
49
+
50
+ $secretKey = ((isset($form_settings['mf_recaptcha_secret_key_v3']) && ($form_settings['mf_recaptcha_secret_key_v3'] != '')) ? $form_settings['mf_recaptcha_secret_key_v3'] : '');
51
+
52
+ $captcha = (isset($form_data['g-recaptcha-response-v3']) ? $form_data['g-recaptcha-response-v3'] : '');
53
+
54
+ $url = 'https://www.google.com/recaptcha/api/siteverify';
55
+ $data = array(
56
+ 'secret' => $secretKey,
57
+ 'response' => $captcha,
58
+ );
59
+
60
+ $curlConfig = array(
61
+ CURLOPT_URL => $url,
62
+ CURLOPT_POST => true,
63
+ CURLOPT_POSTFIELDS => $data,
64
+ CURLOPT_RETURNTRANSFER => true,
65
+ );
66
+
67
+ $ch = curl_init();
68
+ curl_setopt_array($ch, $curlConfig);
69
+ $response = curl_exec($ch);
70
+ curl_close($ch);
71
+
72
+ $responseKeys = json_decode($response,true);
73
+ $this->return['responseKeys'] = $responseKeys;
74
+
75
+ if($responseKeys["success"]) {
76
+ $this->return['status'] = 1;
77
+ } else {
78
+ $this->return['status'] = 0;
79
+ $this->return['error'] = esc_html__('Captcha is not verified.','metform');
80
+ }
81
+
82
+ return $this->return;
83
+ }
84
+ }
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.1.9
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.0
9
  * Author: Wpmet
10
  * Author URI: https://wpmet.com
11
  * Text Domain: metform
plugin.php CHANGED
@@ -7,14 +7,14 @@ final class Plugin{
7
  private static $instance;
8
 
9
  private $entries;
10
- private $forms;
11
 
12
  public function __construct(){
13
  Autoloader::run();
14
  }
15
 
16
  public function version(){
17
- return '1.1.9';
18
  }
19
 
20
  public function package_type(){
@@ -118,6 +118,9 @@ final class Plugin{
118
  // Add banner class
119
  include $this->utils_dir() . 'banner.php';
120
 
 
 
 
121
  add_action('admin_notices', function(){
122
  \WpMet_Banner::run();
123
  });
@@ -137,7 +140,18 @@ final class Plugin{
137
  wp_enqueue_script('select2', $this->public_url().'assets/js/select2.min.js', array(), $this->version(), true);
138
  wp_enqueue_script('flatpickr', $this->public_url().'assets/js/flatpickr.js', array(), $this->version(), true);
139
 
140
- wp_register_script('recaptcha', 'https://www.google.com/recaptcha/api.js?onload=onloadMetFormCallback&render=explicit', array(), $this->version(), true);
 
 
 
 
 
 
 
 
 
 
 
141
  wp_enqueue_script('metform-submission', $this->public_url().'assets/js/submission.js', array(), $this->version(), true);
142
  wp_localize_script('metform-submission', 'mf_submission', array(
143
  'default_required_message' => esc_html__('This field is required.', 'metform')
@@ -188,7 +202,7 @@ final class Plugin{
188
 
189
  $screen = get_current_screen();
190
 
191
- if(in_array($screen->id, ['edit-metform-form','metform_page_mt-form-settings', 'metform-entry'])){
192
 
193
  wp_enqueue_style('metform-ui', $this->public_url().'assets/css/metform-ui.css', false, $this->version());
194
  wp_enqueue_style('metform-admin-style', $this->public_url().'assets/css/admin-style.css', false, $this->version());
7
  private static $instance;
8
 
9
  private $entries;
10
+ private $global_settings;
11
 
12
  public function __construct(){
13
  Autoloader::run();
14
  }
15
 
16
  public function version(){
17
+ return '1.2.0';
18
  }
19
 
20
  public function package_type(){
118
  // Add banner class
119
  include $this->utils_dir() . 'banner.php';
120
 
121
+ // settings page
122
+ Core\Admin\Base::instance()->init();
123
+
124
  add_action('admin_notices', function(){
125
  \WpMet_Banner::run();
126
  });
140
  wp_enqueue_script('select2', $this->public_url().'assets/js/select2.min.js', array(), $this->version(), true);
141
  wp_enqueue_script('flatpickr', $this->public_url().'assets/js/flatpickr.js', array(), $this->version(), true);
142
 
143
+ wp_register_script('recaptcha-v2', 'https://www.google.com/recaptcha/api.js?onload=onloadMetFormCallback&render=explicit', array(), $this->version(), false);
144
+
145
+ $this->global_settings = \MetForm\Core\Admin\Base::instance()->get_settings_option();
146
+
147
+ if(isset($this->global_settings['mf_recaptcha_version']) && ( $this->global_settings['mf_recaptcha_version'] == 'recaptcha-v3' ) && isset($this->global_settings['mf_recaptcha_site_key_v3']) && ( $this->global_settings['mf_recaptcha_site_key_v3'] != '' ) ){
148
+ wp_register_script('recaptcha-v3', 'https://www.google.com/recaptcha/api.js?render='. $this->global_settings['mf_recaptcha_site_key_v3'], array(), $this->version(), false);
149
+ }
150
+
151
+ if(isset($this->global_settings['mf_google_map_api_key']) && ( $this->global_settings['mf_google_map_api_key'] != '' ) ){
152
+ wp_register_script( 'maps-api', 'https://maps.googleapis.com/maps/api/js?key='.$this->global_settings['mf_google_map_api_key'].'&libraries=places&callback=metformMapAutoComplete', array(), '', true );
153
+ }
154
+
155
  wp_enqueue_script('metform-submission', $this->public_url().'assets/js/submission.js', array(), $this->version(), true);
156
  wp_localize_script('metform-submission', 'mf_submission', array(
157
  'default_required_message' => esc_html__('This field is required.', 'metform')
202
 
203
  $screen = get_current_screen();
204
 
205
+ if(in_array($screen->id, ['edit-metform-form','metform_page_mt-form-settings', 'metform-entry', 'metform_page_metform-menu-settings'])){
206
 
207
  wp_enqueue_style('metform-ui', $this->public_url().'assets/css/metform-ui.css', false, $this->version());
208
  wp_enqueue_style('metform-admin-style', $this->public_url().'assets/css/admin-style.css', false, $this->version());
public/assets/css/admin-style.css CHANGED
@@ -1 +1,433 @@
1
- .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}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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; }
public/assets/css/style.css CHANGED
@@ -519,4 +519,48 @@ ul.mf-input.mf-input-rating{
519
  }
520
  .mf-input-wrapper .select2 {
521
  width: 100% !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  }
519
  }
520
  .mf-input-wrapper .select2 {
521
  width: 100% !important;
522
+ }
523
+
524
+ /* summary table css */
525
+ td.mf-value-space {
526
+ border: none;
527
+ border-width: 0;
528
+ }
529
+ .mf-input.metform-entry-data.container {
530
+ border: none;
531
+ padding: 0;
532
+ }
533
+ tr.mf-data-value > td {
534
+ border-width: 0;
535
+ }
536
+
537
+
538
+ .mf-captcha-input-wrapper.mf-captcha-block > i {
539
+ padding-left: 25px;
540
+ }
541
+
542
+ img.mf-input.mf-captcha-image{
543
+ max-width: 200px;
544
+ border: none;
545
+ box-sizing: unset;
546
+ background: transparent;
547
+ padding: 0;
548
+ display: inline-block;
549
+ }
550
+
551
+ .mf-captcha-block > img.mf-input.mf-captcha-image {
552
+ margin: 5px 0 5px 0;
553
+ }
554
+ .mf-captcha-inline > img.mf-input.mf-captcha-image {
555
+ margin: 0 5px 0 0;
556
+ }
557
+ .mf-captcha-input-wrapper.mf-captcha-inline {
558
+ display: inline-flex !important;
559
+ align-items: center;
560
+ width: 100%;
561
+ }
562
+
563
+ .mf-captcha-input-wrapper.mf-captcha-inline > i {
564
+ margin-left: 25px !important;
565
+ order: 1;
566
  }
public/assets/js/admin-script.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){"use strict";function t(t){if(e(".mf-form-user-confirmation").hide(),e(".mf-form-admin-notification").hide(),e(".mf-input-rest-api-group").hide(),e(".mf-mailchimp").hide(),e(".mf-zapier").hide(),e(".mf-slack").hide(),e(".mf-paypal").hide(),e(".mf-stripe").hide(),e(".mf-recaptcha").hide(),""!=t.form_title){e(".mf-form-modalinput-title").val(t.form_title),e(".mf-form-modalinput-success_message").val(t.success_message),e(".mf-form-modalinput-redirect_to").val(t.redirect_to),e(".mf-form-modalinput-success_url").val(t.success_url),e(".mf-form-modalinput-failed_cancel_url").val(t.failed_cancel_url),e(".mf-form-modalinput-limit_total_entries").val(t.limit_total_entries);var i=e(".mf-form-modalinput-store_entries");"1"==t.store_entries?i.attr("checked",!0):i.removeAttr("checked");var a=e(".mf-form-modalinput-hide_form_after_submission");"1"==t.hide_form_after_submission?a.attr("checked",!0):a.removeAttr("checked");var m=e(".mf-form-modalinput-require_login");"1"==t.require_login?m.attr("checked",!0):m.removeAttr("checked");var r=e(".mf-form-modalinput-limit_status");"1"==t.limit_total_entries_status?r.attr("checked",!0):r.removeAttr("checked");var o=e(".mf-form-modalinput-count_views");"1"==t.count_views?o.attr("checked",!0):o.removeAttr("checked");var s=e(".mf-form-modalinput-multiple_submission");"1"==t.multiple_submission?s.attr("checked",!0):s.removeAttr("checked");var c=e(".mf-form-modalinput-enable_recaptcha");"1"==t.enable_recaptcha?c.attr("checked",!0):c.removeAttr("checked");var f=e(".mf-form-modalinput-capture_user_browser_data");"1"==t.capture_user_browser_data?(f.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):f.removeAttr("checked"),e(".mf-form-user-email-subject").val(t.user_email_subject),e(".mf-form-user-email-from").val(t.user_email_from),e(".mf-form-user-reply-to").val(t.user_email_reply_to),e(".mf-form-user-email-body").val(t.user_email_body);var n=e(".mf-form-user-enable");"1"==t.enable_user_notification?(n.attr("checked",!0),e(".mf-form-user-confirmation").show()):(n.removeAttr("checked"),e(".mf-form-user-confirmation").hide());var d=e(".mf-form-user-submission-copy");"1"==t.user_email_attach_submission_copy?d.attr("checked",!0):d.removeAttr("checked"),e(".mf-form-admin-email-subject").val(t.admin_email_subject),e(".mf-form-admin-email-from").val(t.admin_email_from),e(".mf-form-admin-email-to").val(t.admin_email_to),e(".mf-form-admin-reply-to").val(t.admin_email_reply_to),e(".mf-form-admin-email-body").val(t.admin_email_body);var l=e(".mf-form-admin-enable");"1"==t.enable_admin_notification?(l.attr("checked",!0),e(".mf-form-admin-notification").show()):(l.removeAttr("checked"),e(".mf-form-admin-notification").hide());var p=e(".mf-form-admin-submission-copy");"1"==t.admin_email_attach_submission_copy?p.attr("checked",!0):p.removeAttr("checked");var h=e(".mf-form-modalinput-rest_api");"1"==t.mf_rest_api?(h.attr("checked",!0),e(".mf-rest-api").show()):(h.removeAttr("checked"),e(".mf-rest-api").hide());var _=e(".mf-form-modalinput-mail_chimp");"1"==t.mf_mail_chimp?(_.attr("checked",!0),e(".mf-mailchimp").show()):(_.removeAttr("checked"),e(".mf-mailchimp").hide());var u=e(".mf-form-modalinput-zapier");"1"==t.mf_zapier?(u.attr("checked",!0),e(".mf-zapier").show()):(u.removeAttr("checked",!0),e(".mf-zapier").hide());var v=e(".mf-form-modalinput-slack");"1"==t.mf_slack?(v.attr("checked",!0),e(".mf-slack").show()):(v.removeAttr("checked",!0),e(".mf-slack").hide());var k=e(".mf-form-modalinput-paypal");"1"==t.mf_paypal?(k.attr("checked",!0),e(".mf-paypal").show()):(k.removeAttr("checked",!0),e(".mf-paypal").hide());var b=e(".mf-form-modalinput-stripe");"1"==t.mf_stripe?(b.attr("checked",!0),e(".mf-stripe").show()):(b.removeAttr("checked",!0),e(".mf-stripe").hide());b=e(".mf-form-modalinput-stripe");"1"==t.mf_stripe?(b.attr("checked",!0),e(".mf-stripe").show()):(b.removeAttr("checked",!0),e(".mf-stripe").hide());var y=e(".mf-form-modalinput-paypal_sandbox");"1"==t.mf_paypal_sandbox?y.attr("checked",!0):y.removeAttr("checked",!0);var g=e(".mf-form-modalinput-stripe_sandbox");"1"==t.mf_stripe_sandbox?g.attr("checked",!0):g.removeAttr("checked",!0);var w=e(".mf-form-modalinput-recaptcha");"1"==t.mf_recaptcha?(w.attr("checked",!0),e(".mf-recaptcha").show()):w.removeAttr("checked");var A=t.mf_rest_api_method&&t.mf_rest_api_method.length?t.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+A+'"]').prop("selected",!0),e(".mf-rest-api-url").val(t.mf_rest_api_url),e(".mf-mailchimp-api-key").val(t.mf_mailchimp_api_key),e(".mf-mailchimp-list-id").val(t.mf_mailchimp_list_id),e(".mf-zapier-web-hook").val(t.mf_zapier_webhook),e(".mf-slack-web-hook").val(t.mf_slack_webhook),e(".mf-paypal-email").val(t.mf_paypal_email),e(".mf-paypal-token").val(t.mf_paypal_token),e(".mf-stripe-image-url").val(t.mf_stripe_image_url),e(".mf-stripe-live-publishiable-key").val(t.mf_stripe_live_publishiable_key),e(".mf-stripe-live-secret-key").val(t.mf_stripe_live_secret_key),e(".mf-stripe-test-publishiable-key").val(t.mf_stripe_test_publishiable_key),e(".mf-stripe-test-secret-key").val(t.mf_stripe_test_secret_key),e(".mf-recaptcha-site-key").val(t.mf_recaptcha_site_key),e(".mf-recaptcha-secret-key").val(t.mf_recaptcha_secret_key),e("input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api").trigger("change")}}e(".row-actions .edit a, .page-title-action, .metform-form-edit-btn, body.post-type-metform-form a.row-title").on("click",function(i){i.preventDefault();var a=0,m=e("#metform_form_modal"),r=e(this).parents(".column-title"),o=e("body").attr("data-metform-template-key");if(m.addClass("loading"),m.modal("show"),r.length>0){a=e(this).attr("data-metform-form-id"),"undefined"!==o&&(a=o),a=void 0!==a?a:r.find(".hidden").attr("id").split("_")[1];var s=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get/"+a,type:"get",headers:{"X-WP-Nonce":s},dataType:"json",success:function(e){t(e),m.removeClass("loading")}})}else{t({form_title:e(".mf-form-modalinput-title").attr("data-default-value"),admin_email_body:"",admin_email_from:"",admin_email_reply_to:"",admin_email_subject:"",capture_user_browser_data:"",enable_admin_notification:"",limit_total_entries_status:"",limit_total_entries:"0",redirect_to:"",success_url:"",failed_cancel_url:"",require_login:"",store_entries:"1",success_message:e(".mf-form-modalinput-success_message").attr("data-default-value"),user_email_body:"",user_email_from:"",user_email_reply_to:"",user_email_subject:""}),m.removeClass("loading")}m.find("form").attr("data-mf-id",a)}),e(".metform-form-save-btn-editor").on("click",function(){e(".metform-form-save-btn-editor").attr("disabled",!0);var t=e("#metform-form-modalinput-settings");t.attr("data-open-editor","1"),t.trigger("submit")}),e("#metform-form-modalinput-settings").on("submit",function(t){t.preventDefault();var i=e("#metform-form-modal");i.addClass("loading"),e(".metform-form-save-btn-editor").attr("disabled",!0),e(".metform-form-save-btn").attr("disabled",!0);var a=e(this).serialize(),m=e(this).attr("data-mf-id"),r=e(this).attr("data-open-editor"),o=e(this).attr("data-editor-url"),s=e(this).attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/update/"+m,type:"post",data:a,headers:{"X-WP-Nonce":s},dataType:"json",success:function(t){e("#message").css("display","block"),1==t.saved?(e("#post-"+t.data.id).find(".row-title").html(t.data.title),e("#message").removeClass("attr-alert-warning").addClass("attr-alert-success").html(t.status)):e("#message").removeClass("attr-alert-success").addClass("attr-alert-warning").html(t.status),setTimeout(function(){e("#message").css("display","none")},5e3),i.removeClass("loading"),"1"==r&&1==t.saved?setTimeout(function(){window.location.href=o+"?post="+t.data.id+"&action=elementor"},1500):"0"!=m?(e(".metform-form-save-btn-editor").removeAttr("disabled"),e(".metform-form-save-btn").removeAttr("disabled")):"0"==m&&setTimeout(function(){location.reload()},1500)}})}),e("input.mf-form-modalinput-limit_status").on("change",function(){e(this).is(":checked")?e("#limit_status").find("input").removeAttr("disabled"):e(this).is(":not(:checked)")&&e("#limit_status").find("input").attr("disabled","disabled")}),e("input.mf-form-user-enable").on("change",function(){e(this).is(":checked")?e(".mf-form-user-confirmation").show():e(this).is(":not(:checked)")&&e(".mf-form-user-confirmation").hide()}),e("input.mf-form-admin-enable").on("change",function(){e(this).is(":checked")?e(".mf-form-admin-notification").show():e(this).is(":not(:checked)")&&e(".mf-form-admin-notification").hide()}),e("input.mf-form-modalinput-rest_api").on("change",function(){e(this).is(":checked")?e(".mf-input-rest-api-group").show():e(this).is(":not(:checked)")&&e(".mf-input-rest-api-group").hide()}),e("input.mf-form-modalinput-mail_chimp").on("change",function(){e(this).is(":checked")?e(".mf-mailchimp").show():e(this).is(":not(:checked)")&&e(".mf-mailchimp").hide()}),e("input.mf-form-modalinput-zapier").on("change",function(){e(this).is(":checked")?e(".mf-zapier").show():e(this).is(":not(:checked)")&&e(".mf-zapier").hide()}),e("input.mf-form-modalinput-slack").on("change",function(){e(this).is(":checked")?e(".mf-slack").show():e(this).is(":not(:checked)")&&e(".mf-slack").hide()}),e("input.mf-form-modalinput-paypal").on("change",function(){e(this).is(":checked")?e(".mf-paypal").show():e(this).is(":not(:checked)")&&e(".mf-paypal").hide()}),e("input.mf-form-modalinput-stripe").on("change",function(){e(this).is(":checked")?e(".mf-stripe").show():e(this).is(":not(:checked)")&&e(".mf-stripe").hide()}),e("input.mf-form-modalinput-stripe_sandbox").on("change",function(){e(this).is(":checked")?e(".mf_stripe_sandbox").show():e(this).is(":not(:checked)")&&e(".mf_stripe_sandbox").hide()}),e("input.mf-form-modalinput-recaptcha").on("change",function(){e(this).is(":checked")?e(".mf-recaptcha").show():e(this).is(":not(:checked)")&&e(".mf-recaptcha").hide()}),e("input.mf-form-modalinput-capture_user_browser_data").click(function(){e(this).is(":checked")?(e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):e(this).is(":not(:checked)")&&(e("#multiple_submission").removeClass("show_input"),e("#multiple_submission").addClass("hide_input"))})});
1
+ jQuery(document).ready(function(e){"use strict";function t(t){if(e(".mf-form-user-confirmation").hide(),e(".mf-form-admin-notification").hide(),e(".mf-input-rest-api-group").hide(),e(".mf-mailchimp").hide(),e(".mf-zapier").hide(),e(".mf-slack").hide(),e(".mf-paypal").hide(),e(".mf-stripe").hide(),e(".mf-recaptcha").hide(),""!=t.form_title){e(".mf-form-modalinput-title").val(t.form_title),e(".mf-form-modalinput-success_message").val(t.success_message),e(".mf-form-modalinput-redirect_to").val(t.redirect_to),e(".mf-form-modalinput-success_url").val(t.success_url),e(".mf-form-modalinput-failed_cancel_url").val(t.failed_cancel_url),e(".mf-form-modalinput-limit_total_entries").val(t.limit_total_entries);var i=e(".mf-form-modalinput-store_entries");"1"==t.store_entries?i.attr("checked",!0):i.removeAttr("checked");var a=e(".mf-form-modalinput-hide_form_after_submission");"1"==t.hide_form_after_submission?a.attr("checked",!0):a.removeAttr("checked");var m=e(".mf-form-modalinput-require_login");"1"==t.require_login?m.attr("checked",!0):m.removeAttr("checked");var r=e(".mf-form-modalinput-limit_status");"1"==t.limit_total_entries_status?r.attr("checked",!0):r.removeAttr("checked");var o=e(".mf-form-modalinput-count_views");"1"==t.count_views?o.attr("checked",!0):o.removeAttr("checked");var s=e(".mf-form-modalinput-multiple_submission");"1"==t.multiple_submission?s.attr("checked",!0):s.removeAttr("checked");var n=e(".mf-form-modalinput-enable_recaptcha");"1"==t.enable_recaptcha?n.attr("checked",!0):n.removeAttr("checked");var c=e(".mf-form-modalinput-capture_user_browser_data");"1"==t.capture_user_browser_data?(c.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):c.removeAttr("checked"),e(".mf-form-user-email-subject").val(t.user_email_subject),e(".mf-form-user-email-from").val(t.user_email_from),e(".mf-form-user-reply-to").val(t.user_email_reply_to),e(".mf-form-user-email-body").val(t.user_email_body);var f=e(".mf-form-user-enable");"1"==t.enable_user_notification?(f.attr("checked",!0),e(".mf-form-user-confirmation").show()):(f.removeAttr("checked"),e(".mf-form-user-confirmation").hide());var d=e(".mf-form-user-submission-copy");"1"==t.user_email_attach_submission_copy?d.attr("checked",!0):d.removeAttr("checked"),e(".mf-form-admin-email-subject").val(t.admin_email_subject),e(".mf-form-admin-email-from").val(t.admin_email_from),e(".mf-form-admin-email-to").val(t.admin_email_to),e(".mf-form-admin-reply-to").val(t.admin_email_reply_to),e(".mf-form-admin-email-body").val(t.admin_email_body);var l=e(".mf-form-admin-enable");"1"==t.enable_admin_notification?(l.attr("checked",!0),e(".mf-form-admin-notification").show()):(l.removeAttr("checked"),e(".mf-form-admin-notification").hide());var p=e(".mf-form-admin-submission-copy");"1"==t.admin_email_attach_submission_copy?p.attr("checked",!0):p.removeAttr("checked");var h=e(".mf-form-modalinput-rest_api");"1"==t.mf_rest_api?(h.attr("checked",!0),e(".mf-rest-api").show()):(h.removeAttr("checked"),e(".mf-rest-api").hide());var u=e(".mf-form-modalinput-mail_chimp");"1"==t.mf_mail_chimp?(u.attr("checked",!0),e(".mf-mailchimp").show()):(u.removeAttr("checked"),e(".mf-mailchimp").hide());var _=e(".mf-form-modalinput-zapier");"1"==t.mf_zapier?(_.attr("checked",!0),e(".mf-zapier").show()):(_.removeAttr("checked",!0),e(".mf-zapier").hide());var v=e(".mf-form-modalinput-slack");"1"==t.mf_slack?(v.attr("checked",!0),e(".mf-slack").show()):(v.removeAttr("checked",!0),e(".mf-slack").hide());var k=e(".mf-form-modalinput-paypal");"1"==t.mf_paypal?(k.attr("checked",!0),e(".mf-paypal").show()):(k.removeAttr("checked",!0),e(".mf-paypal").hide());var b=e(".mf-form-modalinput-stripe");"1"==t.mf_stripe?(b.attr("checked",!0),e(".mf-stripe").show()):(b.removeAttr("checked",!0),e(".mf-stripe").hide());b=e(".mf-form-modalinput-stripe");"1"==t.mf_stripe?(b.attr("checked",!0),e(".mf-stripe").show()):(b.removeAttr("checked",!0),e(".mf-stripe").hide());var g=e(".mf-form-modalinput-paypal_sandbox");"1"==t.mf_paypal_sandbox?g.attr("checked",!0):g.removeAttr("checked",!0);var y=e(".mf-form-modalinput-stripe_sandbox");"1"==t.mf_stripe_sandbox?y.attr("checked",!0):y.removeAttr("checked",!0);var w=e(".mf-form-modalinput-recaptcha");"1"==t.mf_recaptcha?(w.attr("checked",!0),e(".mf-recaptcha").show()):w.removeAttr("checked");var A=t.mf_rest_api_method&&t.mf_rest_api_method.length?t.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+A+'"]').prop("selected",!0),e(".mf-rest-api-url").val(t.mf_rest_api_url),e(".mf-mailchimp-api-key").val(t.mf_mailchimp_api_key),e(".mf-mailchimp-list-id").val(t.mf_mailchimp_list_id),e(".mf-zapier-web-hook").val(t.mf_zapier_webhook),e(".mf-slack-web-hook").val(t.mf_slack_webhook),e(".mf-paypal-email").val(t.mf_paypal_email),e(".mf-paypal-token").val(t.mf_paypal_token),e(".mf-stripe-image-url").val(t.mf_stripe_image_url),e(".mf-stripe-live-publishiable-key").val(t.mf_stripe_live_publishiable_key),e(".mf-stripe-live-secret-key").val(t.mf_stripe_live_secret_key),e(".mf-stripe-test-publishiable-key").val(t.mf_stripe_test_publishiable_key),e(".mf-stripe-test-secret-key").val(t.mf_stripe_test_secret_key),e(".mf-recaptcha-site-key").val(t.mf_recaptcha_site_key),e(".mf-recaptcha-secret-key").val(t.mf_recaptcha_secret_key),e("input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api").trigger("change")}}e(".row-actions .edit a, .page-title-action, .metform-form-edit-btn, body.post-type-metform-form a.row-title").on("click",function(i){i.preventDefault();var a=0,m=e("#metform_form_modal"),r=e(this).parents(".column-title"),o=e("body").attr("data-metform-template-key");if(m.addClass("loading"),m.modal("show"),r.length>0){a=e(this).attr("data-metform-form-id"),"undefined"!==o&&(a=o),a=void 0!==a?a:r.find(".hidden").attr("id").split("_")[1];var s=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get/"+a,type:"get",headers:{"X-WP-Nonce":s},dataType:"json",success:function(e){t(e),m.removeClass("loading")}})}else{t({form_title:e(".mf-form-modalinput-title").attr("data-default-value"),admin_email_body:"",admin_email_from:"",admin_email_reply_to:"",admin_email_subject:"",capture_user_browser_data:"",enable_admin_notification:"",limit_total_entries_status:"",limit_total_entries:"0",redirect_to:"",success_url:"",failed_cancel_url:"",require_login:"",store_entries:"1",success_message:e(".mf-form-modalinput-success_message").attr("data-default-value"),user_email_body:"",user_email_from:"",user_email_reply_to:"",user_email_subject:""}),m.removeClass("loading")}m.find("form").attr("data-mf-id",a)}),e(".metform-form-save-btn-editor").on("click",function(){e(".metform-form-save-btn-editor").attr("disabled",!0);var t=e("#metform-form-modalinput-settings");t.attr("data-open-editor","1"),t.trigger("submit")}),e("#metform-form-modalinput-settings").on("submit",function(t){t.preventDefault();var i=e("#metform-form-modal");i.addClass("loading"),e(".metform-form-save-btn-editor").attr("disabled",!0),e(".metform-form-save-btn").attr("disabled",!0);var a=e(this).serialize(),m=e(this).attr("data-mf-id"),r=e(this).attr("data-open-editor"),o=e(this).attr("data-editor-url"),s=e(this).attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/update/"+m,type:"post",data:a,headers:{"X-WP-Nonce":s},dataType:"json",success:function(t){e("#message").css("display","block"),1==t.saved?(e("#post-"+t.data.id).find(".row-title").html(t.data.title),e("#message").removeClass("attr-alert-warning").addClass("attr-alert-success").html(t.status)):e("#message").removeClass("attr-alert-success").addClass("attr-alert-warning").html(t.status),setTimeout(function(){e("#message").css("display","none")},5e3),i.removeClass("loading"),"1"==r&&1==t.saved?setTimeout(function(){window.location.href=o+"?post="+t.data.id+"&action=elementor"},1500):"0"!=m?(e(".metform-form-save-btn-editor").removeAttr("disabled"),e(".metform-form-save-btn").removeAttr("disabled")):"0"==m&&setTimeout(function(){location.reload()},1500)}})}),e("input.mf-form-modalinput-limit_status").on("change",function(){e(this).is(":checked")?e("#limit_status").find("input").removeAttr("disabled"):e(this).is(":not(:checked)")&&e("#limit_status").find("input").attr("disabled","disabled")}),e("input.mf-form-user-enable").on("change",function(){e(this).is(":checked")?e(".mf-form-user-confirmation").show():e(this).is(":not(:checked)")&&e(".mf-form-user-confirmation").hide()}),e("input.mf-form-admin-enable").on("change",function(){e(this).is(":checked")?e(".mf-form-admin-notification").show():e(this).is(":not(:checked)")&&e(".mf-form-admin-notification").hide()}),e("input.mf-form-modalinput-rest_api").on("change",function(){e(this).is(":checked")?e(".mf-input-rest-api-group").show():e(this).is(":not(:checked)")&&e(".mf-input-rest-api-group").hide()}),e("input.mf-form-modalinput-mail_chimp").on("change",function(){e(this).is(":checked")?e(".mf-mailchimp").show():e(this).is(":not(:checked)")&&e(".mf-mailchimp").hide()}),e("input.mf-form-modalinput-zapier").on("change",function(){e(this).is(":checked")?e(".mf-zapier").show():e(this).is(":not(:checked)")&&e(".mf-zapier").hide()}),e("input.mf-form-modalinput-slack").on("change",function(){e(this).is(":checked")?e(".mf-slack").show():e(this).is(":not(:checked)")&&e(".mf-slack").hide()}),e("input.mf-form-modalinput-paypal").on("change",function(){e(this).is(":checked")?e(".mf-paypal").show():e(this).is(":not(:checked)")&&e(".mf-paypal").hide()}),e("input.mf-form-modalinput-stripe").on("change",function(){e(this).is(":checked")?e(".mf-stripe").show():e(this).is(":not(:checked)")&&e(".mf-stripe").hide()}),e("input.mf-form-modalinput-stripe_sandbox").on("change",function(){e(this).is(":checked")?e(".mf_stripe_sandbox").show():e(this).is(":not(:checked)")&&e(".mf_stripe_sandbox").hide()}),e("input.mf-form-modalinput-recaptcha").on("change",function(){e(this).is(":checked")?e(".mf-recaptcha").show():e(this).is(":not(:checked)")&&e(".mf-recaptcha").hide()}),e("input.mf-form-modalinput-capture_user_browser_data").click(function(){e(this).is(":checked")?(e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):e(this).is(":not(:checked)")&&(e("#multiple_submission").removeClass("show_input"),e("#multiple_submission").addClass("hide_input"))}),e(".mf-settings-tab .nav-tab").on("click",function(t){t.preventDefault();var i=e(this).attr("href");e(this).addClass("nav-tab-active").siblings().removeClass("nav-tab-active"),e(i).addClass("active").siblings().removeClass("active")}),e(".mf-settings-tab .nav-tab").first().trigger("click"),e(".mf-recaptcha-version").on("change",function(){var t=e(this).val();e("#mf-"+t).fadeIn().siblings().hide()}),e(".mf-recaptcha-version").trigger("change"),e(".mf-form-modalinput-stripe_sandbox").on("change",function(){var t=e(this).parents(".attr-form-group").eq(0).next(".mf-form-modalinput-stripe_sandbox_keys");e(this).is(":checked")?t.fadeIn():t.fadeOut()}),e(".mf-form-modalinput-stripe_sandbox").trigger("change")});
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(function(e){if(e.preventDefault(),a){var s=t(this);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)});var n=s.parent().find(".metform-msg"),r=s.attr("action"),i=new FormData(this),o=s.attr("data-nonce");n.length>1&&s.parent().find(".metform-inx").remove(),t.ajax({url:r,type:"POST",dataType:"JSON",data:i,processData:!1,contentType:!1,headers:{"X-WP-Nonce":o},success:function(e){a=!1;var r=Number(e.status),i="";if(t.each(e.error,function(e,t){i+=t+"<br>"}),i.replace(/<br>+$/,""),1==r?(n.css("display","block"),n.removeClass("attr-alert-warning"),n.addClass("attr-alert-success"),n.html(e.data.message),setTimeout(function(){n.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%"})):(n.css("display","block"),n.removeClass("attr-alert-success"),n.addClass("attr-alert-warning"),n.html(i),setTimeout(function(){n.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 d=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":o},success:function(e){e.status?window.location.href=e.redirect_url:alert(e)}})}else alert("Sorry!! Payment token invalid")}});return d.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(){d.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")&&void 0!==metformSubmision&&metformSubmision(e(".metform-form-content"))});
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))})});
public/assets/js/summary.js CHANGED
@@ -11,7 +11,6 @@ jQuery(document).ready(function($) {
11
  var onlyCheckboxes = $.grep(checkboxValues, function (element) {
12
  return $.inArray(element.name, checkboxKeys) == -1;
13
  });
14
- // console.log([checkboxValues, brokenSerialization, withoutCheckboxes, checkboxKeys]);
15
 
16
  return $.merge(brokenSerialization, onlyCheckboxes);
17
  }
@@ -21,14 +20,28 @@ jQuery(document).ready(function($) {
21
  var forms = $('.metform-form-content');
22
  if(forms.length > 0){
23
  forms.each(function(i, v){
24
- var form = $(this);
25
- form.on('change keyup paste', 'input, select, textarea', function(){
 
 
 
 
 
 
 
 
 
 
 
26
  var rawFormData = form.mfSerializeArray();
27
  rawFormData.shift();
 
28
  $.each(rawFormData, function(index, value){
29
- console.log(value.name+": "+value.value);
 
30
  });
31
- });
 
32
  });
33
  }
34
  }
@@ -45,8 +58,6 @@ jQuery(document).ready(function($) {
45
  };
46
  }
47
 
48
- $('.metform-form-content').on('change keyup paste', 'input, select, textarea', delay(function (e) {
49
- metFormData();
50
- }, 200));
51
 
52
  });
11
  var onlyCheckboxes = $.grep(checkboxValues, function (element) {
12
  return $.inArray(element.name, checkboxKeys) == -1;
13
  });
 
14
 
15
  return $.merge(brokenSerialization, onlyCheckboxes);
16
  }
20
  var forms = $('.metform-form-content');
21
  if(forms.length > 0){
22
  forms.each(function(i, v){
23
+ var form = $(this),
24
+ elSummary = form.find('.mf-input.mf-input-summary.metform-entry-data'),
25
+ elTbody = elSummary.find('tbody');
26
+
27
+ var rawFormData = form.mfSerializeArray();
28
+ rawFormData.shift();
29
+
30
+ $.each(rawFormData, function(index, value){
31
+ elTbody.append('<tr class="mf-data-label"><td colspan="2"><strong>'+value.name+'</strong></td></tr>');
32
+ elTbody.append('<tr class="mf-data-value"><td class="mf-value-space">&nbsp;</td><td class="value-'+value.name+'">'+value.value+'</td></tr>');
33
+ });
34
+
35
+ form.on('change keyup paste', 'input, select, textarea', delay( function (e){
36
  var rawFormData = form.mfSerializeArray();
37
  rawFormData.shift();
38
+
39
  $.each(rawFormData, function(index, value){
40
+ let elCurrent = elTbody.find(".value-"+value.name);
41
+ elCurrent.html(value.value);
42
  });
43
+
44
+ }, 200));
45
  });
46
  }
47
  }
58
  };
59
  }
60
 
61
+ metFormData();
 
 
62
 
63
  });
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.1.9
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -90,6 +90,14 @@ You can use MailChimp in your contact form also create MailChimp signup forms wi
90
  * File Upload
91
 
92
  == Changelog ==
 
 
 
 
 
 
 
 
93
 
94
  Version 1.1.9
95
  Added 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.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
90
  * File Upload
91
 
92
  == Changelog ==
93
+ Version 1.2.0
94
+ add: Global settings page
95
+ fix: Simple captcha
96
+ add: google recaptcha v3
97
+ simple captcha and google recaptcha in different widget
98
+ fix: shortcode form submission issue
99
+ html support in checkbox and opt in text
100
+ add: form summary widget
101
 
102
  Version 1.1.9
103
  Added Simple captcha
utils/util.php CHANGED
@@ -67,6 +67,7 @@ class Util{
67
  'href' => array(),
68
  'rel' => array(),
69
  'title' => array(),
 
70
  ),
71
  'abbr' => array(
72
  'title' => array(),
@@ -214,9 +215,13 @@ class Util{
214
  $rest_url = get_rest_url();
215
  $form_unique_name = (is_numeric($form)) ? ($widget_id.'-'.$form) : $widget_id;
216
  $form_id = (is_numeric($form)) ? $form : $widget_id;
217
- $form_settings = \MetForm\Core\Entries\Action::instance()->get_form_settings($form_id);
 
218
 
219
- $site_key = (isset($form_settings['mf_recaptcha']) && $form_settings['mf_recaptcha'] == '1' && $form_settings['mf_recaptcha_site_key'] != '') ? $form_settings['mf_recaptcha_site_key'] : '';
 
 
 
220
 
221
  ob_start();
222
  ?>
67
  'href' => array(),
68
  'rel' => array(),
69
  'title' => array(),
70
+ 'target' => array(),
71
  ),
72
  'abbr' => array(
73
  'title' => array(),
215
  $rest_url = get_rest_url();
216
  $form_unique_name = (is_numeric($form)) ? ($widget_id.'-'.$form) : $widget_id;
217
  $form_id = (is_numeric($form)) ? $form : $widget_id;
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();
227
  ?>
widgets/checkbox/checkbox.php CHANGED
@@ -546,13 +546,13 @@ Class MetForm_Input_Checkbox extends Widget_Base{
546
  foreach($mf_input_list as $option){
547
  ?>
548
  <div class="mf-checkbox-option <?php echo esc_attr($option['mf_input_option_status']); ?>">
549
- <label><?php echo esc_html(($mf_input_option_text_position == 'before') ? $option['mf_input_option_text']:''); ?>
550
  <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); ?>[]"
551
  value="<?php echo esc_attr($option['mf_input_option_value']); ?>"
552
  <?php echo esc_attr($option['mf_input_option_status']); ?>
553
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
554
  >
555
- <span><?php echo esc_html(($mf_input_option_text_position == 'after') ? $option['mf_input_option_text']:''); ?></span>
556
  </label>
557
  </div>
558
  <?php
546
  foreach($mf_input_list as $option){
547
  ?>
548
  <div class="mf-checkbox-option <?php echo esc_attr($option['mf_input_option_status']); ?>">
549
+ <label><?php echo \MetForm\Utils\Util::kses(($mf_input_option_text_position == 'before') ? $option['mf_input_option_text']:''); ?>
550
  <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); ?>[]"
551
  value="<?php echo esc_attr($option['mf_input_option_value']); ?>"
552
  <?php echo esc_attr($option['mf_input_option_status']); ?>
553
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
554
  >
555
+ <span><?php echo \MetForm\Utils\Util::kses(($mf_input_option_text_position == 'after') ? $option['mf_input_option_text']:''); ?></span>
556
  </label>
557
  </div>
558
  <?php
widgets/listing-optin/listing-optin.php CHANGED
@@ -451,12 +451,12 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
451
  ?>
452
  <div class="mf-checkbox" id="mf-input-optin-<?php echo esc_attr($this->get_id()); ?>">
453
  <div class="mf-checkbox-option">
454
- <label><?php echo esc_html(($mf_listing_optin_option_text_position == 'before') ? $mf_listing_optin_option_text :''); ?>
455
  <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); ?>"
456
  value="1"
457
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
458
  >
459
- <span><?php echo esc_html(($mf_listing_optin_option_text_position == 'after') ? $mf_listing_optin_option_text :''); ?></span>
460
  </label>
461
  </div>
462
  </div>
451
  ?>
452
  <div class="mf-checkbox" id="mf-input-optin-<?php echo esc_attr($this->get_id()); ?>">
453
  <div class="mf-checkbox-option">
454
+ <label><?php echo \MetForm\Utils\Util::kses(($mf_listing_optin_option_text_position == 'before') ? $mf_listing_optin_option_text :''); ?>
455
  <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); ?>"
456
  value="1"
457
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
458
  >
459
+ <span><?php echo \MetForm\Utils\Util::kses(($mf_listing_optin_option_text_position == 'after') ? $mf_listing_optin_option_text :''); ?></span>
460
  </label>
461
  </div>
462
  </div>
widgets/manifest.php CHANGED
@@ -35,6 +35,7 @@ Class Manifest{
35
  'mf-listing-lname',
36
  'mf-listing-optin',
37
  'mf-recaptcha',
 
38
  'mf-rating',
39
  'mf-file-upload',
40
  ];
@@ -67,9 +68,10 @@ Class Manifest{
67
  require_once plugin_dir_path(__FILE__) . 'listing-lname/listing-lname.php';
68
  require_once plugin_dir_path(__FILE__) . 'listing-optin/listing-optin.php';
69
  require_once plugin_dir_path(__FILE__) . 'recaptcha/recaptcha.php';
 
70
  require_once plugin_dir_path(__FILE__) . 'rating/rating.php';
71
  require_once plugin_dir_path(__FILE__) . 'file-upload/file-upload.php';
72
- //require_once plugin_dir_path(__FILE__) . 'summary/summary.php';
73
  }
74
 
75
  public function register_widgets() {
@@ -99,9 +101,10 @@ Class Manifest{
99
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Lname() );
100
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Listing_Optin );
101
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Recaptcha() );
 
102
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Rating() );
103
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_File_Upload() );
104
- //\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Summary() );
105
  }
106
 
107
  public function add_metform_widget_categories( $elements_manager ) {
35
  'mf-listing-lname',
36
  'mf-listing-optin',
37
  'mf-recaptcha',
38
+ 'mf-simple-captcha',
39
  'mf-rating',
40
  'mf-file-upload',
41
  ];
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';
73
  require_once plugin_dir_path(__FILE__) . 'file-upload/file-upload.php';
74
+ require_once plugin_dir_path(__FILE__) . 'summary/summary.php';
75
  }
76
 
77
  public function register_widgets() {
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() );
106
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_File_Upload() );
107
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Summary() );
108
  }
109
 
110
  public function add_metform_widget_categories( $elements_manager ) {
widgets/map-location/map-location.php DELETED
@@ -1,169 +0,0 @@
1
- <?php
2
- namespace Elementor;
3
- defined( 'ABSPATH' ) || exit;
4
-
5
- Class MetForm_Input_Map_Location extends Widget_Base{
6
-
7
- use \MetForm\Traits\Common_Controls;
8
- use \MetForm\Traits\Conditional_Controls;
9
-
10
- public function __construct( $data = [], $args = null ) {
11
- parent::__construct( $data, $args );
12
- $this->add_script_depends('metform-map-location');
13
- $this->add_script_depends('maps-api');
14
- }
15
-
16
- public function map_scipts($api_key){
17
- \wp_register_script( 'maps-api', 'https://maps.googleapis.com/maps/api/js?key='.$api_key.'&libraries=places&callback=metformMapAutoComplete', array(), '', true );
18
- }
19
-
20
- public function get_name() {
21
- return 'mf-map-location';
22
- }
23
-
24
- public function get_title() {
25
- return esc_html__( 'Google Map Location', 'metform' );
26
- }
27
-
28
- public function show_in_panel() {
29
- return 'metform-form' == get_post_type();
30
- }
31
-
32
- public function get_categories() {
33
- return [ 'metform' ];
34
- }
35
-
36
- public function get_keywords() {
37
- return ['metform', 'input', 'map', 'location', 'google', 'autocomplete'];
38
- }
39
-
40
- protected function _register_controls() {
41
-
42
- $this->start_controls_section(
43
- 'content_section',
44
- [
45
- 'label' => esc_html__( 'Content', 'metform' ),
46
- 'tab' => Controls_Manager::TAB_CONTENT,
47
- ]
48
- );
49
-
50
- $this->add_control(
51
- 'mf_input_map_api_key',
52
- [
53
- 'label' => esc_html__( 'Google map api key', 'metform' ),
54
- 'type' => Controls_Manager::TEXT,
55
- 'placeholder' => esc_html__( 'YOUR_API_KEY', 'metform' ),
56
- 'description' => wp_kses( 'How can you get api key? <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">see here</a>', 'metform'),
57
- ]
58
- );
59
-
60
- $this->input_content_controls();
61
-
62
- $this->end_controls_section();
63
-
64
- $this->start_controls_section(
65
- 'settings_section',
66
- [
67
- 'label' => esc_html__( 'Settings', 'metform' ),
68
- 'tab' => Controls_Manager::TAB_CONTENT,
69
- ]
70
- );
71
-
72
- $this->input_setting_controls(['MAX_MIN']);
73
-
74
- $this->end_controls_section();
75
-
76
- if(class_exists('\MetForm\Base\Package')){
77
- $this->input_conditional_control();
78
- }
79
-
80
- $this->start_controls_section(
81
- 'label_section',
82
- [
83
- 'label' => esc_html__( 'Label', 'metform' ),
84
- 'tab' => Controls_Manager::TAB_STYLE,
85
- 'condition' => [
86
- 'mf_input_label_status' => 'yes',
87
- ],
88
- ]
89
- );
90
-
91
- $this->input_label_controls();
92
-
93
- $this->end_controls_section();
94
-
95
- $this->start_controls_section(
96
- 'input_section',
97
- [
98
- 'label' => esc_html__( 'Input', 'metform' ),
99
- 'tab' => Controls_Manager::TAB_STYLE,
100
- ]
101
- );
102
-
103
- $this->input_controls();
104
-
105
- $this->end_controls_section();
106
-
107
- $this->start_controls_section(
108
- 'placeholder_section',
109
- [
110
- 'label' => esc_html__( 'Place Holder', 'metform' ),
111
- 'tab' => Controls_Manager::TAB_STYLE,
112
- ]
113
- );
114
-
115
- $this->input_place_holder_controls();
116
-
117
- $this->end_controls_section();
118
-
119
- $this->start_controls_section(
120
- 'help_text_section',
121
- [
122
- 'label' => esc_html__( 'Help Text', 'metform' ),
123
- 'tab' => Controls_Manager::TAB_STYLE,
124
- 'condition' => [
125
- 'mf_input_help_text!' => ''
126
- ]
127
- ]
128
- );
129
-
130
- $this->input_help_text_controls();
131
-
132
- $this->end_controls_section();
133
-
134
-
135
- }
136
-
137
- protected function render($instance = []){
138
- $settings = $this->get_settings_for_display();
139
- extract($settings);
140
-
141
- $mf_input_map_api_key = (isset($mf_input_map_api_key) ? $mf_input_map_api_key : '');
142
- $this->map_scipts($mf_input_map_api_key);
143
-
144
- $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
145
-
146
- echo "<div class='mf-input-wrapper'>";
147
-
148
- if($mf_input_label_status == 'yes'){
149
- ?>
150
- <label class="mf-input-label" for="mf-input-map-<?php echo esc_attr($this->get_id()); ?>"><?php echo esc_html($mf_input_label); ?>
151
- <span class="mf-input-required-indicator"><?php echo esc_html(($mf_input_required === 'yes') ? '*' : '');?></span>
152
- </label>
153
- <?php
154
- }
155
- ?>
156
- <input type="text" class="mf-input mf-input-map-location <?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; ?>" onfocus="mfgeolocate()" id="mf-input-map-<?php echo esc_attr($this->get_id()); ?>"
157
- name="<?php echo esc_attr($mf_input_name); ?>"
158
- placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
159
- <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
160
- <?php //echo esc_attr($mf_input_readonly_status); ?>
161
- >
162
- <?php
163
- if($mf_input_help_text != ''){
164
- echo "<span class='mf-input-help'>".esc_html($mf_input_help_text)."</span>";
165
- }
166
- echo "</div>";
167
- }
168
-
169
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
widgets/recaptcha/fonts/Acme.ttf DELETED
Binary file
widgets/recaptcha/fonts/Righteous.ttf DELETED
Binary file
widgets/recaptcha/fonts/Ubuntu.ttf DELETED
Binary file
widgets/recaptcha/recaptcha.php CHANGED
@@ -4,10 +4,10 @@ defined( 'ABSPATH' ) || exit;
4
 
5
  Class MetForm_Input_Recaptcha extends Widget_Base{
6
 
7
- public function __construct( $data = [], $args = null ) {
8
- parent::__construct( $data, $args );
9
- $this->add_script_depends('recaptcha');
10
- }
11
 
12
  public function get_name() {
13
  return 'mf-recaptcha';
@@ -38,124 +38,13 @@ Class MetForm_Input_Recaptcha extends Widget_Base{
38
  ]
39
  );
40
 
41
- $this->add_control(
42
- 'mf_recaptcha_type',
43
- [
44
- 'label' => esc_html__( 'reCaptcha type', 'metform' ),
45
- 'type' => Controls_Manager::SELECT,
46
- 'default' => 'captcha',
47
- 'options' => [
48
- 'captcha' => esc_html__( 'Captcha', 'metform' ),
49
- 'recaptcha-v2' => esc_html__( 'reCAPTCHA V2', 'metform' ),
50
- //'recaptcha-v3' => esc_html__( 'reCAPTCHA V3', 'metform' ),
51
- ],
52
- ]
53
- );
54
-
55
  $this->add_control(
56
  'mf_recaptcha_notice_info',
57
  [
58
- 'label' => esc_html__( 'Important Note', 'metform' ),
59
  'type' => Controls_Manager::RAW_HTML,
60
- 'raw' => esc_html__( 'You have to active recaptcha from form settings. ', 'metform' ),
61
- 'content_classes' => 'recaptcha-notice',
62
- 'condition' => [
63
- 'mf_recaptcha_type!' => 'captcha'
64
- ],
65
- ]
66
- );
67
-
68
- $this->add_control(
69
- 'mf_input_label_status',
70
- [
71
- 'label' => esc_html__( 'Show Label', 'metform' ),
72
- 'type' => Controls_Manager::SWITCHER,
73
- 'on' => esc_html__( 'Show', 'metform' ),
74
- 'off' => esc_html__( 'Hide', 'metform' ),
75
- 'return_value' => 'yes',
76
- 'default' => 'yes',
77
- 'condition' => [
78
- 'mf_recaptcha_type' => 'captcha'
79
- ],
80
- 'description' => esc_html__('for adding label on input turn it on. Don\'t want to use label? turn it off.', 'metform'),
81
- ]
82
- );
83
-
84
- $this->add_control(
85
- 'mf_input_label_display_property',
86
- [
87
- 'label' => esc_html__( 'Position', 'metform' ),
88
- 'type' => Controls_Manager::SELECT,
89
- 'default' => 'block',
90
- 'options' => [
91
- 'block' => esc_html__( 'Top', 'metform' ),
92
- 'inline-block' => esc_html__( 'Left', 'metform' ),
93
- ],
94
- 'condition' => [
95
- 'mf_recaptcha_type' => 'captcha',
96
- 'mf_input_label_status' => 'yes',
97
- ],
98
- 'selectors' => [
99
- '{{WRAPPER}} .mf-input-label' => 'display: {{VALUE}}',
100
- ],
101
- 'description' => esc_html__('Select label position. where you want to see it. top of the input or left of the input.', 'metform'),
102
-
103
- ]
104
- );
105
-
106
- $this->add_control(
107
- 'mf_input_label',
108
- [
109
- 'label' => esc_html__( 'Label : ', 'metform' ),
110
- 'type' => Controls_Manager::TEXT,
111
- 'default' => $this->get_title(),
112
- 'title' => esc_html__( 'Enter here label of input', 'metform' ),
113
- 'condition' => [
114
- 'mf_recaptcha_type' => 'captcha',
115
- 'mf_input_label_status' => 'yes',
116
- ],
117
- ]
118
- );
119
-
120
- $this->add_control(
121
- 'mf_input_placeholder',
122
- [
123
- 'label' => esc_html__( 'Place holder', 'metform' ),
124
- 'type' => Controls_Manager::TEXT,
125
- 'default' => $this->get_title(),
126
- 'title' => esc_html__( 'Enter here place holder', 'metform' ),
127
- 'condition' => [
128
- 'mf_recaptcha_type' => 'captcha',
129
- ],
130
- ]
131
- );
132
-
133
- $this->add_control(
134
- 'mf_input_required',
135
- [
136
- 'label' => esc_html__( 'Required ?', 'metform' ),
137
- 'type' => Controls_Manager::SWITCHER,
138
- 'yes' => esc_html__( 'Yes', 'metform' ),
139
- 'no' => esc_html__( 'No', 'metform' ),
140
- 'return_value' => 'yes',
141
- 'default' => 'no',
142
- 'condition' => [
143
- 'mf_recaptcha_type' => 'captcha',
144
- ],
145
- 'description' => esc_html__('Is this field is required for submit the form?. Make it "Yes".', 'metform'),
146
- ]
147
- );
148
-
149
- $this->add_control(
150
- 'mf_input_help_text',
151
- [
152
- 'label' => esc_html__( 'Help Text : ', 'metform' ),
153
- 'type' => Controls_Manager::TEXTAREA,
154
- 'rows' => 3,
155
- 'placeholder' => esc_html__( 'Type your help text here', 'metform' ),
156
- 'condition' => [
157
- 'mf_recaptcha_type' => 'captcha',
158
- ],
159
  ]
160
  );
161
 
@@ -164,33 +53,21 @@ Class MetForm_Input_Recaptcha extends Widget_Base{
164
  [
165
  'label' => esc_html__( 'Add Extra Class Name : ', 'metform' ),
166
  'type' => Controls_Manager::TEXT,
167
- 'condition' => [
168
- 'mf_recaptcha_type!' => 'captcha',
169
- ],
170
  ]
171
  );
172
 
173
- $this->end_controls_section();
174
- }
175
 
176
- public function render_script($path){
177
- ?>
178
- <script>
179
- var path = "<?php echo $path; ?>";
180
- var refreshButton = document.querySelector(".mf-refresh-captcha");
181
- if(refreshButton != null){
182
- refreshButton.onclick = function() {
183
- document.querySelector(".mf-captcha-image").src = path+'/generate-captcha.php?' + Date.now();
184
- }
185
- }
186
- </script>
187
- <?php
188
  }
189
 
190
  protected function render($instance = []){
191
  $settings = $this->get_settings_for_display();
192
  extract($settings);
193
 
 
 
 
 
194
  echo "<div class='mf-input-wrapper'>";
195
 
196
  if($mf_recaptcha_type == 'recaptcha-v2') {
@@ -198,25 +75,24 @@ Class MetForm_Input_Recaptcha extends Widget_Base{
198
  <div id="recaptcha_site_key" class="recaptcha_site_key <?php echo esc_attr($mf_recaptcha_class_name); ?>"></div>
199
  <?php
200
  if(('metform-form' == get_post_type() || 'page' == get_post_type()) && \Elementor\Plugin::$instance->editor->is_edit_mode()){
201
- echo "<div class='attr-alert attr-alert-warning'>".esc_html__('reCAPTCHA will be shown on preview.', 'metform')."</div>";
202
  }
 
203
  }
204
- if($mf_recaptcha_type == 'captcha'){
205
- if($mf_input_label_status == 'yes'){
206
- ?>
207
- <label class="mf-input-label" for="mf-input-captcha-<?php echo esc_attr($this->get_id()); ?>"><?php echo esc_html($mf_input_label); ?>
208
- <span class="mf-input-required-indicator"><?php echo esc_html(($mf_input_required === 'yes') ? '*' : '');?></span>
209
- </label>
210
- <?php
211
- }
212
  ?>
213
- <img src="<?php echo plugin_dir_url( __FILE__ ); ?>/generate-captcha.php" alt="CAPTCHA" class="mf-captcha-image"><i class="fas fa-redo mf-refresh-captcha"></i>
214
- <input class="mf-input mf-captcha-input" id="mf-input-captcha-<?php echo esc_attr($this->get_id()); ?>" type="text" name="mf-captcha-challenge">
 
215
  <?php
 
 
 
 
216
  }
217
  echo '</div>';
218
 
219
- $this->render_script(plugin_dir_url( __FILE__ ));
220
  }
221
 
222
  }
4
 
5
  Class MetForm_Input_Recaptcha extends Widget_Base{
6
 
7
+ // public function __construct( $data = [], $args = null ) {
8
+ // parent::__construct( $data, $args );
9
+ // $this->add_script_depends('recaptcha-v2');
10
+ // }
11
 
12
  public function get_name() {
13
  return 'mf-recaptcha';
38
  ]
39
  );
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $this->add_control(
42
  'mf_recaptcha_notice_info',
43
  [
44
+ 'label' => esc_html__( 'reCAPTCHA configure: ', 'metform-pro' ),
45
  'type' => Controls_Manager::RAW_HTML,
46
+ 'raw' => \MetForm\Utils\Util::kses( 'Turn on recaptcha from form setting.<br>Then you have to must configure recaptcha site and secret key from MetForm -> Settings <a target="__blank" href="'.get_dashboard_url().'admin.php?page=metform-menu-settings'.'">from here.</a><br><a target="__blank" href="https://help.wpmet.com/docs/form-settings/#2-recaptcha-integration">See Documentation.</a>', 'metform-pro' ),
47
+ 'content_classes' => 'mf-input-map-api-notice',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ]
49
  );
50
 
53
  [
54
  'label' => esc_html__( 'Add Extra Class Name : ', 'metform' ),
55
  'type' => Controls_Manager::TEXT,
 
 
 
56
  ]
57
  );
58
 
59
+ $this->end_controls_section();
 
60
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
63
  protected function render($instance = []){
64
  $settings = $this->get_settings_for_display();
65
  extract($settings);
66
 
67
+ $recaptcha_setting = \MetForm\Core\Admin\Base::instance()->get_settings_option();
68
+
69
+ $mf_recaptcha_type = ((isset($recaptcha_setting['mf_recaptcha_version']) && ($recaptcha_setting['mf_recaptcha_version'] != '')) ? $recaptcha_setting['mf_recaptcha_version'] : 'recaptcha-v2');
70
+
71
  echo "<div class='mf-input-wrapper'>";
72
 
73
  if($mf_recaptcha_type == 'recaptcha-v2') {
75
  <div id="recaptcha_site_key" class="recaptcha_site_key <?php echo esc_attr($mf_recaptcha_class_name); ?>"></div>
76
  <?php
77
  if(('metform-form' == get_post_type() || 'page' == get_post_type()) && \Elementor\Plugin::$instance->editor->is_edit_mode()){
78
+ echo "<div class='attr-alert attr-alert-warning'>".esc_html__('reCAPTCHA V2 will be shown on preview.', 'metform')."</div>";
79
  }
80
+ wp_enqueue_script('recaptcha-v2');
81
  }
82
+
83
+ if($mf_recaptcha_type == 'recaptcha-v3'){
 
 
 
 
 
 
84
  ?>
85
+ <div id="recaptcha_site_key_v3" class="recaptcha_site_key_v3 <?php echo esc_attr($mf_recaptcha_class_name); ?>">
86
+ <input type="hidden" class="g-recaptcha-response-v3" name="g-recaptcha-response-v3">
87
+ </div>
88
  <?php
89
+ if(('metform-form' == get_post_type() || 'page' == get_post_type()) && \Elementor\Plugin::$instance->editor->is_edit_mode()){
90
+ echo "<div class='attr-alert attr-alert-warning'>".esc_html__('reCAPTCHA V3 will be shown on preview.', 'metform')."</div>";
91
+ }
92
+ wp_enqueue_script('recaptcha-v3');
93
  }
94
  echo '</div>';
95
 
 
96
  }
97
 
98
  }
widgets/simple-captcha/fonts/PermanentMarker.ttf ADDED
Binary file
widgets/{recaptcha → simple-captcha}/fonts/SourceCodePro.ttf RENAMED
File without changes
widgets/{recaptcha → simple-captcha}/generate-captcha.php RENAMED
@@ -54,7 +54,10 @@ $black = imagecolorallocate($image, 0, 0, 0);
54
  $white = imagecolorallocate($image, 255, 255, 255);
55
  $textcolors = [$black, $white];
56
 
57
- $fonts = [dirname(__FILE__).'\fonts\Acme.ttf', dirname(__FILE__).'\fonts\Ubuntu.ttf', dirname(__FILE__).'\fonts\SourceCodePro.ttf', dirname(__FILE__).'\fonts\Righteous.ttf'];
 
 
 
58
 
59
  $string_length = 6;
60
  $captcha_string = generate_string($permitted_chars, $string_length);
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);
widgets/simple-captcha/simple-captcha.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Elementor;
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ Class MetForm_Input_Simple_Captcha extends Widget_Base{
6
+
7
+ public function get_name() {
8
+ return 'mf-simple-captcha';
9
+ }
10
+
11
+ public function get_title() {
12
+ return esc_html__( 'Simple Captcha', 'metform' );
13
+ }
14
+
15
+ public function show_in_panel() {
16
+ return 'metform-form' == get_post_type();
17
+ }
18
+
19
+ public function get_categories() {
20
+ return [ 'metform' ];
21
+ }
22
+
23
+ public function get_keywords() {
24
+ return ['metform', 'input', 'captcha', 'simple captcha'];
25
+ }
26
+
27
+ protected function _register_controls() {
28
+ $this->start_controls_section(
29
+ 'content_section',
30
+ [
31
+ 'label' => esc_html__( 'Content', 'metform' ),
32
+ 'tab' => Controls_Manager::TAB_CONTENT,
33
+ ]
34
+ );
35
+
36
+ $this->add_control(
37
+ 'mf_input_label_status',
38
+ [
39
+ 'label' => esc_html__( 'Show Label', 'metform' ),
40
+ 'type' => Controls_Manager::SWITCHER,
41
+ 'on' => esc_html__( 'Show', 'metform' ),
42
+ 'off' => esc_html__( 'Hide', 'metform' ),
43
+ 'return_value' => 'yes',
44
+ 'default' => 'yes',
45
+ 'description' => esc_html__('for adding label on input turn it on. Don\'t want to use label? turn it off.', 'metform'),
46
+ ]
47
+ );
48
+
49
+ $this->add_control(
50
+ 'mf_input_label_display_property',
51
+ [
52
+ 'label' => esc_html__( 'Label Position', 'metform' ),
53
+ 'type' => Controls_Manager::SELECT,
54
+ 'default' => 'block',
55
+ 'options' => [
56
+ 'block' => esc_html__( 'Top', 'metform' ),
57
+ 'inline-block' => esc_html__( 'Left', 'metform' ),
58
+ ],
59
+ 'condition' => [
60
+ 'mf_input_label_status' => 'yes',
61
+ ],
62
+ 'selectors' => [
63
+ '{{WRAPPER}} .mf-input-label' => 'display: {{VALUE}}',
64
+ ],
65
+ 'description' => esc_html__('Select label position. where you want to see it. top of the input or left of the input.', 'metform'),
66
+
67
+ ]
68
+ );
69
+
70
+ $this->add_control(
71
+ 'mf_input_input_captcha_display',
72
+ [
73
+ 'label' => esc_html__( 'Input captcha display', 'metform' ),
74
+ 'type' => Controls_Manager::SELECT,
75
+ 'default' => 'block',
76
+ 'options' => [
77
+ 'block' => esc_html__( 'Block', 'metform' ),
78
+ 'inline' => esc_html__( 'Inline', 'metform' ),
79
+ ],
80
+ 'description' => esc_html__('Select input and captcha display property.', 'metform'),
81
+
82
+ ]
83
+ );
84
+
85
+ $this->add_control(
86
+ 'mf_input_label',
87
+ [
88
+ 'label' => esc_html__( 'Label : ', 'metform' ),
89
+ 'type' => Controls_Manager::TEXT,
90
+ 'default' => $this->get_title(),
91
+ 'title' => esc_html__( 'Enter here label of input', 'metform' ),
92
+ 'condition' => [
93
+ 'mf_input_label_status' => 'yes',
94
+ ],
95
+ ]
96
+ );
97
+
98
+ $this->add_control(
99
+ 'mf_input_help_text',
100
+ [
101
+ 'label' => esc_html__( 'Help Text : ', 'metform' ),
102
+ 'type' => Controls_Manager::TEXTAREA,
103
+ 'rows' => 3,
104
+ 'placeholder' => esc_html__( 'Type your help text here', 'metform' ),
105
+ ]
106
+ );
107
+
108
+ $this->end_controls_section();
109
+
110
+ $this->start_controls_section(
111
+ 'label_section',
112
+ [
113
+ 'label' => esc_html__( 'Label', 'metform' ),
114
+ 'tab' => Controls_Manager::TAB_STYLE,
115
+ 'condition' => [
116
+ 'mf_input_label_status' => 'yes',
117
+ ],
118
+ ]
119
+ );
120
+
121
+ $this->add_control(
122
+ 'mf_input_label_width',
123
+ [
124
+ 'label' => esc_html__( 'Width', 'metform' ),
125
+ 'type' => Controls_Manager::SLIDER,
126
+ 'size_units' => [ 'px' ],
127
+ 'range' => [
128
+ 'px' => [
129
+ 'min' => 0,
130
+ 'max' => 1000,
131
+ 'step' => 5,
132
+ ]
133
+ ],
134
+ 'default' => [
135
+ 'unit' => '%',
136
+ 'size' => 20,
137
+ ],
138
+ 'selectors' => [
139
+ '{{WRAPPER}} .mf-input-label' => 'width: {{SIZE}}{{UNIT}};',
140
+ '{{WRAPPER}} .mf-input-wrapper div:not(.mf-captcha-input-wrapper) .mf-input' => 'width: calc(100% - {{SIZE}}{{UNIT}} - 7px)',
141
+ '{{WRAPPER}} .mf-input-wrapper > .iti' => 'width: calc(100% - {{SIZE}}{{UNIT}} - 7px)',
142
+ '{{WRAPPER}} .range-slider' => 'width: calc(100% - {{SIZE}}{{UNIT}} - 7px)',
143
+ '{{WRAPPER}} .mf-input-wrapper .flatpickr-calendar, {{WRAPPER}} .mf-input-wrapper .flatpickr-calendar.hasTime.noCalendar' => 'left: {{SIZE}}{{UNIT}} !important',
144
+ '{{WRAPPER}} .mf-input-wrapper .select2-container' => 'width: calc(100% - {{SIZE}}{{UNIT}} - 7px) !important',
145
+ '{{WRAPPER}} .mf-input-wrapper .mf-captcha-input-wrapper' => 'max-width: calc(100% - {{SIZE}}{{UNIT}} - 7px); display: inline-block; vertical-align: middle;',
146
+ ],
147
+ 'condition' => [
148
+ 'mf_input_label_display_property' => 'inline-block',
149
+ ],
150
+ ]
151
+ );
152
+
153
+ $this->add_control(
154
+ 'mf_input_label_color',
155
+ [
156
+ 'label' => esc_html__( 'Color', 'metform' ),
157
+ 'type' => Controls_Manager::COLOR,
158
+ 'scheme' => [
159
+ 'type' => Scheme_Color::get_type(),
160
+ 'value' => Scheme_Color::COLOR_1,
161
+ ],
162
+ 'selectors' => [
163
+ '{{WRAPPER}} .mf-input-label' => 'color: {{VALUE}}',
164
+ ],
165
+ 'default' => '#000000',
166
+ 'condition' => [
167
+ 'mf_input_label_status' => 'yes',
168
+ ],
169
+ ]
170
+ );
171
+ $this->add_group_control(
172
+ Group_Control_Typography::get_type(),
173
+ [
174
+ 'name' => 'mf_input_label_typography',
175
+ 'label' => esc_html__( 'Typography', 'metform' ),
176
+ 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
177
+ 'selector' => '{{WRAPPER}} .mf-input-label',
178
+ 'condition' => [
179
+ 'mf_input_label_status' => 'yes',
180
+ ],
181
+ ]
182
+ );
183
+ $this->add_responsive_control(
184
+ 'mf_input_label_padding',
185
+ [
186
+ 'label' => esc_html__( 'Padding', 'metform' ),
187
+ 'type' => Controls_Manager::DIMENSIONS,
188
+ 'size_units' => [ 'px', '%', 'em' ],
189
+ 'selectors' => [
190
+ '{{WRAPPER}} .mf-input-label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
191
+ ],
192
+ 'condition' => [
193
+ 'mf_input_label_status' => 'yes',
194
+ ],
195
+ ]
196
+ );
197
+ $this->add_responsive_control(
198
+ 'mf_input_label_margin',
199
+ [
200
+ 'label' => esc_html__( 'Margin', 'metform' ),
201
+ 'type' => Controls_Manager::DIMENSIONS,
202
+ 'size_units' => [ 'px', '%', 'em' ],
203
+ 'selectors' => [
204
+ '{{WRAPPER}} .mf-input-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
205
+ ],
206
+ 'condition' => [
207
+ 'mf_input_label_status' => 'yes',
208
+ ],
209
+ ]
210
+ );
211
+
212
+ $this->end_controls_section();
213
+
214
+ $this->start_controls_section(
215
+ 'captcha_section',
216
+ [
217
+ 'label' => esc_html__( 'Refresh Captcha', 'metform' ),
218
+ 'tab' => Controls_Manager::TAB_STYLE,
219
+ ]
220
+ );
221
+
222
+ $this->add_responsive_control(
223
+ 'mf_input_refresh_captcha_padding',
224
+ [
225
+ 'label' => esc_html__( 'Padding', 'metform' ),
226
+ 'type' => Controls_Manager::DIMENSIONS,
227
+ 'size_units' => [ 'px', '%', 'em' ],
228
+ 'selectors' => [
229
+ '{{WRAPPER}} .mf-refresh-captcha' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
230
+ ],
231
+ ]
232
+ );
233
+
234
+ $this->add_responsive_control(
235
+ 'mf_input_refresh_captcha_margin',
236
+ [
237
+ 'label' => esc_html__( 'Margin', 'metform' ),
238
+ 'type' => Controls_Manager::DIMENSIONS,
239
+ 'size_units' => [ 'px', '%', 'em' ],
240
+ 'selectors' => [
241
+ '{{WRAPPER}} .mf-refresh-captcha' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
242
+ ],
243
+ ]
244
+ );
245
+
246
+ $this->add_control(
247
+ 'mf_input_refresh_captcha_color',
248
+ [
249
+ 'label' => __( 'Color', 'metform' ),
250
+ 'type' => \Elementor\Controls_Manager::COLOR,
251
+ 'scheme' => [
252
+ 'type' => \Elementor\Scheme_Color::get_type(),
253
+ 'value' => \Elementor\Scheme_Color::COLOR_1,
254
+ ],
255
+ 'selectors' => [
256
+ '{{WRAPPER}} .mf-refresh-captcha' => 'color: {{VALUE}}',
257
+ ],
258
+ ]
259
+ );
260
+
261
+ $this->end_controls_section();
262
+
263
+
264
+ }
265
+
266
+ public function render_script($path){
267
+ ?>
268
+ <script>
269
+ var path = "<?php echo $path; ?>";
270
+ var refreshButton = document.querySelectorAll(".mf-refresh-captcha");
271
+ if(refreshButton.length > 0){
272
+ refreshButton.forEach(function(v, i){
273
+ v.onclick = function() {
274
+ this.previousSibling.src = path+'/generate-captcha.php?' + Date.now();
275
+ }
276
+ });
277
+ }
278
+ </script>
279
+ <?php
280
+ }
281
+
282
+ protected function render($instance = []){
283
+ $settings = $this->get_settings_for_display();
284
+ extract($settings);
285
+
286
+ echo "<div class='mf-input-wrapper'>";
287
+
288
+ if($mf_input_label_status == 'yes'){
289
+ ?>
290
+ <label class="mf-input-label" for="mf-input-captcha-<?php echo esc_attr($this->get_id()); ?>">
291
+ <?php echo esc_html($mf_input_label); ?>
292
+ </label>
293
+ <?php
294
+ }
295
+ ?>
296
+ <div class="mf-captcha-input-wrapper <?php echo esc_attr('mf-captcha-'.$mf_input_input_captcha_display); ?>">
297
+ <img src="<?php echo plugin_dir_url( __FILE__ ); ?>generate-captcha.php" alt="CAPTCHA" height="50px" class="mf-input mf-captcha-image"><i class="fas fa-redo mf-refresh-captcha"></i>
298
+ <input type="text" name="mf-captcha-challenge" class="mf-input mf-captcha-input" id="mf-input-captcha-<?php echo esc_attr($this->get_id()); ?>" placeholder="<?php esc_html_e('Entry captcha from the picture', 'metform')?>">
299
+ </div>
300
+
301
+ <?php
302
+ echo '</div>';
303
+
304
+ $this->render_script(plugin_dir_url( __FILE__ ));
305
+ }
306
+
307
+ }
widgets/summary/summary.php CHANGED
@@ -119,17 +119,11 @@ Class MetForm_Input_Summary extends Widget_Base{
119
  <?php
120
  }
121
  ?>
122
- <div class="mf-input metform-entry-data container">
123
  <table class='mf-entry-data' cellpadding="5" cellspacing="0">
124
- <tbody>
125
- <tr class='mf-data-label'>
126
- <td colspan='2'><strong>Key</strong></td>
127
- </tr>
128
- <tr class='mf-data-value'>
129
- <td class='mf-value-space'>&nbsp;</td>
130
- <td>Value</td>
131
- </tr>
132
- </tbody>
133
  </table>
134
  </div>
135
  <?php
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">
124
+ <tbody>
125
+
126
+ </tbody>
 
 
 
 
 
 
127
  </table>
128
  </div>
129
  <?php