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

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

Code changes from version 1.1.8 to 1.1.9

Files changed (51) hide show
  1. core/entries/action.php +120 -10
  2. core/entries/api.php +16 -1
  3. core/entries/{init.php → base.php} +1 -1
  4. core/entries/meta-data.php +0 -1
  5. core/forms/action.php +33 -3
  6. core/forms/api.php +5 -0
  7. core/forms/cpt.php +24 -0
  8. core/forms/hooks.php +16 -0
  9. core/forms/views/modal-editor.php +58 -0
  10. metform.php +1 -1
  11. plugin.php +14 -4
  12. public/assets/css/style.css +21 -0
  13. public/assets/js/admin-script.js +1 -1
  14. public/assets/js/count-views.js +22 -0
  15. public/assets/js/inputs.js +1 -1
  16. public/assets/js/map-location.js +27 -0
  17. public/assets/js/submission.js +1 -1
  18. public/assets/js/summary.js +52 -0
  19. readme.txt +14 -21
  20. traits/common-controls.php +0 -3
  21. traits/conditional-controls.php +29 -27
  22. utils/util.php +1 -0
  23. widgets/checkbox/checkbox.php +2 -2
  24. widgets/date/date.php +2 -3
  25. widgets/email/email.php +2 -2
  26. widgets/file-upload/file-upload.php +2 -2
  27. widgets/listing-fname/listing-fname.php +2 -2
  28. widgets/listing-lname/listing-lname.php +2 -2
  29. widgets/listing-optin/listing-optin.php +2 -2
  30. widgets/manifest.php +4 -10
  31. widgets/map-location/map-location.php +169 -0
  32. widgets/multi-select/multi-select.php +2 -2
  33. widgets/number/number.php +2 -2
  34. widgets/password/password.php +2 -2
  35. widgets/radio/radio.php +2 -2
  36. widgets/range/range.php +2 -2
  37. widgets/rating/rating.php +2 -2
  38. widgets/recaptcha/fonts/Acme.ttf +0 -0
  39. widgets/recaptcha/fonts/Righteous.ttf +0 -0
  40. widgets/recaptcha/fonts/SourceCodePro.ttf +0 -0
  41. widgets/recaptcha/fonts/Ubuntu.ttf +0 -0
  42. widgets/recaptcha/generate-captcha.php +76 -0
  43. widgets/recaptcha/recaptcha.php +166 -8
  44. widgets/select/select.php +2 -2
  45. widgets/summary/summary.php +142 -0
  46. widgets/switch/switch.php +3 -3
  47. widgets/telephone/telephone.php +2 -2
  48. widgets/text/text.php +2 -2
  49. widgets/textarea/textarea.php +2 -2
  50. widgets/time/time.php +2 -2
  51. widgets/url/url.php +2 -2
core/entries/action.php CHANGED
@@ -46,7 +46,7 @@ Class Action{
46
  $this->key_form_data = 'metform_entries__form_data';
47
  $this->key_form_file = 'metform_entries__file_upload';
48
  $this->key_payment_status = 'metform_entries__payment_status';
49
- $this->post_type = Init::instance()->cpt->get_name();
50
 
51
  }
52
 
@@ -64,6 +64,7 @@ Class Action{
64
  $email_name = $this->get_input_name_by_widget_type('mf-email');
65
  $this->email_name = (isset($email_name[0]) ? $email_name[0] : null);
66
 
 
67
  if( !isset( $form_data['form_nonce'] ) || !wp_verify_nonce( $form_data['form_nonce'], 'form_nonce' ) ){
68
  $this->response->status = 0;
69
  $this->response->error[] = esc_html__('Unauthorized submission.','metform');
@@ -77,7 +78,8 @@ Class Action{
77
  return $this->response;
78
  }
79
 
80
- if(isset($this->form_settings['mf_recaptcha']) && (isset($this->fields['mf-recaptcha'])) && $this->form_settings['mf_recaptcha_site_key'] != ''){
 
81
  if((isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '') == ""){
82
  $this->response->status = 0;
83
  $this->response->error[] = esc_html__('Please solve the recaptcha.','metform');
@@ -85,10 +87,28 @@ Class Action{
85
  }
86
 
87
  $secretKey = (($this->form_settings['mf_recaptcha_secret_key'] != '') ? $this->form_settings['mf_recaptcha_secret_key'] : '');
88
- $ip = $_SERVER['REMOTE_ADDR'];
89
- // post request to server
90
- $url = "https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".(isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '');
91
- $response = file_get_contents($url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  $responseKeys = json_decode($response,true);
93
  $this->response->data['responseKeys'] = $responseKeys;
94
 
@@ -100,7 +120,48 @@ Class Action{
100
  return $this->response;
101
  }
102
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
 
104
  $required_loggin = isset($this->form_settings['require_login']) ? ((int)($this->form_settings['require_login'])) : 0;
105
 
106
  if(($required_loggin == 1) && (!is_user_logged_in())){
@@ -109,6 +170,7 @@ Class Action{
109
  return $this->response;
110
  }
111
 
 
112
  if(isset($this->form_settings['limit_total_entries_status'])){
113
  $entry_limit = ((int)($this->form_settings['limit_total_entries_status']));
114
 
@@ -120,6 +182,7 @@ Class Action{
120
  }
121
  }
122
 
 
123
  if (class_exists('\MetForm\Core\Integrations\Mail_Chimp')) {
124
  if(isset($this->form_settings['mf_mail_chimp']) && $this->form_settings['mf_mail_chimp'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
125
 
@@ -136,6 +199,7 @@ Class Action{
136
  }
137
  }
138
 
 
139
  if(class_exists('\MetForm_Pro\Core\Integrations\Zapier')){
140
  if(isset($this->form_settings['mf_zapier']) && $this->form_settings['mf_zapier'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
141
 
@@ -157,6 +221,7 @@ Class Action{
157
  }
158
  }
159
 
 
160
  if(class_exists('\MetForm\Core\Integrations\Slack')){
161
  if(isset($this->form_settings['mf_slack']) && $this->form_settings['mf_slack'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
162
 
@@ -179,8 +244,10 @@ Class Action{
179
  }
180
  }
181
 
 
182
  $this->store( $form_id, $form_data );
183
 
 
184
  if(class_exists('\MetForm_Pro\Core\Integrations\Rest_Api') && isset($this->form_settings['mf_rest_api']) && ($this->form_settings['mf_rest_api_url'] != '')){
185
  $url = $this->form_settings['mf_rest_api_url'];
186
  $method = $this->form_settings['mf_rest_api_method'];
@@ -200,34 +267,77 @@ Class Action{
200
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
201
  }
202
 
 
203
  $file_input_names = $this->get_input_name_by_widget_type('mf-file-upload');
204
 
205
  if( (!empty($file_data)) && ($file_input_names != null)){
206
  $this->upload_file($file_data, $file_input_names);
207
  }
208
-
 
209
  if(isset($this->form_settings['enable_user_notification']) && $this->form_settings['enable_user_notification'] == 1){
210
 
211
  $this->send_user_email($this->form_data);
212
 
213
  }
214
 
 
215
  if(isset($this->form_settings['enable_admin_notification']) && $this->form_settings['enable_admin_notification'] == 1){
216
 
217
  $this->send_admin_email($this->form_data);
218
  }
219
 
 
 
220
  $paymet_method = $this->get_input_name_by_widget_type('mf-payment-method');
221
 
222
  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) ){
223
- if(isset($this->form_data[$paymet_method[0]])){
224
  update_post_meta( $this->entry_id, $this->key_payment_status, 'unpaid');
225
  $rest_url = get_rest_url( null, 'metform/v1/entries/');
226
  $this->response->data['redirect_to'] = $rest_url."paypal/pay?entry_id=".$this->entry_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  }
228
  }
229
 
230
- $this->response->data['message'] = $this->form_settings['success_message'];
231
  return $this->response;
232
 
233
  }
@@ -408,7 +518,7 @@ Class Action{
408
  $this->form_id = $form_id;
409
  }
410
 
411
- $input_widgets = \Metform\Widgets\Manifest::get_instance()->get_input_widgets();
412
 
413
  $widget_input_data = get_post_meta($this->form_id, '_elementor_data', true);
414
  $widget_input_data = json_decode($widget_input_data);
46
  $this->key_form_data = 'metform_entries__form_data';
47
  $this->key_form_file = 'metform_entries__file_upload';
48
  $this->key_payment_status = 'metform_entries__payment_status';
49
+ $this->post_type = Base::instance()->cpt->get_name();
50
 
51
  }
52
 
64
  $email_name = $this->get_input_name_by_widget_type('mf-email');
65
  $this->email_name = (isset($email_name[0]) ? $email_name[0] : null);
66
 
67
+ // nonce check
68
  if( !isset( $form_data['form_nonce'] ) || !wp_verify_nonce( $form_data['form_nonce'], 'form_nonce' ) ){
69
  $this->response->status = 0;
70
  $this->response->error[] = esc_html__('Unauthorized submission.','metform');
78
  return $this->response;
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');
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
 
120
  return $this->response;
121
  }
122
  }
123
+
124
+ // Captcha solve conditiona and action
125
+ if(isset($form_data['mf-captcha-challenge'])){
126
+ if(($form_data['mf-captcha-challenge']) == ""){
127
+ $this->response->status = 0;
128
+ $this->response->error[] = esc_html__('Please solve the recaptcha.','metform');
129
+ return $this->response;
130
+ }
131
+
132
+ session_start();
133
+
134
+ $time = $_SERVER['REQUEST_TIME'];
135
+
136
+ $timeout_duration = 1800;
137
+
138
+ if (isset($_SESSION['LAST_ACTIVITY']) &&
139
+ ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration) {
140
+ session_unset();
141
+ session_destroy();
142
+ session_start();
143
+ }
144
+
145
+ $_SESSION['LAST_ACTIVITY'] = $time;
146
+
147
+ if(!isset($_SESSION['mf_captcha_text'])){
148
+ $this->response->status = 0;
149
+ $this->response->error[] = esc_html__('Time out of this captcha. Please reload or choose another one.','metform');
150
+ return $this->response;
151
+ }
152
+
153
+ if( isset( $form_data['mf-captcha-challenge'] ) && isset( $_SESSION['mf_captcha_text'] ) && ( $form_data['mf-captcha-challenge'] == $_SESSION['mf_captcha_text'] ) ) {
154
+ $this->response->status = 1;
155
+ $this->response->data['captcha'] = esc_html__('Captcha is verified.','metform');
156
+ } else {
157
+ $this->response->status = 0;
158
+ $this->response->error[] = esc_html__('Enter correct captcha.','metform');
159
+ return $this->response;
160
+ }
161
+
162
+ }
163
 
164
+ // user login check and action
165
  $required_loggin = isset($this->form_settings['require_login']) ? ((int)($this->form_settings['require_login'])) : 0;
166
 
167
  if(($required_loggin == 1) && (!is_user_logged_in())){
170
  return $this->response;
171
  }
172
 
173
+ // Total entry limit check and prevent
174
  if(isset($this->form_settings['limit_total_entries_status'])){
175
  $entry_limit = ((int)($this->form_settings['limit_total_entries_status']));
176
 
182
  }
183
  }
184
 
185
+ // mailchimp email store action
186
  if (class_exists('\MetForm\Core\Integrations\Mail_Chimp')) {
187
  if(isset($this->form_settings['mf_mail_chimp']) && $this->form_settings['mf_mail_chimp'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
188
 
199
  }
200
  }
201
 
202
+ // data submit to zapier action and check
203
  if(class_exists('\MetForm_Pro\Core\Integrations\Zapier')){
204
  if(isset($this->form_settings['mf_zapier']) && $this->form_settings['mf_zapier'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
205
 
221
  }
222
  }
223
 
224
+ // data submit to slack check and action
225
  if(class_exists('\MetForm\Core\Integrations\Slack')){
226
  if(isset($this->form_settings['mf_slack']) && $this->form_settings['mf_slack'] == '1' && $this->email_name != null && $form_data[$this->email_name] != ''){
227
 
244
  }
245
  }
246
 
247
+ // Store data in database
248
  $this->store( $form_id, $form_data );
249
 
250
+ // data submit to a rest api check and action
251
  if(class_exists('\MetForm_Pro\Core\Integrations\Rest_Api') && isset($this->form_settings['mf_rest_api']) && ($this->form_settings['mf_rest_api_url'] != '')){
252
  $url = $this->form_settings['mf_rest_api_url'];
253
  $method = $this->form_settings['mf_rest_api_method'];
267
  $this->response->status = isset($response['status']) ? $response['status'] : 0;
268
  }
269
 
270
+ // file upload check and action
271
  $file_input_names = $this->get_input_name_by_widget_type('mf-file-upload');
272
 
273
  if( (!empty($file_data)) && ($file_input_names != null)){
274
  $this->upload_file($file_data, $file_input_names);
275
  }
276
+
277
+ // send confirmation email to user
278
  if(isset($this->form_settings['enable_user_notification']) && $this->form_settings['enable_user_notification'] == 1){
279
 
280
  $this->send_user_email($this->form_data);
281
 
282
  }
283
 
284
+ // send notification email to admins
285
  if(isset($this->form_settings['enable_admin_notification']) && $this->form_settings['enable_admin_notification'] == 1){
286
 
287
  $this->send_admin_email($this->form_data);
288
  }
289
 
290
+ $this->response->data['message'] = $this->form_settings['success_message'];
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/');
298
  $this->response->data['redirect_to'] = $rest_url."paypal/pay?entry_id=".$this->entry_id;
299
+ $this->response->data['message'] = $this->form_settings['success_message']. esc_html__(' Please wait... Redirecting to paypal.', 'metform');
300
+ }
301
+ }
302
+
303
+ if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe') && ($paymet_method[0] != null) ){
304
+ if(isset($this->form_data[$paymet_method[0]]) && $this->form_data[$paymet_method[0]] == 'stripe'){
305
+ update_post_meta( $this->entry_id, $this->key_payment_status, 'unpaid');
306
+
307
+ $payment_widget_name = \MetForm\Core\Entries\Action::instance()->get_input_name_by_widget_type('mf-payment-method', $this->fields);
308
+ $widget = is_array($payment_widget_name) ? current($payment_widget_name) : '';
309
+
310
+ $amount_filed = isset($this->fields[$widget]->mf_input_payment_field_name) ? $this->fields[$widget]->mf_input_payment_field_name : '';
311
+ $amount = isset($this->form_data[$amount_filed]) ? $this->form_data[$amount_filed] : 0;
312
+
313
+ $this->response->data['payment_method'] = $this->form_data[$paymet_method[0]];
314
+
315
+ $icon_url = !empty($this->form_settings['mf_stripe_image_url']) ? $this->form_settings['mf_stripe_image_url'] : 'https://stripe.com/img/documentation/checkout/marketplace.png';
316
+
317
+ // set key for check payment
318
+ $livekey = isset($this->form_settings['mf_stripe_live_publishiable_key']) ? $this->form_settings['mf_stripe_live_publishiable_key'] : '';
319
+ $livekey_test = isset($this->form_settings['mf_stripe_test_publishiable_key']) ? $this->form_settings['mf_stripe_test_publishiable_key'] : '';
320
+ $sandbox = isset($this->form_settings['mf_stripe_sandbox']) ? true : false;
321
+
322
+ $live_keys = ($sandbox) ? $livekey_test : $livekey;
323
+
324
+ $payment['name_post'] = $this->form_settings['form_title'];
325
+ $payment['description'] = $this->form_id;
326
+ $payment['amount'] = $amount;
327
+ $payment['currency_code'] = 'USD';
328
+ $payment['keys'] = $live_keys;
329
+ $payment['image_url'] = $icon_url;
330
+ $payment['entry_id'] = $this->entry_id;
331
+ $payment['form_id'] = $this->form_id;
332
+ $payment['sandbox'] = $sandbox;
333
+
334
+ $this->response->data['payment_data'] = (Object) $payment;
335
+ $rest_url = get_rest_url( null, 'metform/v1/entries/');
336
+ $this->response->data['ajax_stripe'] = $rest_url."stripe/pay?entry_id=".$this->entry_id;
337
+ $this->response->data['message'] = $this->form_settings['success_message']. esc_html__(' Please wait... Open a Stripe Popup Box.', 'metform');
338
  }
339
  }
340
 
 
341
  return $this->response;
342
 
343
  }
518
  $this->form_id = $form_id;
519
  }
520
 
521
+ $input_widgets = \Metform\Widgets\Manifest::instance()->get_input_widgets();
522
 
523
  $widget_input_data = get_post_meta($this->form_id, '_elementor_data', true);
524
  $widget_input_data = json_decode($widget_input_data);
core/entries/api.php CHANGED
@@ -41,10 +41,25 @@ Class Api extends \MetForm\Base\Api{
41
  return 'Pro needed';
42
 
43
  }
44
-
45
  public function get_stripe(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  return $this->request->get_params();
47
  }
48
 
 
49
  }
50
 
41
  return 'Pro needed';
42
 
43
  }
44
+
45
  public function get_stripe(){
46
+ $args = [
47
+ 'method' => (isset($this->request['action']) ? $this->request['action']: ''),
48
+ 'action' => (isset($this->request['id']) ? $this->request['id']: ''),
49
+ 'entry_id' => (isset($this->request['entry_id']) ? $this->request['entry_id']: ''),
50
+ 'token' => (isset($this->request['token']) ? $this->request['token']: ''),
51
+ ];
52
+ if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe')){
53
+ return \MetForm_Pro\Core\Integrations\Payment\Stripe::instance()->init($args);
54
+ }
55
+ return 'Pro needed';
56
+
57
+ }
58
+
59
+ public function get_views(){
60
  return $this->request->get_params();
61
  }
62
 
63
+
64
  }
65
 
core/entries/{init.php → base.php} RENAMED
@@ -2,7 +2,7 @@
2
  namespace MetForm\Core\Entries;
3
  defined( 'ABSPATH' ) || exit;
4
 
5
- Class Init{
6
 
7
  use \MetForm\Traits\Singleton;
8
 
2
  namespace MetForm\Core\Entries;
3
  defined( 'ABSPATH' ) || exit;
4
 
5
+ Class Base{
6
 
7
  use \MetForm\Traits\Singleton;
8
 
core/entries/meta-data.php CHANGED
@@ -160,7 +160,6 @@ Class Meta_Data{
160
 
161
  function show_file_upload_cmb($post){
162
  echo "<div class='mf-file-show'><p class='mf-file'>";
163
-
164
  foreach($this->file_meta_data as $key => $value){
165
  if(empty($this->fields)){
166
  return;
160
 
161
  function show_file_upload_cmb($post){
162
  echo "<div class='mf-file-show'><p class='mf-file'>";
 
163
  foreach($this->file_meta_data as $key => $value){
164
  if(empty($this->fields)){
165
  return;
core/forms/action.php CHANGED
@@ -7,6 +7,7 @@ Class Action{
7
  use \MetForm\Traits\Singleton;
8
 
9
  private $key_form_settings;
 
10
  private $post_type;
11
 
12
  private $fields;
@@ -16,11 +17,9 @@ Class Action{
16
  private $response = [];
17
 
18
  public function __construct(){
19
- if( !current_user_can( 'manage_options' ) ){
20
- return;
21
- }
22
 
23
  $this->key_form_settings = Base::instance()->form->get_key_form_settings();
 
24
  $this->post_type = Base::instance()->form->get_name();
25
 
26
  $this->response = [
@@ -32,6 +31,9 @@ Class Action{
32
  }
33
 
34
  public function store( $form_id, $form_setting ){
 
 
 
35
 
36
  $this->fields = $this->get_fields();
37
  $this->sanitize( $form_setting );
@@ -66,6 +68,9 @@ Class Action{
66
  }
67
 
68
  public function insert(){
 
 
 
69
 
70
  $this->title = ($this->form_setting['form_title'] != '') ? $this->form_setting['form_title'] : 'New Form # '.time();
71
 
@@ -98,6 +103,9 @@ Class Action{
98
  }
99
 
100
  public function update(){
 
 
 
101
 
102
  $this->title = ($this->form_setting['form_title'] != '') ? $this->form_setting['form_title'] : 'New Form # '.time();
103
 
@@ -159,4 +167,26 @@ Class Action{
159
  return $data;
160
 
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
7
  use \MetForm\Traits\Singleton;
8
 
9
  private $key_form_settings;
10
+ private $key_form_count_views;
11
  private $post_type;
12
 
13
  private $fields;
17
  private $response = [];
18
 
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
 
25
  $this->response = [
31
  }
32
 
33
  public function store( $form_id, $form_setting ){
34
+ if( !current_user_can( 'manage_options' ) ){
35
+ return;
36
+ }
37
 
38
  $this->fields = $this->get_fields();
39
  $this->sanitize( $form_setting );
68
  }
69
 
70
  public function insert(){
71
+ if( !current_user_can( 'manage_options' ) ){
72
+ return;
73
+ }
74
 
75
  $this->title = ($this->form_setting['form_title'] != '') ? $this->form_setting['form_title'] : 'New Form # '.time();
76
 
103
  }
104
 
105
  public function update(){
106
+ if( !current_user_can( 'manage_options' ) ){
107
+ return;
108
+ }
109
 
110
  $this->title = ($this->form_setting['form_title'] != '') ? $this->form_setting['form_title'] : 'New Form # '.time();
111
 
167
  return $data;
168
 
169
  }
170
+
171
+ public function get_count_views( $form_id ){
172
+ return get_post_meta( $form_id, $this->key_form_count_views, true );
173
+ }
174
+
175
+ public function count_views( $form_id ){
176
+
177
+ if( current_user_can( 'manage_options' ) ){
178
+ return;
179
+ }
180
+
181
+ $form_setting = $this->get_all_data( $form_id );
182
+ //return $form_setting;
183
+
184
+ if(isset($form_setting['count_views']) && $form_setting['count_views'] == '1'){
185
+ $count = $this->get_count_views( $form_id );
186
+ $count = (int)$count;
187
+ $count++;
188
+ update_post_meta( $form_id, $this->key_form_count_views, $count );
189
+ return $count;
190
+ }
191
+ }
192
  }
core/forms/api.php CHANGED
@@ -51,4 +51,9 @@ Class Api extends \MetForm\Base\Api{
51
  exit();
52
  }
53
 
 
 
 
 
 
54
  }
51
  exit();
52
  }
53
 
54
+ public function post_views(){
55
+ $form_id = $this->request['id'];
56
+ return Action::instance()->count_views($form_id);
57
+ }
58
+
59
  }
core/forms/cpt.php CHANGED
@@ -47,6 +47,9 @@ Class Cpt extends \MetForm\Base\Cpt{
47
  'limit_total_entries' => [
48
  'name' => 'limit_total_entries',
49
  ],
 
 
 
50
  'multiple_submission' => [
51
  'name' => 'multiple_submission',
52
  ],
@@ -137,6 +140,27 @@ Class Cpt extends \MetForm\Base\Cpt{
137
  'mf_paypal_sandbox' => [
138
  'name' => 'mf_paypal_sandbox',
139
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  'mf_recaptcha' => [
141
  'name' => 'mf_recaptcha',
142
  ],
47
  'limit_total_entries' => [
48
  'name' => 'limit_total_entries',
49
  ],
50
+ 'count_views' => [
51
+ 'name' => 'count_views',
52
+ ],
53
  'multiple_submission' => [
54
  'name' => 'multiple_submission',
55
  ],
140
  'mf_paypal_sandbox' => [
141
  'name' => 'mf_paypal_sandbox',
142
  ],
143
+ 'mf_stripe' => [
144
+ 'name' => 'mf_stripe',
145
+ ],
146
+ 'mf_stripe_image_url' => [
147
+ 'name' => 'mf_stripe_image_url',
148
+ ],
149
+ 'mf_stripe_live_publishiable_key' => [
150
+ 'name' => 'mf_stripe_live_publishiable_key',
151
+ ],
152
+ 'mf_stripe_live_secret_key' => [
153
+ 'name' => 'mf_stripe_live_secret_key',
154
+ ],
155
+ 'mf_stripe_sandbox' => [
156
+ 'name' => 'mf_stripe_sandbox',
157
+ ],
158
+ 'mf_stripe_test_publishiable_key' => [
159
+ 'name' => 'mf_stripe_test_publishiable_key',
160
+ ],
161
+ 'mf_stripe_test_secret_key' => [
162
+ 'name' => 'mf_stripe_test_secret_key',
163
+ ],
164
  'mf_recaptcha' => [
165
  'name' => 'mf_recaptcha',
166
  ],
core/forms/hooks.php CHANGED
@@ -34,6 +34,7 @@ Class Hooks{
34
 
35
  $columns['shortcode'] = esc_html__( 'Shortcode', 'metform' );
36
  $columns['count'] = esc_html__( 'Entries', 'metform' );
 
37
  $columns['author'] = esc_html( $author_column );
38
  $columns['date'] = esc_html( $date_column );
39
 
@@ -60,6 +61,21 @@ Class Hooks{
60
  echo "<a data-metform-form-id=".esc_attr($post_id)." class='attr-btn attr-btn-primary mf-entry-filter' href=".esc_url($current_url).">".esc_html($count)."</a>";
61
  echo "<a class='attr-btn attr-btn-info mf-entry-export-csv' href=".esc_url($export_url).">".esc_html__('Export CSV', 'metform')."</a>";
62
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
  }
65
 
34
 
35
  $columns['shortcode'] = esc_html__( 'Shortcode', 'metform' );
36
  $columns['count'] = esc_html__( 'Entries', 'metform' );
37
+ $columns['views_conversion'] = esc_html__( 'Views/ Conversion', 'metform' );
38
  $columns['author'] = esc_html( $author_column );
39
  $columns['date'] = esc_html( $date_column );
40
 
61
  echo "<a data-metform-form-id=".esc_attr($post_id)." class='attr-btn attr-btn-primary mf-entry-filter' href=".esc_url($current_url).">".esc_html($count)."</a>";
62
  echo "<a class='attr-btn attr-btn-info mf-entry-export-csv' href=".esc_url($export_url).">".esc_html__('Export CSV', 'metform')."</a>";
63
  break;
64
+ case 'views_conversion':
65
+ $views = \MetForm\Core\Forms\Action::instance()->get_count_views($post_id);
66
+ $views = (int)$views;
67
+
68
+ $count = \MetForm\Core\Entries\Action::instance()->get_entry_count($post_id);
69
+ $count = (int)$count;
70
+
71
+ if($views != 0){
72
+ $conversion = ($count*100)/$views;
73
+ $conversion = round($conversion, 2);
74
+ }else{
75
+ $conversion = 0;
76
+ }
77
+ echo esc_html($views."/ ".$conversion."%");
78
+ break;
79
  }
80
  }
81
 
core/forms/views/modal-editor.php CHANGED
@@ -85,6 +85,14 @@
85
  <span class='mf-input-help'><?php esc_html_e('Limit the total number of submissions for this form.','metform'); ?></span>
86
  </div>
87
  <br>
 
 
 
 
 
 
 
 
88
  <div class="mf-input-group">
89
  <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Redirect To:', 'metform'); ?></label>
90
  <input type="text" name="redirect_to" class="mf-form-modalinput-redirect_to attr-form-control" placeholder="<?php esc_html_e('Redirection link', 'metform'); ?>">
@@ -343,6 +351,56 @@
343
  <?php endif ?>
344
  <br>
345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  </div>
347
 
348
  </div>
85
  <span class='mf-input-help'><?php esc_html_e('Limit the total number of submissions for this form.','metform'); ?></span>
86
  </div>
87
  <br>
88
+ <div class="mf-input-group">
89
+ <label class="attr-input-label">
90
+ <input type="checkbox" value="1" name="count_views" class="mf-admin-control-input mf-form-modalinput-count_views">
91
+ <span><?php esc_html_e('Count views:', 'metform'); ?></span>
92
+ </label>
93
+ <span class='mf-input-help'><?php esc_html_e('Track form views.','metform'); ?></span>
94
+ </div>
95
+ <br>
96
  <div class="mf-input-group">
97
  <label for="attr-input-label" class="attr-input-label"><?php esc_html_e('Redirect To:', 'metform'); ?></label>
98
  <input type="text" name="redirect_to" class="mf-form-modalinput-redirect_to attr-form-control" placeholder="<?php esc_html_e('Redirection link', 'metform'); ?>">
351
  <?php endif ?>
352
  <br>
353
 
354
+ <?php if(class_exists('\MetForm_Pro\Core\Integrations\Payment\Stripe')): ?>
355
+ <div class="mf-input-group">
356
+ <label class="attr-input-label">
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
+
404
  </div>
405
 
406
  </div>
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.8
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.1.9
9
  * Author: Wpmet
10
  * Author URI: https://wpmet.com
11
  * Text Domain: metform
plugin.php CHANGED
@@ -14,7 +14,7 @@ final class Plugin{
14
  }
15
 
16
  public function version(){
17
- return '1.1.8';
18
  }
19
 
20
  public function package_type(){
@@ -111,9 +111,9 @@ final class Plugin{
111
 
112
  Core\Forms\Base::instance()->init();
113
  Controls\Base::instance()->init();
114
- $this->entries = Core\Entries\Init::instance();
115
 
116
- Widgets\Manifest::get_instance()->init();
117
 
118
  // Add banner class
119
  include $this->utils_dir() . 'banner.php';
@@ -136,13 +136,23 @@ final class Plugin{
136
  wp_enqueue_script('asRange', $this->public_url().'assets/js/jquery-asRange.min.js', array(), $this->version(), true);
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')
144
  ));
 
 
 
 
 
 
 
 
145
 
 
 
146
  do_action('metform/onload/enqueue_scripts');
147
  }
148
 
14
  }
15
 
16
  public function version(){
17
+ return '1.1.9';
18
  }
19
 
20
  public function package_type(){
111
 
112
  Core\Forms\Base::instance()->init();
113
  Controls\Base::instance()->init();
114
+ $this->entries = Core\Entries\Base::instance();
115
 
116
+ Widgets\Manifest::instance()->init();
117
 
118
  // Add banner class
119
  include $this->utils_dir() . 'banner.php';
136
  wp_enqueue_script('asRange', $this->public_url().'assets/js/jquery-asRange.min.js', array(), $this->version(), true);
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')
144
  ));
145
+
146
+ if(! \Elementor\Plugin::$instance->preview->is_preview_mode()){
147
+ $rest_url = get_rest_url( null, 'metform/v1/forms/');
148
+ wp_enqueue_script('metform-count-views', $this->public_url().'assets/js/count-views.js', array(), $this->version(), true);
149
+ wp_localize_script('metform-count-views', 'rest_api', array(
150
+ 'end_point' => $rest_url
151
+ ));
152
+ }
153
 
154
+ wp_register_script('metform-summary', $this->public_url().'assets/js/summary.js', array(), $this->version(), true);
155
+
156
  do_action('metform/onload/enqueue_scripts');
157
  }
158
 
public/assets/css/style.css CHANGED
@@ -498,4 +498,25 @@ ul.mf-input.mf-input-rating{
498
  .mf-input-multiselect,
499
  .mf-input-select{
500
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
  }
498
  .mf-input-multiselect,
499
  .mf-input-select{
500
  display: none;
501
+ }
502
+
503
+ .metform-entry-data table.mf-entry-data {
504
+ width: 100%;
505
+ background-color: #fff;
506
+ border: 1px solid #eaf2fa;
507
+ }
508
+ .metform-entry-data table.mf-entry-data tbody tr.mf-data-label {
509
+ background-color: #eaf2fa;
510
+ }
511
+ .metform-entry-data table.mf-entry-data tbody tr.mf-data-value {
512
+ background-color: #fff;
513
+ }
514
+ .metform-entry-data table.mf-entry-data tbody tr.mf-data-value td.mf-value-space {
515
+ width: 20px;
516
+ }
517
+ .elementor-widget-mf-range .mf-field-error .error {
518
+ display: none !important;
519
+ }
520
+ .mf-input-wrapper .select2 {
521
+ width: 100% !important;
522
  }
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-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 a=e(".mf-form-modalinput-store_entries");"1"==t.store_entries?a.attr("checked",!0):a.removeAttr("checked");var i=e(".mf-form-modalinput-hide_form_after_submission");"1"==t.hide_form_after_submission?i.attr("checked",!0):i.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-multiple_submission");"1"==t.multiple_submission?o.attr("checked",!0):o.removeAttr("checked");var s=e(".mf-form-modalinput-enable_recaptcha");"1"==t.enable_recaptcha?s.attr("checked",!0):s.removeAttr("checked");var n=e(".mf-form-modalinput-capture_user_browser_data");"1"==t.capture_user_browser_data?(n.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):n.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 c=e(".mf-form-user-enable");"1"==t.enable_user_notification?(c.attr("checked",!0),e(".mf-form-user-confirmation").show()):(c.removeAttr("checked"),e(".mf-form-user-confirmation").hide());var f=e(".mf-form-user-submission-copy");"1"==t.user_email_attach_submission_copy?f.attr("checked",!0):f.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 d=e(".mf-form-admin-enable");"1"==t.enable_admin_notification?(d.attr("checked",!0),e(".mf-form-admin-notification").show()):(d.removeAttr("checked"),e(".mf-form-admin-notification").hide());var l=e(".mf-form-admin-submission-copy");"1"==t.admin_email_attach_submission_copy?l.attr("checked",!0):l.removeAttr("checked");var u=e(".mf-form-modalinput-rest_api");"1"==t.mf_rest_api?(u.attr("checked",!0),e(".mf-rest-api").show()):(u.removeAttr("checked"),e(".mf-rest-api").hide());var p=e(".mf-form-modalinput-mail_chimp");"1"==t.mf_mail_chimp?(p.attr("checked",!0),e(".mf-mailchimp").show()):(p.removeAttr("checked"),e(".mf-mailchimp").hide());var h=e(".mf-form-modalinput-zapier");"1"==t.mf_zapier?(h.attr("checked",!0),e(".mf-zapier").show()):(h.removeAttr("checked",!0),e(".mf-zapier").hide());var _=e(".mf-form-modalinput-slack");"1"==t.mf_slack?(_.attr("checked",!0),e(".mf-slack").show()):(_.removeAttr("checked",!0),e(".mf-slack").hide());var v=e(".mf-form-modalinput-paypal");"1"==t.mf_paypal?(v.attr("checked",!0),e(".mf-paypal").show()):(v.removeAttr("checked",!0),e(".mf-paypal").hide());var k=e(".mf-form-modalinput-paypal_sandbox");"1"==t.mf_paypal_sandbox?k.attr("checked",!0):k.removeAttr("checked",!0);var b=e(".mf-form-modalinput-recaptcha");"1"==t.mf_recaptcha?(b.attr("checked",!0),e(".mf-recaptcha").show()):b.removeAttr("checked");var y=t.mf_rest_api_method&&t.mf_rest_api_method.length?t.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+y+'"]').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-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(a){a.preventDefault();var i=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){i=e(this).attr("data-metform-form-id"),"undefined"!==o&&(i=o),i=void 0!==i?i: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/"+i,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",i)}),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 a=e("#metform-form-modal");a.addClass("loading"),e(".metform-form-save-btn-editor").attr("disabled",!0),e(".metform-form-save-btn").attr("disabled",!0);var i=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:i,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),a.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-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 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"))})});
public/assets/js/count-views.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ 'use strict'
3
+ var forms = $('.metform-form-content');
4
+ if(forms.length > 0){
5
+ forms.each(function(i, v){
6
+ var nonce = $(this).attr('data-nonce'),
7
+ post_url = rest_api.end_point+'views/',
8
+ form_id = $(this).attr('data-form-id');
9
+
10
+ $.ajax({
11
+ url: post_url+form_id,
12
+ type: 'POST',
13
+ headers: {
14
+ 'X-WP-Nonce': nonce
15
+ },
16
+ success: function (response) {
17
+ //console.log(response);
18
+ }
19
+ });
20
+ });
21
+ }
22
+ });
public/assets/js/inputs.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"use strict";var a={init:function(){var n={"mf-range.default":a.RangeInput,"mf-date.default":a.DateInput,"mf-time.default":a.TimeInput,"mf-select.default":a.SelectInput,"mf-multi-select.default":a.MultiSelectInput,"mf-rating.default":a.Rating,"mf-file-upload.default":a.fileUpload};t.each(n,function(t,a){e.hooks.addAction("frontend/element_ready/"+t,a)})},RangeInput:function(e){var a=e.find(".mf-rs-range"),n=a.attr("min"),i=a.attr("max"),r=a.attr("step"),f=a.attr("range"),l={step:r,min:n,max:i};"true"==f&&(l.range=Boolean(f)),a.asRange(l),a.on("asRange::change",function(e){var a=t(this).asRange("get");Array.isArray(a)&&(a=Number(a[1])-Number(a[0])),t(this).val(a).trigger("change").valid()})},DateInput:function(t){var e=t.find(".mf-date-input"),a=e.attr("data-mfMinDate"),n=e.attr("data-mfMaxDate"),i=e.attr("data-mfRangeDate"),r=e.attr("data-mfDateFormat"),f=e.attr("data-mfEnableTime"),l=e.attr("data-mfDisableDates"),d={appendTo:t.find(".mf-input-wrapper").get(0)};"yes"==f&&(d.enableTime=!0,r+=" H:i"),""!=l&&(d.disable=JSON.parse(l)),""!=a&&(d.minDate=a),""!=n&&(d.maxDate=n),"yes"==i&&(d.mode="range"),d.dateFormat=r,e.flatpickr(d)},TimeInput:function(t){var e=t.find(".mf-input-time"),a=e.attr("data-mftime24h"),n={appendTo:t.find(".mf-input-wrapper").get(0),dateFormat:"h:i K",enableTime:!0,noCalendar:!0};"yes"==a&&(n.dateFormat="H:i",n.time_24hr=!0),e.flatpickr(n)},SelectInput:function(t){t.find("select.mf-input-select").select2({dropdownParent:t.find(".mf-input-wrapper")})},MultiSelectInput:function(e){var a=e.find("select.mf-input-multiselect");a.select2({dropdownParent:e.find(".mf-input-wrapper")}),a.on("change",function(){t(this).valid()})},Rating:function(e){var a=e.find(".mf-input-rating li");a.on("mouseover",function(){var e=parseInt(t(this).data("value"),10);t(this).parent().children("li.star-li").each(function(a){a<e?t(this).addClass("hover"):t(this).removeClass("hover")})}).on("mouseout",function(){t(this).parent().children("li.star-li").each(function(e){t(this).removeClass("hover")})}),a.on("click",function(){var e=parseInt(t(this).data("value"),10),a=t(this).parent().children("li.star-li");for(let e=0;e<a.length;e++)t(a[e]).removeClass("selected");for(let n=0;n<e;n++)t(a[n]).addClass("selected");var n=t(this).parents().find("input.mf-input-hidden");n.val(e),n.valid()})},fileUpload:function(e){e.find(".mf-input-file-upload").on("change",function(){var a=t(this).val().match(/\\([^\\]+)$/)[1];e.find(".mf-file-name span").html(a)})}};t(window).on("elementor/frontend/init",a.init)}(jQuery,window.elementorFrontend);
1
+ !function(t,e){"use strict";var a={init:function(){var n={"mf-range.default":a.RangeInput,"mf-date.default":a.DateInput,"mf-time.default":a.TimeInput,"mf-select.default":a.SelectInput,"mf-multi-select.default":a.MultiSelectInput,"mf-rating.default":a.Rating,"mf-file-upload.default":a.fileUpload,"metform.default":a.Metform};t.each(n,function(t,a){e.hooks.addAction("frontend/element_ready/"+t,a)})},RangeInput:function(e){var a=e.find(".mf-rs-range"),n=a.attr("min"),i=a.attr("max"),r=a.attr("step"),f=a.attr("range"),o={step:r,min:n,max:i};"true"==f&&(o.range=Boolean(f)),a.asRange(o),a.on("asRange::change",function(e){var a=t(this).asRange("get");Array.isArray(a)&&(a=Number(a[1])-Number(a[0])),t(this).val(a).trigger("change").valid()})},DateInput:function(t){var e=t.find(".mf-date-input"),a=e.attr("data-mfMinDate"),n=e.attr("data-mfMaxDate"),i=e.attr("data-mfRangeDate"),r=e.attr("data-mfDateFormat"),f=e.attr("data-mfEnableTime"),o=e.attr("data-mfDisableDates"),l={appendTo:t.find(".mf-input-wrapper").get(0)};"yes"==f&&(l.enableTime=!0,r+=" H:i"),""!=o&&(l.disable=JSON.parse(o)),""!=a&&(l.minDate=a),""!=n&&(l.maxDate=n),"yes"==i&&(l.mode="range"),l.dateFormat=r,e.flatpickr(l)},TimeInput:function(t){var e=t.find(".mf-input-time"),a=e.attr("data-mftime24h"),n={appendTo:t.find(".mf-input-wrapper").get(0),dateFormat:"h:i K",enableTime:!0,noCalendar:!0};"yes"==a&&(n.dateFormat="H:i",n.time_24hr=!0),e.flatpickr(n)},SelectInput:function(t){t.find("select.mf-input-select").select2({dropdownParent:t.find(".mf-input-wrapper")})},MultiSelectInput:function(e){var a=e.find("select.mf-input-multiselect");a.select2({dropdownParent:e.find(".mf-input-wrapper")}),a.on("change",function(){t(this).valid()})},Rating:function(e){var a=e.find(".mf-input-rating li");a.on("mouseover",function(){var e=parseInt(t(this).data("value"),10);t(this).parent().children("li.star-li").each(function(a){a<e?t(this).addClass("hover"):t(this).removeClass("hover")})}).on("mouseout",function(){t(this).parent().children("li.star-li").each(function(e){t(this).removeClass("hover")})}),a.on("click",function(){var e=parseInt(t(this).data("value"),10),a=t(this).parent().children("li.star-li");for(let e=0;e<a.length;e++)t(a[e]).removeClass("selected");for(let n=0;n<e;n++)t(a[n]).addClass("selected");var n=t(this).parents().find("input.mf-input-hidden");n.val(e).trigger("change"),n.valid()})},fileUpload:function(e){e.find(".mf-input-file-upload").on("change",function(){var a=t(this).val().match(/\\([^\\]+)$/)[1];e.find(".mf-file-name span").html(a)})},Metform:function(t){var e=t.find(".metform-form-content");"undefined"!=typeof metformSubmision&&metformSubmision(e)}};t(window).on("elementor/frontend/init",a.init)}(jQuery,window.elementorFrontend);
public/assets/js/map-location.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var mapLocationAutocomplete;
2
+
3
+ function metformMapAutoComplete() {
4
+
5
+ var select = document.querySelectorAll('.mf-input-map-location');
6
+
7
+ select.forEach(function(v, i){
8
+ mapLocationAutocomplete = new google.maps.places.Autocomplete(
9
+ select[i], {types: ['geocode']});
10
+ });
11
+
12
+
13
+ }
14
+
15
+ function mfgeolocate() {
16
+ if (navigator.geolocation) {
17
+ navigator.geolocation.getCurrentPosition(function(position) {
18
+ var geolocation = {
19
+ lat: position.coords.latitude,
20
+ lng: position.coords.longitude
21
+ };
22
+ var circle = new google.maps.Circle(
23
+ {center: geolocation, radius: position.coords.accuracy});
24
+ mapLocationAutocomplete.setBounds(circle.getBounds());
25
+ });
26
+ }
27
+ }
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");t.attr("id",t.attr("id")+"_"+e),grecaptcha.render("recaptcha_site_key_"+e,{sitekey:a.data("site-key")})})};jQuery(document).ready(function(e){var t=!1;e.validator.addMethod("regx",function(e,t,a){return new RegExp(a).test(e)},e.validator.format("Please match the expression {0}")),e.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},e.validator.format("Please match word length.")),jQuery.validator.addMethod("ratingValidate",function(t,a,s){return!e(a).prop("required")||e(a).parents(".mf-input-wrapper").find(".mf-input-rating li.selected").length},e.validator.format(mf_submission.default_required_message)),e(".metform-form-content").validate({ignore:[],rules:{"mf-rating":{ratingValidate:!0}},submitHandler:function(e){t=!0},errorPlacement:function(e,t){t.parents(".mf-input-wrapper").append(e)},highlight:function(t){e(t).parents(".mf-input-wrapper").addClass("mf-field-error")},unhighlight:function(t){e(t).parents(".mf-input-wrapper").removeClass("mf-field-error")}}),e(".mf-input").each(function(){var t=e(this).attr("data-validation"),a=e(this).attr("min"),s=e(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}};t&&("none"!==(t=JSON.parse(t)).validation_type&&(n.required=!0,n.messages.required=t.warning_message),"by_character_length"===t.validation_type?(t.min_length&&(n.minlength=t.min_length,n.messages.minlength=t.warning_message),t.max_length&&(n.maxlength=t.max_length,n.messages.maxlength=t.warning_message),n.messages.email=t.warning_message):"by_word_length"===t.validation_type?(n.wordLength={},n.messages.wordLength=t.warning_message,t.min_length&&(n.wordLength.min=t.min_length),t.max_length&&(n.wordLength.max=t.max_length),n.messages.email=t.warning_message):"by_expresssion_based"===t.validation_type&&(n.messages.regx=t.warning_message,t.expression&&e(this).rules("add",{regx:t.expression}),n.messages.email=t.warning_message)),(a||s)&&(n.range=[a,s]),e(this).rules("add",n)}),e(".metform-form-content").submit(function(a){if(t){a.preventDefault();var s=e(this);s.find('.mf-input[type="tel"]').each(function(){var t,a=e(this),s=a.val();t=a.siblings(".iti__flag-container").find(".iti__selected-dial-code").text(),a.val(t+s)});var n=s.parent().find(".metform-msg"),r=s.attr("action"),i=new FormData(this),m=s.attr("data-nonce");n.length>1&&s.parent().find(".metform-inx").remove(),e.ajax({url:r,type:"POST",dataType:"JSON",data:i,processData:!1,contentType:!1,headers:{"X-WP-Nonce":m},success:function(a){t=!1;var r=Number(a.status),i="";e.each(a.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(a.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)),""!=a.data.hide_form&&setTimeout(function(){s.css("display","none")},2e3),""!=a.data.redirect_to&&setTimeout(function(){window.location.href=a.data.redirect_to},1500)}})}})});
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"))});
public/assets/js/summary.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ 'use strict'
3
+
4
+ $.fn.extend({
5
+ mfSerializeArray: function () {
6
+ var brokenSerialization = $.fn.serializeArray.apply(this);
7
+ var checkboxValues = $(this).find('input[type=checkbox], input[type=radio]').map(function () {
8
+ return { 'name': this.name, 'value': this.checked };
9
+ }).get();
10
+ var checkboxKeys = $.map(brokenSerialization, function (element) { return element.name; });
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
+ }
18
+ });
19
+
20
+ function metFormData(){
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
+ }
35
+
36
+
37
+ function delay(callback, ms) {
38
+ var timer = 0;
39
+ return function () {
40
+ var context = this, args = arguments;
41
+ clearTimeout(timer);
42
+ timer = setTimeout(function () {
43
+ callback.apply(context, args);
44
+ }, ms || 0);
45
+ };
46
+ }
47
+
48
+ $('.metform-form-content').on('change keyup paste', 'input, select, textarea', delay(function (e) {
49
+ metFormData();
50
+ }, 200));
51
+
52
+ });
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Metform Elementor Addon - Most flexible and design-friendly Contact Form builder ===
2
  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.8
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -16,10 +16,6 @@ Metform an addon for elementor builder, build any kind of form metform builder.
16
  Metform builder an addon for elementor, build any form on the fly with metform builder. It can manage multiple contact forms, and you can customize the form with an elementor builder.
17
  MetForm is not only a contact form plugin, but it is also a complete drag & drop form builder with elementor. You can build any contact forms, in Just Minutes. You don't even Have to be a programmer or developer.
18
 
19
- == Metform intro ==
20
- <iframe width="560" height="315" src="https://www.youtube.com/embed/zg1QIouKO_Q" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
21
-
22
- == Metform from scratch ==
23
  <iframe width="560" height="315" src="https://www.youtube.com/embed/8R4-Q14cu-w" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
24
 
25
  == Flexibility ==
@@ -69,14 +65,6 @@ You can use MailChimp in your contact form also create MailChimp signup forms wi
69
  * Editable successful form submission message.
70
  * Translation ready
71
 
72
- == PRO FEATURES ==
73
- * Muti Step form
74
- * Calculation
75
- * Conditional Logic
76
- * Paypal Intregation
77
- * Webhook
78
- * Zapier Intregation
79
-
80
 
81
 
82
 
@@ -101,16 +89,16 @@ You can use MailChimp in your contact form also create MailChimp signup forms wi
101
  * Rating
102
  * File Upload
103
 
104
- == Supported PRO fields==
105
- * Simple Repeater Field
106
- * Toggle select Field
107
- * Phone number with country code
108
- * Image Select Field
109
- * More coming soon
110
 
 
 
 
 
 
 
111
 
112
 
113
- == Changelog ==
114
 
115
  Version 1.1.8
116
  Fix: Updated input default color
@@ -120,6 +108,8 @@ Fix: Added default value of some widget controls
120
  Fix: Organized the widget controls
121
  Fix: Improved table UI
122
 
 
 
123
  Version: 1.1.5
124
  3rd party plugin compatibility
125
  Rest API Data submit improvement
@@ -147,6 +137,9 @@ Added telephone widget
147
  Added widget area to edit save use from same page.
148
 
149
 
 
 
 
150
  == Upgrade Notice ==
151
 
152
 
1
+ === Metform Elementor Addon - Most flexible and design-friendly Contact Form builder ===
2
  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
16
  Metform builder an addon for elementor, build any form on the fly with metform builder. It can manage multiple contact forms, and you can customize the form with an elementor builder.
17
  MetForm is not only a contact form plugin, but it is also a complete drag & drop form builder with elementor. You can build any contact forms, in Just Minutes. You don't even Have to be a programmer or developer.
18
 
 
 
 
 
19
  <iframe width="560" height="315" src="https://www.youtube.com/embed/8R4-Q14cu-w" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
20
 
21
  == Flexibility ==
65
  * Editable successful form submission message.
66
  * Translation ready
67
 
 
 
 
 
 
 
 
 
68
 
69
 
70
 
89
  * Rating
90
  * File Upload
91
 
92
+ == Changelog ==
 
 
 
 
 
93
 
94
+ Version 1.1.9
95
+ Added Simple captcha
96
+ Added conversion and views in entries tabs
97
+ Fixed Recaptcha version 2 issue
98
+ Improve validation
99
+ Re-arranged controls
100
 
101
 
 
102
 
103
  Version 1.1.8
104
  Fix: Updated input default color
108
  Fix: Organized the widget controls
109
  Fix: Improved table UI
110
 
111
+
112
+
113
  Version: 1.1.5
114
  3rd party plugin compatibility
115
  Rest API Data submit improvement
137
  Added widget area to edit save use from same page.
138
 
139
 
140
+
141
+
142
+
143
  == Upgrade Notice ==
144
 
145
 
traits/common-controls.php CHANGED
@@ -637,9 +637,6 @@ trait Common_Controls{
637
  '{{WRAPPER}} .mf-input' => 'border-radius: {{SIZE}}{{UNIT}};',
638
  '{{WRAPPER}} .mf-input-wrapper .select2-container--default .select2-selection--single, {{WRAPPER}} .select2-container--default .select2-search--dropdown .select2-search__field, {{WRAPPER}} .mf-input-wrapper ul.select2-results__options .select2-results__option, {{WRAPPER}} .mf-input-wrapper .select2-container .select2-selection--multiple .select2-selection__rendered, {{WRAPPER}} .mf-file-upload-container .mf-input-file-upload-label, {{WRAPPER}} .mf-input-wrapper .iti--separate-dial-code .iti__selected-flag, {{WRAPPER}} .mf-input-calculation-total' => 'border-radius: {{SIZE}}{{UNIT}};',
639
  ],
640
- 'condition' => [
641
- 'mf_input_border_border!' => '',
642
- ],
643
  ]
644
  );
645
 
637
  '{{WRAPPER}} .mf-input' => 'border-radius: {{SIZE}}{{UNIT}};',
638
  '{{WRAPPER}} .mf-input-wrapper .select2-container--default .select2-selection--single, {{WRAPPER}} .select2-container--default .select2-search--dropdown .select2-search__field, {{WRAPPER}} .mf-input-wrapper ul.select2-results__options .select2-results__option, {{WRAPPER}} .mf-input-wrapper .select2-container .select2-selection--multiple .select2-selection__rendered, {{WRAPPER}} .mf-file-upload-container .mf-input-file-upload-label, {{WRAPPER}} .mf-input-wrapper .iti--separate-dial-code .iti__selected-flag, {{WRAPPER}} .mf-input-calculation-total' => 'border-radius: {{SIZE}}{{UNIT}};',
639
  ],
 
 
 
640
  ]
641
  );
642
 
traits/conditional-controls.php CHANGED
@@ -37,6 +37,7 @@ trait Conditional_Controls{
37
  'label_on' => 'Yes',
38
  'label_off' => 'No',
39
  'return_value' => 'yes',
 
40
  ]
41
  );
42
 
@@ -46,11 +47,32 @@ trait Conditional_Controls{
46
  'label' => esc_html__( 'Condition match criteria', 'metform' ),
47
  'type' => Controls_Manager::SELECT,
48
  'label_block' => true,
 
49
  'options' => [
50
- 'or' => esc_html__( 'Any', 'metform' ),
51
- 'and' => esc_html__( 'All', 'metform' ),
52
  ],
53
- 'default' => 'or',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  'condition' => [
55
  'mf_conditional_logic_form_enable' => 'yes',
56
  ],
@@ -78,18 +100,14 @@ trait Conditional_Controls{
78
  'options' => [
79
  'not-empty' => esc_html__( 'not empty', 'metform' ),
80
  'empty' => esc_html__( 'empty', 'metform' ),
81
- '=' => esc_html__( 'equals', 'metform' ),
82
  '!=' => esc_html__( 'not equals', 'metform' ),
83
  '>' => esc_html__( 'greater than', 'metform' ),
84
  '>=' => esc_html__( 'greater than equal', 'metform' ),
85
  '<' => esc_html__( 'smaller than', 'metform' ),
86
  '<=' => esc_html__( 'smaller than equal', 'metform' ),
87
- 'checked' => esc_html__( 'checked', 'metform' ),
88
- 'unchecked' => esc_html__( 'unchecked', 'metform' ),
89
- ],
90
- 'default' => [
91
- 'not-empty',
92
  ],
 
93
  ]
94
  );
95
 
@@ -101,28 +119,12 @@ trait Conditional_Controls{
101
  'label_block' => true,
102
  'placeholder' => esc_html__( '50', 'metform' ),
103
  'condition' => [
104
- 'mf_conditional_logic_form_comparison_operators' => ['=','!=','>','>=','<','<=','contains'],
105
  ],
106
  ]
107
  );
108
 
109
- $repeater->add_control(
110
- 'mf_conditional_logic_form_action',
111
- [
112
- 'label' => esc_html__( 'Do', 'metform' ),
113
- 'label_block' => true,
114
- 'type' => Controls_Manager::SELECT,
115
- 'multiple' => true,
116
- 'options' => [
117
- 'show' => 'Show this field',
118
- 'hide' => 'Hide this field',
119
- 'set_value' => 'Set Value',
120
- ],
121
- 'default' => [
122
- 'show',
123
- ],
124
- ]
125
- );
126
 
127
  $repeater->add_control(
128
  'mf_conditional_logic_form_set_value',
37
  'label_on' => 'Yes',
38
  'label_off' => 'No',
39
  'return_value' => 'yes',
40
+ 'frontend_available' => true
41
  ]
42
  );
43
 
47
  'label' => esc_html__( 'Condition match criteria', 'metform' ),
48
  'type' => Controls_Manager::SELECT,
49
  'label_block' => true,
50
+ 'frontend_available' => true,
51
  'options' => [
52
+ 'and' => esc_html__( 'AND', 'metform' ),
53
+ 'or' => esc_html__( 'OR', 'metform' ),
54
  ],
55
+ 'default' => 'and',
56
+ 'condition' => [
57
+ 'mf_conditional_logic_form_enable' => 'yes',
58
+ ],
59
+ ]
60
+ );
61
+
62
+ $this->add_control(
63
+ 'mf_conditional_logic_form_action',
64
+ [
65
+ 'label' => esc_html__( 'Action', 'metform' ),
66
+ 'label_block' => true,
67
+ 'frontend_available' => true,
68
+ 'type' => Controls_Manager::SELECT,
69
+ 'multiple' => true,
70
+ 'options' => [
71
+ 'show' => 'Show this field',
72
+ 'hide' => 'Hide this field',
73
+ // 'set_value' => 'Set Value',
74
+ ],
75
+ 'default' => 'show',
76
  'condition' => [
77
  'mf_conditional_logic_form_enable' => 'yes',
78
  ],
100
  'options' => [
101
  'not-empty' => esc_html__( 'not empty', 'metform' ),
102
  'empty' => esc_html__( 'empty', 'metform' ),
103
+ '==' => esc_html__( 'equals', 'metform' ),
104
  '!=' => esc_html__( 'not equals', 'metform' ),
105
  '>' => esc_html__( 'greater than', 'metform' ),
106
  '>=' => esc_html__( 'greater than equal', 'metform' ),
107
  '<' => esc_html__( 'smaller than', 'metform' ),
108
  '<=' => esc_html__( 'smaller than equal', 'metform' ),
 
 
 
 
 
109
  ],
110
+ 'default' => 'not-empty',
111
  ]
112
  );
113
 
119
  'label_block' => true,
120
  'placeholder' => esc_html__( '50', 'metform' ),
121
  'condition' => [
122
+ 'mf_conditional_logic_form_comparison_operators' => ['==','!=','>','>=','<','<=','contains'],
123
  ],
124
  ]
125
  );
126
 
127
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
  $repeater->add_control(
130
  'mf_conditional_logic_form_set_value',
utils/util.php CHANGED
@@ -226,6 +226,7 @@ class Util{
226
  data-nonce="<?php echo wp_create_nonce('wp_rest');?>"
227
  action="<?php echo esc_attr($rest_url."metform/v1/entries/insert/".$form_id); ?>"
228
  method="POST"
 
229
  class="metform-form-content"
230
  data-site-key="<?php echo esc_attr($site_key); ?>"
231
  enctype="multipart/form-data"
226
  data-nonce="<?php echo wp_create_nonce('wp_rest');?>"
227
  action="<?php echo esc_attr($rest_url."metform/v1/entries/insert/".$form_id); ?>"
228
  method="POST"
229
+ data-form-id = "<?php echo esc_attr($form_id); ?>"
230
  class="metform-form-content"
231
  data-site-key="<?php echo esc_attr($site_key); ?>"
232
  enctype="multipart/form-data"
widgets/checkbox/checkbox.php CHANGED
@@ -531,7 +531,7 @@ Class MetForm_Input_Checkbox extends Widget_Base{
531
 
532
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
533
 
534
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
535
 
536
  if($mf_input_label_status == 'yes'){
537
  ?>
@@ -547,7 +547,7 @@ Class MetForm_Input_Checkbox extends Widget_Base{
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" 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' : '')?>
531
 
532
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
533
 
534
+ echo "<div class='mf-input-wrapper'>";
535
 
536
  if($mf_input_label_status == 'yes'){
537
  ?>
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' : '')?>
widgets/date/date.php CHANGED
@@ -376,7 +376,7 @@ Class MetForm_Input_Date extends Widget_Base{
376
 
377
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
378
 
379
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
380
 
381
  if($mf_input_label_status == 'yes'){
382
  ?>
@@ -386,8 +386,7 @@ Class MetForm_Input_Date extends Widget_Base{
386
  <?php
387
  }
388
  ?>
389
- <input type="text" class="mf-input mf-date-input" id="mf-input-date-<?php echo esc_attr($this->get_id()); ?>"
390
- name="<?php echo esc_attr($mf_input_name); ?>"
391
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
392
  data-mfMinDate = "<?php echo esc_attr($mf_input_min_date); ?>"
393
  data-mfMaxDate= "<?php echo esc_attr($mf_input_max_date); ?>"
376
 
377
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
378
 
379
+ echo "<div class='mf-input-wrapper'>";
380
 
381
  if($mf_input_label_status == 'yes'){
382
  ?>
386
  <?php
387
  }
388
  ?>
389
+ <input type="text" class="mf-input mf-date-input <?php echo ((isset($mf_input_validation_type) && $mf_input_validation_type !='none') || isset($mf_input_required) && $mf_input_required === 'yes') ? 'mf-input-do-validate' : ''; ?> <?php echo $class; ?>"
 
390
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
391
  data-mfMinDate = "<?php echo esc_attr($mf_input_min_date); ?>"
392
  data-mfMaxDate= "<?php echo esc_attr($mf_input_max_date); ?>"
widgets/email/email.php CHANGED
@@ -129,7 +129,7 @@ Class MetForm_Input_Email extends widget_base{
129
 
130
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
131
 
132
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
133
 
134
  if($mf_input_label_status == 'yes'){
135
  ?>
@@ -139,7 +139,7 @@ Class MetForm_Input_Email extends widget_base{
139
  <?php
140
  }
141
  ?>
142
- <input type="email" class="mf-input" id="mf-input-email-<?php echo esc_attr($this->get_id()); ?>"
143
  name="<?php echo esc_attr($mf_input_name); ?>"
144
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
145
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
129
 
130
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
131
 
132
+ echo "<div class='mf-input-wrapper'>";
133
 
134
  if($mf_input_label_status == 'yes'){
135
  ?>
139
  <?php
140
  }
141
  ?>
142
+ <input type="email" class="mf-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; ?>" id="mf-input-email-<?php echo esc_attr($this->get_id()); ?>"
143
  name="<?php echo esc_attr($mf_input_name); ?>"
144
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
145
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/file-upload/file-upload.php CHANGED
@@ -394,7 +394,7 @@ Class MetForm_Input_File_Upload extends Widget_base{
394
 
395
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
396
 
397
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
398
 
399
  if($mf_input_label_status == 'yes'){
400
  ?>
@@ -405,7 +405,7 @@ Class MetForm_Input_File_Upload extends Widget_base{
405
  }
406
  ?>
407
  <div class="mf-file-upload-container">
408
- <input type="file" class="mf-input mf-input-file-upload" id="mf-input-file-upload-<?php echo esc_attr($this->get_id()); ?>"
409
  name="<?php echo esc_attr($mf_input_name); ?>"
410
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
411
  accept="<?php echo esc_attr($accept != null ? $accept : '');?>"
394
 
395
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
396
 
397
+ echo "<div class='mf-input-wrapper'>";
398
 
399
  if($mf_input_label_status == 'yes'){
400
  ?>
405
  }
406
  ?>
407
  <div class="mf-file-upload-container">
408
+ <input type="file" class="mf-input mf-input-file-upload <?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; ?>" id="mf-input-file-upload-<?php echo esc_attr($this->get_id()); ?>"
409
  name="<?php echo esc_attr($mf_input_name); ?>"
410
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
411
  accept="<?php echo esc_attr($accept != null ? $accept : '');?>"
widgets/listing-fname/listing-fname.php CHANGED
@@ -128,7 +128,7 @@ Class MetForm_Input_Listing_Fname extends Widget_Base{
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
@@ -138,7 +138,7 @@ Class MetForm_Input_Listing_Fname extends Widget_Base{
138
  <?php
139
  }
140
  ?>
141
- <input type="text" class="mf-input" id="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr($mf_input_name); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
+ echo "<div class='mf-input-wrapper'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
138
  <?php
139
  }
140
  ?>
141
+ <input type="text" class="mf-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; ?>" id="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr($mf_input_name); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/listing-lname/listing-lname.php CHANGED
@@ -128,7 +128,7 @@ Class MetForm_Input_Listing_Lname extends Widget_Base{
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
@@ -138,7 +138,7 @@ Class MetForm_Input_Listing_Lname extends Widget_Base{
138
  <?php
139
  }
140
  ?>
141
- <input type="text" class="mf-input" id="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr( $mf_input_name ); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
+ echo "<div class='mf-input-wrapper'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
138
  <?php
139
  }
140
  ?>
141
+ <input type="text" class="mf-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; ?>" id="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr( $mf_input_name ); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/listing-optin/listing-optin.php CHANGED
@@ -439,7 +439,7 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
439
 
440
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
441
 
442
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
443
 
444
  if($mf_input_label_status == 'yes'){
445
  ?>
@@ -452,7 +452,7 @@ Class MetForm_Input_Listing_Optin extends Widget_Base{
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" name="<?php echo esc_attr($mf_input_name); ?>"
456
  value="1"
457
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
458
  >
439
 
440
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
441
 
442
+ echo "<div class='mf-input-wrapper'>";
443
 
444
  if($mf_input_label_status == 'yes'){
445
  ?>
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
  >
widgets/manifest.php CHANGED
@@ -3,16 +3,8 @@ namespace MetForm\Widgets;
3
  defined( 'ABSPATH' ) || exit;
4
 
5
  Class Manifest{
6
-
7
- private static $instance = null;
8
-
9
- public static function get_instance(){
10
- if (!self::$instance){
11
- self::$instance = new self();
12
- }
13
- return self::$instance;
14
- }
15
-
16
  public function init() {
17
 
18
  add_action( 'elementor/elements/categories_registered', [ $this, 'add_metform_widget_categories' ]);
@@ -77,6 +69,7 @@ Class Manifest{
77
  require_once plugin_dir_path(__FILE__) . 'recaptcha/recaptcha.php';
78
  require_once plugin_dir_path(__FILE__) . 'rating/rating.php';
79
  require_once plugin_dir_path(__FILE__) . 'file-upload/file-upload.php';
 
80
  }
81
 
82
  public function register_widgets() {
@@ -108,6 +101,7 @@ Class Manifest{
108
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Recaptcha() );
109
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_Rating() );
110
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\MetForm_Input_File_Upload() );
 
111
  }
112
 
113
  public function add_metform_widget_categories( $elements_manager ) {
3
  defined( 'ABSPATH' ) || exit;
4
 
5
  Class Manifest{
6
+ use \MetForm\Traits\Singleton;
7
+
 
 
 
 
 
 
 
 
8
  public function init() {
9
 
10
  add_action( 'elementor/elements/categories_registered', [ $this, 'add_metform_widget_categories' ]);
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() {
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 ) {
widgets/map-location/map-location.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/multi-select/multi-select.php CHANGED
@@ -183,7 +183,7 @@ Class MetForm_Input_Multi_Select extends Widget_Base{
183
 
184
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
185
 
186
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
187
 
188
  if($mf_input_label_status == 'yes'){
189
  ?>
@@ -193,7 +193,7 @@ Class MetForm_Input_Multi_Select extends Widget_Base{
193
  <?php
194
  }
195
  ?>
196
- <select class="mf-input mf-input-multiselect" id="mf-input-multi-select-<?php echo esc_attr($this->get_id()); ?>"
197
  name="<?php echo esc_attr($mf_input_name); ?>[]"
198
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '');?>
199
  multiple="multiple"
183
 
184
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
185
 
186
+ echo "<div class='mf-input-wrapper'>";
187
 
188
  if($mf_input_label_status == 'yes'){
189
  ?>
193
  <?php
194
  }
195
  ?>
196
+ <select class="mf-input mf-input-multiselect <?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; ?>" id="mf-input-multi-select-<?php echo esc_attr($this->get_id()); ?>"
197
  name="<?php echo esc_attr($mf_input_name); ?>[]"
198
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '');?>
199
  multiple="multiple"
widgets/number/number.php CHANGED
@@ -127,7 +127,7 @@ Class MetForm_Input_Number extends Widget_Base{
127
 
128
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
129
 
130
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
131
 
132
  if($mf_input_label_status == 'yes'){
133
  ?>
@@ -137,7 +137,7 @@ Class MetForm_Input_Number extends Widget_Base{
137
  <?php
138
  }
139
  ?>
140
- <input type="number" class="mf-input" id="mf-input-mobile-<?php echo esc_attr($this->get_id()); ?>"
141
  name="<?php echo esc_attr($mf_input_name); ?>"
142
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
143
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
127
 
128
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
129
 
130
+ echo "<div class='mf-input-wrapper'>";
131
 
132
  if($mf_input_label_status == 'yes'){
133
  ?>
137
  <?php
138
  }
139
  ?>
140
+ <input type="number" class="mf-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; ?>" id="mf-input-mobile-<?php echo esc_attr($this->get_id()); ?>"
141
  name="<?php echo esc_attr($mf_input_name); ?>"
142
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
143
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/password/password.php CHANGED
@@ -127,7 +127,7 @@ Class MetForm_Input_Password extends Widget_Base{
127
 
128
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
129
 
130
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
131
 
132
  if($mf_input_label_status == 'yes'){
133
  ?>
@@ -137,7 +137,7 @@ Class MetForm_Input_Password extends Widget_Base{
137
  <?php
138
  }
139
  ?>
140
- <input type="password" class="mf-input" id="mf-input-password-<?php echo esc_attr($this->get_id()); ?>"
141
  name="<?php echo esc_attr($mf_input_name); ?>"
142
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
143
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
127
 
128
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
129
 
130
+ echo "<div class='mf-input-wrapper'>";
131
 
132
  if($mf_input_label_status == 'yes'){
133
  ?>
137
  <?php
138
  }
139
  ?>
140
+ <input type="password" class="mf-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; ?>" id="mf-input-password-<?php echo esc_attr($this->get_id()); ?>"
141
  name="<?php echo esc_attr($mf_input_name); ?>"
142
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
143
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/radio/radio.php CHANGED
@@ -545,7 +545,7 @@ Class MetForm_Input_Radio extends Widget_Base{
545
 
546
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
547
 
548
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
549
 
550
  if($mf_input_label_status == 'yes'){
551
  ?>
@@ -561,7 +561,7 @@ Class MetForm_Input_Radio extends Widget_Base{
561
  ?>
562
  <div class="mf-radio-option <?php echo esc_attr($option['mf_input_option_status']); ?>">
563
  <label><?php echo esc_html(($mf_input_option_text_position == 'before') ? $option['mf_input_option_text']:''); ?>
564
- <input type="radio" class="mf-input mf-radio-input" name="<?php echo esc_attr($mf_input_name); ?>"
565
  value="<?php echo esc_attr($option['mf_input_option_value']); ?>"
566
  <?php echo esc_attr($option['mf_input_option_status']); ?>
567
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
545
 
546
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
547
 
548
+ echo "<div class='mf-input-wrapper'>";
549
 
550
  if($mf_input_label_status == 'yes'){
551
  ?>
561
  ?>
562
  <div class="mf-radio-option <?php echo esc_attr($option['mf_input_option_status']); ?>">
563
  <label><?php echo esc_html(($mf_input_option_text_position == 'before') ? $option['mf_input_option_text']:''); ?>
564
+ <input type="radio" class="mf-input mf-radio-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); ?>"
565
  value="<?php echo esc_attr($option['mf_input_option_value']); ?>"
566
  <?php echo esc_attr($option['mf_input_option_status']); ?>
567
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
widgets/range/range.php CHANGED
@@ -209,7 +209,7 @@ Class MetForm_Input_Range extends Widget_Base{
209
 
210
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
211
 
212
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
213
 
214
  if($mf_input_label_status == 'yes'){
215
  ?>
@@ -249,7 +249,7 @@ Class MetForm_Input_Range extends Widget_Base{
249
  // }
250
  ?>
251
 
252
- <input class="mf-input mf-rs-range" id="mf-input-range-<?php echo esc_attr($this->get_id()); ?>"
253
  name="<?php echo esc_attr($mf_input_name); ?>"
254
  <?php //echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
255
  <?php //echo esc_attr($mf_input_readonly_status); ?>
209
 
210
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
211
 
212
+ echo "<div class='mf-input-wrapper'>";
213
 
214
  if($mf_input_label_status == 'yes'){
215
  ?>
249
  // }
250
  ?>
251
 
252
+ <input class="mf-input mf-rs-range <?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; ?>" id="mf-input-range-<?php echo esc_attr($this->get_id()); ?>"
253
  name="<?php echo esc_attr($mf_input_name); ?>"
254
  <?php //echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
255
  <?php //echo esc_attr($mf_input_readonly_status); ?>
widgets/rating/rating.php CHANGED
@@ -305,7 +305,7 @@ Class MetForm_Input_Rating extends Widget_Base{
305
 
306
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
307
 
308
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
309
 
310
  if($mf_input_label_status == 'yes'){
311
  ?>
@@ -323,7 +323,7 @@ Class MetForm_Input_Rating extends Widget_Base{
323
  <?php endfor;?>
324
  </ul>
325
 
326
- <input type="hidden" class="mf-input mf-input-hidden" id="mf-input-<?php echo esc_attr($this->get_id()); ?>"
327
  name="<?php echo esc_attr($mf_input_name); ?>" value="1"
328
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
329
  />
305
 
306
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
307
 
308
+ echo "<div class='mf-input-wrapper'>";
309
 
310
  if($mf_input_label_status == 'yes'){
311
  ?>
323
  <?php endfor;?>
324
  </ul>
325
 
326
+ <input type="hidden" class="mf-input mf-input-hidden <?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; ?>" id="mf-input-<?php echo esc_attr($this->get_id()); ?>"
327
  name="<?php echo esc_attr($mf_input_name); ?>" value="1"
328
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
329
  />
widgets/recaptcha/fonts/Acme.ttf ADDED
Binary file
widgets/recaptcha/fonts/Righteous.ttf ADDED
Binary file
widgets/recaptcha/fonts/SourceCodePro.ttf ADDED
Binary file
widgets/recaptcha/fonts/Ubuntu.ttf ADDED
Binary file
widgets/recaptcha/generate-captcha.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ session_start();
4
+
5
+ $time = $_SERVER['REQUEST_TIME'];
6
+
7
+ $timeout_duration = 1800;
8
+
9
+ if (isset($_SESSION['LAST_ACTIVITY']) &&
10
+ ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration) {
11
+ session_unset();
12
+ session_destroy();
13
+ session_start();
14
+ }
15
+
16
+ $_SESSION['LAST_ACTIVITY'] = $time;
17
+
18
+ $permitted_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
19
+
20
+ function generate_string($input, $strength = 10) {
21
+ $input_length = strlen($input);
22
+ $random_string = '';
23
+ for($i = 0; $i < $strength; $i++) {
24
+ $random_character = $input[mt_rand(0, $input_length - 1)];
25
+ $random_string .= $random_character;
26
+ }
27
+
28
+ return $random_string;
29
+ }
30
+
31
+ $image = imagecreatetruecolor(200, 50);
32
+
33
+ imageantialias($image, true);
34
+
35
+ $colors = [];
36
+
37
+ $red = rand(125, 175);
38
+ $green = rand(125, 175);
39
+ $blue = rand(125, 175);
40
+
41
+ for($i = 0; $i < 5; $i++) {
42
+ $colors[] = imagecolorallocate($image, $red - 20*$i, $green - 20*$i, $blue - 20*$i);
43
+ }
44
+
45
+ imagefill($image, 0, 0, $colors[0]);
46
+
47
+ for($i = 0; $i < 10; $i++) {
48
+ imagesetthickness($image, rand(2, 10));
49
+ $rect_color = $colors[rand(1, 4)];
50
+ imagerectangle($image, rand(-10, 190), rand(-10, 10), rand(-10, 190), rand(40, 60), $rect_color);
51
+ }
52
+
53
+ $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);
61
+
62
+ $_SESSION['mf_captcha_text'] = $captcha_string;
63
+
64
+ for($i = 0; $i < $string_length; $i++) {
65
+ $letter_space = 170/$string_length;
66
+ $initial = 15;
67
+
68
+ imagettftext($image, 20, rand(-15, 15), $initial + $i*$letter_space, rand(20, 40), $textcolors[rand(0, 1)], $fonts[array_rand($fonts)], $captcha_string[$i]);
69
+ }
70
+
71
+ header('Content-type: image/png');
72
+ imagepng($image);
73
+ imagedestroy($image);
74
+
75
+
76
+ ?>
widgets/recaptcha/recaptcha.php CHANGED
@@ -38,27 +38,185 @@ Class MetForm_Input_Recaptcha extends Widget_Base{
38
  ]
39
  );
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $this->add_control(
42
  'mf_recaptcha_class_name',
43
  [
44
- 'label' => esc_html__( 'Add Extra Class Name : ', 'plugin-domain' ),
45
  'type' => Controls_Manager::TEXT,
 
 
 
46
  ]
47
  );
48
 
49
  $this->end_controls_section();
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  protected function render($instance = []){
53
  $settings = $this->get_settings_for_display();
54
  extract($settings);
55
-
56
- ?>
57
- <div id="recaptcha_site_key" class="recaptcha_site_key <?php echo esc_attr($mf_recaptcha_class_name); ?>"></div>
58
- <?php
59
- if(('metform-form' == get_post_type() || 'page' == get_post_type()) && \Elementor\Plugin::$instance->editor->is_edit_mode()){
60
- echo "<div class='attr-alert attr-alert-warning'>".esc_html__('reCAPTCHA will be shown on preview.', 'metform')."</div>";
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
 
64
  }
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
+
162
  $this->add_control(
163
  'mf_recaptcha_class_name',
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') {
197
+ ?>
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
  }
widgets/select/select.php CHANGED
@@ -183,7 +183,7 @@ Class MetForm_Input_Select extends Widget_Base{
183
 
184
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
185
 
186
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
187
 
188
  if($mf_input_label_status == 'yes'){
189
  ?>
@@ -193,7 +193,7 @@ Class MetForm_Input_Select extends Widget_Base{
193
  <?php
194
  }
195
  ?>
196
- <select class="mf-input mf-input-select" id="mf-input-select-<?php echo esc_attr($this->get_id()); ?>"
197
  name="<?php echo esc_attr($mf_input_name); ?>"
198
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '');?>
199
  >
183
 
184
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
185
 
186
+ echo "<div class='mf-input-wrapper'>";
187
 
188
  if($mf_input_label_status == 'yes'){
189
  ?>
193
  <?php
194
  }
195
  ?>
196
+ <select class="mf-input mf-input-select <?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; ?>" id="mf-input-select-<?php echo esc_attr($this->get_id()); ?>"
197
  name="<?php echo esc_attr($mf_input_name); ?>"
198
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '');?>
199
  >
widgets/summary/summary.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Elementor;
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ Class MetForm_Input_Summary 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-summary');
13
+ }
14
+
15
+ public function get_name() {
16
+ return 'mf-summary';
17
+ }
18
+
19
+ public function get_title() {
20
+ return esc_html__( 'Summary', 'metform' );
21
+ }
22
+
23
+ public function show_in_panel() {
24
+ return 'metform-form' == get_post_type();
25
+ }
26
+
27
+ public function get_categories() {
28
+ return [ 'metform' ];
29
+ }
30
+
31
+ public function get_keywords() {
32
+ return ['metform', 'input', 'summary', 'preview'];
33
+ }
34
+
35
+ protected function _register_controls() {
36
+
37
+ $this->start_controls_section(
38
+ 'content_section',
39
+ [
40
+ 'label' => esc_html__( 'Content', 'metform' ),
41
+ 'tab' => Controls_Manager::TAB_CONTENT,
42
+ ]
43
+ );
44
+
45
+ $this->input_content_controls();
46
+
47
+ $this->end_controls_section();
48
+
49
+ $this->start_controls_section(
50
+ 'settings_section',
51
+ [
52
+ 'label' => esc_html__( 'Settings', 'metform' ),
53
+ 'tab' => Controls_Manager::TAB_CONTENT,
54
+ ]
55
+ );
56
+
57
+ $this->input_setting_controls();
58
+
59
+ $this->end_controls_section();
60
+
61
+ $this->start_controls_section(
62
+ 'label_section',
63
+ [
64
+ 'label' => esc_html__( 'Label', 'metform' ),
65
+ 'tab' => Controls_Manager::TAB_STYLE,
66
+ 'condition' => [
67
+ 'mf_input_label_status' => 'yes',
68
+ ],
69
+ ]
70
+ );
71
+
72
+ $this->input_label_controls();
73
+
74
+ $this->end_controls_section();
75
+
76
+ $this->start_controls_section(
77
+ 'input_section',
78
+ [
79
+ 'label' => esc_html__( 'Input', 'metform' ),
80
+ 'tab' => Controls_Manager::TAB_STYLE,
81
+ ]
82
+ );
83
+
84
+ //$this->input_controls();
85
+
86
+ $this->end_controls_section();
87
+
88
+ $this->start_controls_section(
89
+ 'help_text_section',
90
+ [
91
+ 'label' => esc_html__( 'Help Text', 'metform' ),
92
+ 'tab' => Controls_Manager::TAB_STYLE,
93
+ 'condition' => [
94
+ 'mf_input_help_text!' => ''
95
+ ]
96
+ ]
97
+ );
98
+
99
+ $this->input_help_text_controls();
100
+
101
+ $this->end_controls_section();
102
+
103
+
104
+ }
105
+
106
+ protected function render($instance = []){
107
+ $settings = $this->get_settings_for_display();
108
+ extract($settings);
109
+
110
+ $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
111
+
112
+ echo "<div class='mf-input-wrapper'>";
113
+
114
+ if($mf_input_label_status == 'yes'){
115
+ ?>
116
+ <label class="mf-input-label" for="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"><?php echo esc_html($mf_input_label); ?>
117
+ <span class="mf-input-required-indicator"><?php echo esc_html(($mf_input_required === 'yes') ? '*' : '');?></span>
118
+ </label>
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
136
+ if($mf_input_help_text != ''){
137
+ echo "<span class='mf-input-help'>".esc_html($mf_input_help_text)."</span>";
138
+ }
139
+ echo "</div>";
140
+ }
141
+
142
+ }
widgets/switch/switch.php CHANGED
@@ -277,7 +277,7 @@ Class MetForm_Input_Switch extends Widget_Base{
277
 
278
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
279
 
280
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
281
 
282
  if($mf_input_label_status == 'yes'){
283
  ?>
@@ -288,8 +288,8 @@ Class MetForm_Input_Switch extends Widget_Base{
288
  }
289
  ?>
290
  <span class="mf-input-switch-control mf-input-switch">
291
- <input type="checkbox" name="<?php echo esc_attr($mf_input_name); ?>" value="1" class="mf-input mf-input-control" id="mf-input-switch-<?php echo esc_attr($this->get_id()); ?>" <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>>
292
- <label data-enable="<?php echo esc_attr($mf_swtich_enable_text) ?>" data-disable="<?php echo esc_attr($mf_swtich_disable_text) ?>" class="mf-input-control-label" for="mf-input-switch-<?php echo esc_attr($this->get_id()); ?>"></label>
293
  </span>
294
  <?php
295
  if($mf_input_help_text != ''){
277
 
278
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
279
 
280
+ echo "<div class='mf-input-wrapper'>";
281
 
282
  if($mf_input_label_status == 'yes'){
283
  ?>
288
  }
289
  ?>
290
  <span class="mf-input-switch-control mf-input-switch">
291
+ <input type="checkbox" name="<?php echo esc_attr($mf_input_name); ?>" value="1" class="mf-input mf-input-control mf-input-switch-box <?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; ?>" id="mf-input-switch-<?php echo esc_attr($this->get_id()); ?>" <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>>
292
+ <label data-enable="<?php echo isset($mf_swtich_enable_text) ? esc_attr($mf_swtich_enable_text) : ''; ?>" data-disable="<?php echo isset($mf_swtich_disable_text) ? esc_attr($mf_swtich_disable_text) : '' ?>" class="mf-input-control-label" for="mf-input-switch-<?php echo esc_attr($this->get_id()); ?>"></label>
293
  </span>
294
  <?php
295
  if($mf_input_help_text != ''){
widgets/telephone/telephone.php CHANGED
@@ -128,7 +128,7 @@ Class MetForm_Input_Telephone extends Widget_Base{
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
@@ -138,7 +138,7 @@ Class MetForm_Input_Telephone extends Widget_Base{
138
  <?php
139
  }
140
  ?>
141
- <input type="tel" class="mf-input" id="mf-input-telephone-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr($mf_input_name); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
+ echo "<div class='mf-input-wrapper'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
138
  <?php
139
  }
140
  ?>
141
+ <input type="tel" class="mf-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; ?>" id="mf-input-telephone-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr($mf_input_name); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/text/text.php CHANGED
@@ -128,7 +128,7 @@ Class MetForm_Input_Text extends Widget_Base{
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
@@ -138,7 +138,7 @@ Class MetForm_Input_Text extends Widget_Base{
138
  <?php
139
  }
140
  ?>
141
- <input type="text" class="mf-input" id="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr($mf_input_name); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
128
 
129
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
130
 
131
+ echo "<div class='mf-input-wrapper'>";
132
 
133
  if($mf_input_label_status == 'yes'){
134
  ?>
138
  <?php
139
  }
140
  ?>
141
+ <input type="text" class="mf-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; ?>" id="mf-input-text-<?php echo esc_attr($this->get_id()); ?>"
142
  name="<?php echo esc_attr($mf_input_name); ?>"
143
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
144
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/textarea/textarea.php CHANGED
@@ -152,7 +152,7 @@ Class MetForm_Input_Textarea extends Widget_Base{
152
 
153
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
154
 
155
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
156
 
157
  if($mf_input_label_status == 'yes'){
158
  ?>
@@ -162,7 +162,7 @@ Class MetForm_Input_Textarea extends Widget_Base{
162
  <?php
163
  }
164
  ?>
165
- <textarea class="mf-input mf-textarea" id="mf-input-text-area-<?php echo esc_attr($this->get_id()); ?>"
166
  name="<?php echo esc_attr($mf_input_name); ?>"
167
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
168
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
152
 
153
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
154
 
155
+ echo "<div class='mf-input-wrapper'>";
156
 
157
  if($mf_input_label_status == 'yes'){
158
  ?>
162
  <?php
163
  }
164
  ?>
165
+ <textarea class="mf-input mf-textarea <?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; ?>" id="mf-input-text-area-<?php echo esc_attr($this->get_id()); ?>"
166
  name="<?php echo esc_attr($mf_input_name); ?>"
167
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
168
  data-validation = "<?php echo esc_attr(json_encode($validation)); ?>"
widgets/time/time.php CHANGED
@@ -118,7 +118,7 @@ Class MetForm_Input_Time extends Widget_Base{
118
 
119
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
120
 
121
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
122
 
123
  if($mf_input_label_status == 'yes'){
124
  ?>
@@ -128,7 +128,7 @@ Class MetForm_Input_Time extends Widget_Base{
128
  <?php
129
  }
130
  ?>
131
- <input type="time" class="mf-input mf-input-time" id="mf-input-time-<?php echo esc_attr($this->get_id()); ?>"
132
  name="<?php echo esc_attr($mf_input_name); ?>"
133
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
134
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
118
 
119
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
120
 
121
+ echo "<div class='mf-input-wrapper'>";
122
 
123
  if($mf_input_label_status == 'yes'){
124
  ?>
128
  <?php
129
  }
130
  ?>
131
+ <input type="time" class="mf-input mf-input-time <?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; ?>" id="mf-input-time-<?php echo esc_attr($this->get_id()); ?>"
132
  name="<?php echo esc_attr($mf_input_name); ?>"
133
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
134
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
widgets/url/url.php CHANGED
@@ -109,7 +109,7 @@ Class MetForm_Input_Url extends Widget_Base{
109
 
110
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
111
 
112
- echo "<div class='mf-input-wrapper ".$class."' data-mf-form-conditional-logic-requirement='".(isset($mf_conditional_logic_form_and_or_operators) ? $mf_conditional_logic_form_and_or_operators : '')."'>";
113
 
114
  if($mf_input_label_status == 'yes'){
115
  ?>
@@ -119,7 +119,7 @@ Class MetForm_Input_Url extends Widget_Base{
119
  <?php
120
  }
121
  ?>
122
- <input type="url" class="mf-input" id="mf-input-url-<?php echo esc_attr($this->get_id()); ?>"
123
  name="<?php echo esc_attr($mf_input_name); ?>"
124
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
125
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
109
 
110
  $class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
111
 
112
+ echo "<div class='mf-input-wrapper'>";
113
 
114
  if($mf_input_label_status == 'yes'){
115
  ?>
119
  <?php
120
  }
121
  ?>
122
+ <input type="url" class="mf-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; ?>" id="mf-input-url-<?php echo esc_attr($this->get_id()); ?>"
123
  name="<?php echo esc_attr($mf_input_name); ?>"
124
  placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
125
  <?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>